summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore2
-rw-r--r--BUILD/FINISH.sh6
-rwxr-xr-xBUILD/SETUP.sh2
-rw-r--r--CMakeLists.txt20
-rw-r--r--client/get_password.c4
-rw-r--r--client/mysql.cc1
-rw-r--r--client/mysqladmin.cc55
-rw-r--r--client/mysqlbinlog.cc53
-rw-r--r--client/mysqldump.c42
-rw-r--r--client/mysqltest.cc114
-rw-r--r--cmake/configure.pl7
-rw-r--r--cmake/cpack_rpm.cmake1
-rw-r--r--cmake/maintainer.cmake2
-rw-r--r--cmake/os/WindowsCache.cmake3
-rw-r--r--cmake/readline.cmake2
-rw-r--r--config.h.cmake8
-rw-r--r--configure.cmake11
-rw-r--r--dbug/dbug.c3
-rw-r--r--dbug/factorial.c14
-rw-r--r--debian/additions/my.cnf2
-rwxr-xr-xdebian/autobake-deb.sh9
-rw-r--r--debian/dist/Debian/control2
-rw-r--r--debian/dist/Debian/mariadb-server-5.5.postinst4
-rw-r--r--debian/dist/Ubuntu/control2
-rw-r--r--debian/dist/Ubuntu/mariadb-server-5.5.postinst2
-rw-r--r--debian/mariadb-client-5.5.files1
-rw-r--r--debian/mariadb-server-5.5.mysql.init4
-rw-r--r--extra/resolveip.c4
-rw-r--r--extra/yassl/taocrypt/src/asn.cpp4
-rw-r--r--extra/yassl/taocrypt/src/dsa.cpp2
-rw-r--r--include/CMakeLists.txt1
-rw-r--r--include/atomic/nolock.h2
-rw-r--r--include/handler_state.h21
-rw-r--r--include/lf.h2
-rw-r--r--include/m_string.h6
-rw-r--r--include/my_getopt.h4
-rw-r--r--include/my_global.h28
-rw-r--r--include/my_net.h2
-rw-r--r--include/my_pthread.h68
-rw-r--r--include/my_sys.h6
-rw-r--r--include/mysql/plugin.h2
-rw-r--r--include/mysql/plugin_audit.h.pp2
-rw-r--r--include/mysql/plugin_auth.h.pp2
-rw-r--r--include/mysql/plugin_ftparser.h.pp2
-rw-r--r--include/sql_common.h9
-rw-r--r--libmysql/CMakeLists.txt1
-rw-r--r--libmysql/get_password.c4
-rw-r--r--libmysql/libmysql.c9
-rw-r--r--libmysqld/CMakeLists.txt2
-rw-r--r--libmysqld/examples/CMakeLists.txt4
-rw-r--r--man/CMakeLists.txt2
-rw-r--r--mysql-test/extra/binlog_tests/binlog.test47
-rw-r--r--mysql-test/extra/binlog_tests/binlog_insert_delayed.test1
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test4
-rw-r--r--mysql-test/extra/rpl_tests/create_recursive_construct.inc17
-rw-r--r--mysql-test/extra/rpl_tests/rpl_auto_increment.test5
-rw-r--r--mysql-test/extra/rpl_tests/rpl_deadlock.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_delayed.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_max_relay_size.test3
-rw-r--r--mysql-test/include/binlog_start_pos.inc8
-rw-r--r--mysql-test/include/index_merge2.inc1
-rw-r--r--mysql-test/include/mtr_warnings.sql2
-rw-r--r--mysql-test/include/mysqlbinlog_have_debug.inc34
-rw-r--r--mysql-test/include/query_cache_partitions.inc126
-rw-r--r--mysql-test/include/setup_fake_relay_log.inc4
-rw-r--r--mysql-test/include/show_binlog_events.inc2
-rw-r--r--mysql-test/include/show_binlog_events2.inc19
-rw-r--r--mysql-test/include/show_events.inc27
-rw-r--r--mysql-test/include/strict_autoinc.inc3
-rw-r--r--mysql-test/lib/mtr_cases.pm15
-rwxr-xr-xmysql-test/mysql-test-run.pl3
-rw-r--r--mysql-test/r/adddate_454.result10
-rw-r--r--mysql-test/r/auto_increment.result7
-rw-r--r--mysql-test/r/auto_increment_ranges_innodb.result266
-rw-r--r--mysql-test/r/auto_increment_ranges_myisam.result272
-rw-r--r--mysql-test/r/case.result4
-rw-r--r--mysql-test/r/commit_1innodb.result2
-rw-r--r--mysql-test/r/compare.result4
-rw-r--r--mysql-test/r/create-big.result4
-rw-r--r--mysql-test/r/create.result2
-rw-r--r--mysql-test/r/ctype_binary.result4
-rw-r--r--mysql-test/r/ctype_cp1251.result4
-rw-r--r--mysql-test/r/ctype_latin1.result4
-rw-r--r--mysql-test/r/ctype_ucs.result4
-rw-r--r--mysql-test/r/ctype_utf32.result6
-rw-r--r--mysql-test/r/ctype_utf8.result4
-rw-r--r--mysql-test/r/datetime_456.result8
-rw-r--r--mysql-test/r/derived_view.result6
-rw-r--r--mysql-test/r/errors.result8
-rw-r--r--mysql-test/r/explain.result10
-rw-r--r--mysql-test/r/features.result140
-rw-r--r--mysql-test/r/filesort_debug.result2
-rw-r--r--mysql-test/r/flush.result7
-rw-r--r--mysql-test/r/func_group.result4
-rw-r--r--mysql-test/r/func_group_innodb.result27
-rw-r--r--mysql-test/r/func_time.result8
-rw-r--r--mysql-test/r/gis.result23
-rw-r--r--mysql-test/r/group_by.result45
-rw-r--r--mysql-test/r/group_min_max.result10
-rw-r--r--mysql-test/r/index_merge_innodb.result17
-rw-r--r--mysql-test/r/index_merge_myisam.result2
-rw-r--r--mysql-test/r/insert.result12
-rw-r--r--mysql-test/r/insert_select.result4
-rw-r--r--mysql-test/r/insert_update.result4
-rw-r--r--mysql-test/r/key.result2
-rw-r--r--mysql-test/r/last_value.result73
-rw-r--r--mysql-test/r/limit_rows_examined.result2
-rw-r--r--mysql-test/r/loaddata.result6
-rw-r--r--mysql-test/r/mdev375.result14
-rw-r--r--mysql-test/r/mix2_myisam.result2
-rw-r--r--mysql-test/r/myisam_mrr.result2
-rw-r--r--mysql-test/r/mysqlbinlog-innodb.result4
-rw-r--r--mysql-test/r/mysqlbinlog.result25
-rw-r--r--mysql-test/r/mysqlbinlog2.result82
-rw-r--r--mysql-test/r/mysqlbinlog_row.result4
-rw-r--r--mysql-test/r/mysqlbinlog_row_innodb.result16
-rw-r--r--mysql-test/r/mysqlbinlog_row_myisam.result16
-rw-r--r--mysql-test/r/mysqlbinlog_row_trans.result4
-rw-r--r--mysql-test/r/mysqld--help.result22
-rw-r--r--mysql-test/r/mysqldump-max.result10
-rw-r--r--mysql-test/r/mysqldump.result46
-rw-r--r--mysql-test/r/mysqltest.result3
-rw-r--r--mysql-test/r/null_key.result2
-rw-r--r--mysql-test/r/order_by.result1017
-rw-r--r--mysql-test/r/order_by_sortkey.result159
-rw-r--r--mysql-test/r/parser.result2
-rw-r--r--mysql-test/r/partition.result14
-rw-r--r--mysql-test/r/partition_cache.result18
-rw-r--r--mysql-test/r/partition_cache_innodb.result151
-rw-r--r--mysql-test/r/partition_cache_myisam.result153
-rw-r--r--mysql-test/r/partition_pruning.result6
-rw-r--r--mysql-test/r/ps.result106
-rw-r--r--mysql-test/r/replace.result4
-rw-r--r--mysql-test/r/show_explain.result1078
-rw-r--r--mysql-test/r/show_explain_ps.result29
-rw-r--r--mysql-test/r/sp.result7
-rw-r--r--mysql-test/r/str_to_datetime_457.result51
-rw-r--r--mysql-test/r/strict_autoinc_1myisam.result4
-rw-r--r--mysql-test/r/strict_autoinc_2innodb.result4
-rw-r--r--mysql-test/r/strict_autoinc_3heap.result4
-rw-r--r--mysql-test/r/subselect.result101
-rw-r--r--mysql-test/r/subselect2.result12
-rw-r--r--mysql-test/r/subselect4.result243
-rw-r--r--mysql-test/r/subselect_innodb.result45
-rw-r--r--mysql-test/r/subselect_mat.result2
-rw-r--r--mysql-test/r/subselect_mat_cost_bugs.result4
-rw-r--r--mysql-test/r/subselect_no_mat.result101
-rw-r--r--mysql-test/r/subselect_no_opts.result101
-rw-r--r--mysql-test/r/subselect_no_scache.result101
-rw-r--r--mysql-test/r/subselect_no_semijoin.result101
-rw-r--r--mysql-test/r/trigger.result2
-rw-r--r--mysql-test/r/type_blob.result4
-rw-r--r--mysql-test/r/type_date.result12
-rw-r--r--mysql-test/r/type_year.result17
-rw-r--r--mysql-test/r/user_var-binlog.result2
-rw-r--r--mysql-test/r/view.result56
-rw-r--r--mysql-test/r/xa_binlog.result2
-rw-r--r--mysql-test/r/xtradb_mrr.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_base64_flag.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_checkpoint.result88
-rw-r--r--mysql-test/suite/binlog/r/binlog_drop_if_exists.result18
-rw-r--r--mysql-test/suite/binlog/r/binlog_innodb_row.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_ioerr.result1
-rw-r--r--mysql-test/suite/binlog/r/binlog_mdev342.result1
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_annotate.result13
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_binlog.result81
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result16
-rw-r--r--mysql-test/suite/binlog/r/binlog_server_id.result9
-rw-r--r--mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_binlog.result90
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_blackhole.result3
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_unsafe.result1
-rw-r--r--mysql-test/suite/binlog/r/binlog_xa_recover.result198
-rw-r--r--mysql-test/suite/binlog/t/binlog_checkpoint.test108
-rw-r--r--mysql-test/suite/binlog/t/binlog_drop_if_exists.test15
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed.test12
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed_simulate.test4
-rw-r--r--mysql-test/suite/binlog/t/binlog_xa_recover-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_xa_recover.test239
-rw-r--r--mysql-test/suite/engines/funcs/r/an_calendar.result6
-rw-r--r--mysql-test/suite/engines/funcs/r/datetime_function.result8
-rw-r--r--mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result5
-rw-r--r--mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result5
-rw-r--r--mysql-test/suite/engines/funcs/r/db_use_error.result2
-rw-r--r--mysql-test/suite/engines/funcs/r/de_calendar_range.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/in_calendar_2_unique_constraints_duplicate_update.result30
-rw-r--r--mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_duplicate_update.result7
-rw-r--r--mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_error.result4
-rw-r--r--mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_ignore.result4
-rw-r--r--mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_duplicate_update.result7
-rw-r--r--mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_error.result4
-rw-r--r--mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_ignore.result6
-rw-r--r--mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_duplicate_update.result29
-rw-r--r--mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_error.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_ignore.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_duplicate_update.result29
-rw-r--r--mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_error.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_ignore.result24
-rw-r--r--mysql-test/suite/engines/funcs/r/in_multicolumn_number_pk_constraint_duplicate_update.result29
-rw-r--r--mysql-test/suite/engines/funcs/r/in_number_boundary_error.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result8
-rw-r--r--mysql-test/suite/engines/funcs/r/ld_all_number_string_calendar_types.result672
-rw-r--r--mysql-test/suite/engines/funcs/r/sq_all.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/sq_error.result8
-rw-r--r--mysql-test/suite/engines/funcs/r/up_calendar_range.result16
-rw-r--r--mysql-test/suite/engines/funcs/t/se_join_left.test630
-rw-r--r--mysql-test/suite/engines/funcs/t/se_join_left_outer.test420
-rw-r--r--mysql-test/suite/engines/funcs/t/se_join_natural_left.test420
-rw-r--r--mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test420
-rw-r--r--mysql-test/suite/engines/iuds/r/delete_time.result4
-rw-r--r--mysql-test/suite/engines/iuds/r/delete_year.result6
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_decimal.result2
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_number.result138
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_time.result79
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_year.result12
-rw-r--r--mysql-test/suite/engines/iuds/r/type_bit_iuds.result48
-rw-r--r--mysql-test/suite/engines/iuds/r/update_delete_calendar.result59
-rw-r--r--mysql-test/suite/engines/iuds/r/update_delete_number.result10
-rw-r--r--mysql-test/suite/engines/iuds/r/update_time.result10
-rw-r--r--mysql-test/suite/engines/iuds/r/update_year.result6
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_func_view.result4
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_innodb.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_memory.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_myisam.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result6
-rw-r--r--mysql-test/suite/funcs_1/r/memory_func_view.result4
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result4
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_func_view.result4
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views-big.result4
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result4
-rw-r--r--mysql-test/suite/heap/heap.result52
-rw-r--r--mysql-test/suite/heap/heap.test52
-rw-r--r--mysql-test/suite/heap/heap_hash.result19
-rw-r--r--mysql-test/suite/heap/heap_hash.test13
-rw-r--r--mysql-test/suite/innodb/r/auto_increment_dup.result33
-rw-r--r--mysql-test/suite/innodb/r/binlog_consistent.result69
-rw-r--r--mysql-test/suite/innodb/r/group_commit_binlog_pos.result3
-rw-r--r--mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result3
-rw-r--r--mysql-test/suite/innodb/r/group_commit_crash.result10
-rw-r--r--mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result10
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result28
-rw-r--r--mysql-test/suite/innodb/r/innodb-lock.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug52745.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug56947.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result5
-rw-r--r--mysql-test/suite/innodb/t/auto_increment_dup.test51
-rw-r--r--mysql-test/suite/innodb/t/group_commit_binlog_pos.test13
-rw-r--r--mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test13
-rw-r--r--mysql-test/suite/innodb/t/group_commit_crash.test2
-rw-r--r--mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test24
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14007649.test4
-rw-r--r--mysql-test/suite/maria/lock.result3
-rw-r--r--mysql-test/suite/maria/lock.test8
-rw-r--r--mysql-test/suite/maria/maria-connect.result1
-rw-r--r--mysql-test/suite/maria/maria3.result2
-rw-r--r--mysql-test/suite/maria/mrr.result2
-rw-r--r--mysql-test/suite/mtr2/combinations5
-rw-r--r--mysql-test/suite/multi_source/info_logs-master.opt1
-rw-r--r--mysql-test/suite/multi_source/info_logs.result115
-rw-r--r--mysql-test/suite/multi_source/info_logs.test178
-rw-r--r--mysql-test/suite/multi_source/multisource.result140
-rw-r--r--mysql-test/suite/multi_source/multisource.test229
-rw-r--r--mysql-test/suite/multi_source/my.cnf25
-rw-r--r--mysql-test/suite/multi_source/relaylog_events.result27
-rw-r--r--mysql-test/suite/multi_source/relaylog_events.test51
-rw-r--r--mysql-test/suite/multi_source/reset_master_slave.inc29
-rw-r--r--mysql-test/suite/multi_source/reset_slave.result28
-rw-r--r--mysql-test/suite/multi_source/reset_slave.test68
-rw-r--r--mysql-test/suite/multi_source/simple.result79
-rw-r--r--mysql-test/suite/multi_source/simple.test73
-rw-r--r--mysql-test/suite/multi_source/skip_counter.result113
-rw-r--r--mysql-test/suite/multi_source/skip_counter.test143
-rw-r--r--mysql-test/suite/multi_source/status_vars.result97
-rw-r--r--mysql-test/suite/multi_source/status_vars.test138
-rw-r--r--mysql-test/suite/multi_source/syntax.result87
-rw-r--r--mysql-test/suite/multi_source/syntax.test79
-rw-r--r--mysql-test/suite/multi_source/wait_for_sql_thread_read_all.inc6
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result4
-rw-r--r--mysql-test/suite/perfschema/disabled.def1
-rw-r--r--mysql-test/suite/perfschema/r/digest_table_full.result2
-rw-r--r--mysql-test/suite/perfschema/r/func_file_io.result12
-rw-r--r--mysql-test/suite/perfschema/r/nesting.result234
-rw-r--r--mysql-test/suite/perfschema/r/ortho_iter.result2
-rw-r--r--mysql-test/suite/perfschema/r/privilege_table_io.result2
-rw-r--r--mysql-test/suite/perfschema/r/query_cache.result12
-rw-r--r--mysql-test/suite/perfschema/r/relaylog.result8
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_idle.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_stages.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_statements.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_waits.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_innodb.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_account.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_host.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_setup_actors.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_setup_objects.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_socket_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_socket_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stage_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stages_history.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statements_history.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_hdl.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_user.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_waits_history.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_off.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_on.result2
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest.result40
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest_consumers.result40
-rw-r--r--mysql-test/suite/perfschema/r/statement_digest_long_query.result4
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_off.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result2
-rw-r--r--mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result2
-rw-r--r--mysql-test/suite/perfschema/t/func_file_io.test4
-rw-r--r--mysql-test/suite/perfschema/t/query_cache.test4
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_send.test3
-rw-r--r--mysql-test/suite/rpl/r/rpl_auto_increment.result19
-rw-r--r--mysql-test/suite/rpl/r/rpl_checksum.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_deadlock_innodb.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_dbs_dynamic.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_flush_logs.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_basic.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_hrtime.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff4
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddatalocal.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_log_pos.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result98
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev382.result368
-rw-r--r--mysql-test/suite/rpl/r/rpl_packet.result11
-rw-r--r--mysql-test/suite/rpl/r/rpl_rewrt_db.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_rotate_logs.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_annotate_do.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_annotate_dont.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log_innodb.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_max_relay_size.result7
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result70
-rw-r--r--mysql-test/suite/rpl/r/rpl_skip_replication.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_log.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result7
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result64
-rw-r--r--mysql-test/suite/rpl/r/rpl_trigger.result10
-rw-r--r--mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test17
-rw-r--r--mysql-test/suite/rpl/t/rpl_flush_logs.test24
-rw-r--r--mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test104
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev382.test265
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet-slave.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet.test15
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_stop_slave.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_trigger.test7
-rw-r--r--mysql-test/suite/storage_engine/1st.result11
-rw-r--r--mysql-test/suite/storage_engine/1st.test81
-rw-r--r--mysql-test/suite/storage_engine/alter_table.inc91
-rw-r--r--mysql-test/suite/storage_engine/alter_table.result147
-rw-r--r--mysql-test/suite/storage_engine/alter_table.test148
-rw-r--r--mysql-test/suite/storage_engine/alter_table_online.result35
-rw-r--r--mysql-test/suite/storage_engine/alter_table_online.test160
-rw-r--r--mysql-test/suite/storage_engine/alter_tablespace.result19
-rw-r--r--mysql-test/suite/storage_engine/alter_tablespace.test91
-rw-r--r--mysql-test/suite/storage_engine/analyze_table.inc43
-rw-r--r--mysql-test/suite/storage_engine/analyze_table.result29
-rw-r--r--mysql-test/suite/storage_engine/analyze_table.test14
-rw-r--r--mysql-test/suite/storage_engine/autoinc_secondary.result40
-rw-r--r--mysql-test/suite/storage_engine/autoinc_secondary.test73
-rw-r--r--mysql-test/suite/storage_engine/autoinc_vars.result55
-rw-r--r--mysql-test/suite/storage_engine/autoinc_vars.test68
-rw-r--r--mysql-test/suite/storage_engine/autoincrement.result133
-rw-r--r--mysql-test/suite/storage_engine/autoincrement.test114
-rw-r--r--mysql-test/suite/storage_engine/cache_index.result69
-rw-r--r--mysql-test/suite/storage_engine/cache_index.test142
-rw-r--r--mysql-test/suite/storage_engine/check_errors.inc80
-rw-r--r--mysql-test/suite/storage_engine/check_table.inc62
-rw-r--r--mysql-test/suite/storage_engine/check_table.result68
-rw-r--r--mysql-test/suite/storage_engine/check_table.test14
-rw-r--r--mysql-test/suite/storage_engine/checksum_table.inc31
-rw-r--r--mysql-test/suite/storage_engine/checksum_table.result20
-rw-r--r--mysql-test/suite/storage_engine/checksum_table.test11
-rw-r--r--mysql-test/suite/storage_engine/checksum_table_live.inc30
-rw-r--r--mysql-test/suite/storage_engine/checksum_table_live.result20
-rw-r--r--mysql-test/suite/storage_engine/checksum_table_live.test13
-rw-r--r--mysql-test/suite/storage_engine/cleanup_engine.inc11
-rw-r--r--mysql-test/suite/storage_engine/col_not_null.inc92
-rw-r--r--mysql-test/suite/storage_engine/col_null.inc65
-rw-r--r--mysql-test/suite/storage_engine/col_opt_default.result20
-rw-r--r--mysql-test/suite/storage_engine/col_opt_default.test49
-rw-r--r--mysql-test/suite/storage_engine/col_opt_not_null.result2062
-rw-r--r--mysql-test/suite/storage_engine/col_opt_not_null.test260
-rw-r--r--mysql-test/suite/storage_engine/col_opt_null.result1991
-rw-r--r--mysql-test/suite/storage_engine/col_opt_null.test208
-rw-r--r--mysql-test/suite/storage_engine/col_opt_unsigned.result697
-rw-r--r--mysql-test/suite/storage_engine/col_opt_unsigned.test95
-rw-r--r--mysql-test/suite/storage_engine/col_opt_zerofill.result679
-rw-r--r--mysql-test/suite/storage_engine/col_opt_zerofill.test88
-rw-r--r--mysql-test/suite/storage_engine/create_table.inc174
-rw-r--r--mysql-test/suite/storage_engine/create_table.result45
-rw-r--r--mysql-test/suite/storage_engine/create_table.test107
-rw-r--r--mysql-test/suite/storage_engine/define_engine.inc45
-rw-r--r--mysql-test/suite/storage_engine/delete.result77
-rw-r--r--mysql-test/suite/storage_engine/delete.test68
-rw-r--r--mysql-test/suite/storage_engine/delete_ignore.result59
-rw-r--r--mysql-test/suite/storage_engine/delete_ignore.test44
-rw-r--r--mysql-test/suite/storage_engine/delete_low_prio.result59
-rw-r--r--mysql-test/suite/storage_engine/delete_low_prio.test162
-rw-r--r--mysql-test/suite/storage_engine/delete_quick.result25
-rw-r--r--mysql-test/suite/storage_engine/delete_quick.test55
-rw-r--r--mysql-test/suite/storage_engine/delete_with_keys.result38
-rw-r--r--mysql-test/suite/storage_engine/delete_with_keys.test74
-rw-r--r--mysql-test/suite/storage_engine/describe.result18
-rw-r--r--mysql-test/suite/storage_engine/describe.test50
-rw-r--r--mysql-test/suite/storage_engine/disabled.def0
-rw-r--r--mysql-test/suite/storage_engine/foreign_keys.result71
-rw-r--r--mysql-test/suite/storage_engine/foreign_keys.test148
-rw-r--r--mysql-test/suite/storage_engine/fulltext_search.result132
-rw-r--r--mysql-test/suite/storage_engine/fulltext_search.test187
-rw-r--r--mysql-test/suite/storage_engine/handler.result77
-rw-r--r--mysql-test/suite/storage_engine/handler.test81
-rw-r--r--mysql-test/suite/storage_engine/have_default_index.inc20
-rw-r--r--mysql-test/suite/storage_engine/have_engine.inc127
-rw-r--r--mysql-test/suite/storage_engine/index.inc194
-rw-r--r--mysql-test/suite/storage_engine/index.result67
-rw-r--r--mysql-test/suite/storage_engine/index.test23
-rw-r--r--mysql-test/suite/storage_engine/index_enable_disable.result45
-rw-r--r--mysql-test/suite/storage_engine/index_enable_disable.test88
-rw-r--r--mysql-test/suite/storage_engine/index_key_block_size.result43
-rw-r--r--mysql-test/suite/storage_engine/index_key_block_size.test125
-rw-r--r--mysql-test/suite/storage_engine/index_primary.result53
-rw-r--r--mysql-test/suite/storage_engine/index_primary.test136
-rw-r--r--mysql-test/suite/storage_engine/index_type_btree.result67
-rw-r--r--mysql-test/suite/storage_engine/index_type_btree.test12
-rw-r--r--mysql-test/suite/storage_engine/index_type_hash.result67
-rw-r--r--mysql-test/suite/storage_engine/index_type_hash.test12
-rw-r--r--mysql-test/suite/storage_engine/insert.result149
-rw-r--r--mysql-test/suite/storage_engine/insert.test78
-rw-r--r--mysql-test/suite/storage_engine/insert_delayed.result25
-rw-r--r--mysql-test/suite/storage_engine/insert_delayed.test62
-rw-r--r--mysql-test/suite/storage_engine/insert_high_prio.result64
-rw-r--r--mysql-test/suite/storage_engine/insert_high_prio.test143
-rw-r--r--mysql-test/suite/storage_engine/insert_low_prio.result39
-rw-r--r--mysql-test/suite/storage_engine/insert_low_prio.test95
-rw-r--r--mysql-test/suite/storage_engine/insert_with_keys.result148
-rw-r--r--mysql-test/suite/storage_engine/insert_with_keys.test143
-rw-r--r--mysql-test/suite/storage_engine/loaddata.result68
-rw-r--r--mysql-test/suite/storage_engine/loaddata.test88
-rw-r--r--mysql-test/suite/storage_engine/lock.result111
-rw-r--r--mysql-test/suite/storage_engine/lock.test244
-rw-r--r--mysql-test/suite/storage_engine/lock_concurrent.result12
-rw-r--r--mysql-test/suite/storage_engine/lock_concurrent.test52
-rw-r--r--mysql-test/suite/storage_engine/mask_engine.inc14
-rw-r--r--mysql-test/suite/storage_engine/misc.result79
-rw-r--r--mysql-test/suite/storage_engine/misc.test47
-rw-r--r--mysql-test/suite/storage_engine/my.cnf7
-rw-r--r--mysql-test/suite/storage_engine/obfuscate.inc4
-rw-r--r--mysql-test/suite/storage_engine/optimize_table.inc42
-rw-r--r--mysql-test/suite/storage_engine/optimize_table.result29
-rw-r--r--mysql-test/suite/storage_engine/optimize_table.test14
-rw-r--r--mysql-test/suite/storage_engine/parts/alter_table.result42
-rw-r--r--mysql-test/suite/storage_engine/parts/alter_table.test107
-rw-r--r--mysql-test/suite/storage_engine/parts/analyze_table.result47
-rw-r--r--mysql-test/suite/storage_engine/parts/analyze_table.test61
-rw-r--r--mysql-test/suite/storage_engine/parts/check_table.result104
-rw-r--r--mysql-test/suite/storage_engine/parts/check_table.test82
-rw-r--r--mysql-test/suite/storage_engine/parts/checksum_table.result40
-rw-r--r--mysql-test/suite/storage_engine/parts/checksum_table.test13
-rw-r--r--mysql-test/suite/storage_engine/parts/create_table.result91
-rw-r--r--mysql-test/suite/storage_engine/parts/create_table.test179
-rw-r--r--mysql-test/suite/storage_engine/parts/my.cnf9
-rw-r--r--mysql-test/suite/storage_engine/parts/optimize_table.result54
-rw-r--r--mysql-test/suite/storage_engine/parts/optimize_table.test69
-rw-r--r--mysql-test/suite/storage_engine/parts/repair_table.result236
-rw-r--r--mysql-test/suite/storage_engine/parts/repair_table.test78
-rw-r--r--mysql-test/suite/storage_engine/parts/truncate_table.result68
-rw-r--r--mysql-test/suite/storage_engine/parts/truncate_table.test111
-rw-r--r--mysql-test/suite/storage_engine/repair_table.inc155
-rw-r--r--mysql-test/suite/storage_engine/repair_table.result106
-rw-r--r--mysql-test/suite/storage_engine/repair_table.test14
-rw-r--r--mysql-test/suite/storage_engine/replace.result47
-rw-r--r--mysql-test/suite/storage_engine/replace.test67
-rw-r--r--mysql-test/suite/storage_engine/se-innodb.out1
-rw-r--r--mysql-test/suite/storage_engine/select.result390
-rw-r--r--mysql-test/suite/storage_engine/select.test210
-rw-r--r--mysql-test/suite/storage_engine/select_high_prio.result45
-rw-r--r--mysql-test/suite/storage_engine/select_high_prio.test139
-rw-r--r--mysql-test/suite/storage_engine/show_engine.result11
-rw-r--r--mysql-test/suite/storage_engine/show_engine.test31
-rw-r--r--mysql-test/suite/storage_engine/show_table_status.result62
-rw-r--r--mysql-test/suite/storage_engine/show_table_status.test30
-rw-r--r--mysql-test/suite/storage_engine/strict_check_errors.inc23
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_ai.result14
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_ai.test35
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_avg_row_length.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_avg_row_length.test35
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_checksum.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_checksum.test30
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_connection.result24
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_connection.test52
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_data_index_dir.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_data_index_dir.test51
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_delay_key_write.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_delay_key_write.test35
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_insert_method.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_insert_method.test35
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_key_block_size.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_key_block_size.test35
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_max_rows.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_max_rows.test35
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_min_rows.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_min_rows.test35
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_pack_keys.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_pack_keys.test35
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_password.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_password.test40
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_row_format.result16
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_row_format.test35
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_union.result14
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_union.test41
-rw-r--r--mysql-test/suite/storage_engine/tbl_standard_opts.result40
-rw-r--r--mysql-test/suite/storage_engine/tbl_standard_opts.test60
-rw-r--r--mysql-test/suite/storage_engine/tbl_temporary.result11
-rw-r--r--mysql-test/suite/storage_engine/tbl_temporary.test32
-rw-r--r--mysql-test/suite/storage_engine/truncate_table.result41
-rw-r--r--mysql-test/suite/storage_engine/truncate_table.test81
-rw-r--r--mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result18
-rw-r--r--mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.test9
-rw-r--r--mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result18
-rw-r--r--mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.test9
-rw-r--r--mysql-test/suite/storage_engine/trx/consistent_snapshot.inc50
-rw-r--r--mysql-test/suite/storage_engine/trx/delete.result72
-rw-r--r--mysql-test/suite/storage_engine/trx/delete.test51
-rw-r--r--mysql-test/suite/storage_engine/trx/insert.result55
-rw-r--r--mysql-test/suite/storage_engine/trx/insert.test44
-rw-r--r--mysql-test/suite/storage_engine/trx/level_read_committed.result91
-rw-r--r--mysql-test/suite/storage_engine/trx/level_read_committed.test10
-rw-r--r--mysql-test/suite/storage_engine/trx/level_read_uncommitted.result116
-rw-r--r--mysql-test/suite/storage_engine/trx/level_read_uncommitted.test9
-rw-r--r--mysql-test/suite/storage_engine/trx/level_repeatable_read.result69
-rw-r--r--mysql-test/suite/storage_engine/trx/level_repeatable_read.test8
-rw-r--r--mysql-test/suite/storage_engine/trx/level_serializable.result56
-rw-r--r--mysql-test/suite/storage_engine/trx/level_serializable.test8
-rw-r--r--mysql-test/suite/storage_engine/trx/my.cnf7
-rw-r--r--mysql-test/suite/storage_engine/trx/select_for_update.result35
-rw-r--r--mysql-test/suite/storage_engine/trx/select_for_update.test87
-rw-r--r--mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result37
-rw-r--r--mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test82
-rw-r--r--mysql-test/suite/storage_engine/trx/support_savepoints.inc10
-rw-r--r--mysql-test/suite/storage_engine/trx/support_transactions.inc10
-rw-r--r--mysql-test/suite/storage_engine/trx/support_xa.inc12
-rw-r--r--mysql-test/suite/storage_engine/trx/transaction_isolation.inc99
-rw-r--r--mysql-test/suite/storage_engine/trx/update.result48
-rw-r--r--mysql-test/suite/storage_engine/trx/update.test50
-rw-r--r--mysql-test/suite/storage_engine/trx/xa.result96
-rw-r--r--mysql-test/suite/storage_engine/trx/xa.test118
-rw-r--r--mysql-test/suite/storage_engine/trx/xa_recovery.result29
-rw-r--r--mysql-test/suite/storage_engine/trx/xa_recovery.test71
-rw-r--r--mysql-test/suite/storage_engine/type_binary.inc52
-rw-r--r--mysql-test/suite/storage_engine/type_binary.result62
-rw-r--r--mysql-test/suite/storage_engine/type_binary.test10
-rw-r--r--mysql-test/suite/storage_engine/type_binary_indexes.result126
-rw-r--r--mysql-test/suite/storage_engine/type_binary_indexes.test149
-rw-r--r--mysql-test/suite/storage_engine/type_bit.inc76
-rw-r--r--mysql-test/suite/storage_engine/type_bit.result47
-rw-r--r--mysql-test/suite/storage_engine/type_bit.test10
-rw-r--r--mysql-test/suite/storage_engine/type_bit_indexes.result132
-rw-r--r--mysql-test/suite/storage_engine/type_bit_indexes.test175
-rw-r--r--mysql-test/suite/storage_engine/type_blob.inc65
-rw-r--r--mysql-test/suite/storage_engine/type_blob.result54
-rw-r--r--mysql-test/suite/storage_engine/type_blob.test10
-rw-r--r--mysql-test/suite/storage_engine/type_blob_indexes.result152
-rw-r--r--mysql-test/suite/storage_engine/type_blob_indexes.test188
-rw-r--r--mysql-test/suite/storage_engine/type_bool.inc81
-rw-r--r--mysql-test/suite/storage_engine/type_bool.result70
-rw-r--r--mysql-test/suite/storage_engine/type_bool.test10
-rw-r--r--mysql-test/suite/storage_engine/type_char.inc59
-rw-r--r--mysql-test/suite/storage_engine/type_char.result56
-rw-r--r--mysql-test/suite/storage_engine/type_char.test10
-rw-r--r--mysql-test/suite/storage_engine/type_char_indexes.result144
-rw-r--r--mysql-test/suite/storage_engine/type_char_indexes.test186
-rw-r--r--mysql-test/suite/storage_engine/type_date_time.inc55
-rw-r--r--mysql-test/suite/storage_engine/type_date_time.result48
-rw-r--r--mysql-test/suite/storage_engine/type_date_time.test11
-rw-r--r--mysql-test/suite/storage_engine/type_date_time_indexes.result278
-rw-r--r--mysql-test/suite/storage_engine/type_date_time_indexes.test366
-rw-r--r--mysql-test/suite/storage_engine/type_enum.inc69
-rw-r--r--mysql-test/suite/storage_engine/type_enum.result46
-rw-r--r--mysql-test/suite/storage_engine/type_enum.test10
-rw-r--r--mysql-test/suite/storage_engine/type_enum_indexes.result108
-rw-r--r--mysql-test/suite/storage_engine/type_enum_indexes.test146
-rw-r--r--mysql-test/suite/storage_engine/type_fixed.inc89
-rw-r--r--mysql-test/suite/storage_engine/type_fixed.result116
-rw-r--r--mysql-test/suite/storage_engine/type_fixed.test10
-rw-r--r--mysql-test/suite/storage_engine/type_fixed_indexes.result148
-rw-r--r--mysql-test/suite/storage_engine/type_fixed_indexes.test167
-rw-r--r--mysql-test/suite/storage_engine/type_float.inc111
-rw-r--r--mysql-test/suite/storage_engine/type_float.result286
-rw-r--r--mysql-test/suite/storage_engine/type_float.test10
-rw-r--r--mysql-test/suite/storage_engine/type_float_indexes.result146
-rw-r--r--mysql-test/suite/storage_engine/type_float_indexes.test203
-rw-r--r--mysql-test/suite/storage_engine/type_int.inc84
-rw-r--r--mysql-test/suite/storage_engine/type_int.result209
-rw-r--r--mysql-test/suite/storage_engine/type_int.test10
-rw-r--r--mysql-test/suite/storage_engine/type_int_indexes.result133
-rw-r--r--mysql-test/suite/storage_engine/type_int_indexes.test146
-rw-r--r--mysql-test/suite/storage_engine/type_set.inc69
-rw-r--r--mysql-test/suite/storage_engine/type_set.result48
-rw-r--r--mysql-test/suite/storage_engine/type_set.test10
-rw-r--r--mysql-test/suite/storage_engine/type_set_indexes.result137
-rw-r--r--mysql-test/suite/storage_engine/type_set_indexes.test167
-rw-r--r--mysql-test/suite/storage_engine/type_spatial.inc738
-rw-r--r--mysql-test/suite/storage_engine/type_spatial.result700
-rw-r--r--mysql-test/suite/storage_engine/type_spatial.test10
-rw-r--r--mysql-test/suite/storage_engine/type_spatial_indexes.result1400
-rw-r--r--mysql-test/suite/storage_engine/type_spatial_indexes.test15
-rw-r--r--mysql-test/suite/storage_engine/type_text.inc65
-rw-r--r--mysql-test/suite/storage_engine/type_text.result54
-rw-r--r--mysql-test/suite/storage_engine/type_text.test10
-rw-r--r--mysql-test/suite/storage_engine/type_text_indexes.result137
-rw-r--r--mysql-test/suite/storage_engine/type_text_indexes.test175
-rw-r--r--mysql-test/suite/storage_engine/type_varbinary.inc101
-rw-r--r--mysql-test/suite/storage_engine/type_varbinary.result92
-rw-r--r--mysql-test/suite/storage_engine/type_varbinary.test10
-rw-r--r--mysql-test/suite/storage_engine/type_varchar.inc100
-rw-r--r--mysql-test/suite/storage_engine/type_varchar.result127
-rw-r--r--mysql-test/suite/storage_engine/type_varchar.test10
-rw-r--r--mysql-test/suite/storage_engine/unexpected_result.inc50
-rw-r--r--mysql-test/suite/storage_engine/update.result50
-rw-r--r--mysql-test/suite/storage_engine/update.test43
-rw-r--r--mysql-test/suite/storage_engine/update_ignore.result54
-rw-r--r--mysql-test/suite/storage_engine/update_ignore.test43
-rw-r--r--mysql-test/suite/storage_engine/update_low_prio.result66
-rw-r--r--mysql-test/suite/storage_engine/update_low_prio.test167
-rw-r--r--mysql-test/suite/storage_engine/update_multi.result65
-rw-r--r--mysql-test/suite/storage_engine/update_multi.test44
-rw-r--r--mysql-test/suite/storage_engine/update_with_keys.result90
-rw-r--r--mysql-test/suite/storage_engine/update_with_keys.test152
-rw-r--r--mysql-test/suite/storage_engine/vcol.result69
-rw-r--r--mysql-test/suite/storage_engine/vcol.test72
-rw-r--r--mysql-test/suite/sys_vars/r/all_vars.result1
-rw-r--r--mysql-test/suite/sys_vars/r/default_master_connection_basic.result94
-rw-r--r--mysql-test/suite/sys_vars/r/expensive_subquery_limit_basic.result52
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_merge_sort_block_size_basic.result24
-rw-r--r--mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result29
-rw-r--r--mysql-test/suite/sys_vars/r/slave_max_allowed_packet_basic.result147
-rw-r--r--mysql-test/suite/sys_vars/r/sql_slave_skip_counter_basic.result3
-rw-r--r--mysql-test/suite/sys_vars/t/default_master_connection_basic.test128
-rw-r--r--mysql-test/suite/sys_vars/t/expensive_subquery_limit_basic.test38
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_merge_sort_block_size_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test5
-rw-r--r--mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test177
-rw-r--r--mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test8
-rw-r--r--mysql-test/t/adddate_454.test9
-rw-r--r--mysql-test/t/auto_increment.test5
-rw-r--r--mysql-test/t/auto_increment_ranges.inc240
-rw-r--r--mysql-test/t/auto_increment_ranges_innodb.test7
-rw-r--r--mysql-test/t/auto_increment_ranges_myisam.test7
-rw-r--r--mysql-test/t/case.test11
-rw-r--r--mysql-test/t/compare.test8
-rw-r--r--mysql-test/t/create-big.test27
-rw-r--r--mysql-test/t/ctype_utf32.test5
-rw-r--r--mysql-test/t/datetime_456.test8
-rw-r--r--mysql-test/t/errors.test9
-rw-r--r--mysql-test/t/features.test111
-rw-r--r--mysql-test/t/filesort_debug.test2
-rw-r--r--mysql-test/t/flush.test8
-rw-r--r--mysql-test/t/func_group_innodb.test29
-rw-r--r--mysql-test/t/func_time.test4
-rw-r--r--mysql-test/t/gis.test16
-rw-r--r--mysql-test/t/group_by.test49
-rw-r--r--mysql-test/t/index_merge_innodb.test15
-rw-r--r--mysql-test/t/last_value.test46
-rw-r--r--mysql-test/t/mdev375.test22
-rw-r--r--mysql-test/t/mysql_plugin.test4
-rw-r--r--mysql-test/t/mysqlbinlog2.test38
-rw-r--r--mysql-test/t/mysqldump-max.test2
-rw-r--r--mysql-test/t/mysqltest.test5
-rw-r--r--mysql-test/t/order_by.test240
-rw-r--r--mysql-test/t/order_by_sortkey.test64
-rw-r--r--mysql-test/t/parser.test2
-rw-r--r--mysql-test/t/partition.test10
-rw-r--r--mysql-test/t/partition_cache_innodb.test14
-rw-r--r--mysql-test/t/partition_cache_myisam.test14
-rw-r--r--mysql-test/t/ps.test92
-rw-r--r--mysql-test/t/replace.test4
-rw-r--r--mysql-test/t/show_explain.test1115
-rw-r--r--mysql-test/t/show_explain_ps.test51
-rw-r--r--mysql-test/t/sp.test9
-rw-r--r--mysql-test/t/str_to_datetime_457.test26
-rw-r--r--mysql-test/t/subselect.test87
-rw-r--r--mysql-test/t/subselect4.test69
-rw-r--r--mysql-test/t/subselect_innodb.test48
-rw-r--r--mysql-test/t/type_year.test8
-rw-r--r--mysql-test/t/view.test48
-rw-r--r--mysql-test/t/xa_binlog.test2
-rw-r--r--mysys/charset-def.c2
-rw-r--r--mysys/lf_alloc-pin.c2
-rw-r--r--mysys/lf_hash.c4
-rw-r--r--mysys/mf_fn_ext.c37
-rw-r--r--mysys/mf_iocache2.c60
-rw-r--r--mysys/mf_radix.c5
-rw-r--r--mysys/mf_sort.c2
-rw-r--r--mysys/my_chsize.c7
-rw-r--r--mysys/my_getopt.c10
-rw-r--r--mysys/my_lock.c2
-rw-r--r--mysys/my_pthread.c69
-rw-r--r--mysys/my_rename.c16
-rw-r--r--mysys/my_sync.c18
-rw-r--r--mysys/my_write.c5
-rw-r--r--mysys/thr_mutex.c3
-rw-r--r--mysys/waiting_threads.c2
-rw-r--r--plugin/auth_pam/auth_pam.c2
-rw-r--r--plugin/semisync/semisync.cc2
-rw-r--r--plugin/semisync/semisync.h2
-rw-r--r--plugin/semisync/semisync_master.cc3
-rw-r--r--plugin/semisync/semisync_master_plugin.cc22
-rw-r--r--plugin/semisync/semisync_slave_plugin.cc2
-rw-r--r--scripts/CMakeLists.txt3
-rw-r--r--scripts/fill_help_tables.sql3946
-rwxr-xr-xscripts/mytop.sh147
-rw-r--r--sql-common/client.c21
-rw-r--r--sql-common/my_time.c409
-rw-r--r--sql/CMakeLists.txt2
-rw-r--r--sql/bounded_queue.h195
-rw-r--r--sql/create_options.cc5
-rw-r--r--sql/derror.cc4
-rw-r--r--sql/event_db_repository.cc11
-rw-r--r--sql/event_scheduler.cc6
-rw-r--r--sql/events.cc33
-rw-r--r--sql/field.cc16
-rw-r--r--sql/filesort.cc574
-rw-r--r--sql/filesort.h4
-rw-r--r--sql/filesort_utils.cc143
-rw-r--r--sql/filesort_utils.h129
-rw-r--r--sql/ha_ndbcluster_binlog.cc25
-rw-r--r--sql/ha_partition.cc141
-rw-r--r--sql/ha_partition.h26
-rw-r--r--sql/handler.cc128
-rw-r--r--sql/handler.h90
-rw-r--r--sql/item.cc32
-rw-r--r--sql/item.h107
-rw-r--r--sql/item_cmpfunc.cc21
-rw-r--r--sql/item_create.cc23
-rw-r--r--sql/item_func.cc101
-rw-r--r--sql/item_func.h26
-rw-r--r--sql/item_geofunc.cc6
-rw-r--r--sql/item_strfunc.cc1
-rw-r--r--sql/item_subselect.cc366
-rw-r--r--sql/item_subselect.h5
-rw-r--r--sql/item_timefunc.cc37
-rw-r--r--sql/item_xmlfunc.cc2
-rw-r--r--sql/lex.h2
-rw-r--r--sql/log.cc1011
-rw-r--r--sql/log.h143
-rw-r--r--sql/log_event.cc750
-rw-r--r--sql/log_event.h147
-rw-r--r--sql/log_event_old.cc2
-rw-r--r--sql/log_event_old.h2
-rw-r--r--sql/multi_range_read.cc2
-rw-r--r--sql/my_apc.cc270
-rw-r--r--sql/my_apc.h138
-rw-r--r--sql/mysqld.cc311
-rw-r--r--sql/mysqld.h14
-rw-r--r--sql/opt_range.cc27
-rw-r--r--sql/opt_subselect.cc15
-rw-r--r--sql/opt_sum.cc2
-rw-r--r--sql/protocol.cc6
-rw-r--r--sql/protocol.h5
-rw-r--r--sql/repl_failsafe.cc1
-rw-r--r--sql/rpl_mi.cc616
-rw-r--r--sql/rpl_mi.h54
-rw-r--r--sql/rpl_record.cc2
-rw-r--r--sql/rpl_rli.cc74
-rw-r--r--sql/rpl_rli.h6
-rw-r--r--sql/rpl_utility.cc7
-rw-r--r--sql/rpl_utility.h2
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/set_var.h3
-rw-r--r--sql/share/errmsg-utf8.txt59
-rw-r--r--sql/signal_handler.cc17
-rw-r--r--sql/slave.cc315
-rw-r--r--sql/slave.h9
-rw-r--r--sql/sp.cc34
-rw-r--r--sql/sp_head.cc2
-rw-r--r--sql/spatial.h2
-rw-r--r--sql/sql_acl.cc184
-rw-r--r--sql/sql_admin.cc1
-rw-r--r--sql/sql_array.h71
-rw-r--r--sql/sql_base.cc62
-rw-r--r--sql/sql_cache.cc97
-rw-r--r--sql/sql_cache.h31
-rw-r--r--sql/sql_class.cc190
-rw-r--r--sql/sql_class.h193
-rw-r--r--sql/sql_cmd.h2
-rw-r--r--sql/sql_const.h1
-rw-r--r--sql/sql_cursor.cc2
-rw-r--r--sql/sql_db.cc41
-rw-r--r--sql/sql_delete.cc16
-rw-r--r--sql/sql_insert.cc70
-rw-r--r--sql/sql_join_cache.cc13
-rw-r--r--sql/sql_lex.cc130
-rw-r--r--sql/sql_lex.h20
-rw-r--r--sql/sql_load.cc96
-rw-r--r--sql/sql_parse.cc297
-rw-r--r--sql/sql_partition.cc6
-rw-r--r--sql/sql_plugin.cc2
-rw-r--r--sql/sql_plugin.h6
-rw-r--r--sql/sql_prepare.cc3
-rw-r--r--sql/sql_priv.h1
-rw-r--r--sql/sql_profile.cc8
-rw-r--r--sql/sql_profile.h2
-rw-r--r--sql/sql_reload.cc51
-rw-r--r--sql/sql_repl.cc274
-rw-r--r--sql/sql_select.cc857
-rw-r--r--sql/sql_select.h49
-rw-r--r--sql/sql_show.cc246
-rw-r--r--sql/sql_show.h28
-rw-r--r--sql/sql_sort.h50
-rw-r--r--sql/sql_state.c2
-rw-r--r--sql/sql_string.cc28
-rw-r--r--sql/sql_string.h1
-rw-r--r--sql/sql_table.cc187
-rw-r--r--sql/sql_time.cc69
-rw-r--r--sql/sql_time.h2
-rw-r--r--sql/sql_trigger.cc3
-rw-r--r--sql/sql_truncate.cc41
-rw-r--r--sql/sql_udf.cc47
-rw-r--r--sql/sql_union.cc4
-rw-r--r--sql/sql_update.cc8
-rw-r--r--sql/sql_yacc.yy142
-rw-r--r--sql/strfunc.cc1
-rw-r--r--sql/sys_vars.cc282
-rw-r--r--sql/sys_vars.h174
-rw-r--r--sql/table.cc33
-rw-r--r--sql/table.h64
-rw-r--r--sql/tztime.cc4
-rw-r--r--sql/uniques.cc9
-rw-r--r--storage/archive/azio.c27
-rw-r--r--storage/archive/ha_archive.cc27
-rw-r--r--storage/example/ha_example.cc5
-rw-r--r--storage/example/mysql-test/mtr/suite.pm8
-rw-r--r--storage/heap/hp_block.c23
-rw-r--r--storage/heap/hp_create.c23
-rw-r--r--storage/heap/hp_hash.c9
-rw-r--r--storage/innobase/btr/btr0btr.cc2
-rw-r--r--storage/innobase/buf/buf0buf.cc9
-rw-r--r--storage/innobase/buf/buf0lru.cc14
-rw-r--r--storage/innobase/buf/buf0rea.cc47
-rw-r--r--storage/innobase/dict/dict0dict.cc37
-rw-r--r--storage/innobase/ha/ha0ha.cc12
-rw-r--r--storage/innobase/handler/ha_innodb.cc191
-rw-r--r--storage/innobase/handler/handler0alter.cc18
-rw-r--r--storage/innobase/include/btr0btr.h3
-rw-r--r--storage/innobase/include/btr0types.h4
-rw-r--r--storage/innobase/include/buf0buf.h21
-rw-r--r--storage/innobase/include/dict0dict.h6
-rw-r--r--storage/innobase/include/trx0sys.h2
-rw-r--r--storage/innobase/log/log0recv.cc2
-rw-r--r--storage/innobase/mysql-test/storage_engine/alter_tablespace.opt2
-rw-r--r--storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff30
-rw-r--r--storage/innobase/mysql-test/storage_engine/cache_index.rdiff71
-rw-r--r--storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff13
-rw-r--r--storage/innobase/mysql-test/storage_engine/define_engine.inc45
-rw-r--r--storage/innobase/mysql-test/storage_engine/disabled.def9
-rw-r--r--storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff150
-rw-r--r--storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff33
-rw-r--r--storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff60
-rw-r--r--storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff26
-rw-r--r--storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff22
-rw-r--r--storage/innobase/mysql-test/storage_engine/optimize_table.rdiff37
-rw-r--r--storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff22
-rw-r--r--storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff20
-rw-r--r--storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff58
-rw-r--r--storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff228
-rw-r--r--storage/innobase/mysql-test/storage_engine/parts/suite.opt4
-rw-r--r--storage/innobase/mysql-test/storage_engine/repair_table.rdiff129
-rw-r--r--storage/innobase/mysql-test/storage_engine/suite.opt4
-rw-r--r--storage/innobase/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff18
-rw-r--r--storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff11
-rw-r--r--storage/innobase/mysql-test/storage_engine/tbl_opt_key_block_size.opt3
-rw-r--r--storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.opt3
-rw-r--r--storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff10
-rw-r--r--storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff16
-rw-r--r--storage/innobase/mysql-test/storage_engine/trx/disabled.def2
-rw-r--r--storage/innobase/mysql-test/storage_engine/trx/suite.opt5
-rw-r--r--storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff20
-rw-r--r--storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff11
-rw-r--r--storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff712
-rw-r--r--storage/innobase/mysql-test/storage_engine/vcol.rdiff82
-rw-r--r--storage/innobase/row/row0ins.cc6
-rw-r--r--storage/innobase/row/row0vers.cc12
-rw-r--r--storage/innobase/trx/trx0trx.cc11
-rw-r--r--storage/maria/CMakeLists.txt2
-rw-r--r--storage/maria/ha_maria.cc24
-rw-r--r--storage/maria/ha_maria.h7
-rw-r--r--storage/maria/ma_blockrec.c2
-rw-r--r--storage/maria/ma_ft_nlq_search.c2
-rw-r--r--storage/maria/ma_key_recover.c6
-rw-r--r--storage/maria/ma_pagecache.c1
-rw-r--r--storage/maria/ma_search.c4
-rwxr-xr-xstorage/maria/ma_test_all.sh13
-rw-r--r--storage/maria/maria_chk.c3
-rw-r--r--storage/myisam/CMakeLists.txt2
-rw-r--r--storage/myisam/ft_boolean_search.c16
-rw-r--r--storage/myisam/ft_nlq_search.c19
-rw-r--r--storage/myisam/ha_myisam.cc22
-rw-r--r--storage/myisam/ha_myisam.h7
-rw-r--r--storage/myisam/mi_extra.c2
-rwxr-xr-xstorage/myisam/mi_test_all.sh2
-rw-r--r--storage/myisam/myisamchk.c3
-rw-r--r--storage/myisam/mysql-test/mtr2/suite.pm9
-rw-r--r--storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff32
-rw-r--r--storage/myisam/mysql-test/storage_engine/check_table.rdiff20
-rw-r--r--storage/myisam/mysql-test/storage_engine/define_engine.inc45
-rw-r--r--storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff145
-rw-r--r--storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff60
-rw-r--r--storage/myisam/mysql-test/storage_engine/show_engine.rdiff10
-rw-r--r--storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff11
-rw-r--r--storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff16
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff9
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff9
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/delete.rdiff50
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/insert.rdiff65
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff44
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff7
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff53
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff69
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff50
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff37
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/update.rdiff58
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/xa.rdiff89
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff33
-rw-r--r--storage/myisammrg/ha_myisammrg.cc41
-rw-r--r--storage/myisammrg/ha_myisammrg.h6
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/alter_table.inc116
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff68
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff27
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff22
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff34
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff46
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff0
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff6
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/cleanup_engine.inc16
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/create_table.inc208
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/create_table.rdiff37
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/define_engine.inc49
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/disabled.def2
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff138
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff142
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/handler.rdiff79
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/index.rdiff6
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff17
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff6
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff34
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff14
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/lock.rdiff62
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff24
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff63
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff83
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff172
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff81
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff156
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff91
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff295
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff100
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff103
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff2
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff4
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff35
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff9
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff9
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff34
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff32
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff44
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff7
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff53
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff69
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff40
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff26
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff41
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff34
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff22
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff8
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff4
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff706
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff1412
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/vcol.rdiff79
-rw-r--r--storage/oqgraph/CMakeLists.txt22
-rw-r--r--storage/sphinx/ha_sphinx.cc12
-rw-r--r--storage/xtradb/btr/btr0btr.c6
-rw-r--r--storage/xtradb/btr/btr0cur.c2
-rw-r--r--storage/xtradb/buf/buf0buf.c11
-rw-r--r--storage/xtradb/buf/buf0flu.c9
-rw-r--r--storage/xtradb/buf/buf0lru.c51
-rw-r--r--storage/xtradb/buf/buf0rea.c47
-rw-r--r--storage/xtradb/dict/dict0dict.c42
-rw-r--r--storage/xtradb/dict/dict0load.c4
-rw-r--r--storage/xtradb/dict/dict0mem.c4
-rw-r--r--storage/xtradb/fil/fil0fil.c9
-rw-r--r--storage/xtradb/ha/ha0ha.c16
-rw-r--r--storage/xtradb/handler/ha_innodb.cc157
-rw-r--r--storage/xtradb/handler/ha_innodb.h1
-rw-r--r--storage/xtradb/handler/handler0alter.cc18
-rw-r--r--storage/xtradb/handler/i_s.cc312
-rw-r--r--storage/xtradb/handler/i_s.h2
-rw-r--r--storage/xtradb/include/btr0btr.h3
-rw-r--r--storage/xtradb/include/btr0types.h4
-rw-r--r--storage/xtradb/include/buf0buf.h23
-rw-r--r--storage/xtradb/include/buf0buf.ic2
-rw-r--r--storage/xtradb/include/dict0dict.h5
-rw-r--r--storage/xtradb/include/dict0dict.ic2
-rw-r--r--storage/xtradb/include/ha_prototypes.h11
-rw-r--r--storage/xtradb/include/log0log.h2
-rw-r--r--storage/xtradb/include/os0file.h2
-rw-r--r--storage/xtradb/include/srv0srv.h3
-rw-r--r--storage/xtradb/include/trx0sys.h4
-rw-r--r--storage/xtradb/include/trx0trx.h1
-rw-r--r--storage/xtradb/include/univ.i5
-rw-r--r--storage/xtradb/log/log0recv.c2
-rw-r--r--storage/xtradb/mem/mem0dbg.c4
-rw-r--r--storage/xtradb/os/os0file.c2
-rw-r--r--storage/xtradb/page/page0zip.c2
-rw-r--r--storage/xtradb/row/row0ins.c6
-rw-r--r--storage/xtradb/row/row0merge.c188
-rw-r--r--storage/xtradb/row/row0vers.c11
-rw-r--r--storage/xtradb/srv/srv0start.c3
-rw-r--r--storage/xtradb/sync/sync0arr.c5
-rw-r--r--storage/xtradb/trx/trx0sys.c2
-rw-r--r--storage/xtradb/trx/trx0trx.c11
-rw-r--r--storage/xtradb/ut/ut0dbg.c6
-rw-r--r--storage/xtradb/ut/ut0ut.c8
-rw-r--r--strings/ctype-ucs2.c11
-rw-r--r--strings/my_vsnprintf.c50
-rw-r--r--support-files/compiler_warnings.supp3
-rw-r--r--support-files/my-huge.cnf.sh2
-rw-r--r--support-files/mysql.spec.sh2
-rw-r--r--tests/mysql_client_fw.c1440
-rw-r--r--tests/mysql_client_test.c1762
-rw-r--r--unittest/mysys/ma_dyncol-t.c2
-rw-r--r--unittest/sql/CMakeLists.txt3
-rw-r--r--unittest/sql/my_apc-t.cc228
-rw-r--r--unittest/strings/strings-t.c2
-rw-r--r--vio/viosslfactories.c11
-rw-r--r--win/packaging/ca/CMakeLists.txt2
1113 files changed, 65313 insertions, 8544 deletions
diff --git a/.bzrignore b/.bzrignore
index c94b3202d91..d190c8be0f7 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1096,7 +1096,6 @@ CPackSourceConfig.cmake
Docs/INFO_BIN
Docs/INFO_SRC
tags
-sql/.empty
Testing
info_macros.cmake
VERSION.dep
@@ -1136,6 +1135,7 @@ plugin/handler_socket/perl-Net-HandlerSocket/Makefile.PL
libmysqld/libmysqld_exports_file.cc
libmysqld/gcalc_slicescan.cc
libmysqld/gcalc_tools.cc
+libmysqld/my_apc.cc
sql/share/errmsg.sys
sql/share/mysql
install_manifest.txt
diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh
index 37dcd1fe836..b7ff195ccf6 100644
--- a/BUILD/FINISH.sh
+++ b/BUILD/FINISH.sh
@@ -21,6 +21,12 @@ extra_configs="$extra_configs $local_infile_configs $EXTRA_CONFIGS"
configure="./configure $base_configs $extra_configs"
+if test "$just_print" = "1" -a "$just_configure" = "1"
+then
+ just_print=""
+ configure="$configure --print"
+fi
+
commands="\
/bin/rm -rf configure;
/bin/rm -rf CMakeCache.txt CMakeFiles/
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index de3cb4890a9..5154f64b98f 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -139,7 +139,7 @@ else
# C warnings
c_warnings="$warnings"
# C++ warnings
- cxx_warnings="$warnings -Wno-unused-parameter"
+ cxx_warnings="$warnings -Wno-unused-parameter -Wno-invalid-offsetof"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
cxx_warnings="$cxx_warnings -Wnon-virtual-dtor"
debug_extra_cflags="-O0 -g3 -gdwarf-2"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 74697ce232d..5133d024ef1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -285,6 +285,7 @@ IF(WITH_UNIT_TESTS)
ADD_SUBDIRECTORY(unittest/strings)
ADD_SUBDIRECTORY(unittest/examples)
ADD_SUBDIRECTORY(unittest/mysys)
+ ADD_SUBDIRECTORY(unittest/sql)
ENDIF()
IF(NOT WITHOUT_SERVER)
@@ -300,14 +301,16 @@ ADD_SUBDIRECTORY(vio)
ADD_SUBDIRECTORY(regex)
ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(libmysql)
-
+ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(extra)
+ADD_SUBDIRECTORY(libservices)
+ADD_SUBDIRECTORY(scripts)
+ADD_SUBDIRECTORY(sql/share)
+ADD_SUBDIRECTORY(support-files)
+
IF(NOT WITHOUT_SERVER)
ADD_SUBDIRECTORY(tests)
- ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(sql)
- ADD_SUBDIRECTORY(sql/share)
- ADD_SUBDIRECTORY(libservices)
OPTION (WITH_EMBEDDED_SERVER "Compile MySQL with embedded server" OFF)
IF(WITH_EMBEDDED_SERVER)
ADD_SUBDIRECTORY(libmysqld)
@@ -316,12 +319,11 @@ IF(NOT WITHOUT_SERVER)
ADD_SUBDIRECTORY(mysql-test)
ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)
- ADD_SUBDIRECTORY(support-files)
- ADD_SUBDIRECTORY(scripts)
ADD_SUBDIRECTORY(sql-bench)
- IF(UNIX)
- ADD_SUBDIRECTORY(man)
- ENDIF()
+ENDIF()
+
+IF(UNIX)
+ ADD_SUBDIRECTORY(man)
ENDIF()
INCLUDE(cmake/abi_check.cmake)
diff --git a/client/get_password.c b/client/get_password.c
index c6653183f48..09d307b5553 100644
--- a/client/get_password.c
+++ b/client/get_password.c
@@ -23,10 +23,6 @@
#include <m_string.h>
#include <m_ctype.h>
-#if defined(HAVE_BROKEN_GETPASS) && !defined(HAVE_GETPASSPHRASE)
-#undef HAVE_GETPASS
-#endif
-
#ifdef HAVE_GETPASS
#ifdef HAVE_PWD_H
#include <pwd.h>
diff --git a/client/mysql.cc b/client/mysql.cc
index 5f205791b8e..9bc1d02bb64 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -897,6 +897,7 @@ static COMMANDS commands[] = {
{ "LAST_INSERT_ID", 0, 0, 0, ""},
{ "ISSIMPLE", 0, 0, 0, ""},
{ "LAST_DAY", 0, 0, 0, ""},
+ { "LAST_VALUE", 0, 0, 0, ""},
{ "LCASE", 0, 0, 0, ""},
{ "LEAST", 0, 0, 0, ""},
{ "LENGTH", 0, 0, 0, ""},
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index e2c96d35c73..bab566e045c 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -23,7 +23,7 @@
#include <mysql.h>
#include <sql_common.h>
-#define ADMIN_VERSION "9.0"
+#define ADMIN_VERSION "9.1"
#define MAX_MYSQL_VAR 512
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@@ -97,6 +97,7 @@ enum commands {
ADMIN_FLUSH_HOSTS, ADMIN_FLUSH_TABLES, ADMIN_PASSWORD,
ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS,
ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE,
+ ADMIN_START_ALL_SLAVES, ADMIN_STOP_ALL_SLAVES,
ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD, ADMIN_FLUSH_SLOW_LOG,
ADMIN_FLUSH_TABLE_STATISTICS, ADMIN_FLUSH_INDEX_STATISTICS,
ADMIN_FLUSH_USER_STATISTICS, ADMIN_FLUSH_CLIENT_STATISTICS,
@@ -110,6 +111,7 @@ static const char *command_names[]= {
"flush-hosts", "flush-tables", "password",
"ping", "extended-status", "flush-status",
"flush-privileges", "start-slave", "stop-slave",
+ "start-all-slaves", "stop-all-slaves",
"flush-threads", "old-password", "flush-slow-log",
"flush-table-statistics", "flush-index-statistics",
"flush-user-statistics", "flush-client-statistics",
@@ -1117,26 +1119,67 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
case ADMIN_START_SLAVE:
- if (mysql_query(mysql, "START SLAVE"))
+ case ADMIN_START_ALL_SLAVES:
+ {
+ my_bool many_slaves= 0;
+ const char *query= "START SLAVE";
+ if (command == ADMIN_START_ALL_SLAVES && mariadb_connection(mysql) &&
+ mysql_get_server_version(mysql) >= 100000)
+ {
+ query="START ALL SLAVES";
+ many_slaves= 1;
+ }
+
+ if (mysql_query(mysql, query))
{
my_printf_error(0, "Error starting slave: %s", error_flags,
mysql_error(mysql));
return -1;
}
+ else if (!many_slaves || mysql_warning_count(mysql) > 0)
+ {
+ if (!option_silent)
+ puts("Slave('s) started");
+ }
else
- puts("Slave started");
+ {
+ if (!option_silent)
+ puts("No slaves to start");
+ }
break;
+ }
case ADMIN_STOP_SLAVE:
- if (mysql_query(mysql, "STOP SLAVE"))
+ case ADMIN_STOP_ALL_SLAVES:
+ {
+ const char *query= "STOP SLAVE";
+ my_bool many_slaves= 0;
+
+ if (command == ADMIN_STOP_ALL_SLAVES && mariadb_connection(mysql) &&
+ mysql_get_server_version(mysql) >= 100000)
+ {
+ query="STOP ALL SLAVES";
+ many_slaves= 1;
+ }
+
+ if (mysql_query(mysql, query))
{
my_printf_error(0, "Error stopping slave: %s", error_flags,
mysql_error(mysql));
return -1;
}
+ else if (!many_slaves || mysql_warning_count(mysql) > 0)
+ {
+ /* We can't detect if there was any slaves to stop with STOP SLAVE */
+ if (many_slaves && !option_silent)
+ puts("Slave('s) stopped");
+ }
else
- puts("Slave stopped");
+ {
+ if (!option_silent)
+ puts("All slaves was already stopped");
+ }
break;
-
+ }
case ADMIN_PING:
mysql->reconnect=0; /* We want to know of reconnects */
if (!mysql_ping(mysql))
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 91a2bd2aef3..f604b8bc84f 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2012, Monty Program Ab
+ Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -743,7 +743,7 @@ print_use_stmt(PRINT_EVENT_INFO* pinfo, const Query_log_event *ev)
return;
// In case of rewrite rule print USE statement for db_to
- fprintf(result_file, "use %s%s\n", db_to, pinfo->delimiter);
+ my_fprintf(result_file, "use %`s%s\n", db_to, pinfo->delimiter);
// Copy the *original* db to pinfo to suppress emiting
// of USE stmts by log_event print-functions.
@@ -844,6 +844,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
DBUG_ENTER("process_event");
print_event_info->short_form= short_form;
Exit_status retval= OK_CONTINUE;
+ IO_CACHE *const head= &print_event_info->head_cache;
/*
Format events are not concerned by --offset and such, we always need to
@@ -923,6 +924,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
print_skip_replication_statement(print_event_info, ev);
ev->print(result_file, print_event_info);
}
+ if (head->error == -1)
+ goto err;
break;
}
@@ -955,8 +958,9 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
{
print_skip_replication_statement(print_event_info, ev);
ce->print(result_file, print_event_info, TRUE);
+ if (head->error == -1)
+ goto err;
}
-
// If this binlog is not 3.23 ; why this test??
if (glob_description_event->binlog_version >= 3)
{
@@ -978,6 +982,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
output of Append_block_log_event::print is only a comment.
*/
ev->print(result_file, print_event_info);
+ if (head->error == -1)
+ goto err;
if ((retval= load_processor.process((Append_block_log_event*) ev)) !=
OK_CONTINUE)
goto end;
@@ -986,6 +992,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
case EXEC_LOAD_EVENT:
{
ev->print(result_file, print_event_info);
+ if (head->error == -1)
+ goto err;
Execute_load_log_event *exv= (Execute_load_log_event*)ev;
Create_file_log_event *ce= load_processor.grab_event(exv->file_id);
/*
@@ -1003,6 +1011,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
ce->print(result_file, print_event_info, TRUE);
my_free((void*)ce->fname);
delete ce;
+ if (head->error == -1)
+ goto err;
}
else
warning("Ignoring Execute_load_log_event as there is no "
@@ -1015,6 +1025,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
print_event_info->common_header_len=
glob_description_event->common_header_len;
ev->print(result_file, print_event_info);
+ if (head->error == -1)
+ goto err;
if (!remote_opt)
{
ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
@@ -1044,6 +1056,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
break;
case BEGIN_LOAD_QUERY_EVENT:
ev->print(result_file, print_event_info);
+ if (head->error == -1)
+ goto err;
if ((retval= load_processor.process((Begin_load_query_log_event*) ev)) !=
OK_CONTINUE)
goto end;
@@ -1061,6 +1075,12 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
convert_path_to_forward_slashes(fname);
print_skip_replication_statement(print_event_info, ev);
exlq->print(result_file, print_event_info, fname);
+ if (head->error == -1)
+ {
+ if (fname)
+ my_free(fname);
+ goto err;
+ }
}
else
warning("Ignoring Execute_load_query since there is no "
@@ -1191,6 +1211,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
default:
print_skip_replication_statement(print_event_info, ev);
ev->print(result_file, print_event_info);
+ if (head->error == -1)
+ goto err;
}
}
@@ -1354,7 +1376,7 @@ static struct my_option my_options[] =
"Stop reading the binlog at position N. Applies to the last binlog "
"passed on the command line.",
&stop_position, &stop_position, 0, GET_ULL,
- REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
+ REQUIRED_ARG, (longlong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
(ulonglong)(~(my_off_t)0), 0, 0, 0},
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
requested binlog but rather continue printing until the end of the last \
@@ -1785,6 +1807,19 @@ static Exit_status check_master_version()
"Master returned '%s'", mysql_error(mysql));
goto err;
}
+
+ /*
+ Announce our capabilities to the server, so it will send us all the events
+ that we know about.
+ */
+ if (mysql_query(mysql, "SET @mariadb_slave_capability="
+ STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_MINE)))
+ {
+ error("Could not inform master about capability. Master returned '%s'",
+ mysql_error(mysql));
+ goto err;
+ }
+
delete glob_description_event;
switch (version) {
case 3:
@@ -2324,7 +2359,13 @@ err:
end:
if (fd >= 0)
my_close(fd, MYF(MY_WME));
- end_io_cache(file);
+ /*
+ Since the end_io_cache() writes to the
+ file errors may happen.
+ */
+ if (end_io_cache(file))
+ retval= ERROR_STOP;
+
return retval;
}
diff --git a/client/mysqldump.c b/client/mysqldump.c
index a28def57b44..8decdb65582 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2615,6 +2615,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (strcmp(field->name, "View") == 0)
{
char *scv_buff= NULL;
+ my_ulonglong n_cols;
verbose_msg("-- It's a view, create dummy table for view\n");
@@ -2629,8 +2630,8 @@ static uint get_table_structure(char *table, char *db, char *table_type,
the same name in order to satisfy views that depend on this view.
The table will be removed when the actual view is created.
- The properties of each column, aside from the data type, are not
- preserved in this temporary table, because they are not necessary.
+ The properties of each column, are not preserved in this temporary
+ table, because they are not necessary.
This will not be necessary once we can determine dependencies
between views and can simply dump them in the appropriate order.
@@ -2657,8 +2658,23 @@ static uint get_table_structure(char *table, char *db, char *table_type,
else
my_free(scv_buff);
- if (mysql_num_rows(result))
+ n_cols= mysql_num_rows(result);
+ if (0 != n_cols)
{
+
+ /*
+ The actual formula is based on the column names and how the .FRM
+ files are stored and is too volatile to be repeated here.
+ Thus we simply warn the user if the columns exceed a limit we
+ know works most of the time.
+ */
+ if (n_cols >= 1000)
+ fprintf(stderr,
+ "-- Warning: Creating a stand-in table for view %s may"
+ " fail when replaying the dump file produced because "
+ "of the number of columns exceeding 1000. Exercise "
+ "caution when replaying the produced dump file.\n",
+ table);
if (opt_drop)
{
/*
@@ -2685,14 +2701,19 @@ static uint get_table_structure(char *table, char *db, char *table_type,
row= mysql_fetch_row(result);
- fprintf(sql_file, " %s %s", quote_name(row[0], name_buff, 0),
- row[1]);
+ /*
+ The actual column type doesn't matter anyway, since the table will
+ be dropped at run time.
+ We do tinyint to avoid hitting the row size limit.
+ */
+ fprintf(sql_file, " %s tinyint NOT NULL",
+ quote_name(row[0], name_buff, 0));
while((row= mysql_fetch_row(result)))
{
/* col name, col type */
- fprintf(sql_file, ",\n %s %s",
- quote_name(row[0], name_buff, 0), row[1]);
+ fprintf(sql_file, ",\n %s tinyint NOT NULL",
+ quote_name(row[0], name_buff, 0));
}
/*
@@ -4164,6 +4185,7 @@ static int dump_all_databases()
if (dump_all_tables_in_db(row[0]))
result=1;
}
+ mysql_free_result(tableres);
if (seen_views)
{
if (mysql_query(mysql, "SHOW DATABASES") ||
@@ -4186,6 +4208,7 @@ static int dump_all_databases()
if (dump_all_views_in_db(row[0]))
result=1;
}
+ mysql_free_result(tableres);
}
return result;
}
@@ -4314,8 +4337,6 @@ static int init_dumping(char *database, int init_func(char*))
check_io(md_result_file);
}
}
- if (extended_insert)
- init_dynamic_string_checked(&extended_row, "", 1024, 1024);
return 0;
} /* init_dumping */
@@ -5592,6 +5613,9 @@ int main(int argc, char **argv)
if (opt_alltspcs)
dump_all_tablespaces();
+ if (extended_insert)
+ init_dynamic_string_checked(&extended_row, "", 1024, 1024);
+
if (opt_alldbs)
{
if (!opt_alltspcs && !opt_notspcs)
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index fe481020574..6ccb1063cd2 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009-2012 Monty Program Ab.
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2012, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -84,6 +84,8 @@ static my_bool non_blocking_api_enabled= 0;
#define QUERY_SEND_FLAG 1
#define QUERY_REAP_FLAG 2
+#define QUERY_PRINT_ORIGINAL_FLAG 4
+
#ifndef HAVE_SETENV
static int setenv(const char *name, const char *value, int overwrite);
#endif
@@ -253,6 +255,8 @@ static void init_re(void);
static int match_re(my_regex_t *, char *);
static void free_re(void);
+static char *get_string(char **to_ptr, char **from_ptr,
+ struct st_command *command);
static int replace(DYNAMIC_STRING *ds_str,
const char *search_str, ulong search_len,
const char *replace_str, ulong replace_len);
@@ -342,7 +346,8 @@ enum enum_commands {
Q_ERROR,
Q_SEND, Q_REAP,
Q_DIRTY_CLOSE, Q_REPLACE, Q_REPLACE_COLUMN,
- Q_PING, Q_EVAL,
+ Q_PING, Q_EVAL,
+ Q_EVALP,
Q_EVAL_RESULT,
Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG,
Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG,
@@ -408,6 +413,7 @@ const char *command_names[]=
"replace_column",
"ping",
"eval",
+ "evalp",
"eval_result",
/* Enable/disable that the _query_ is logged to result file */
"enable_query_log",
@@ -621,6 +627,8 @@ void free_all_replace(){
free_replace_column();
}
+void var_set_int(const char* name, int value);
+
class LogFile {
FILE* m_file;
@@ -1275,6 +1283,8 @@ void handle_command_error(struct st_command *command, uint error,
{
DBUG_ENTER("handle_command_error");
DBUG_PRINT("enter", ("error: %d", error));
+ var_set_int("$sys_errno",sys_errno);
+ var_set_int("$errno",error);
if (error != 0)
{
int i;
@@ -1285,7 +1295,7 @@ void handle_command_error(struct st_command *command, uint error,
"errno: %d",
command->first_word_len, command->query, error, my_errno,
sys_errno);
- return;
+ DBUG_VOID_RETURN;
}
i= match_expected_error(command, error, NULL);
@@ -4576,7 +4586,8 @@ void do_wait_for_slave_to_stop(struct st_command *c __attribute__((unused)))
}
-void do_sync_with_master2(struct st_command *command, long offset)
+void do_sync_with_master2(struct st_command *command, long offset,
+ const char *connection_name)
{
MYSQL_RES *res;
MYSQL_ROW row;
@@ -4587,8 +4598,9 @@ void do_sync_with_master2(struct st_command *command, long offset)
if (!master_pos.file[0])
die("Calling 'sync_with_master' without calling 'save_master_pos'");
- sprintf(query_buf, "select master_pos_wait('%s', %ld, %d)",
- master_pos.file, master_pos.pos + offset, timeout);
+ sprintf(query_buf, "select master_pos_wait('%s', %ld, %d, '%s')",
+ master_pos.file, master_pos.pos + offset, timeout,
+ connection_name);
if (mysql_query(mysql, query_buf))
die("failed in '%s': %d: %s", query_buf, mysql_errno(mysql),
@@ -4648,16 +4660,32 @@ void do_sync_with_master(struct st_command *command)
long offset= 0;
char *p= command->first_argument;
const char *offset_start= p;
+ char *start, *buff= 0;
+ start= (char*) "";
+
if (*offset_start)
{
for (; my_isdigit(charset_info, *p); p++)
offset = offset * 10 + *p - '0';
- if(*p && !my_isspace(charset_info, *p))
+ if (*p && !my_isspace(charset_info, *p) && *p != ',')
die("Invalid integer argument \"%s\"", offset_start);
+
+ while (*p && my_isspace(charset_info, *p))
+ p++;
+ if (*p == ',')
+ {
+ p++;
+ while (*p && my_isspace(charset_info, *p))
+ p++;
+ start= buff= (char*)my_malloc(strlen(p)+1,MYF(MY_WME | MY_FAE));
+ get_string(&buff, &p, command);
+ }
command->last_argument= p;
}
- do_sync_with_master2(command, offset);
+ do_sync_with_master2(command, offset, start);
+ if (buff)
+ my_free(start);
return;
}
@@ -5144,7 +5172,7 @@ typedef struct
static st_error global_error_names[] =
{
- { "<No error>", (uint) -1, "" },
+ { "<No error>", -1U, "" },
#include <mysqld_ername.h>
{ 0, 0, 0 }
};
@@ -5201,15 +5229,32 @@ const char *get_errname_from_code (uint error_code)
void do_get_errcodes(struct st_command *command)
{
struct st_match_err *to= saved_expected_errors.err;
- char *p= command->first_argument;
- uint count= 0;
- char *next;
-
DBUG_ENTER("do_get_errcodes");
- if (!*p)
+ if (!*command->first_argument)
die("Missing argument(s) to 'error'");
+ /* TODO: Potentially, there is a possibility of variables
+ being expanded twice, e.g.
+
+ let $errcodes = 1,\$a;
+ let $a = 1051;
+ error $errcodes;
+ DROP TABLE unknown_table;
+ ...
+ Got one of the listed errors
+
+ But since it requires manual escaping, it does not seem
+ particularly dangerous or error-prone.
+ */
+ DYNAMIC_STRING ds;
+ init_dynamic_string(&ds, 0, command->query_len + 64, 256);
+ do_eval(&ds, command->first_argument, command->end, !is_windows);
+ char *p= ds.str;
+
+ uint count= 0;
+ char *next;
+
do
{
char *end;
@@ -5265,7 +5310,7 @@ void do_get_errcodes(struct st_command *command)
{
die("The sqlstate definition must start with an uppercase S");
}
- else if (*p == 'E')
+ else if (*p == 'E' || *p == 'W')
{
/* Error name string */
@@ -5274,9 +5319,9 @@ void do_get_errcodes(struct st_command *command)
to->type= ERR_ERRNO;
DBUG_PRINT("info", ("ERR_ERRNO: %d", to->code.errnum));
}
- else if (*p == 'e')
+ else if (*p == 'e' || *p == 'w')
{
- die("The error name definition must start with an uppercase E");
+ die("The error name definition must start with an uppercase E or W");
}
else
{
@@ -5319,11 +5364,15 @@ void do_get_errcodes(struct st_command *command)
} while (*p);
- command->last_argument= p;
+ command->last_argument= command->first_argument;
+ while (*command->last_argument)
+ command->last_argument++;
+
to->type= ERR_EMPTY; /* End of data */
DBUG_PRINT("info", ("Expected errors: %d", count));
saved_expected_errors.count= count;
+ dynstr_free(&ds);
DBUG_VOID_RETURN;
}
@@ -5335,8 +5384,8 @@ void do_get_errcodes(struct st_command *command)
If string is a '$variable', return the value of the variable.
*/
-char *get_string(char **to_ptr, char **from_ptr,
- struct st_command *command)
+static char *get_string(char **to_ptr, char **from_ptr,
+ struct st_command *command)
{
char c, sep;
char *to= *to_ptr, *from= *from_ptr, *start=to;
@@ -7687,6 +7736,8 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
*/
if ((counter==0) && do_read_query_result(cn))
{
+ /* we've failed to collect the result set */
+ cn->pending= TRUE;
handle_error(command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), ds);
goto end;
@@ -8271,7 +8322,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
/*
Evaluate query if this is an eval command
*/
- if (command->type == Q_EVAL || command->type == Q_SEND_EVAL)
+ if (command->type == Q_EVAL || command->type == Q_SEND_EVAL ||
+ command->type == Q_EVALP)
{
init_dynamic_string(&eval_query, "", command->query_len+256, 1024);
do_eval(&eval_query, command->query, command->end, FALSE);
@@ -8303,10 +8355,20 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
*/
if (!disable_query_log && (flags & QUERY_SEND_FLAG))
{
- replace_dynstr_append_mem(ds, query, query_len);
+ char *print_query= query;
+ int print_len= query_len;
+ if (flags & QUERY_PRINT_ORIGINAL_FLAG)
+ {
+ print_query= command->query;
+ print_len= command->end - command->query;
+ }
+ replace_dynstr_append_mem(ds, print_query, print_len);
dynstr_append_mem(ds, delimiter, delimiter_length);
dynstr_append_mem(ds, "\n", 1);
}
+
+ /* We're done with this flag */
+ flags &= ~QUERY_PRINT_ORIGINAL_FLAG;
/*
Write the command to the result file before we execute the query
@@ -9169,6 +9231,7 @@ int main(int argc, char **argv)
case Q_EVAL_RESULT:
die("'eval_result' command is deprecated");
case Q_EVAL:
+ case Q_EVALP:
case Q_QUERY_VERTICAL:
case Q_QUERY_HORIZONTAL:
if (command->query == command->query_buf)
@@ -9196,6 +9259,9 @@ int main(int argc, char **argv)
flags= QUERY_REAP_FLAG;
}
+ if (command->type == Q_EVALP)
+ flags |= QUERY_PRINT_ORIGINAL_FLAG;
+
/* Check for special property for this query */
display_result_vertically|= (command->type == Q_QUERY_VERTICAL);
@@ -9265,7 +9331,7 @@ int main(int argc, char **argv)
select_connection(command);
else
select_connection_name("slave");
- do_sync_with_master2(command, 0);
+ do_sync_with_master2(command, 0, "");
break;
}
case Q_COMMENT:
diff --git a/cmake/configure.pl b/cmake/configure.pl
index 69f973c41fb..3a7d187c0be 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -25,6 +25,7 @@ my $cmakeargs = "";
# Assume this script is in <srcroot>/cmake
my $srcdir = dirname(dirname(abs_path($0)));
my $cmake_install_prefix="";
+my $just_print= 0;
# Sets installation directory, bindir, libdir, libexecdir etc
# the equivalent CMake variables are given without prefix
@@ -113,6 +114,11 @@ foreach my $option (@ARGV)
system("cmake ${srcdir} -LH");
exit(0);
}
+ if ($option =~ /print/)
+ {
+ $just_print=1;
+ next;
+ }
if($option =~ /with-plugins=/)
{
my @plugins= split(/,/, substr($option,13));
@@ -223,6 +229,7 @@ foreach my $option (@ARGV)
}
print("configure.pl : calling cmake $srcdir $cmakeargs\n");
+exit(0) if ($just_print);
unlink("CMakeCache.txt");
my $rc = system("cmake $srcdir $cmakeargs");
exit($rc);
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index 8e70af6c5a9..e915e732612 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -65,6 +65,7 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}
SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common")
SET(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d")
+SET(CPACK_RPM_common_USER_FILELIST "%config(noreplace) /etc/my.cnf")
SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MySQL-client MySQL-OurDelta-client")
SET(CPACK_RPM_client_PACKAGE_PROVIDES "MariaDB-client MySQL-client mysql-client")
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
index a70226e2b6e..d52405e8bcc 100644
--- a/cmake/maintainer.cmake
+++ b/cmake/maintainer.cmake
@@ -18,7 +18,7 @@ INCLUDE(CheckCCompilerFlag)
# Setup GCC (GNU C compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS)
SET(MY_MAINTAINER_WARNINGS
- "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -DFORCE_INIT_OF_VARS")
+ "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Wno-invalid-offsetof -DFORCE_INIT_OF_VARS")
CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers"
HAVE_NO_MISSING_FIELD_INITIALIZERS)
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index 8456cd69b0b..b93a1c12a2e 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -364,4 +364,7 @@ SET(HAVE_SOCKADDR_IN_SIN_LEN CACHE INTERNAL "")
SET(HAVE_SOCKADDR_IN6_SIN6_LEN CACHE INTERNAL "")
SET(HAVE_VALGRIND CACHE INTERNAL "")
SET(HAVE_EVENT_H CACHE INTERNAL "")
+SET(HAVE_LINUX_UNISTD_H CACHE INTERNAL "")
+SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "")
+SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "")
ENDIF()
diff --git a/cmake/readline.cmake b/cmake/readline.cmake
index fd2e690fab9..285b436921e 100644
--- a/cmake/readline.cmake
+++ b/cmake/readline.cmake
@@ -109,6 +109,8 @@ MACRO (FIND_CURSES)
ENDIF()
ENDIF()
ENDIF()
+ CHECK_LIBRARY_EXISTS(${CURSES_LIBRARY} setupterm "" HAVE_SETUPTERM)
+ CHECK_LIBRARY_EXISTS(${CURSES_LIBRARY} vidattr "" HAVE_VIDATTR)
ENDMACRO()
MACRO (MYSQL_USE_BUNDLED_READLINE)
diff --git a/config.h.cmake b/config.h.cmake
index 5f1614993c3..e6ec8b23b58 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -46,6 +46,7 @@
#cmakedefine HAVE_IEEEFP_H 1
#cmakedefine HAVE_INTTYPES_H 1
#cmakedefine HAVE_LIMITS_H 1
+#cmakedefine HAVE_LINUX_UNISTD_H 1
#cmakedefine HAVE_LOCALE_H 1
#cmakedefine HAVE_MALLOC_H 1
#cmakedefine HAVE_MEMORY_H 1
@@ -83,6 +84,7 @@
#cmakedefine HAVE_SYS_SHM_H 1
#cmakedefine HAVE_SYS_SOCKET_H 1
#cmakedefine HAVE_SYS_SOCKIO_H 1
+#cmakedefine HAVE_SYS_UTSNAME_H 1
#cmakedefine HAVE_SYS_STAT_H 1
#cmakedefine HAVE_SYS_STREAM_H 1
#cmakedefine HAVE_SYS_TERMCAP_H 1
@@ -130,6 +132,7 @@
#cmakedefine FIONREAD_IN_SYS_FILIO 1
/* Functions we may want to use. */
+#cmakedefine HAVE_ACCESS 1
#cmakedefine HAVE_AIOWAIT 1
#cmakedefine HAVE_ALARM 1
#cmakedefine HAVE_ALLOCA 1
@@ -151,6 +154,7 @@
#cmakedefine HAVE_FCONVERT 1
#cmakedefine HAVE_FDATASYNC 1
#cmakedefine HAVE_DECL_FDATASYNC 1
+#cmakedefine HAVE_FEDISABLEEXCEPT 1
#cmakedefine HAVE_FESETROUND 1
#cmakedefine HAVE_FINITE 1
#cmakedefine HAVE_FP_EXCEPT 1
@@ -175,6 +179,7 @@
#cmakedefine HAVE_GETWD 1
#cmakedefine HAVE_GMTIME_R 1
#cmakedefine gmtime_r @gmtime_r@
+#cmakedefine HAVE_IN_ADDR_T 1
#cmakedefine HAVE_INITGROUPS 1
#cmakedefine HAVE_ISSETUGID 1
#cmakedefine HAVE_GETUID 1
@@ -215,6 +220,7 @@
#cmakedefine HAVE_RDTSCLL 1
#cmakedefine HAVE_READ_REAL_TIME 1
#cmakedefine HAVE_PTHREAD_ATTR_CREATE 1
+#cmakedefine HAVE_PTHREAD_ATTR_GETGUARDSIZE 1
#cmakedefine HAVE_PTHREAD_ATTR_GETSTACKSIZE 1
#cmakedefine HAVE_PTHREAD_ATTR_SETPRIO 1
#cmakedefine HAVE_PTHREAD_ATTR_SETSCHEDPARAM 1
@@ -247,6 +253,7 @@
#cmakedefine HAVE_SETFD 1
#cmakedefine HAVE_SETENV 1
#cmakedefine HAVE_SETLOCALE 1
+#cmakedefine HAVE_SETUPTERM 1
#cmakedefine HAVE_SIGADDSET 1
#cmakedefine HAVE_SIGEMPTYSET 1
#cmakedefine HAVE_SIGHOLD 1
@@ -284,6 +291,7 @@
#cmakedefine HAVE_TIME 1
#cmakedefine HAVE_TIMES 1
#cmakedefine HAVE_VALLOC 1
+#cmakedefine HAVE_VIDATTR 1
#define HAVE_VIO_READ_BUFF 1
#cmakedefine HAVE_VASPRINTF 1
#cmakedefine HAVE_VPRINTF 1
diff --git a/configure.cmake b/configure.cmake
index 96918798807..6095c588962 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -56,10 +56,10 @@ ENDIF()
# Always enable -Wall for gnu C/C++
IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_FLAGS MATCHES ".*-Wall.*")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter")
+ SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_FLAGS MATCHES ".*-Wall.*")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
+ SET(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS} -Wall")
ENDIF()
@@ -195,6 +195,7 @@ CHECK_INCLUDE_FILES (grp.h HAVE_GRP_H)
CHECK_INCLUDE_FILES (ieeefp.h HAVE_IEEEFP_H)
CHECK_INCLUDE_FILES (inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILES (langinfo.h HAVE_LANGINFO_H)
+CHECK_INCLUDE_FILES (linux/unistd.h HAVE_LINUX_UNISTD_H)
CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H)
CHECK_INCLUDE_FILES (locale.h HAVE_LOCALE_H)
CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
@@ -254,6 +255,7 @@ CHECK_INCLUDE_FILES (vis.h HAVE_VIS_H)
CHECK_INCLUDE_FILES (wchar.h HAVE_WCHAR_H)
CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H)
CHECK_INCLUDE_FILES (sys/sockio.h HAVE_SYS_SOCKIO_H)
+CHECK_INCLUDE_FILES (sys/utsname.h HAVE_SYS_UTSNAME_H)
IF(BFD_H_EXISTS)
IF(NOT_FOR_DISTRIBUTION)
@@ -319,6 +321,7 @@ ENDIF()
#
# Tests for functions
#
+CHECK_FUNCTION_EXISTS (access HAVE_ACCESS)
#CHECK_FUNCTION_EXISTS (aiowait HAVE_AIOWAIT)
CHECK_FUNCTION_EXISTS (aio_read HAVE_AIO_READ)
CHECK_FUNCTION_EXISTS (alarm HAVE_ALARM)
@@ -547,6 +550,10 @@ IF(NOT SIZEOF_MODE_T)
SET(mode_t int)
ENDIF()
+IF(HAVE_NETINET_IN_H)
+ SET(CMAKE_EXTRA_INCLUDE_FILES netinet/in.h)
+ MY_CHECK_TYPE_SIZE(in_addr_t IN_ADDR_T)
+ENDIF(HAVE_NETINET_IN_H)
IF(HAVE_STDINT_H)
SET(CMAKE_EXTRA_INCLUDE_FILES stdint.h)
diff --git a/dbug/dbug.c b/dbug/dbug.c
index af0a937ff07..b285b32fa17 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -284,9 +284,6 @@ static int DoTrace(CODE_STATE *cs);
/* Test to see if file is writable */
#if defined(HAVE_ACCESS)
static BOOLEAN Writable(const char *pathname);
- /* Change file owner and group */
-static void ChangeOwner(CODE_STATE *cs, char *pathname);
- /* Allocate memory for runtime support */
#endif
static void DoPrefix(CODE_STATE *cs, uint line);
diff --git a/dbug/factorial.c b/dbug/factorial.c
index 7b190ea8d8e..e1cb77f0e30 100644
--- a/dbug/factorial.c
+++ b/dbug/factorial.c
@@ -1,14 +1,3 @@
-#ifdef DBUG_OFF /* We are testing dbug */
-
-int factorial(register int value) {
- if(value > 1) {
- value *= factorial(value-1);
- }
- return value;
-}
-
-#else
-
#include <my_global.h>
int factorial (
@@ -22,6 +11,3 @@ register int value)
DBUG_PRINT ("result", ("result is %d", value));
DBUG_RETURN (value);
}
-
-#endif
-
diff --git a/debian/additions/my.cnf b/debian/additions/my.cnf
index fd9bcf19977..a27f8543f0b 100644
--- a/debian/additions/my.cnf
+++ b/debian/additions/my.cnf
@@ -65,7 +65,7 @@ max_heap_table_size = 32M
myisam_recover = BACKUP
key_buffer_size = 128M
#open-files-limit = 2000
-table_cache = 400
+table_open_cache = 400
myisam_sort_buffer_size = 512M
concurrent_insert = 2
read_buffer_size = 2M
diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index d2288ee8b42..d4a1fa70d8c 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -37,6 +37,11 @@ case "${CODENAME}" in
*) LIBREADLINE_DEV=libreadline-gplv2-dev ;;
esac
+case "${CODENAME}" in
+ etch|lenny|hardy|intrepid|jaunty|karmic) CMAKE_DEP='' ;;
+ *) CMAKE_DEP='cmake (>= 2.7), ' ;;
+esac
+
# Clean up build file symlinks that are distro-specific. First remove all, then set
# new links.
DISTRODIRS="$(ls ./debian/dist)"
@@ -53,7 +58,9 @@ echo "Copying distribution specific build files for ${DISTRO}"
DISTROFILES="$(ls ./debian/dist/${DISTRO})"
for distrofile in ${DISTROFILES}; do
rm -f "./debian/${distrofile}"
- sed -e "s/\\\${LIBREADLINE_DEV}/${LIBREADLINE_DEV}/g" < "./debian/dist/${DISTRO}/${distrofile}" > "./debian/${distrofile}"
+ sed -e "s/\\\${LIBREADLINE_DEV}/${LIBREADLINE_DEV}/g" \
+ -e "s/\\\${CMAKE_DEP}/${CMAKE_DEP}/g" \
+ < "./debian/dist/${DISTRO}/${distrofile}" > "./debian/${distrofile}"
chmod --reference="./debian/dist/${DISTRO}/${distrofile}" "./debian/${distrofile}"
done;
diff --git a/debian/dist/Debian/control b/debian/dist/Debian/control
index 7a324c93895..95bde727093 100644
--- a/debian/dist/Debian/control
+++ b/debian/dist/Debian/control
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net>
Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net>
-Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libevent-dev, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper
+Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libevent-dev, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev
Standards-Version: 3.8.3
Homepage: http://mariadb.org/
Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/5.5/files
diff --git a/debian/dist/Debian/mariadb-server-5.5.postinst b/debian/dist/Debian/mariadb-server-5.5.postinst
index e3f2df13b4b..4da8979fd03 100644
--- a/debian/dist/Debian/mariadb-server-5.5.postinst
+++ b/debian/dist/Debian/mariadb-server-5.5.postinst
@@ -21,7 +21,7 @@ invoke() {
fi
}
-MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --loose-innodb=OFF --loose-pbxt=OFF --default-storage-engine=myisam"
+MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --loose-innodb=OFF --default-storage-engine=myisam"
test_mysql_access() {
mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1
@@ -212,7 +212,7 @@ EOF
# admin might already have chosen to remove one or more plugins. Newlines are necessary.
install_plugins=`/bin/echo -e \
"USE mysql;\n" \
- "CREATE TABLE plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \
+ "CREATE TABLE IF NOT EXISTS plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \
" dl char(128) COLLATE utf8_bin NOT NULL DEFAULT '', " \
" PRIMARY KEY (name)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='MySQL plugins';" `
diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control
index 8a8a93c37aa..70ef5fd2ecf 100644
--- a/debian/dist/Ubuntu/control
+++ b/debian/dist/Ubuntu/control
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net>
Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net>
-Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libevent-dev, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper
+Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libevent-dev, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev
Standards-Version: 3.8.2
Homepage: http://mariadb.org/
Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/5.5/files
diff --git a/debian/dist/Ubuntu/mariadb-server-5.5.postinst b/debian/dist/Ubuntu/mariadb-server-5.5.postinst
index a0c351194bb..1c7aa37f69f 100644
--- a/debian/dist/Ubuntu/mariadb-server-5.5.postinst
+++ b/debian/dist/Ubuntu/mariadb-server-5.5.postinst
@@ -21,7 +21,7 @@ invoke() {
fi
}
-MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --loose-innodb=OFF --loose-pbxt=OFF --default-storage-engine=myisam"
+MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --loose-innodb=OFF --default-storage-engine=myisam"
test_mysql_access() {
mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1
diff --git a/debian/mariadb-client-5.5.files b/debian/mariadb-client-5.5.files
index 9cb949ea53e..335f736d680 100644
--- a/debian/mariadb-client-5.5.files
+++ b/debian/mariadb-client-5.5.files
@@ -11,6 +11,7 @@ usr/bin/mysqlimport
usr/bin/mysqlreport
usr/bin/mysqlshow
usr/bin/mysqlslap
+usr/bin/mytop
usr/bin/mysql_waitpid
usr/share/lintian/overrides/mariadb-client-5.5
usr/share/man/man1/innotop.1
diff --git a/debian/mariadb-server-5.5.mysql.init b/debian/mariadb-server-5.5.mysql.init
index b83316aedea..01e1288525e 100644
--- a/debian/mariadb-server-5.5.mysql.init
+++ b/debian/mariadb-server-5.5.mysql.init
@@ -109,7 +109,7 @@ case "${1:-''}" in
/usr/bin/mysqld_safe > /dev/null 2>&1 &
# 6s was reported in #352070 to be too few when using ndbcluster
- for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-14}"); do
+ for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do
sleep 1
if mysqld_status check_alive nowarn ; then break; fi
log_progress_msg "."
@@ -142,7 +142,7 @@ case "${1:-''}" in
log_daemon_msg "Killing MariaDB database server by signal" "mysqld"
killall -15 mysqld
server_down=
- for i in 1 2 3 4 5 6 7 8 9 10; do
+ for i in 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10; do
sleep 1
if mysqld_status check_dead nowarn; then server_down=1; break; fi
done
diff --git a/extra/resolveip.c b/extra/resolveip.c
index 871fd31482e..b6840d9d463 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -25,9 +25,7 @@
#ifndef WIN32
# include <sys/types.h>
# include <sys/socket.h>
-# ifndef HAVE_BROKEN_NETINET_INCLUDES
-# include <netinet/in.h>
-# endif
+# include <netinet/in.h>
# include <arpa/inet.h>
# include <netdb.h>
#endif
diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp
index 0271891fa53..04fdcd85bd8 100644
--- a/extra/yassl/taocrypt/src/asn.cpp
+++ b/extra/yassl/taocrypt/src/asn.cpp
@@ -766,6 +766,10 @@ void CertDecoder::GetName(NameType nt)
while (source_.get_index() < length) {
GetSet();
+ if (source_.GetError().What() == SET_E) {
+ source_.SetError(NO_ERROR_E); // extensions may only have sequence
+ source_.prev();
+ }
GetSequence();
byte b = source_.next();
diff --git a/extra/yassl/taocrypt/src/dsa.cpp b/extra/yassl/taocrypt/src/dsa.cpp
index a4e9c9503e7..7b882b10cd1 100644
--- a/extra/yassl/taocrypt/src/dsa.cpp
+++ b/extra/yassl/taocrypt/src/dsa.cpp
@@ -184,7 +184,7 @@ word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig,
s_ = (kInv * (H + x*r_)) % q;
if (!(!!r_ && !!s_))
- return -1;
+ return (word32) -1;
int rSz = r_.ByteCount();
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 8ff613155d3..acb187aeb63 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -52,6 +52,7 @@ SET(HEADERS
m_ctype.h
my_attribute.h
my_compiler.h
+ handler_state.h
)
INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development)
diff --git a/include/atomic/nolock.h b/include/atomic/nolock.h
index 1da184158ab..56f37644f96 100644
--- a/include/atomic/nolock.h
+++ b/include/atomic/nolock.h
@@ -36,7 +36,7 @@
choose the Solaris implementation on Solaris (mainly for SunStudio
compilers).
*/
-# if defined(_MSV_VER)
+# if defined(_MSC_VER)
# include "generic-msvc.h"
# elif __GNUC__
# if defined(HAVE_SOLARIS_ATOMIC)
diff --git a/include/handler_state.h b/include/handler_state.h
new file mode 100644
index 00000000000..65604a672fb
--- /dev/null
+++ b/include/handler_state.h
@@ -0,0 +1,21 @@
+/*
+ Map handler error message to sql states. Note that this list MUST be in
+ increasing order!
+ See sql_state.c for usage
+*/
+
+{ HA_ERR_KEY_NOT_FOUND, "02000", "" },
+{ HA_ERR_FOUND_DUPP_KEY, "23000", "" },
+{ HA_ERR_WRONG_COMMAND, "0A000", "" },
+{ HA_ERR_UNSUPPORTED, "0A000", "" },
+{ HA_WRONG_CREATE_OPTION, "0A000", "" },
+{ HA_ERR_FOUND_DUPP_UNIQUE, "23000", "" },
+{ HA_ERR_UNKNOWN_CHARSET, "0A000", "" },
+{ HA_ERR_READ_ONLY_TRANSACTION, "25000", "" },
+{ HA_ERR_LOCK_DEADLOCK, "40001", "" },
+{ HA_ERR_NO_REFERENCED_ROW, "23000", "" },
+{ HA_ERR_ROW_IS_REFERENCED, "23000", "" },
+{ HA_ERR_TABLE_EXIST, "42S01", "" },
+{ HA_ERR_FOREIGN_DUPLICATE_KEY, "23000", "" },
+{ HA_ERR_TABLE_READONLY, "25000", "" },
+{ HA_ERR_AUTOINC_ERANGE, "22003", "" },
diff --git a/include/lf.h b/include/lf.h
index cdd24c07502..07769d10943 100644
--- a/include/lf.h
+++ b/include/lf.h
@@ -95,7 +95,7 @@ nolock_wrap(lf_dynarray_iterate, int,
*/
#define LF_PINBOX_PINS 4
-#define LF_PURGATORY_SIZE 10
+#define LF_PURGATORY_SIZE 100
typedef void lf_pinbox_free_func(void *, void *, void*);
diff --git a/include/m_string.h b/include/m_string.h
index 9fc6cda4764..9efa0376942 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -62,13 +62,9 @@
# define bmove_align(A,B,C) memcpy((A),(B),(C))
-#if !defined(HAVE_BCMP)
# define bcmp(A,B,C) memcmp((A),(B),(C))
-#endif
-#if !defined(bzero) && (!defined(HAVE_BZERO) || !HAVE_DECL_BZERO || defined(_AIX))
-/* See autoconf doku: "HAVE_DECL_symbol" will be defined after configure, to 0 or 1 */
-/* AIX has bzero() as a function, but the declaration prototype is strangely hidden */
+#if !defined(bzero)
# define bzero(A,B) memset((A),0,(B))
#endif
diff --git a/include/my_getopt.h b/include/my_getopt.h
index 650f6300796..589d9c9880c 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2002, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2002, 2012, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -79,7 +79,7 @@ struct my_option
enum get_opt_arg_type arg_type; /**< e.g. REQUIRED_ARG or OPT_ARG */
longlong def_value; /**< Default value */
longlong min_value; /**< Min allowed value (for numbers) */
- longlong max_value; /**< Max allowed value (for numbers) */
+ ulonglong max_value; /**< Max allowed value (for numbers) */
longlong sub_size; /**< Unused */
long block_size; /**< Value should be a mult. of this (for numbers) */
void *app_type; /**< To be used by an application */
diff --git a/include/my_global.h b/include/my_global.h
index a6d3a595d3e..ed9ac83cfe6 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -218,11 +218,6 @@
#include <sys/types.h>
#endif
-#ifdef HAVE_THREADS_WITHOUT_SOCKETS
-/* MIT pthreads does not work with unix sockets */
-#undef HAVE_SYS_UN_H
-#endif
-
#define __EXTENSIONS__ 1 /* We want some extension */
#ifndef __STDC_EXT__
#define __STDC_EXT__ 1 /* To get large file support on hpux */
@@ -295,18 +290,6 @@ inline double my_ulonglong2double(unsigned long long A) { return (double A); }
C_MODE_END
#endif /* _AIX */
-#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
-#undef HAVE_SNPRINTF
-#endif
-#ifdef HAVE_BROKEN_PREAD
-/*
- pread()/pwrite() are not 64 bit safe on HP-UX 11.0 without
- installing the kernel patch PHKL_20349 or greater
-*/
-#undef HAVE_PREAD
-#undef HAVE_PWRITE
-#endif
-
#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */
#undef HAVE_INITGROUPS
#endif
@@ -812,18 +795,7 @@ inline unsigned long long my_double2ulonglong(double d)
#endif
#ifdef HAVE_ISINF
-/* Check if C compiler is affected by GCC bug #39228 */
-#if !defined(__cplusplus) && defined(HAVE_BROKEN_ISINF)
-/* Force store/reload of the argument to/from a 64-bit double */
-static inline double my_isinf(double x)
-{
- volatile double t= x;
- return isinf(t);
-}
-#else
-/* System-provided isinf() is available and safe to use */
#define my_isinf(X) isinf(X)
-#endif
#else /* !HAVE_ISINF */
#define my_isinf(X) (!finite(X) && !isnan(X))
#endif
diff --git a/include/my_net.h b/include/my_net.h
index 8c62790bf51..60dcd1dead2 100644
--- a/include/my_net.h
+++ b/include/my_net.h
@@ -43,7 +43,7 @@ C_MODE_START
#include <sys/ioctl.h>
#endif
-#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES)
+#if !defined(__WIN__)
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
diff --git a/include/my_pthread.h b/include/my_pthread.h
index d10dd283555..5872f7c5904 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -201,28 +201,13 @@ extern int my_pthread_create_detached;
int sigwait(sigset_t *set, int *sig);
#endif
-#ifndef HAVE_NONPOSIX_SIGWAIT
#define my_sigwait(A,B) sigwait((A),(B))
-#else
-int my_sigwait(const sigset_t *set,int *sig);
-#endif
-
-#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
-#ifndef SAFE_MUTEX
-#define pthread_mutex_init(a,b) my_pthread_mutex_noposix_init((a),(b))
-extern int my_pthread_mutex_noposix_init(pthread_mutex_t *mp,
- const pthread_mutexattr_t *attr);
-#endif /* SAFE_MUTEX */
-#define pthread_cond_init(a,b) my_pthread_cond_noposix_init((a),(b))
-extern int my_pthread_cond_noposix_init(pthread_cond_t *mp,
- const pthread_condattr_t *attr);
-#endif /* HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */
#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK)
#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C))
#endif
-#if !defined(HAVE_SIGWAIT) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
+#if !defined(HAVE_SIGWAIT) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(_AIX)
int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
#endif
@@ -248,24 +233,12 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
#define my_sigset(A,B) signal((A),(B))
#endif
-#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) || defined(HAVE_DEC_3_2_THREADS)
+#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE)
#define pthread_attr_setscope(A,B)
#undef HAVE_GETHOSTBYADDR_R /* No definition */
#endif
-#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT) && !defined(SAFE_MUTEX)
-extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
- pthread_mutex_t *mutex,
- struct timespec *abstime);
-#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C))
-#endif
-
-#if !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC)
#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B))
-#else
-#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
-void *my_pthread_getspecific_imp(pthread_key_t key);
-#endif
#ifndef HAVE_LOCALTIME_R
struct tm *localtime_r(const time_t *clock, struct tm *res);
@@ -286,34 +259,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res);
#define pthread_key_delete(A) pthread_dummy(0)
#endif
-#ifdef HAVE_CTHREADS_WRAPPER /* For MacOSX */
-#define pthread_cond_destroy(A) pthread_dummy(0)
-#define pthread_mutex_destroy(A) pthread_dummy(0)
-#define pthread_attr_delete(A) pthread_dummy(0)
-#define pthread_condattr_delete(A) pthread_dummy(0)
-#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
-#define pthread_equal(A,B) ((A) == (B))
-#define pthread_cond_timedwait(a,b,c) pthread_cond_wait((a),(b))
-#define pthread_attr_init(A) pthread_attr_create(A)
-#define pthread_attr_destroy(A) pthread_attr_delete(A)
-#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
-#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D))
-#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH)
-#undef pthread_detach_this_thread
-#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
-#endif
-
-#ifdef HAVE_DARWIN5_THREADS
-#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH)
-#define pthread_condattr_init(A) pthread_dummy(0)
-#define pthread_condattr_destroy(A) pthread_dummy(0)
-#undef pthread_detach_this_thread
-#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
-#endif
-
-#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
+#if defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)
/* This is set on AIX_3_2 and Siemens unix (and DEC OSF/1 3.2 too) */
#define pthread_key_create(A,B) \
pthread_keycreate(A,(B) ?\
@@ -353,7 +299,7 @@ void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size);
int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#endif
-#if !defined(HAVE_PTHREAD_YIELD_ONE_ARG) && !defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
+#if !defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
/* no pthread_yield() available */
#ifdef HAVE_SCHED_YIELD
#define pthread_yield() sched_yield()
@@ -514,12 +460,6 @@ int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp);
/* READ-WRITE thread locking */
-#ifdef HAVE_BROKEN_RWLOCK /* For OpenUnix */
-#undef HAVE_PTHREAD_RWLOCK_RDLOCK
-#undef HAVE_RWLOCK_INIT
-#undef HAVE_RWLOCK_T
-#endif
-
#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS)
/* use these defs for simple mutex locking */
#define rw_lock_t pthread_mutex_t
diff --git a/include/my_sys.h b/include/my_sys.h
index f4f41b3b108..30513d17e0a 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -85,6 +85,7 @@ typedef struct my_aio_result {
#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
#define MY_SYNC 4096 /* my_copy(): sync dst file */
#define MY_SYNC_DIR 32768 /* my_create/delete/rename: sync directory */
+#define MY_SYNC_FILESIZE 65536 /* my_sync(): safe sync when file is extended */
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/
@@ -634,6 +635,7 @@ extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
extern int my_fclose(FILE *fd,myf MyFlags);
extern int my_vfprintf(FILE *stream, const char* format, va_list args);
extern void my_strerror(char *buf, size_t len, int nr);
+extern int my_fprintf(FILE *stream, const char* format, ...);
extern File my_fileno(FILE *fd);
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern int my_chmod(const char *name, mode_t mode, myf my_flags);
@@ -682,6 +684,7 @@ extern my_bool has_path(const char *name);
extern char *convert_dirname(char *to, const char *from, const char *from_end);
extern void to_unix_path(char * name);
extern char * fn_ext(const char *name);
+extern char * fn_ext2(const char *name);
extern char * fn_same(char * toname,const char *name,int flag);
extern char * fn_format(char * to,const char *name,const char *dir,
const char *form, uint flag);
@@ -717,6 +720,7 @@ extern int flush_write_cache(RECORD_CACHE *info);
extern void handle_recived_signals(void);
extern sig_handler my_set_alarm_variable(int signo);
+extern my_bool radixsort_is_appliccable(uint n_items, size_t size_of_element);
extern void my_string_ptr_sort(uchar *base,uint items,size_t size);
extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
size_t size_of_element,uchar *buffer[]);
@@ -758,6 +762,8 @@ extern size_t my_b_fill(IO_CACHE *info);
extern void my_b_seek(IO_CACHE *info,my_off_t pos);
extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length);
extern my_off_t my_b_filelength(IO_CACHE *info);
+extern size_t my_b_write_backtick_quote(IO_CACHE *info, const char *str,
+ size_t len);
extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...);
extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
extern my_bool open_cached_file(IO_CACHE *cache,const char *dir,
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index b73f2d75193..b8e90f764bd 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -167,7 +167,7 @@ enum enum_mysql_show_type
SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG,
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
- SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG,
+ SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
SHOW_always_last
};
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index b987f690592..dea2446ac9c 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -94,7 +94,7 @@ enum enum_mysql_show_type
SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG,
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
- SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG,
+ SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
SHOW_always_last
};
struct st_mysql_show_var {
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 113aaf62d19..f1213a73bc6 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -94,7 +94,7 @@ enum enum_mysql_show_type
SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG,
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
- SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG,
+ SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
SHOW_always_last
};
struct st_mysql_show_var {
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index 6011e7f7519..74b298098dd 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -94,7 +94,7 @@ enum enum_mysql_show_type
SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG,
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
- SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG,
+ SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
SHOW_always_last
};
struct st_mysql_show_var {
diff --git a/include/sql_common.h b/include/sql_common.h
index 99abdb2bf72..406a87010fb 100644
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@ -1,7 +1,7 @@
#ifndef SQL_COMMON_INCLUDED
#define SQL_COMMON_INCLUDED
-/* Copyright (c) 2003, 2010, Oracle and/or its affiliates.
- Copyright (c) 2010, 2011, Monty Program Ab
+/* Copyright (c) 2003, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -82,8 +82,9 @@ typedef struct st_mysql_methods
0, arg, length, 1, stmt)
extern CHARSET_INFO *default_client_charset_info;
-MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
- my_bool default_value, uint server_capabilities);
+MYSQL_FIELD *unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,
+ uint fields, my_bool default_value,
+ uint server_capabilities);
void free_rows(MYSQL_DATA *cur);
void free_old_query(MYSQL *mysql);
void end_server(MYSQL *mysql);
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index 182c8748934..f67b3962c1a 100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -17,7 +17,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysql
${CMAKE_SOURCE_DIR}/regex
- ${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/strings
${SSL_INCLUDE_DIRS}
${SSL_INTERNAL_INCLUDE_DIRS}
diff --git a/libmysql/get_password.c b/libmysql/get_password.c
index a10d112ccd0..16f6b25822d 100644
--- a/libmysql/get_password.c
+++ b/libmysql/get_password.c
@@ -26,10 +26,6 @@
#include <m_string.h>
#include <m_ctype.h>
-#if defined(HAVE_BROKEN_GETPASS) && !defined(HAVE_GETPASSPHRASE)
-#undef HAVE_GETPASS
-#endif
-
#ifdef HAVE_GETPASS
#ifdef HAVE_PWD_H
#include <pwd.h>
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 230376bc3b0..f90cc96a90f 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates
+ Copyright (c) 2009, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -811,7 +812,7 @@ MYSQL_FIELD *cli_list_fields(MYSQL *mysql)
return NULL;
mysql->field_count= (uint) query->rows;
- return unpack_fields(query,&mysql->field_alloc,
+ return unpack_fields(mysql, query,&mysql->field_alloc,
mysql->field_count, 1, mysql->server_capabilities);
}
@@ -871,7 +872,7 @@ mysql_list_processes(MYSQL *mysql)
if (!(fields = (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*) 0,
protocol_41(mysql) ? 7 : 5)))
DBUG_RETURN(NULL);
- if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,field_count,0,
+ if (!(mysql->fields=unpack_fields(mysql, fields,&mysql->field_alloc,field_count,0,
mysql->server_capabilities)))
DBUG_RETURN(0);
mysql->status=MYSQL_STATUS_GET_RESULT;
@@ -1456,7 +1457,7 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
if (!(fields_data= (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,7)))
DBUG_RETURN(1);
- if (!(stmt->fields= unpack_fields(fields_data,&stmt->mem_root,
+ if (!(stmt->fields= unpack_fields(mysql, fields_data,&stmt->mem_root,
field_count,0,
mysql->server_capabilities)))
DBUG_RETURN(1);
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index ea27a3569e2..b3ce2ce720b 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -44,6 +44,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql-common/client_plugin.c ../sql-common/mysql_async.c
../sql/password.c ../sql/discover.cc ../sql/derror.cc
../sql/field.cc ../sql/field_conv.cc
+ ../sql/filesort_utils.cc
../sql/filesort.cc ../sql/gstream.cc ../sql/slave.cc
../sql/signal_handler.cc
../sql/handler.cc ../sql/hash_filo.cc ../sql/hostname.cc
@@ -96,6 +97,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/create_options.cc ../sql/rpl_utility.cc
../sql/rpl_reporting.cc
../sql/sql_expression_cache.cc
+ ../sql/my_apc.cc ../sql/my_apc.h
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)
diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index 146e51d79c7..559b1d9ae32 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -15,9 +15,9 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysqld/include
- ${CMAKE_SOURCE_DIR}/regex
+ ${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/sql
- ${MY_READLINE_INCLUDE_DIR}
+ ${MY_READLINE_INCLUDE_DIR}
)
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index d7ef1fae0bf..37f454c6d34 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -21,7 +21,7 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1
mysql_tzinfo_to_sql.1 mysql_upgrade.1 mysql_zap.1
mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1
mysqlman.1 mysqltest.1 perror.1 replace.1 resolve_stack_dump.1
- resolveip.1)
+ resolveip.1 mysqlbug.1)
SET(MAN8_SERVER mysqld.8 mysqlmanager.8)
SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysqlaccess.1 mysqladmin.1 mysqlbinlog.1 mysqlcheck.1
diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test
index 3bbc693ceda..5b57eab1005 100644
--- a/mysql-test/extra/binlog_tests/binlog.test
+++ b/mysql-test/extra/binlog_tests/binlog.test
@@ -205,16 +205,55 @@ DROP PROCEDURE p4;
--echo End of 5.0 tests
-# Test of a too big SET INSERT_ID: see if the truncated value goes
-# into binlog (right), or the too big value (wrong); we look at the
-# binlog further down with SHOW BINLOG EVENTS.
+# Test of a too big SET INSERT_ID.
+# This should generate an error and should not be put in binlog
+# We look at the binlog further down with SHOW BINLOG EVENTS.
+
reset master;
create table t1 (id tinyint auto_increment primary key);
+insert into t1 values(5);
+set insert_id=128;
+--error 167
+insert into t1 values(null) /* Not binlogged */;
+
+# The followin insert ignore will be put in binlog
set insert_id=128;
-insert into t1 values(null);
+insert ignore into t1 values(null) /* Insert 128 */;
+
+# Insert with duplicate key error should not go into binglo
+set insert_id=5;
+--error ER_DUP_ENTRY
+insert into t1 values(null) /* Not binlogged */;
+
+# Insert with autogenerated key + duplicate key error should go into binlog
+set insert_id=5;
+insert ignore into t1 values(null) /* Insert 5 */;
select * from t1;
drop table t1;
+# Same tests but with 2 rows inserted at a time
+
+create table t1 (id tinyint auto_increment primary key) engine=myisam;
+set insert_id=128;
+--error 167
+insert into t1 values(5),(null) /* Insert_id 128 */;
+
+# The followin insert ignore will be put in binlog
+set insert_id=128;
+insert ignore into t1 values (4),(null) /* Insert_id 128 */;
+
+# Insert with duplicate key error should not go into binglo
+set insert_id=5;
+--error ER_DUP_ENTRY
+insert into t1 values(3),(null) /* Insert_id 5 */;
+
+# Insert with autogenerated key + duplicate key error should go into binlog
+set insert_id=5;
+insert ignore into t1 values(2),(null) /* Insert_id 5 */;
+select * from t1 order by id;
+drop table t1;
+
+
# bug#22027
create table t1 (a int);
create table if not exists t2 select * from t1;
diff --git a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
index 7b31a3ebf17..8f669fc1152 100644
--- a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
+++ b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
@@ -28,6 +28,7 @@
# BUG#20627: INSERT DELAYED does not honour auto_increment_* variables
# Bug in this test: BUG#38068: binlog_stm_binlog fails sporadically in pushbuild
+reset master;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
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 b41bfeaba74..4ce001cfdd7 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
@@ -318,8 +318,8 @@ connection con4;
select get_lock("a",10); # wait for rollback to finish
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
- --let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 7)
- --let $binlog_query= query_get_value(SHOW BINLOG EVENTS, Info, 7)
+ --let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 8)
+ --let $binlog_query= query_get_value(SHOW BINLOG EVENTS, Info, 8)
if ($binlog_query != ROLLBACK) {
--echo Wrong query from SHOW BINLOG EVENTS. Expected ROLLBACK, got '$binlog_query'
--source include/show_rpl_debug_info.inc
diff --git a/mysql-test/extra/rpl_tests/create_recursive_construct.inc b/mysql-test/extra/rpl_tests/create_recursive_construct.inc
index 6e130a8154f..e790a1db41f 100644
--- a/mysql-test/extra/rpl_tests/create_recursive_construct.inc
+++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc
@@ -325,7 +325,8 @@ if ($CRC_RET_stmt_sidef) {
SHOW BINLOG EVENTS;
--die Wrong number of warnings.
}
- --let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 2)
+ # There should be no events after format description and binlog checkpoint.
+ --let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 3)
if ($binlog_event != No such row) {
--enable_query_log
--echo ******** Failure! Something was written to the binlog despite SQL_LOG_BIN=0 ********
@@ -345,23 +346,23 @@ if ($CRC_RET_stmt_sidef) {
SHOW BINLOG EVENTS;
--die Warnings printed
}
- --let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 3)
- # The first event is format_description, the second is
- # Query_event('BEGIN'), and the third should be our Query
+ --let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 4)
+ # The first event is format_description, the second is Binlog_checkpoint,
+ # the third Query_event('BEGIN'), and the fourth should be our Query
# for 'INSERT DELAYED' unsafe_type 3, which is safe after
# the fix of bug#54579.
if (`SELECT $unsafe_type = 3 AND '$event_type' != 'Query'`) {
--enable_query_log
- --echo ******** Failure! Event number 3 was a '$event_type', not a 'Query'. ********
+ --echo ******** Failure! Event number 4 was a '$event_type', not a 'Query'. ********
SHOW BINLOG EVENTS;
--die Wrong events in binlog.
}
- # The first event is format_description, the second is
- # Query_event('BEGIN'), and the third should be our Table_map
+ # The first event is format_description, the second is Binlog_checkpoint,
+ # the third is Query_event('BEGIN'), and the fourth should be our Table_map
# for unsafe statement.
if (`SELECT $unsafe_type != 3 AND '$event_type' != 'Table_map'`) {
--enable_query_log
- --echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ********
+ --echo ******** Failure! Event number 4 was a '$event_type', not a 'Table_map'. ********
SHOW BINLOG EVENTS;
--die Wrong events in binlog.
}
diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test
index bd5943d46ea..8cd86de8040 100644
--- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test
+++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test
@@ -111,7 +111,7 @@ set auto_increment_increment=11;
set auto_increment_offset=4;
insert into t1 values(null);
insert into t1 values(null);
---error ER_DUP_ENTRY
+--error 167
insert into t1 values(null);
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
@@ -120,6 +120,8 @@ create table t2 (a tinyint unsigned not null auto_increment primary key) engine=
set auto_increment_increment=10;
set auto_increment_offset=1;
set insert_id=1000;
+insert into t2 values(10);
+--error 167
insert into t2 values(null);
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
@@ -127,6 +129,7 @@ select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 orde
create table t3 like t1;
set auto_increment_increment=1000;
set auto_increment_offset=700;
+--error 167
insert into t3 values(null);
select * from t3 order by a;
sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test
index 0e862e041e6..56ff4683df8 100644
--- a/mysql-test/extra/rpl_tests/rpl_deadlock.test
+++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test
@@ -34,7 +34,7 @@ INSERT INTO t3 VALUES (3);
COMMIT;
save_master_pos;
# Save BEGIN event into variable
-let $master_pos_begin= query_get_value(SHOW BINLOG EVENTS, Pos, 5);
+let $master_pos_begin= query_get_value(SHOW BINLOG EVENTS, Pos, 6);
--echo
# 1) Test deadlock
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
index df08622b0bd..2dbba38166b 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
@@ -102,7 +102,9 @@ CREATE TABLE t1(a int, UNIQUE(a));
--let $_start= query_get_value(SHOW MASTER STATUS, Position, 1)
INSERT DELAYED IGNORE INTO t1 VALUES(1);
+--disable_warnings
INSERT DELAYED IGNORE INTO t1 VALUES(1);
+--enable_warnings
flush table t1; # to wait for INSERT DELAYED to be done
if (`SELECT @@global.binlog_format = 'STATEMENT'`)
{
@@ -133,7 +135,7 @@ if (`SELECT @@global.binlog_format = 'STATEMENT'`)
{
#must show two INSERT DELAYED
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
- --let $binlog_limit= 1,6
+ --let $binlog_limit= 2,6
--source include/show_binlog_events.inc
}
select * from 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 d8cd4f2d284..0fcff5ebe6c 100644
--- a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
+++ b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
@@ -34,7 +34,7 @@ reset slave;
--echo # Test 1
--echo #
-set @my_max_binlog_size= @@global.max_binlog_size;
+set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; # mapped to 4096
select @@global.max_relay_log_size;
@@ -110,6 +110,7 @@ source include/show_master_status.inc;
# Restore max_binlog_size
connection slave;
set global max_binlog_size= @my_max_binlog_size;
+set global max_relay_log_size= @my_max_relay_log_size;
--echo #
--echo # End of 4.1 tests
diff --git a/mysql-test/include/binlog_start_pos.inc b/mysql-test/include/binlog_start_pos.inc
index add5a42a426..5237e357b28 100644
--- a/mysql-test/include/binlog_start_pos.inc
+++ b/mysql-test/include/binlog_start_pos.inc
@@ -15,14 +15,14 @@
# 1 /* Checksum algorithm */ +
# 4 /* CRC32 length */
#
-# With current number of events = 160,
+# With current number of events = 161,
#
-# binlog_start_pos = 4 + 19 + 57 + 160 + 1 + 4 = 245.
+# binlog_start_pos = 4 + 19 + 57 + 161 + 1 + 4 = 246.
#
##############################################################################
-let $binlog_start_pos=245;
+let $binlog_start_pos=246;
--disable_query_log
-SET @binlog_start_pos=245;
+SET @binlog_start_pos=246;
--enable_query_log
diff --git a/mysql-test/include/index_merge2.inc b/mysql-test/include/index_merge2.inc
index 1d6b82e1787..c50a45a9923 100644
--- a/mysql-test/include/index_merge2.inc
+++ b/mysql-test/include/index_merge2.inc
@@ -343,6 +343,7 @@ alter table t1 add index i3(key3);
update t1 set key2=key1,key3=key1;
# to test the bug, the following must use "sort_union":
+--replace_column 9 REF
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
drop table t1;
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
index a690ca4b334..c30cb7d1ff4 100644
--- a/mysql-test/include/mtr_warnings.sql
+++ b/mysql-test/include/mtr_warnings.sql
@@ -225,6 +225,8 @@ INSERT INTO global_suppressions VALUES
("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum on master.*"),
("Slave I/O: Get master BINLOG_CHECKSUM failed with error.*"),
("Slave I/O: Notifying master by SET @master_binlog_checksum= @@global.binlog_checksum failed with error.*"),
+ ("Slave I/O: Setting master-side filtering of @@skip_replication failed with error:.*"),
+ ("Slave I/O: Setting @mariadb_slave_capability failed with error:.*"),
("THE_LAST_SUPPRESSION")||
diff --git a/mysql-test/include/mysqlbinlog_have_debug.inc b/mysql-test/include/mysqlbinlog_have_debug.inc
new file mode 100644
index 00000000000..14da1379ecd
--- /dev/null
+++ b/mysql-test/include/mysqlbinlog_have_debug.inc
@@ -0,0 +1,34 @@
+#############################################
+# checks if mysqlbinlog is debug compiled
+# this "cannot" be done simply by using
+# have_debug.inc
+#############################################
+
+--disable_query_log
+--let $temp_out_help_file=$MYSQL_TMP_DIR/mysqlbinlog_help.tmp
+--exec $MYSQL_BINLOG --help>$temp_out_help_file
+let log_tmp=$temp_out_help_file;
+--let $temp_inc=$MYSQL_TMP_DIR/temp.inc
+let inc_tmp=$temp_inc;
+
+--perl
+use strict;
+my $tmp_file= $ENV{'log_tmp'} or die "log_tmp not set";
+open(FILE, "$tmp_file") or die("Unable to open $tmp_file: $!\n");
+my $count = () = grep(/Output debug log/g,<FILE>);
+close FILE;
+
+my $temp_inc= $ENV{'inc_tmp'} or die "temp_inc not set";
+open(FILE_INC,">", "$temp_inc") or die("can't open file \"$temp_inc\": $!");
+print FILE_INC '--let $is_debug= '.$count;
+close FILE_INC;
+EOF
+--source $temp_inc
+
+if (!$is_debug)
+{
+ --skip mysqlbinlog needs to be debug compiled
+}
+--remove_file $temp_out_help_file
+--remove_file $temp_inc
+--enable_query_log
diff --git a/mysql-test/include/query_cache_partitions.inc b/mysql-test/include/query_cache_partitions.inc
new file mode 100644
index 00000000000..e5bb7406c10
--- /dev/null
+++ b/mysql-test/include/query_cache_partitions.inc
@@ -0,0 +1,126 @@
+# include/query_cache_partitions.inc
+#
+# The variables
+# $engine_type -- storage engine to be tested
+# have to be set before sourcing this script.
+
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+
+# Initialise
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+set @save_query_cache_size = @@global.query_cache_size;
+
+--echo # Test that partitions works with query cache
+
+flush query cache;
+
+SET GLOBAL query_cache_size=1024*1024*512;
+ CREATE TABLE `t1` (
+ `id` int(11) NOT NULL ,
+ `created_at` datetime NOT NULL,
+ `cool` tinyint default 0
+ );
+
+ ALTER TABLE t1 PARTITION BY RANGE (TO_DAYS(created_at)) (
+ PARTITION month_2010_4 VALUES LESS THAN (734258),
+ PARTITION month_2010_5 VALUES LESS THAN (734289),
+ PARTITION month_max VALUES LESS THAN MAXVALUE
+ );
+
+show create table t1;
+
+INSERT INTO t1 VALUES (1, now(), 0);
+
+flush status;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+
+
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+
+drop table t1;
+
+--echo # Test that sub-partitions works with query cache
+
+flush query cache;
+
+SET GLOBAL query_cache_size=1024*1024*512;
+ CREATE TABLE `t1` (
+ `id` int(11) NOT NULL ,
+ `created_at` datetime NOT NULL,
+ `cool` tinyint default 0
+ )
+ PARTITION BY RANGE (TO_DAYS(created_at))
+ subpartition by hash(cool) subpartitions 3 (
+ PARTITION month_2010_4 VALUES LESS THAN (734258),
+ PARTITION month_2010_5 VALUES LESS THAN (734289),
+ PARTITION month_max VALUES LESS THAN MAXVALUE
+ );
+
+show create table t1;
+
+INSERT INTO t1 VALUES (1, now(), 0);
+
+flush status;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+
+drop table t1;
+
+--echo #
+--echo # MySQL bug#53775 Query on partitioned table returns cached result
+--echo # from previous transaction
+--echo #
+
+flush query cache;
+flush status;
+
+SET GLOBAL query_cache_size=1024*1024*512;
+ CREATE TABLE `t1` (
+ `id` int(11) NOT NULL ,
+ `created_at` datetime NOT NULL,
+ `cool` tinyint default 0
+ );
+
+ ALTER TABLE t1 PARTITION BY RANGE (TO_DAYS(created_at)) (
+ PARTITION month_2010_4 VALUES LESS THAN (734258),
+ PARTITION month_2010_5 VALUES LESS THAN (734289),
+ PARTITION month_max VALUES LESS THAN MAXVALUE
+ );
+
+INSERT INTO t1 VALUES (1, now(), 0);
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+
+BEGIN;
+UPDATE `t1` SET `cool` = 1 WHERE `id` = 1;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+ROLLBACK;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+BEGIN;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+ROLLBACK;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+
+drop table t1;
+
+set @@global.query_cache_size = @save_query_cache_size;
diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc
index 4f1d4f6f162..a1964572427 100644
--- a/mysql-test/include/setup_fake_relay_log.inc
+++ b/mysql-test/include/setup_fake_relay_log.inc
@@ -74,7 +74,6 @@ let $_fake_relay_index= $_fake_datadir/$_fake_filename.index;
let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`;
RESET SLAVE;
-let $_orphan_relay_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
# Create relay log file.
--copy_file $fake_relay_log $_fake_relay_log
@@ -103,8 +102,5 @@ let $_orphan_relay_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
# Setup replication from existing relay log.
eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4;
-# remove the orphan log file (became spurious)
--- remove_file $_fake_datadir/$_orphan_relay_file
-
--let $include_filename= setup_fake_relay_log.inc
--source include/end_include_file.inc
diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc
index dd458096071..b2462e0d1b1 100644
--- a/mysql-test/include/show_binlog_events.inc
+++ b/mysql-test/include/show_binlog_events.inc
@@ -20,7 +20,7 @@
#
# $binlog_start
# Position for the 'FROM' clause of SHOW BINLOG EVENTS. If none
-# given, starts right after the Format_description_log_event.
+# given, starts right after the Binlog_checkpoint_log_even.
#
# $binlog_limit
# Limit for the 'LIMIT' clause of SHOW BINLOG EVENTS, i.e.:
diff --git a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc
index c32d12537fd..65a357c59f4 100644
--- a/mysql-test/include/show_binlog_events2.inc
+++ b/mysql-test/include/show_binlog_events2.inc
@@ -1,5 +1,16 @@
---let $binlog_start=245
---replace_result $binlog_start <binlog_start>
+if ($binlog_start)
+{
+ --let $_binlog_start=$binlog_start
+}
+if (!$binlog_start)
+{
+ --let $_binlog_start=246
+}
+if ($binlog_file)
+{
+ --let $_in_binlog_file=in '$binlog_file'
+}
+--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
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/
+--eval show binlog events $_in_binlog_file from $_binlog_start
diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc
index ae2f08f65a6..2de24951846 100644
--- a/mysql-test/include/show_events.inc
+++ b/mysql-test/include/show_events.inc
@@ -10,13 +10,28 @@
--let $include_filename= show_events.inc
--source include/begin_include_file.inc
+# Do not modify $binlog_start - if we did, it could wrongly persist until a
+# later call of show_events.inc.
+if ($binlog_start)
+{
+ --let $_binlog_start= $binlog_start
+}
if (!$binlog_start)
{
- # If $binlog_start is not set, we will set it as the second event's
- # position. The first event(Description Event) is always ignored. For
- # description event's length might be changed because of adding new events,
- # 'SHOW BINLOG EVENTS LIMIT 1' is used to get the right value.
- --let $binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
+ # If $binlog_start is not set, we will set it as the third event's
+ # position (second in relay log which has not Binlog Checkpoing event).
+ # The first two events (Description Event and Binlog Checkpoint
+ # event) are always ignored. For description event's length might be changed
+ # because of adding new events, 'SHOW BINLOG EVENTS LIMIT 2' is used to get
+ # the right value.
+ if ($is_relay_log)
+ {
+ --let $_binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
+ }
+ if (!$is_relay_log)
+ {
+ --let $_binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 2, End_log_pos, 2)
+ }
}
--let $_se_old_statement= $statement
@@ -44,7 +59,7 @@ if ($binlog_file)
--let $statement= $statement in '$_binlog_file'
}
---let $statement= $statement from $binlog_start
+--let $statement= $statement from $_binlog_start
if ($binlog_limit != '')
{
diff --git a/mysql-test/include/strict_autoinc.inc b/mysql-test/include/strict_autoinc.inc
index 823efcc2040..3298008b66f 100644
--- a/mysql-test/include/strict_autoinc.inc
+++ b/mysql-test/include/strict_autoinc.inc
@@ -19,11 +19,12 @@ select count(*) from t1;
set auto_increment_increment=1000;
set auto_increment_offset=700;
---error ER_WARN_DATA_OUT_OF_RANGE
+--error 167
insert into t1 values(null);
select count(*) from t1;
set @@sql_mode=@org_mode;
+--error 167
insert into t1 values(null);
select * from t1;
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 160fdcd935b..a8db67f1e67 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -472,11 +472,13 @@ sub process_suite {
else
{
my @combs;
- @combs = combinations_from_file($parent, "$suitedir/combinations")
- unless $suite->{skip};
+ my $from = "$suitedir/combinations";
+ @combs = combinations_from_file($parent, $from) unless $suite->{skip};
$suite->{combinations} = [ @combs ];
# in overlays it's a union of parent's and overlay's files.
- unshift @{$suite->{combinations}}, @{$parent->{combinations}} if $parent;
+ unshift @{$suite->{combinations}},
+ grep { not $skip_combinations{"$from => $_->{name}"} }
+ @{$parent->{combinations}} if $parent;
}
# suite.opt
@@ -1039,8 +1041,11 @@ sub get_tags_from_file($$) {
$suite = load_suite_for_file($comb_file) if $prefix[0] eq '';
my @comb;
unless ($suite->{skip}) {
- @comb = combinations_from_file($over, "$prefix[0]$comb_file");
- push @comb, combinations_from_file(undef, "$prefix[1]$comb_file") if $over;
+ my $from = "$prefix[0]$comb_file";
+ @comb = combinations_from_file($over, $from);
+ push @comb,
+ grep { not $skip_combinations{"$from => $_->{name}"} }
+ combinations_from_file(undef, "$prefix[1]$comb_file") if $over;
}
push @combinations, [ @comb ];
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index c7c10f16816..ce964d6856d 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -174,6 +174,7 @@ my $DEFAULT_SUITES= join(',', map { "$_-" } qw(
heap
innodb
maria
+ multi_source
optimizer_unfixed_bugs
oqgraph
parts
@@ -1147,7 +1148,6 @@ sub command_line_setup {
'start-from=s' => \&collect_option,
'big-test+' => \$opt_big_test,
'combination=s' => \@opt_combinations,
- 'skip-combinations' => \&collect_option,
'experimental=s' => \@opt_experimentals,
# skip-im is deprecated and silently ignored
'skip-im' => \&ignore_option,
@@ -6265,7 +6265,6 @@ Options to control what engine/variation to run
all generated configs
combination=<opt> Use at least twice to run tests with specified
options to mysqld
- skip-combinations Ignore combination file (or options)
Options to control directories to use
tmpdir=DIR The directory where temporary files are stored
diff --git a/mysql-test/r/adddate_454.result b/mysql-test/r/adddate_454.result
new file mode 100644
index 00000000000..0993cdce32c
--- /dev/null
+++ b/mysql-test/r/adddate_454.result
@@ -0,0 +1,10 @@
+create table t1 (d date);
+insert into t1 values ('2012-00-00');
+select * from t1;
+d
+2012-00-00
+update t1 set d = adddate(d, interval 1 day);
+select * from t1;
+d
+NULL
+drop table t1;
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 30b4ff11227..12cbf294b69 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -150,7 +150,7 @@ select last_insert_id();
last_insert_id()
255
insert into t1 set i = null;
-ERROR 23000: Duplicate entry '255' for key 'PRIMARY'
+ERROR 22003: Out of range value for column 'i' at row 1
select last_insert_id();
last_insert_id()
255
@@ -162,8 +162,7 @@ select last_insert_id();
last_insert_id()
255
insert into t1 set i = null;
-Warnings:
-Warning 1264 Out of range value for column 'i' at row 1
+ERROR 22003: Out of range value for column 'i' at row 1
select last_insert_id();
last_insert_id()
255
@@ -487,7 +486,7 @@ SELECT @@SESSION.AUTO_INCREMENT_OFFSET;
@@SESSION.AUTO_INCREMENT_OFFSET
1
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
-ERROR 22003: Out of range value for column 't1' at row 167
+ERROR 22003: Out of range value for column 'c1' at row 2
SELECT * FROM t1;
c1
1
diff --git a/mysql-test/r/auto_increment_ranges_innodb.result b/mysql-test/r/auto_increment_ranges_innodb.result
new file mode 100644
index 00000000000..fb936ddfd2b
--- /dev/null
+++ b/mysql-test/r/auto_increment_ranges_innodb.result
@@ -0,0 +1,266 @@
+set default_storage_engine=innodb;
+drop table if exists t1;
+#
+# Testing ranges with smallint
+#
+create table t1 (a smallint primary key auto_increment);
+insert into t1 values(32767);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+truncate table t1;
+insert into t1 values(32767-1);
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+select * from t1;
+a
+32766
+32767
+truncate table t1;
+insert into t1 values(32767),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 2
+select * from t1;
+a
+truncate table t1;
+insert into t1 values(32767-1),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(32767+1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t1;
+a
+32767
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
+#
+# Testing ranges with unsigned smallint
+#
+create table t1 (a smallint unsigned primary key auto_increment);
+insert into t1 values(65535);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+truncate table t1;
+insert into t1 values(65535-1);
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+select * from t1;
+a
+65534
+65535
+truncate table t1;
+insert into t1 values(65535),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 2
+select * from t1;
+a
+truncate table t1;
+insert into t1 values(65535-1),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(65535+1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t1;
+a
+65535
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
+#
+# Testing ranges with integer
+#
+create table t1 (a int primary key auto_increment);
+insert into t1 values(2147483647);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+truncate table t1;
+insert into t1 values(2147483647-1);
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+select * from t1;
+a
+2147483646
+2147483647
+truncate table t1;
+insert into t1 values(2147483647),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 2
+select * from t1;
+a
+truncate table t1;
+insert into t1 values(2147483647-1),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(2147483647+1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t1;
+a
+2147483647
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
+#
+# Testing ranges with unsigned integer
+#
+create table t1 (a int unsigned primary key auto_increment);
+insert into t1 values(4294967295);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+truncate table t1;
+insert into t1 values(4294967295-1);
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+select * from t1;
+a
+4294967294
+4294967295
+truncate table t1;
+insert into t1 values(4294967295),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 2
+select * from t1;
+a
+truncate table t1;
+insert into t1 values(4294967295-1),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(4294967295+1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t1;
+a
+4294967295
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
+#
+# Testing ranges with bigint
+#
+create table t1 (a bigint primary key auto_increment);
+insert into t1 values(cast(9223372036854775807 as unsigned));
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+truncate table t1;
+insert into t1 values(cast(9223372036854775807 as unsigned)-1);
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+select * from t1;
+a
+9223372036854775806
+9223372036854775807
+truncate table t1;
+insert into t1 values(cast(9223372036854775807 as unsigned)),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 2
+select * from t1;
+a
+truncate table t1;
+insert into t1 values(cast(9223372036854775807 as unsigned)-1),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(cast(9223372036854775807 as unsigned)+1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t1;
+a
+9223372036854775807
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
+#
+# Testing ranges with unsigned bigint
+#
+create table t1 (a bigint unsigned primary key auto_increment);
+insert into t1 values(18446744073709551615-1);
+insert into t1 values(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+insert into t1 values(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+truncate table t1;
+insert into t1 values(18446744073709551615-1);
+insert into t1 values(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+insert into t1 values(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+select * from t1;
+a
+18446744073709551614
+truncate table t1;
+insert into t1 values(18446744073709551615),(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+select * from t1;
+a
+truncate table t1;
+insert into t1 values(18446744073709551615-1),(NULL),(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+drop table t1;
+#
+# Test IGNORE and strict mode
+#
+create table t1 (a smallint primary key auto_increment);
+insert ignore into t1 values(32766),(NULL),(NULL),(1);
+Warnings:
+Warning 167 Out of range value for column 'a' at row 3
+select * from t1;
+a
+1
+32766
+32767
+truncate table t1;
+set @org_mode=@@sql_mode;
+set @@sql_mode='ansi,traditional';
+insert ignore into t1 values(32766),(NULL),(NULL);
+Warnings:
+Warning 167 Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(32766),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+set @@sql_mode=@org_mode;
+drop table t1;
+#
+# Test auto increment with negative numbers
+#
+CREATE TABLE t1 (a INTEGER AUTO_INCREMENT, PRIMARY KEY (a));
+INSERT INTO t1 VALUES (NULL), (2), (-5), (NULL);
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1;
+a
+-5
+1
+2
+3
+5
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES (-5), (NULL);
+SELECT * FROM t1;
+a
+-5
+1
+DROP TABLE t1;
+#
+# Test inserting a value out-of-range into an auto increment column
+#
+CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (32768);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES (NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+SELECT * FROM t1;
+a
+2
+32767
+DROP TABLE t1;
+#
+# Test old behaviour
+#
+create table t1 (a smallint primary key auto_increment);
+insert into t1 values(32766),(NULL);
+delete from t1 where a=32767;
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
diff --git a/mysql-test/r/auto_increment_ranges_myisam.result b/mysql-test/r/auto_increment_ranges_myisam.result
new file mode 100644
index 00000000000..5101321c864
--- /dev/null
+++ b/mysql-test/r/auto_increment_ranges_myisam.result
@@ -0,0 +1,272 @@
+set default_storage_engine=MYISAM;
+drop table if exists t1;
+#
+# Testing ranges with smallint
+#
+create table t1 (a smallint primary key auto_increment);
+insert into t1 values(32767);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+truncate table t1;
+insert into t1 values(32767-1);
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+select * from t1;
+a
+32766
+32767
+truncate table t1;
+insert into t1 values(32767),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 2
+select * from t1;
+a
+32767
+truncate table t1;
+insert into t1 values(32767-1),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(32767+1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t1;
+a
+32767
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
+#
+# Testing ranges with unsigned smallint
+#
+create table t1 (a smallint unsigned primary key auto_increment);
+insert into t1 values(65535);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+truncate table t1;
+insert into t1 values(65535-1);
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+select * from t1;
+a
+65534
+65535
+truncate table t1;
+insert into t1 values(65535),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 2
+select * from t1;
+a
+65535
+truncate table t1;
+insert into t1 values(65535-1),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(65535+1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t1;
+a
+65535
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
+#
+# Testing ranges with integer
+#
+create table t1 (a int primary key auto_increment);
+insert into t1 values(2147483647);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+truncate table t1;
+insert into t1 values(2147483647-1);
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+select * from t1;
+a
+2147483646
+2147483647
+truncate table t1;
+insert into t1 values(2147483647),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 2
+select * from t1;
+a
+2147483647
+truncate table t1;
+insert into t1 values(2147483647-1),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(2147483647+1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t1;
+a
+2147483647
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
+#
+# Testing ranges with unsigned integer
+#
+create table t1 (a int unsigned primary key auto_increment);
+insert into t1 values(4294967295);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+truncate table t1;
+insert into t1 values(4294967295-1);
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+select * from t1;
+a
+4294967294
+4294967295
+truncate table t1;
+insert into t1 values(4294967295),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 2
+select * from t1;
+a
+4294967295
+truncate table t1;
+insert into t1 values(4294967295-1),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(4294967295+1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t1;
+a
+4294967295
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
+#
+# Testing ranges with bigint
+#
+create table t1 (a bigint primary key auto_increment);
+insert into t1 values(cast(9223372036854775807 as unsigned));
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+truncate table t1;
+insert into t1 values(cast(9223372036854775807 as unsigned)-1);
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+select * from t1;
+a
+9223372036854775806
+9223372036854775807
+truncate table t1;
+insert into t1 values(cast(9223372036854775807 as unsigned)),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 2
+select * from t1;
+a
+9223372036854775807
+truncate table t1;
+insert into t1 values(cast(9223372036854775807 as unsigned)-1),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(cast(9223372036854775807 as unsigned)+1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t1;
+a
+9223372036854775807
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
+#
+# Testing ranges with unsigned bigint
+#
+create table t1 (a bigint unsigned primary key auto_increment);
+insert into t1 values(18446744073709551615-1);
+insert into t1 values(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+insert into t1 values(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+truncate table t1;
+insert into t1 values(18446744073709551615-1);
+insert into t1 values(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+insert into t1 values(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+select * from t1;
+a
+18446744073709551614
+truncate table t1;
+insert into t1 values(18446744073709551615),(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+select * from t1;
+a
+18446744073709551615
+truncate table t1;
+insert into t1 values(18446744073709551615-1),(NULL),(NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+drop table t1;
+#
+# Test IGNORE and strict mode
+#
+create table t1 (a smallint primary key auto_increment);
+insert ignore into t1 values(32766),(NULL),(NULL),(1);
+Warnings:
+Warning 167 Out of range value for column 'a' at row 3
+select * from t1;
+a
+1
+32766
+32767
+truncate table t1;
+set @org_mode=@@sql_mode;
+set @@sql_mode='ansi,traditional';
+insert ignore into t1 values(32766),(NULL),(NULL);
+Warnings:
+Warning 167 Out of range value for column 'a' at row 3
+truncate table t1;
+insert into t1 values(32766),(NULL),(NULL);
+ERROR 22003: Out of range value for column 'a' at row 3
+set @@sql_mode=@org_mode;
+drop table t1;
+#
+# Test auto increment with negative numbers
+#
+CREATE TABLE t1 (a INTEGER AUTO_INCREMENT, PRIMARY KEY (a));
+INSERT INTO t1 VALUES (NULL), (2), (-5), (NULL);
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1;
+a
+-5
+1
+2
+3
+4
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES (-5), (NULL);
+SELECT * FROM t1;
+a
+-5
+1
+DROP TABLE t1;
+#
+# Test inserting a value out-of-range into an auto increment column
+#
+CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (32768);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES (NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+SELECT * FROM t1;
+a
+2
+32767
+DROP TABLE t1;
+#
+# Test old behaviour
+#
+create table t1 (a smallint primary key auto_increment);
+insert into t1 values(32766),(NULL);
+delete from t1 where a=32767;
+insert into t1 values(NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+drop table t1;
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index a95975f1097..3852da5d4b0 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -220,6 +220,10 @@ a d
3 11120436154190595086
drop table t1, t2;
End of 5.0 tests
+CREATE TABLE t1(a YEAR);
+SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
+1
+DROP TABLE t1;
create table t1 (f1 time);
insert t1 values ('00:00:00'),('00:01:00');
select case t1.f1 when '00:00:00' then 1 end from t1;
diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result
index 3e3d75f66e4..af198edc4ca 100644
--- a/mysql-test/r/commit_1innodb.result
+++ b/mysql-test/r/commit_1innodb.result
@@ -529,6 +529,8 @@ SUCCESS
# 13. Read-write statement: INSERT IGNORE, change 0 rows.
#
insert ignore t1 set a=2;
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'a'
call p_verify_status_increment(2, 2, 1, 0);
SUCCESS
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index 6ee01349022..cdd234f1478 100644
--- a/mysql-test/r/compare.result
+++ b/mysql-test/r/compare.result
@@ -96,3 +96,7 @@ SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
a
DROP TABLE t1;
End of 5.0 tests
+CREATE TABLE t1(a INT ZEROFILL);
+SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2;
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/create-big.result b/mysql-test/r/create-big.result
index 34293d7e5cd..4cce5d8618c 100644
--- a/mysql-test/r/create-big.result
+++ b/mysql-test/r/create-big.result
@@ -53,8 +53,8 @@ set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
set debug_sync='now WAIT_FOR parked';
alter table t3 rename to t1;
-ERROR 42S01: Table 't1' already exists
set debug_sync='now SIGNAL go';
+ERROR 42S01: Table 't1' already exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -65,8 +65,8 @@ set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
set debug_sync='now WAIT_FOR parked';
alter table t3 rename to t1, add k int;
-ERROR 42S01: Table 't1' already exists
set debug_sync='now SIGNAL go';
+ERROR 42S01: Table 't1' already exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 0a6dff6d9a3..ba52959be84 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -2396,6 +2396,8 @@ a b
drop table t1;
create table if not exists t1 (a int unique, b int)
ignore select 1 as a, 1 as b union select 1 as a, 2 as b;
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'a'
select * from t1;
a b
1 1
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 1cb4b48ed69..c897108f793 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -2039,6 +2039,8 @@ hex(concat(a)) a
30303030303030303030303030303031303030302E31 00000000000000010000.1
drop table t1;
create table t1 (a year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
select hex(concat(a)) from t1;
hex(concat(a))
@@ -2352,6 +2354,8 @@ hex(a)
drop table t1;
drop view v1;
create table t1 (a year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index 3d695a87701..5323469dff3 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -2431,6 +2431,8 @@ hex(concat(a)) a
30303030303030303030303030303031303030302E31 00000000000000010000.1
drop table t1;
create table t1 (a year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
select hex(concat(a)) from t1;
hex(concat(a))
@@ -2744,6 +2746,8 @@ hex(a)
drop table t1;
drop view v1;
create table t1 (a year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index e2169e4e4e2..ae459fce8eb 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -2458,6 +2458,8 @@ hex(concat(a)) a
30303030303030303030303030303031303030302E31 00000000000000010000.1
drop table t1;
create table t1 (a year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
select hex(concat(a)) from t1;
hex(concat(a))
@@ -2771,6 +2773,8 @@ hex(a)
drop table t1;
drop view v1;
create table t1 (a year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 501b9cb611b..d463ce87c92 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -3341,6 +3341,8 @@ hex(concat(a)) a
00300030003000300030003000300030003000300030003000300030003000310030003000300030002E0031 00000000000000010000.1
drop table t1;
create table t1 (a year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
select hex(concat(a)) from t1;
hex(concat(a))
@@ -3654,6 +3656,8 @@ hex(a)
drop table t1;
drop view v1;
create table t1 (a year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 03f60261450..6cf24d768f7 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -1182,5 +1182,11 @@ a 256
Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT()
#
+# incorrect charset for val_str_ascii
+#
+SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second;
+'2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second
+2010-10-10 10:10:10
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 4dd9d787528..69e32977103 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -4197,6 +4197,8 @@ hex(concat(a)) a
30303030303030303030303030303031303030302E31 00000000000000010000.1
drop table t1;
create table t1 (a year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
select hex(concat(a)) from t1;
hex(concat(a))
@@ -4510,6 +4512,8 @@ hex(a)
drop table t1;
drop view v1;
create table t1 (a year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;
diff --git a/mysql-test/r/datetime_456.result b/mysql-test/r/datetime_456.result
new file mode 100644
index 00000000000..ba020a250b7
--- /dev/null
+++ b/mysql-test/r/datetime_456.result
@@ -0,0 +1,8 @@
+create table t1 (d datetime);
+insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')),
+(from_days(3652499));
+select * from t1;
+d
+NULL
+NULL
+drop table t1;
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index ba01db4a66f..5446406924f 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -1687,7 +1687,6 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b AND t.c = t1.a;
b c a
-8 c c
EXPLAIN EXTENDED
SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
@@ -1702,7 +1701,6 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b <> 0 AND t.c = t1.a;
b c a
-8 c c
INSERT INTO t3 VALUES (100), (200);
EXPLAIN EXTENDED
SELECT t.b, t.c, t1.a
@@ -1718,7 +1716,7 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b AND t.c = t1.a;
b c a
-8 c c
+NULL NULL c
EXPLAIN EXTENDED
SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
@@ -1733,7 +1731,7 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b <> 0 AND t.c = t1.a;
b c a
-8 c c
+NULL NULL c
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2,t3;
#
diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result
index 8560e6176c4..23c77d3978c 100644
--- a/mysql-test/r/errors.result
+++ b/mysql-test/r/errors.result
@@ -160,3 +160,11 @@ ERROR 42S22: Unknown column '' in 'VALUES() function'
INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE
b=(SELECT VALUES(a)+2 FROM t1);
DROP TABLE t1, t2;
+#
+# MDEV-492: incorrect error check before sending OK in mysql_update
+#
+CREATE TABLE t1 (a CHAR(3), b BLOB);
+UPDATE t1 SET a = 'new'
+WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
+ERROR 22007: Illegal value used as argument of dynamic column function
+drop table t1;
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index e081b56e6ce..919e29f185e 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -287,7 +287,7 @@ WHERE t1.f1 GROUP BY t1.f1));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1
-2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
+2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
PREPARE stmt FROM
'EXPLAIN SELECT 1 FROM t1
WHERE 1 > ALL((SELECT t1.f1 FROM t1 RIGHT OUTER JOIN t1 a
@@ -297,12 +297,12 @@ EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1
-2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
+2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1
-2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
+2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
DEALLOCATE PREPARE stmt;
PREPARE stmt FROM
'EXPLAIN SELECT 1 FROM t1
@@ -313,12 +313,12 @@ EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1
-2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
+2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1
-2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
+2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests.
diff --git a/mysql-test/r/features.result b/mysql-test/r/features.result
new file mode 100644
index 00000000000..7b6a352ab0c
--- /dev/null
+++ b/mysql-test/r/features.result
@@ -0,0 +1,140 @@
+drop table if exists t1;
+show status like "feature%";
+Variable_name Value
+Feature_dynamic_columns 0
+Feature_fulltext 0
+Feature_gis 0
+Feature_locale 0
+Feature_subquery 0
+Feature_timezone 0
+Feature_trigger 0
+Feature_xml 0
+#
+# Feature GIS
+#
+CREATE TABLE t1 (g POINT);
+SHOW FIELDS FROM t1;
+Field Type Null Key Default Extra
+g point YES NULL
+INSERT INTO t1 VALUES
+(PointFromText('POINT(10 10)')),
+(PointFromText('POINT(20 10)')),
+(PointFromText('POINT(20 20)')),
+(PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+drop table t1;
+show status like "feature_gis";
+Variable_name Value
+Feature_gis 3
+#
+# Feature dynamic columns
+#
+set @a= COLUMN_CREATE(1, 1212 AS int);
+set @b= column_add(@a, 2, 1212 as integer);
+select column_get(@b, 2 as integer);
+column_get(@b, 2 as integer)
+1212
+show status like "feature_dynamic_columns";
+Variable_name Value
+Feature_dynamic_columns 2
+#
+# Feature fulltext
+#
+CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) engine=myisam;
+INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
+('Full-text indexes', 'are called collections'),
+('Only MyISAM tables','support collections'),
+('Function MATCH ... AGAINST()','is used to do a search'),
+('Full-text search in MySQL', 'implements vector space model');
+select * from t1 where MATCH(a,b) AGAINST ("collections");
+a b
+Only MyISAM tables support collections
+Full-text indexes are called collections
+select * from t1 where MATCH(a,b) AGAINST ("indexes");
+a b
+Full-text indexes are called collections
+drop table t1;
+show status like "feature_fulltext";
+Variable_name Value
+Feature_fulltext 2
+#
+# Feature locale
+#
+SET lc_messages=sr_RS;
+SET lc_messages=en_US;
+show status like "feature_locale";
+Variable_name Value
+Feature_locale 2
+#
+# Feature subquery
+#
+select (select 2);
+(select 2)
+2
+SELECT (SELECT 1) UNION SELECT (SELECT 2);
+(SELECT 1)
+1
+2
+create table t1 (a int);
+insert into t1 values (2);
+select (select a from t1 where t1.a=t2.a), a from t1 as t2;
+(select a from t1 where t1.a=t2.a) a
+2 2
+drop table t1;
+show status like "feature_subquery";
+Variable_name Value
+Feature_subquery 4
+#
+# Feature timezone
+#
+SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
+FROM_UNIXTIME(unix_timestamp()) > "1970-01-01"
+1
+set time_zone="+03:00";
+SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
+FROM_UNIXTIME(unix_timestamp()) > "1970-01-01"
+1
+set time_zone= @@global.time_zone;
+show status like "feature_timezone";
+Variable_name Value
+Feature_timezone 1
+#
+# Feature triggers
+#
+create table t1 (i int);
+# let us test some very simple trigger
+create trigger trg before insert on t1 for each row set @a:=1;
+set @a:=0;
+select @a;
+@a
+0
+insert into t1 values (1),(2);
+select @a;
+@a
+1
+SHOW TRIGGERS IN test like 't1';
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+trg INSERT t1 set @a:=1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+drop trigger trg;
+drop table t1;
+show status like "%trigger%";
+Variable_name Value
+Com_create_trigger 1
+Com_drop_trigger 1
+Com_show_create_trigger 0
+Com_show_triggers 1
+Executed_triggers 2
+Feature_trigger 2
+#
+# Feature xml
+#
+SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
+SELECT extractValue(@xml,'/a');
+extractValue(@xml,'/a')
+a1 a2
+select 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>
+show status like "feature_xml";
+Variable_name Value
+Feature_xml 2
diff --git a/mysql-test/r/filesort_debug.result b/mysql-test/r/filesort_debug.result
index 6d6eb817259..13912ac8756 100644
--- a/mysql-test/r/filesort_debug.result
+++ b/mysql-test/r/filesort_debug.result
@@ -4,7 +4,7 @@ SET @old_debug= @@session.debug;
#
CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
-SET session debug_dbug= '+d,make_sort_keys_alloc_fail';
+SET session debug_dbug= '+d,alloc_sort_buffer_fail';
CALL mtr.add_suppression("Out of sort memory");
SELECT * FROM t1 ORDER BY f1 ASC, f0;
ERROR HY001: Out of sort memory, consider increasing server sort buffer size
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index d3b3cd16210..b64351045bf 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -489,3 +489,10 @@ UNLOCK TABLES;
# Switching to connection 'default'.
COMMIT;
DROP TABLE t1;
+#
+# Test flushing slave or relay logs twice
+#
+flush relay logs,relay logs;
+ERROR HY000: Incorrect usage of FLUSH and RELAY LOGS
+flush slave,slave;
+ERROR HY000: Incorrect usage of FLUSH and SLAVE
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index c38201f6d9f..65323257300 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1527,6 +1527,8 @@ DROP TABLE t1;
# Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
#
create table t1 (f1 year(2), f2 year(4), f3 date, f4 datetime);
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values
(98,1998,19980101,"1998-01-01 00:00:00"),
(00,2000,20000101,"2000-01-01 00:00:01"),
@@ -1838,7 +1840,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 range a a 4 NULL 4 100.00 Using where; Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where (<expr_cache><<cache>(1),<cache>(2)>(<in_optimizer>(<cache>((1,2)),<exists>(select 3,4 having (((1 = 3) or isnull(3)) and ((2 = 4) or isnull(4)) and <is_not_null_test>(3) and <is_not_null_test>(4))))) and (`test`.`t1`.`a` < 10))
+Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where (<cache>(<in_optimizer>((1,2),<exists>(select 3,4 having (((1 = 3) or isnull(3)) and ((2 = 4) or isnull(4)) and <is_not_null_test>(3) and <is_not_null_test>(4))))) and (`test`.`t1`.`a` < 10))
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10;
MAX(a)
NULL
diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result
index 6485793d0e1..67ea44f187a 100644
--- a/mysql-test/r/func_group_innodb.result
+++ b/mysql-test/r/func_group_innodb.result
@@ -146,19 +146,6 @@ count(*) min(7) max(7)
0 NULL NULL
drop table t1m, t1i, t2m, t2i;
#
-# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
-#
-CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
-KEY(b, c, a(765))) ENGINE=INNODB;
-INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
-SELECT MIN(c) FROM t1 GROUP BY b;
-MIN(c)
-0
-EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL b 263 NULL 4 Using index for group-by
-DROP TABLE t1;
-#
# Bug #57954: BIT_AND function returns incorrect results when
# semijoin=on
CREATE TABLE c (
@@ -230,4 +217,18 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
member_id_to COUNT(*)
518491 2
DROP TABLE t1;
+# End of test BUG#12713907
+#
+# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
+#
+CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
+KEY(b, c, a(765))) ENGINE=INNODB;
+INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
+SELECT MIN(c) FROM t1 GROUP BY b;
+MIN(c)
+0
+EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL b 263 NULL 4 Using index for group-by
+DROP TABLE t1;
End of 5.5 tests
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index bfc6b72caa1..98854db4812 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1023,11 +1023,11 @@ MAKETIME(CAST(-1 AS UNSIGNED), 0, 0)
Warnings:
Note 1105 Cast to unsigned converted negative integer to it's positive complement
Warning 1292 Truncated incorrect time value: '18446744073709551615:00:00'
-SELECT EXTRACT(HOUR FROM '100000:02:03');
-EXTRACT(HOUR FROM '100000:02:03')
+SELECT EXTRACT(HOUR FROM '10000:02:03');
+EXTRACT(HOUR FROM '10000:02:03')
838
Warnings:
-Warning 1292 Truncated incorrect time value: '100000:02:03'
+Warning 1292 Truncated incorrect time value: '10000:02:03'
CREATE TABLE t1(f1 TIME);
INSERT INTO t1 VALUES('916:00:00 a');
Warnings:
@@ -1922,3 +1922,5 @@ cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6))
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
123456 10
+select now(258);
+ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6.
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index ca48177b1b5..30385323502 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -1428,6 +1428,29 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
count(*)
1
DROP DATABASE gis_ogs;
+#
+# BUG #1043845 st_distance() results are incorrect depending on variable order
+#
+select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
+ -95.9673057475387 36.1344478941074,
+ -95.9673063519371 36.134484524621,
+ -95.9673049102515 36.1343976584193)'),
+geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
+st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
+ -95.9673057475387 36.1344478941074,
+ -95.9673063519371 36.134484524621,
+
+0.008148695928146028
+select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
+geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
+ -95.9673057475387 36.1344478941074,
+ -95.9673063519371 36.134484524621,
+ -95.9673049102515 36.1343976584193) ')) ;
+st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
+geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
+ -95.9673057475387 36.1344478941074,
+ -95.9673063519371 36.
+0.008148695928146028
USE test;
#
# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 85ec79d94a1..72c53697e61 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -2149,3 +2149,48 @@ f1 MIN(f2) MAX(f2)
4 00:25:00 00:25:00
DROP TABLE t1;
#End of test#49771
+#
+# Bug #58782
+# Missing rows with SELECT .. WHERE .. IN subquery
+# with full GROUP BY and no aggr
+#
+CREATE TABLE t1 (
+pk INT NOT NULL,
+col_int_nokey INT,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (10,7);
+INSERT INTO t1 VALUES (11,1);
+INSERT INTO t1 VALUES (12,5);
+INSERT INTO t1 VALUES (13,3);
+SELECT pk AS field1, col_int_nokey AS field2
+FROM t1
+WHERE col_int_nokey > 0
+GROUP BY field1, field2;
+field1 field2
+10 7
+11 1
+12 5
+13 3
+CREATE TABLE where_subselect
+SELECT pk AS field1, col_int_nokey AS field2
+FROM t1
+WHERE col_int_nokey > 0
+GROUP BY field1, field2
+;
+SELECT *
+FROM where_subselect
+WHERE (field1, field2) IN (
+SELECT pk AS field1, col_int_nokey AS field2
+FROM t1
+WHERE col_int_nokey > 0
+GROUP BY field1, field2
+);
+field1 field2
+10 7
+11 1
+12 5
+13 3
+DROP TABLE t1;
+DROP TABLE where_subselect;
+# End of Bug #58782
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index 95caa6853b8..ce0793b70a6 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2403,7 +2403,7 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
+2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
@@ -2421,7 +2421,7 @@ AND t1_outer1.b = t1_outer2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer (flat, BNL join)
-2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
+2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
id select_type table type possible_keys key key_len ref rows Extra
@@ -2757,7 +2757,7 @@ EXPLAIN
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
id select_type table type possible_keys key key_len ref rows Extra
x x x x x x x x x Impossible WHERE noticed after reading const tables
-x x x x x x x x x Using index
+x x x x x x x x x Using where; Using index
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
MIN( a )
NULL
@@ -2829,7 +2829,7 @@ EXPLAIN
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
id select_type table type possible_keys key key_len ref rows Extra
x x x x x x x x x Impossible WHERE noticed after reading const tables
-x x x x x x x x x Using index
+x x x x x x x x x Using where; Using index
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
MIN( a )
NULL
@@ -2908,7 +2908,7 @@ EXPLAIN
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
id select_type table type possible_keys key key_len ref rows Extra
x x x x x x x x x Impossible WHERE noticed after reading const tables
-x x x x x x x x x Using index
+x x x x x x x x x Using where; Using index
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
MIN( a )
NULL
diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result
index b8eda092291..b93d15f7bef 100644
--- a/mysql-test/r/index_merge_innodb.result
+++ b/mysql-test/r/index_merge_innodb.result
@@ -313,7 +313,7 @@ alter table t1 add index i3(key3);
update t1 set key2=key1,key3=key1;
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL 9 Using sort_union(i3,i2); Using where
+1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where
select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
key1 key2 key3
31 31 31
@@ -777,4 +777,19 @@ commit;
select * from t1 where t1.zone_id=830 AND modified=9;
pk zone_id modified
drop table t0, t1;
+#
+# MDEV-376: Wrong result (missing rows) with index_merge+index_merge_intersection, join
+#
+CREATE TABLE t1 (
+a INT, b CHAR(1), c CHAR(1), KEY(a), KEY(b)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (8,'v','v'),(8,'m','m'),(9,'d','d');
+SELECT ta.* FROM t1 AS ta, t1 AS tb
+WHERE ( tb.b != ta.b OR tb.a = ta.a )
+AND ( tb.b = ta.c OR tb.b = ta.b );
+a b c
+8 v v
+8 m m
+9 d d
+DROP TABLE t1;
set optimizer_switch= @optimizer_switch_save;
diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result
index bf151a872cf..0b6959d15a9 100644
--- a/mysql-test/r/index_merge_myisam.result
+++ b/mysql-test/r/index_merge_myisam.result
@@ -1146,7 +1146,7 @@ alter table t1 add index i3(key3);
update t1 set key2=key1,key3=key1;
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL 11 Using sort_union(i3,i2); Using where
+1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where
select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
key1 key2 key3
31 31 31
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 655303be7f4..7110f541fb7 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -327,9 +327,11 @@ select row_count();
row_count()
3
insert ignore into t1 values (1, 1);
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
select row_count();
row_count()
-0
+-1
replace into t1 values (1, 11);
select row_count();
row_count()
@@ -371,7 +373,15 @@ drop table t1,t2;
create table t1 (id int primary key auto_increment, data int, unique(data));
insert ignore into t1 values(NULL,100),(NULL,110),(NULL,120);
insert ignore into t1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
+Warnings:
+Warning 1062 Duplicate entry '110' for key 'data'
+Warning 1062 Duplicate entry '120' for key 'data'
+Warning 1062 Duplicate entry '100' for key 'data'
insert ignore into t1 values(NULL,130),(NULL,140),(500,110),(550,120),(450,100),(NULL,150);
+Warnings:
+Warning 1062 Duplicate entry '110' for key 'data'
+Warning 1062 Duplicate entry '120' for key 'data'
+Warning 1062 Duplicate entry '100' for key 'data'
select * from t1 order by id;
id data
1 100
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index c952b914167..8bfc4e9215e 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -6,6 +6,10 @@ insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
ERROR 23000: Duplicate entry '16' for key 'PRIMARY'
insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
+Warnings:
+Warning 1062 Duplicate entry '16' for key 'PRIMARY'
+Warning 1062 Duplicate entry '16' for key 'PRIMARY'
+Warning 1062 Duplicate entry '22' for key 'PRIMARY'
select * from t2;
payoutID
1
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index c3acea5d11f..1987c5c0559 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -172,11 +172,15 @@ DROP TABLE t2;
create table t1 (a int not null unique) engine=myisam;
insert into t1 values (1),(2);
insert ignore into t1 select 1 on duplicate key update a=2;
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'a'
select * from t1;
a
1
2
insert ignore into t1 select a from t1 as t2 on duplicate key update a=t1.a+1 ;
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'a'
select * from t1;
a
1
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index e215caadb1c..e63afeab126 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -599,7 +599,7 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
+2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
SELECT 1 as RES FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
RES
diff --git a/mysql-test/r/last_value.result b/mysql-test/r/last_value.result
new file mode 100644
index 00000000000..6222eacd4f0
--- /dev/null
+++ b/mysql-test/r/last_value.result
@@ -0,0 +1,73 @@
+drop table if exists t1;
+drop database if exists mysqltest;
+CREATE TABLE t1 (a INT, b INT, c INT, d INT);
+INSERT INTO t1 VALUES (1,3,0,NULL),(2,2,0,NULL),(3,4,0,NULL),(4,2,0,NULL);
+SELECT * FROM t1;
+a b c d
+1 3 0 NULL
+2 2 0 NULL
+3 4 0 NULL
+4 2 0 NULL
+UPDATE t1 SET c=LAST_VALUE(@last_a:=a,@last_b:=b,@last_c:=c,1), d=4211 WHERE c=0 ORDER BY b DESC LIMIT 1;
+SELECT @last_a, @last_b, @last_c;
+@last_a @last_b @last_c
+3 4 0
+SELECT * FROM t1;
+a b c d
+1 3 0 NULL
+2 2 0 NULL
+3 4 1 4211
+4 2 0 NULL
+DROP TABLE t1;
+SELECT LAST_VALUE(@last_a:=1,@last_b:=1);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def LAST_VALUE(@last_a:=1,@last_b:=1) 8 1 1 N 32897 0 63
+LAST_VALUE(@last_a:=1,@last_b:=1)
+1
+select @last_b;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def @last_b 8 20 1 Y 32896 0 63
+@last_b
+1
+SELECT LAST_VALUE(@last_a:=1,@last_b:=1.0);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def LAST_VALUE(@last_a:=1,@last_b:=1.0) 246 4 3 N 32897 1 63
+LAST_VALUE(@last_a:=1,@last_b:=1.0)
+1.0
+select @last_b;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def @last_b 246 83 3 Y 32896 30 63
+@last_b
+1.0
+SELECT LAST_VALUE(@last_a:=1,@last_b:="hello");
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def LAST_VALUE(@last_a:=1,@last_b:="hello") 253 5 5 N 1 31 8
+LAST_VALUE(@last_a:=1,@last_b:="hello")
+hello
+select @last_b;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def @last_b 250 16777215 5 Y 0 31 8
+@last_b
+hello
+SELECT date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03"));
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03")) 10 10 10 Y 128 0 63
+date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03"))
+2001-02-03
+select @last_b;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def @last_b 250 16777215 10 Y 0 31 8
+@last_b
+2001-02-03
+SELECT LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL) 6 0 0 Y 32896 0 63
+LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL)
+NULL
+select @last_b;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def @last_b 250 16777215 10 Y 0 31 8
+@last_b
+2001-02-03
+SELECT LAST_VALUE();
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
diff --git a/mysql-test/r/limit_rows_examined.result b/mysql-test/r/limit_rows_examined.result
index 3a5212818ef..f4242f17a14 100644
--- a/mysql-test/r/limit_rows_examined.result
+++ b/mysql-test/r/limit_rows_examined.result
@@ -679,7 +679,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 Using temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Distinct
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 3
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
SELECT DISTINCT a AS field1 FROM t1, t2
WHERE EXISTS (SELECT c FROM t3 LEFT JOIN t2 ON b = d)
HAVING field1 > 'aaa' LIMIT ROWS EXAMINED 20;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index ee0e63706a1..c4c8216c14a 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -5,8 +5,8 @@ Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
-Warning 1264 Out of range value for column 'a' at row 2
-Warning 1264 Out of range value for column 'b' at row 2
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 2
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
SELECT * from t1;
@@ -20,7 +20,7 @@ load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
-Warning 1264 Out of range value for column 'b' at row 2
+Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 2
SELECT * from t1;
a b c d
diff --git a/mysql-test/r/mdev375.result b/mysql-test/r/mdev375.result
new file mode 100644
index 00000000000..32580804686
--- /dev/null
+++ b/mysql-test/r/mdev375.result
@@ -0,0 +1,14 @@
+SET GLOBAL log_warnings=4;
+SET GLOBAL max_connections=2;
+SELECT 1;
+1
+1
+SELECT 2;
+2
+2
+ERROR HY000: Too many connections
+SELECT 0;
+0
+0
+SET GLOBAL log_warnings=default;
+SET GLOBAL max_connections=default;
diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result
index e5f5857d2c9..6f90555325b 100644
--- a/mysql-test/r/mix2_myisam.result
+++ b/mysql-test/r/mix2_myisam.result
@@ -702,6 +702,8 @@ id
2
99
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
+Warnings:
+Warning 1062 Duplicate entry '1-1' for key 'PRIMARY'
commit;
select id,id3 from t1;
id id3
diff --git a/mysql-test/r/myisam_mrr.result b/mysql-test/r/myisam_mrr.result
index 03d212dbc04..bd50df7c40e 100644
--- a/mysql-test/r/myisam_mrr.result
+++ b/mysql-test/r/myisam_mrr.result
@@ -278,6 +278,8 @@ bb-1 NULL cc-2 NULL-1
drop table t1, t2, t3, t4;
create table t1 (a int, b int not null,unique key (a,b),index(b));
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
+Warnings:
+Warning 1062 Duplicate entry '6-6' for key 'a'
create table t2 like t1;
insert into t2 select * from t1;
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
diff --git a/mysql-test/r/mysqlbinlog-innodb.result b/mysql-test/r/mysqlbinlog-innodb.result
index fed2c8a8651..41d15bc32d3 100644
--- a/mysql-test/r/mysqlbinlog-innodb.result
+++ b/mysql-test/r/mysqlbinlog-innodb.result
@@ -34,7 +34,7 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
INSERT INTO t1 VALUES (1)
/*!*/;
@@ -65,7 +65,7 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-use foo/*!*/;
+use `foo`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
INSERT INTO t1 VALUES (1)
/*!*/;
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 43226436b6d..63b0ea2a71a 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -18,7 +18,7 @@ flush logs;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -111,7 +111,7 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
/*!*/;
@@ -202,7 +202,7 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
insert into t1 values ("Alas")
/*!*/;
@@ -219,7 +219,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -312,7 +312,7 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
/*!*/;
@@ -403,7 +403,7 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
insert into t1 values ("Alas")
/*!*/;
@@ -427,7 +427,7 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1108844555/*!*/;
insert t1 values (1)
/*!*/;
@@ -445,7 +445,7 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1108844555/*!*/;
insert t1 values (1)
/*!*/;
@@ -498,7 +498,7 @@ ERROR 42000: PROCEDURE test.p1 does not exist
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -548,7 +548,7 @@ flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -725,7 +725,7 @@ FLUSH LOGS;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1253783037/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -825,7 +825,7 @@ BEGIN
SET TIMESTAMP=1266652094/*!*/;
SavePoint mixed_cases
/*!*/;
-use db1/*!*/;
+use `db1`/*!*/;
SET TIMESTAMP=1266652094/*!*/;
INSERT INTO db1.t2 VALUES("in savepoint mixed_cases")
/*!*/;
@@ -892,6 +892,7 @@ DROP DATABASE test1;
FLUSH LOGS;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Query # # CREATE DATABASE test1
master-bin.000002 # Query # # use `test1`; CREATE TABLE t1(id int)
master-bin.000002 # Query # # DROP DATABASE test1
diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result
index 52a589ca7c1..bf65bab602d 100644
--- a/mysql-test/r/mysqlbinlog2.result
+++ b/mysql-test/r/mysqlbinlog2.result
@@ -19,7 +19,7 @@ insert into t1 values(null, "f");
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -103,7 +103,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=1/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
insert into t1 values(null, "a")
/*!*/;
@@ -172,7 +172,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=3/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609944/*!*/;
insert into t1 values(null, "c")
/*!*/;
@@ -209,7 +209,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -263,7 +263,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=3/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609944/*!*/;
insert into t1 values(null, "c")
/*!*/;
@@ -289,7 +289,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=3/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609944/*!*/;
insert into t1 values(null, "c")
/*!*/;
@@ -326,7 +326,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -369,7 +369,7 @@ flush logs;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -445,7 +445,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=6/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609943/*!*/;
insert into t1 values(null, "f")
/*!*/;
@@ -474,7 +474,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=1/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
insert into t1 values(null, "a")
/*!*/;
@@ -535,7 +535,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=6/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609943/*!*/;
insert into t1 values(null, "f")
/*!*/;
@@ -564,7 +564,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=3/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609944/*!*/;
insert into t1 values(null, "c")
/*!*/;
@@ -605,7 +605,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=6/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609943/*!*/;
insert into t1 values(null, "f")
/*!*/;
@@ -622,7 +622,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -697,7 +697,6 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-SET INSERT_ID=6/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -720,7 +719,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=3/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609944/*!*/;
insert into t1 values(null, "c")
/*!*/;
@@ -761,7 +760,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=6/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609943/*!*/;
insert into t1 values(null, "f")
/*!*/;
@@ -778,7 +777,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -820,7 +819,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -904,7 +903,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=1/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
insert into t1 values(null, "a")
/*!*/;
@@ -972,7 +971,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=3/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609944/*!*/;
insert into t1 values(null, "c")
/*!*/;
@@ -1009,7 +1008,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -1062,7 +1061,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=3/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609944/*!*/;
insert into t1 values(null, "c")
/*!*/;
@@ -1088,7 +1087,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=3/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609944/*!*/;
insert into t1 values(null, "c")
/*!*/;
@@ -1125,7 +1124,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -1167,7 +1166,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -1243,7 +1242,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=6/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609943/*!*/;
insert into t1 values(null, "f")
/*!*/;
@@ -1272,7 +1271,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=1/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
insert into t1 values(null, "a")
/*!*/;
@@ -1333,7 +1332,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=6/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609943/*!*/;
insert into t1 values(null, "f")
/*!*/;
@@ -1361,7 +1360,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=3/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609944/*!*/;
insert into t1 values(null, "c")
/*!*/;
@@ -1402,7 +1401,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=6/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609943/*!*/;
insert into t1 values(null, "f")
/*!*/;
@@ -1419,7 +1418,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -1483,17 +1482,6 @@ COMMIT
/*!*/;
DELIMITER ;
DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
-SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=0/*!*/;
-SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
-/*!\C latin1 *//*!*/;
-SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-SET @@session.lc_time_names=0/*!*/;
-SET @@session.collation_database=DEFAULT/*!*/;
-BEGIN
-/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -1516,7 +1504,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=3/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609944/*!*/;
insert into t1 values(null, "c")
/*!*/;
@@ -1557,7 +1545,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=6/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609943/*!*/;
insert into t1 values(null, "f")
/*!*/;
@@ -1574,7 +1562,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -1616,7 +1604,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
diff --git a/mysql-test/r/mysqlbinlog_row.result b/mysql-test/r/mysqlbinlog_row.result
index 7ae1ea36899..6361cdadb32 100644
--- a/mysql-test/r/mysqlbinlog_row.result
+++ b/mysql-test/r/mysqlbinlog_row.result
@@ -335,8 +335,10 @@ DELIMITER /*!*/;
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
diff --git a/mysql-test/r/mysqlbinlog_row_innodb.result b/mysql-test/r/mysqlbinlog_row_innodb.result
index 00a3eb79b64..4be266d586c 100644
--- a/mysql-test/r/mysqlbinlog_row_innodb.result
+++ b/mysql-test/r/mysqlbinlog_row_innodb.result
@@ -2252,8 +2252,10 @@ DELIMITER /*!*/;
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -3875,8 +3877,10 @@ DELIMITER /*!*/;
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -4242,8 +4246,10 @@ DELIMITER /*!*/;
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -4803,8 +4809,10 @@ DELIMITER /*!*/;
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
diff --git a/mysql-test/r/mysqlbinlog_row_myisam.result b/mysql-test/r/mysqlbinlog_row_myisam.result
index 7b0112d0a91..d4062565320 100644
--- a/mysql-test/r/mysqlbinlog_row_myisam.result
+++ b/mysql-test/r/mysqlbinlog_row_myisam.result
@@ -2252,8 +2252,10 @@ DELIMITER /*!*/;
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -3897,8 +3899,10 @@ DELIMITER /*!*/;
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -4270,8 +4274,10 @@ DELIMITER /*!*/;
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -4841,8 +4847,10 @@ DELIMITER /*!*/;
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
diff --git a/mysql-test/r/mysqlbinlog_row_trans.result b/mysql-test/r/mysqlbinlog_row_trans.result
index 5c96db7d19b..85106ab9684 100644
--- a/mysql-test/r/mysqlbinlog_row_trans.result
+++ b/mysql-test/r/mysqlbinlog_row_trans.result
@@ -131,8 +131,10 @@ DELIMITER /*!*/;
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 2b34c4da8af..5b8e6ea3348 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -355,8 +355,7 @@ The following options may be given as the first argument:
--max-binlog-cache-size=#
Sets the total size of the transactional cache
--max-binlog-size=# Binary log will be rotated automatically when the size
- exceeds this value. Will also apply to relay logs if
- max_relay_log_size is 0
+ exceeds this value.
--max-binlog-stmt-cache-size=#
Sets the total size of the statement cache
--max-connect-errors=#
@@ -382,9 +381,9 @@ The following options may be given as the first argument:
--max-prepared-stmt-count=#
Maximum number of prepared statements in the server
--max-relay-log-size=#
- If non-zero: relay log will be rotated automatically when
- the size exceeds this value; if zero: when the size
- exceeds max_binlog_size
+ relay log will be rotated automatically when the size
+ exceeds this value. If 0 are startup, it's set to
+ max_binlog_size
--max-seeks-for-key=#
Limit assumed max number of seeks when looking up rows
based on a key
@@ -765,7 +764,7 @@ The following options may be given as the first argument:
partial matching
--rpl-recovery-rank=#
Unused, will be removed
- --safe-mode Skip some optimize stages (for testing).
+ --safe-mode Skip some optimize stages (for testing). Deprecated.
--safe-user-create Don't allow new user creation by the user who has no
write privileges to the mysql.user table.
--secure-auth Disallow authentication for accounts that have old
@@ -805,8 +804,11 @@ The following options may be given as the first argument:
--slave-load-tmpdir=name
The location where the slave should put its temporary
files when replicating a LOAD DATA INFILE command
+ --slave-max-allowed-packet=#
+ The maximum packet length to sent successfully from the
+ master to slave.
--slave-net-timeout=#
- Number of seconds to wait for more data from a
+ Number of seconds to wait for more data from any
master/slave connection before aborting the read
--slave-skip-errors=name
Tells the slave thread to continue replication when a
@@ -991,7 +993,6 @@ key-cache-age-threshold 300
key-cache-block-size 1024
key-cache-division-limit 100
key-cache-segments 0
-language MYSQL_SHAREDIR/
large-pages FALSE
lc-messages en_US
lc-messages-dir MYSQL_SHAREDIR/
@@ -1034,7 +1035,7 @@ max-join-size 18446744073709551615
max-length-for-sort-data 1024
max-long-data-size 1048576
max-prepared-stmt-count 16382
-max-relay-log-size 0
+max-relay-log-size 1073741824
max-seeks-for-key 18446744073709551615
max-sort-length 1024
max-sp-recursion-depth 0
@@ -1101,7 +1102,7 @@ performance-schema-max-rwlock-instances 1000000
performance-schema-max-socket-classes 10
performance-schema-max-socket-instances 1000
performance-schema-max-stage-classes 150
-performance-schema-max-statement-classes 170
+performance-schema-max-statement-classes 173
performance-schema-max-table-handles 10000
performance-schema-max-table-instances 1000
performance-schema-max-thread-classes 50
@@ -1155,6 +1156,7 @@ skip-show-database FALSE
skip-slave-start FALSE
slave-compressed-protocol FALSE
slave-exec-mode STRICT
+slave-max-allowed-packet 1073741824
slave-net-timeout 3600
slave-skip-errors (No default value)
slave-sql-verify-checksum TRUE
diff --git a/mysql-test/r/mysqldump-max.result b/mysql-test/r/mysqldump-max.result
index 6722f308358..fb0be20c119 100644
--- a/mysql-test/r/mysqldump-max.result
+++ b/mysql-test/r/mysqldump-max.result
@@ -332,12 +332,12 @@ a b
2 1
DROP TABLE t1;
DROP TABLE t2;
-SHOW BINLOG EVENTS LIMIT 6,3;
+SHOW BINLOG EVENTS LIMIT 7,3;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 663 Query 1 731 BEGIN
-master-bin.000001 731 Query 1 828 use `test`; INSERT INTO t2 VALUES (1,0), (2,0)
-master-bin.000001 828 Xid 1 855 COMMIT /* XID */
--- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=855;
+master-bin.000001 704 Query 1 772 BEGIN
+master-bin.000001 772 Query 1 869 use `test`; INSERT INTO t2 VALUES (1,0), (2,0)
+master-bin.000001 869 Xid 1 896 COMMIT /* XID */
+-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=896;
SELECT * FROM t1 ORDER BY a;
a
1
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 6f1b43b7b2b..b58a904bc1f 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -2073,7 +2073,7 @@ DROP TABLE IF EXISTS `v2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v2` (
- `a` varchar(30)
+ `a` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
@@ -2167,7 +2167,7 @@ DROP TABLE IF EXISTS `v1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v1` (
- `a` int(11)
+ `a` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
@@ -2241,7 +2241,7 @@ DROP TABLE IF EXISTS `v2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v2` (
- `a` varchar(30)
+ `a` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
@@ -2355,9 +2355,9 @@ DROP TABLE IF EXISTS `v1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v1` (
- `a` int(11),
- `b` int(11),
- `c` varchar(30)
+ `a` tinyint NOT NULL,
+ `b` tinyint NOT NULL,
+ `c` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `v2`;
@@ -2365,7 +2365,7 @@ DROP TABLE IF EXISTS `v2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v2` (
- `a` int(11)
+ `a` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `v3`;
@@ -2373,9 +2373,9 @@ DROP TABLE IF EXISTS `v3`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v3` (
- `a` int(11),
- `b` int(11),
- `c` varchar(30)
+ `a` tinyint NOT NULL,
+ `b` tinyint NOT NULL,
+ `c` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
@@ -3112,9 +3112,9 @@ DROP TABLE IF EXISTS `v0`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v0` (
- `a` int(11),
- `b` varchar(32),
- `c` varchar(32)
+ `a` tinyint NOT NULL,
+ `b` tinyint NOT NULL,
+ `c` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `v1`;
@@ -3122,9 +3122,9 @@ DROP TABLE IF EXISTS `v1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v1` (
- `a` int(11),
- `b` varchar(32),
- `c` varchar(32)
+ `a` tinyint NOT NULL,
+ `b` tinyint NOT NULL,
+ `c` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `v2`;
@@ -3132,9 +3132,9 @@ DROP TABLE IF EXISTS `v2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v2` (
- `a` int(11),
- `b` varchar(32),
- `c` varchar(32)
+ `a` tinyint NOT NULL,
+ `b` tinyint NOT NULL,
+ `c` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
@@ -3514,7 +3514,7 @@ DROP TABLE IF EXISTS `v1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v1` (
- `id` int(11)
+ `id` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
@@ -3574,7 +3574,7 @@ USE `mysqldump_views`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `nasishnasifu` (
- `id` bigint(20) unsigned
+ `id` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
@@ -3967,7 +3967,7 @@ DROP TABLE IF EXISTS `v2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v2` (
- `c` int(11)
+ `c` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
@@ -4384,7 +4384,7 @@ DROP TABLE IF EXISTS `v1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v1` (
- `id` int(11)
+ `id` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 25345227d59..d08ffd96a04 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -232,7 +232,7 @@ mysqltest: At line 2: Spurious text after `query` expression
mysqltest: At line 1: Missing argument(s) to 'error'
mysqltest: At line 1: Missing argument(s) to 'error'
mysqltest: At line 1: The sqlstate definition must start with an uppercase S
-mysqltest: At line 1: The error name definition must start with an uppercase E
+mysqltest: At line 1: The error name definition must start with an uppercase E or W
mysqltest: At line 1: Invalid argument to error: '9eeeee' - the errno may only consist of digits[0-9]
mysqltest: At line 1: Invalid argument to error: '1sssss' - the errno may only consist of digits[0-9]
mysqltest: At line 1: The sqlstate must be exactly 5 chars long
@@ -690,6 +690,7 @@ Got one of the listed errors
insert into t1 values ("Abcd");
Got one of the listed errors
garbage;
+SELECT * FROM non_existing_table;
drop table t2;
create table t1 ( f1 char(10));
insert into t1 values ("Abcd");
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index 35c6ebe1442..ba79011f53e 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -1,6 +1,8 @@
drop table if exists t1,t2;
create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
+Warnings:
+Warning 1062 Duplicate entry '6-6' for key 'a'
explain select * from t1 where a is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 3 Using where; Using index
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index d320b5b669f..1ded1e90314 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -1439,6 +1439,7 @@ CALL mtr.add_suppression("Out of sort memory");
select * from t1 order by b;
ERROR HY001: Out of sort memory, consider increasing server sort buffer size
drop table t1;
+set session sort_buffer_size= 30000;
#
# Bug #39844: Query Crash Mysql Server 5.0.67
#
@@ -1533,6 +1534,890 @@ ppfcz1 DE ppfcz1 14 8 57.5
ppfcz1 DE ppfcz1 14 9 59.5
ppfcz1 DE ppfcz1 14 10 61.5
DROP TABLE t1,t2,t3;
+#
+# WL#1393 - Optimizing filesort with small limit
+#
+CREATE TABLE t1(f0 int auto_increment primary key, f1 int, f2 varchar(200));
+INSERT INTO t1(f1, f2) VALUES
+(0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
+(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
+(11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
+(16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
+(21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
+(26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
+(31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
+(36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
+(41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
+(46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
+(51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
+(56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
+(61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
+(66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
+(71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
+(76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
+(81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
+(86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
+(91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
+(96,"96"),(97,"97"),(98,"98"),(99,"99");
+SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 100;
+f0 f1 f2
+1 0 0
+2 1 1
+3 2 2
+4 3 3
+5 4 4
+6 5 5
+7 6 6
+8 7 7
+9 8 8
+10 9 9
+11 10 10
+12 11 11
+13 12 12
+14 13 13
+15 14 14
+16 15 15
+17 16 16
+18 17 17
+19 18 18
+20 19 19
+21 20 20
+22 21 21
+23 22 22
+24 23 23
+25 24 24
+26 25 25
+27 26 26
+28 27 27
+29 28 28
+30 29 29
+31 30 30
+32 31 31
+33 32 32
+34 33 33
+35 34 34
+36 35 35
+37 36 36
+38 37 37
+39 38 38
+40 39 39
+41 40 40
+42 41 41
+43 42 42
+44 43 43
+45 44 44
+46 45 45
+47 46 46
+48 47 47
+49 48 48
+50 49 49
+51 50 50
+52 51 51
+53 52 52
+54 53 53
+55 54 54
+56 55 55
+57 56 56
+58 57 57
+59 58 58
+60 59 59
+61 60 60
+62 61 61
+63 62 62
+64 63 63
+65 64 64
+66 65 65
+67 66 66
+68 67 67
+69 68 68
+70 69 69
+71 70 70
+72 71 71
+73 72 72
+74 73 73
+75 74 74
+76 75 75
+77 76 76
+78 77 77
+79 78 78
+80 79 79
+81 80 80
+82 81 81
+83 82 82
+84 83 83
+85 84 84
+86 85 85
+87 86 86
+88 87 87
+89 88 88
+90 89 89
+91 90 90
+92 91 91
+93 92 92
+94 93 93
+95 94 94
+96 95 95
+97 96 96
+98 97 97
+99 98 98
+100 99 99
+SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 30;
+f0 f1 f2
+1 0 0
+2 1 1
+3 2 2
+4 3 3
+5 4 4
+6 5 5
+7 6 6
+8 7 7
+9 8 8
+10 9 9
+11 10 10
+12 11 11
+13 12 12
+14 13 13
+15 14 14
+16 15 15
+17 16 16
+18 17 17
+19 18 18
+20 19 19
+21 20 20
+22 21 21
+23 22 22
+24 23 23
+25 24 24
+26 25 25
+27 26 26
+28 27 27
+29 28 28
+30 29 29
+SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 0;
+f0 f1 f2
+SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 30;
+f0 f1 f2
+100 99 99
+99 98 98
+98 97 97
+97 96 96
+96 95 95
+95 94 94
+94 93 93
+93 92 92
+92 91 91
+91 90 90
+10 9 9
+90 89 89
+89 88 88
+88 87 87
+87 86 86
+86 85 85
+85 84 84
+84 83 83
+83 82 82
+82 81 81
+81 80 80
+9 8 8
+80 79 79
+79 78 78
+78 77 77
+77 76 76
+76 75 75
+75 74 74
+74 73 73
+73 72 72
+SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 0;
+f0 f1 f2
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 20;
+f0 f1 f2
+12 11 11
+13 12 12
+14 13 13
+15 14 14
+16 15 15
+17 16 16
+18 17 17
+19 18 18
+20 19 19
+21 20 20
+22 21 21
+23 22 22
+24 23 23
+25 24 24
+26 25 25
+27 26 26
+28 27 27
+29 28 28
+30 29 29
+31 30 30
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0;
+f0 f1 f2
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10;
+f0 f1 f2
+22 21 21
+23 22 22
+24 23 23
+25 24 24
+26 25 25
+27 26 26
+28 27 27
+29 28 28
+30 29 29
+31 30 30
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10;
+f0 f1 f2
+set sort_buffer_size= 32768;
+CREATE TEMPORARY TABLE tmp (f1 int, f2 varchar(20));
+INSERT INTO tmp SELECT f1, f2 FROM t1;
+INSERT INTO t1(f1, f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1, f2 FROM t1;
+INSERT INTO t1(f1, f2) SELECT * FROM tmp;
+SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 30;
+f0 f1 f2
+1 0 0
+101 0 0
+201 0 0
+301 0 0
+401 0 0
+2 1 1
+102 1 1
+202 1 1
+302 1 1
+402 1 1
+3 2 2
+103 2 2
+203 2 2
+303 2 2
+403 2 2
+4 3 3
+104 3 3
+204 3 3
+304 3 3
+404 3 3
+5 4 4
+105 4 4
+205 4 4
+305 4 4
+405 4 4
+6 5 5
+106 5 5
+206 5 5
+306 5 5
+406 5 5
+SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 0;
+f0 f1 f2
+SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 30;
+f0 f1 f2
+100 99 99
+200 99 99
+300 99 99
+400 99 99
+500 99 99
+99 98 98
+199 98 98
+299 98 98
+399 98 98
+499 98 98
+98 97 97
+198 97 97
+298 97 97
+398 97 97
+498 97 97
+97 96 96
+197 96 96
+297 96 96
+397 96 96
+497 96 96
+96 95 95
+196 95 95
+296 95 95
+396 95 95
+496 95 95
+95 94 94
+195 94 94
+295 94 94
+395 94 94
+495 94 94
+SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 0;
+f0 f1 f2
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 20;
+f0 f1 f2
+12 11 11
+112 11 11
+212 11 11
+312 11 11
+412 11 11
+13 12 12
+113 12 12
+213 12 12
+313 12 12
+413 12 12
+14 13 13
+114 13 13
+214 13 13
+314 13 13
+414 13 13
+15 14 14
+115 14 14
+215 14 14
+315 14 14
+415 14 14
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0;
+f0 f1 f2
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10;
+f0 f1 f2
+14 13 13
+114 13 13
+214 13 13
+314 13 13
+414 13 13
+15 14 14
+115 14 14
+215 14 14
+315 14 14
+415 14 14
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10;
+f0 f1 f2
+set sort_buffer_size= 32768;
+SELECT SQL_CALC_FOUND_ROWS * FROM t1
+ORDER BY f1, f0 LIMIT 30;
+f0 f1 f2
+1 0 0
+101 0 0
+201 0 0
+301 0 0
+401 0 0
+2 1 1
+102 1 1
+202 1 1
+302 1 1
+402 1 1
+3 2 2
+103 2 2
+203 2 2
+303 2 2
+403 2 2
+4 3 3
+104 3 3
+204 3 3
+304 3 3
+404 3 3
+5 4 4
+105 4 4
+205 4 4
+305 4 4
+405 4 4
+6 5 5
+106 5 5
+206 5 5
+306 5 5
+406 5 5
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+500
+SELECT SQL_CALC_FOUND_ROWS * FROM t1
+ORDER BY f1, f0 LIMIT 0;
+f0 f1 f2
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+500
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
+ORDER BY f2, f0 LIMIT 20;
+f0 f1 f2
+12 11 11
+112 11 11
+212 11 11
+312 11 11
+412 11 11
+13 12 12
+113 12 12
+213 12 12
+313 12 12
+413 12 12
+14 13 13
+114 13 13
+214 13 13
+314 13 13
+414 13 13
+15 14 14
+115 14 14
+215 14 14
+315 14 14
+415 14 14
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+445
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
+ORDER BY f2, f0 LIMIT 0;
+f0 f1 f2
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+445
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
+ORDER BY f2, f0 LIMIT 10 OFFSET 10;
+f0 f1 f2
+14 13 13
+114 13 13
+214 13 13
+314 13 13
+414 13 13
+15 14 14
+115 14 14
+215 14 14
+315 14 14
+415 14 14
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+445
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
+ORDER BY f2, f0 LIMIT 0 OFFSET 10;
+f0 f1 f2
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+445
+set sort_buffer_size= 327680;
+SELECT * FROM t1 JOIN tmp on t1.f2=tmp.f2
+ORDER BY tmp.f1, f0 LIMIT 30;
+f0 f1 f2 f1 f2
+1 0 0 0 0
+1 0 0 0 0
+1 0 0 0 0
+101 0 0 0 0
+101 0 0 0 0
+101 0 0 0 0
+201 0 0 0 0
+201 0 0 0 0
+201 0 0 0 0
+301 0 0 0 0
+301 0 0 0 0
+301 0 0 0 0
+401 0 0 0 0
+401 0 0 0 0
+401 0 0 0 0
+2 1 1 1 1
+2 1 1 1 1
+2 1 1 1 1
+102 1 1 1 1
+102 1 1 1 1
+102 1 1 1 1
+202 1 1 1 1
+202 1 1 1 1
+202 1 1 1 1
+302 1 1 1 1
+302 1 1 1 1
+302 1 1 1 1
+402 1 1 1 1
+402 1 1 1 1
+402 1 1 1 1
+SELECT * FROM t1 JOIN tmp on t1.f2=tmp.f2
+ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
+f0 f1 f2 f1 f2
+3 2 2 2 2
+3 2 2 2 2
+3 2 2 2 2
+103 2 2 2 2
+103 2 2 2 2
+103 2 2 2 2
+203 2 2 2 2
+203 2 2 2 2
+203 2 2 2 2
+303 2 2 2 2
+303 2 2 2 2
+303 2 2 2 2
+403 2 2 2 2
+403 2 2 2 2
+403 2 2 2 2
+4 3 3 3 3
+4 3 3 3 3
+4 3 3 3 3
+104 3 3 3 3
+104 3 3 3 3
+104 3 3 3 3
+204 3 3 3 3
+204 3 3 3 3
+204 3 3 3 3
+304 3 3 3 3
+304 3 3 3 3
+304 3 3 3 3
+404 3 3 3 3
+404 3 3 3 3
+404 3 3 3 3
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 JOIN tmp on t1.f2=tmp.f2
+ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
+f0 f1 f2 f1 f2
+3 2 2 2 2
+3 2 2 2 2
+3 2 2 2 2
+103 2 2 2 2
+103 2 2 2 2
+103 2 2 2 2
+203 2 2 2 2
+203 2 2 2 2
+203 2 2 2 2
+303 2 2 2 2
+303 2 2 2 2
+303 2 2 2 2
+403 2 2 2 2
+403 2 2 2 2
+403 2 2 2 2
+4 3 3 3 3
+4 3 3 3 3
+4 3 3 3 3
+104 3 3 3 3
+104 3 3 3 3
+104 3 3 3 3
+204 3 3 3 3
+204 3 3 3 3
+204 3 3 3 3
+304 3 3 3 3
+304 3 3 3 3
+304 3 3 3 3
+404 3 3 3 3
+404 3 3 3 3
+404 3 3 3 3
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+1500
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 JOIN tmp on t1.f2=tmp.f2
+WHERE t1.f2>20
+ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
+f0 f1 f2 f1 f2
+24 23 23 23 23
+24 23 23 23 23
+24 23 23 23 23
+124 23 23 23 23
+124 23 23 23 23
+124 23 23 23 23
+224 23 23 23 23
+224 23 23 23 23
+224 23 23 23 23
+324 23 23 23 23
+324 23 23 23 23
+324 23 23 23 23
+424 23 23 23 23
+424 23 23 23 23
+424 23 23 23 23
+25 24 24 24 24
+25 24 24 24 24
+25 24 24 24 24
+125 24 24 24 24
+125 24 24 24 24
+125 24 24 24 24
+225 24 24 24 24
+225 24 24 24 24
+225 24 24 24 24
+325 24 24 24 24
+325 24 24 24 24
+325 24 24 24 24
+425 24 24 24 24
+425 24 24 24 24
+425 24 24 24 24
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+1185
+CREATE VIEW v1 as SELECT * FROM t1 ORDER BY f1, f0 LIMIT 30;
+SELECT * FROM v1;
+f0 f1 f2
+1 0 0
+101 0 0
+201 0 0
+301 0 0
+401 0 0
+2 1 1
+102 1 1
+202 1 1
+302 1 1
+402 1 1
+3 2 2
+103 2 2
+203 2 2
+303 2 2
+403 2 2
+4 3 3
+104 3 3
+204 3 3
+304 3 3
+404 3 3
+5 4 4
+105 4 4
+205 4 4
+305 4 4
+405 4 4
+6 5 5
+106 5 5
+206 5 5
+306 5 5
+406 5 5
+drop view v1;
+CREATE VIEW v1 as SELECT * FROM t1 ORDER BY f1, f0 LIMIT 100;
+SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30;
+f0 f1 f2
+1 0 0
+101 0 0
+201 0 0
+301 0 0
+401 0 0
+2 1 1
+102 1 1
+202 1 1
+302 1 1
+402 1 1
+11 10 10
+111 10 10
+211 10 10
+311 10 10
+411 10 10
+12 11 11
+112 11 11
+212 11 11
+312 11 11
+412 11 11
+13 12 12
+113 12 12
+213 12 12
+313 12 12
+413 12 12
+14 13 13
+114 13 13
+214 13 13
+314 13 13
+414 13 13
+CREATE VIEW v2 as SELECT * FROM t1 ORDER BY f2, f0 LIMIT 100;
+SELECT * FROM v1 JOIN v2 on v1.f1=v2.f1 ORDER BY v1.f2,v1.f0,v2.f0
+LIMIT 30;
+f0 f1 f2 f0 f1 f2
+1 0 0 1 0 0
+1 0 0 101 0 0
+1 0 0 201 0 0
+1 0 0 301 0 0
+1 0 0 401 0 0
+101 0 0 1 0 0
+101 0 0 101 0 0
+101 0 0 201 0 0
+101 0 0 301 0 0
+101 0 0 401 0 0
+201 0 0 1 0 0
+201 0 0 101 0 0
+201 0 0 201 0 0
+201 0 0 301 0 0
+201 0 0 401 0 0
+301 0 0 1 0 0
+301 0 0 101 0 0
+301 0 0 201 0 0
+301 0 0 301 0 0
+301 0 0 401 0 0
+401 0 0 1 0 0
+401 0 0 101 0 0
+401 0 0 201 0 0
+401 0 0 301 0 0
+401 0 0 401 0 0
+2 1 1 2 1 1
+2 1 1 102 1 1
+2 1 1 202 1 1
+2 1 1 302 1 1
+2 1 1 402 1 1
+SELECT floor(f1/10) f3, count(f2) FROM t1
+GROUP BY 1 ORDER BY 2,1 LIMIT 5;
+f3 count(f2)
+0 50
+1 50
+2 50
+3 50
+4 50
+SELECT floor(f1/10) f3, count(f2) FROM t1
+GROUP BY 1 ORDER BY 2,1 LIMIT 0;
+f3 count(f2)
+CREATE PROCEDURE wl1393_sp_test()
+BEGIN
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 30;
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 15 OFFSET 15;
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
+ORDER BY f2, f0 LIMIT 15 OFFSET 15;
+SELECT FOUND_ROWS();
+SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30;
+END|
+CALL wl1393_sp_test()|
+f0 f1 f2
+12 11 11
+112 11 11
+212 11 11
+312 11 11
+412 11 11
+13 12 12
+113 12 12
+213 12 12
+313 12 12
+413 12 12
+14 13 13
+114 13 13
+214 13 13
+314 13 13
+414 13 13
+15 14 14
+115 14 14
+215 14 14
+315 14 14
+415 14 14
+16 15 15
+116 15 15
+216 15 15
+316 15 15
+416 15 15
+17 16 16
+117 16 16
+217 16 16
+317 16 16
+417 16 16
+f0 f1 f2
+15 14 14
+115 14 14
+215 14 14
+315 14 14
+415 14 14
+16 15 15
+116 15 15
+216 15 15
+316 15 15
+416 15 15
+17 16 16
+117 16 16
+217 16 16
+317 16 16
+417 16 16
+f0 f1 f2
+15 14 14
+115 14 14
+215 14 14
+315 14 14
+415 14 14
+16 15 15
+116 15 15
+216 15 15
+316 15 15
+416 15 15
+17 16 16
+117 16 16
+217 16 16
+317 16 16
+417 16 16
+FOUND_ROWS()
+445
+f0 f1 f2
+1 0 0
+101 0 0
+201 0 0
+301 0 0
+401 0 0
+2 1 1
+102 1 1
+202 1 1
+302 1 1
+402 1 1
+11 10 10
+111 10 10
+211 10 10
+311 10 10
+411 10 10
+12 11 11
+112 11 11
+212 11 11
+312 11 11
+412 11 11
+13 12 12
+113 12 12
+213 12 12
+313 12 12
+413 12 12
+14 13 13
+114 13 13
+214 13 13
+314 13 13
+414 13 13
+DROP PROCEDURE wl1393_sp_test|
+SELECT d1.f1, d1.f2 FROM t1
+LEFT JOIN (SELECT * FROM t1 ORDER BY f1 LIMIT 30) d1 on t1.f1=d1.f1
+ORDER BY d1.f2 DESC LIMIT 30;
+f1 f2
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+5 5
+4 4
+4 4
+4 4
+4 4
+4 4
+SELECT * FROM t1 WHERE f1 = (SELECT f1 FROM t1 ORDER BY 1 LIMIT 1);
+f0 f1 f2
+1 0 0
+101 0 0
+201 0 0
+301 0 0
+401 0 0
+SELECT * FROM t1 WHERE f1 = (SELECT f1 FROM t1 ORDER BY 1 LIMIT 2);
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1, tmp;
+DROP VIEW v1, v2;
+# end of WL#1393 - Optimizing filesort with small limit
+#
+# Bug #58761
+# Crash in Field::is_null in field.h on subquery in WHERE clause
+#
+CREATE TABLE t1 (
+pk INT NOT NULL AUTO_INCREMENT,
+col_int_key INT DEFAULT NULL,
+col_varchar_key VARCHAR(1) DEFAULT NULL,
+PRIMARY KEY (pk),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+INSERT INTO t1 VALUES (27,7,'x');
+INSERT INTO t1 VALUES (28,6,'m');
+INSERT INTO t1 VALUES (29,4,'c');
+CREATE TABLE where_subselect
+SELECT DISTINCT `pk` AS field1 , `pk` AS field2
+FROM t1 AS alias1
+WHERE alias1 . `col_int_key` > 229
+OR alias1 . `col_varchar_key` IS NOT NULL
+GROUP BY field1, field2
+;
+SELECT *
+FROM where_subselect
+WHERE (field1, field2) IN (
+SELECT DISTINCT `pk` AS field1 , `pk` AS field2
+FROM t1 AS alias1
+WHERE alias1 . `col_int_key` > 229
+OR alias1 . `col_varchar_key` IS NOT NULL
+GROUP BY field1, field2
+);
+field1 field2
+27 27
+28 28
+29 29
+DROP TABLE t1;
+DROP TABLE where_subselect;
+# End of Bug #58761
CREATE TABLE t1 (
id1 INT NULL,
id2 INT NOT NULL,
@@ -1813,3 +2698,135 @@ Warnings:
Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`) group by `test`.`t2`.`b` order by `test`.`t1`.`b`
drop table t1,t2;
End of 5.2 tests
+#
+# Bug mdev-449: ORDER BY with small sort_buffer_size
+#
+CREATE TABLE t1(f0 int auto_increment primary key, f1 int, f2 varchar(200));
+INSERT INTO t1(f1, f2) VALUES
+(0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
+(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
+(11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
+(16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
+(21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
+(26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
+(31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
+(36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
+(41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
+(46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
+(51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
+(56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
+(61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
+(66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
+(71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
+(76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
+(81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
+(86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
+(91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
+(96,"96"),(97,"97"),(98,"98"),(99,"99");
+set @save_sort_buffer_size= @@sort_buffer_size;
+set sort_buffer_size= 2000;
+SELECT * FROM t1 ORDER BY f1 DESC, f0;
+f0 f1 f2
+100 99 99
+99 98 98
+98 97 97
+97 96 96
+96 95 95
+95 94 94
+94 93 93
+93 92 92
+92 91 91
+91 90 90
+90 89 89
+89 88 88
+88 87 87
+87 86 86
+86 85 85
+85 84 84
+84 83 83
+83 82 82
+82 81 81
+81 80 80
+80 79 79
+79 78 78
+78 77 77
+77 76 76
+76 75 75
+75 74 74
+74 73 73
+73 72 72
+72 71 71
+71 70 70
+70 69 69
+69 68 68
+68 67 67
+67 66 66
+66 65 65
+65 64 64
+64 63 63
+63 62 62
+62 61 61
+61 60 60
+60 59 59
+59 58 58
+58 57 57
+57 56 56
+56 55 55
+55 54 54
+54 53 53
+53 52 52
+52 51 51
+51 50 50
+50 49 49
+49 48 48
+48 47 47
+47 46 46
+46 45 45
+45 44 44
+44 43 43
+43 42 42
+42 41 41
+41 40 40
+40 39 39
+39 38 38
+38 37 37
+37 36 36
+36 35 35
+35 34 34
+34 33 33
+33 32 32
+32 31 31
+31 30 30
+30 29 29
+29 28 28
+28 27 27
+27 26 26
+26 25 25
+25 24 24
+24 23 23
+23 22 22
+22 21 21
+21 20 20
+20 19 19
+19 18 18
+18 17 17
+17 16 16
+16 15 15
+15 14 14
+14 13 13
+13 12 12
+12 11 11
+11 10 10
+10 9 9
+9 8 8
+8 7 7
+7 6 6
+6 5 5
+5 4 4
+4 3 3
+3 2 2
+2 1 1
+1 0 0
+set sort_buffer_size= @save_sort_buffer_size;
+DROP TABLE t1;
+End of 5.3 tests
diff --git a/mysql-test/r/order_by_sortkey.result b/mysql-test/r/order_by_sortkey.result
new file mode 100644
index 00000000000..717780f0af2
--- /dev/null
+++ b/mysql-test/r/order_by_sortkey.result
@@ -0,0 +1,159 @@
+CREATE TABLE t1(
+f0 int auto_increment PRIMARY KEY,
+f1 int,
+f2 varchar(200)
+);
+INSERT INTO t1(f1, f2) VALUES
+(0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
+(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
+(11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
+(16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
+(21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
+(26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
+(31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
+(36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
+(41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
+(46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
+(51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
+(56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
+(61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
+(66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
+(71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
+(76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
+(81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
+(86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
+(91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
+(96,"96"),(97,"97"),(98,"98"),(99,"99");
+CREATE TEMPORARY TABLE tmp (f1 int, f2 varchar(20));
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+set sort_buffer_size= 32768;
+FLUSH STATUS;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SELECT * FROM t1 ORDER BY f2 LIMIT 100;
+f0 f1 f2
+1 0 0
+101 0 0
+201 0 0
+301 0 0
+401 0 0
+501 0 0
+601 0 0
+701 0 0
+801 0 0
+901 0 0
+1001 0 0
+1101 0 0
+1201 0 0
+1301 0 0
+1401 0 0
+1501 0 0
+1601 0 0
+1701 0 0
+1801 0 0
+1901 0 0
+2001 0 0
+2101 0 0
+2201 0 0
+2301 0 0
+2401 0 0
+2501 0 0
+2601 0 0
+2701 0 0
+2801 0 0
+2901 0 0
+3001 0 0
+3101 0 0
+3201 0 0
+3301 0 0
+3401 0 0
+3501 0 0
+3601 0 0
+3701 0 0
+3801 0 0
+3901 0 0
+4001 0 0
+4101 0 0
+4201 0 0
+4301 0 0
+4401 0 0
+4501 0 0
+4601 0 0
+4701 0 0
+4801 0 0
+4901 0 0
+5001 0 0
+5101 0 0
+5201 0 0
+5301 0 0
+5401 0 0
+5501 0 0
+5601 0 0
+5701 0 0
+5801 0 0
+5901 0 0
+6001 0 0
+6101 0 0
+6201 0 0
+6301 0 0
+6401 0 0
+6501 0 0
+6601 0 0
+6701 0 0
+6801 0 0
+6901 0 0
+7001 0 0
+7101 0 0
+7201 0 0
+7301 0 0
+7401 0 0
+7501 0 0
+7601 0 0
+7701 0 0
+7801 0 0
+7901 0 0
+8001 0 0
+8101 0 0
+8201 0 0
+8301 0 0
+8401 0 0
+8501 0 0
+8601 0 0
+8701 0 0
+8801 0 0
+8901 0 0
+9001 0 0
+9101 0 0
+9201 0 0
+9301 0 0
+9401 0 0
+9501 0 0
+9601 0 0
+9701 0 0
+9801 0 0
+9901 0 0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 100
+Sort_scan 1
+DROP TABLE t1, tmp;
diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result
index 10700d0ba73..54378f16d49 100644
--- a/mysql-test/r/parser.result
+++ b/mysql-test/r/parser.result
@@ -441,7 +441,7 @@ select master_pos_wait();
ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
select master_pos_wait(1);
ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
-select master_pos_wait(1, 2, 3, 4);
+select master_pos_wait(1, 2, 3, 4, 5);
ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
select rand(1, 2, 3);
ERROR 42000: Incorrect parameter count in the call to native function 'rand'
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 431c5dda116..40586b8d54b 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -2473,3 +2473,17 @@ SELECT * FROM vtmp;
1
DROP VIEW vtmp;
DROP TABLE t1;
+#
+# MDEV-365 "Got assertion when doing alter table on a partition"
+#
+CREATE TABLE t1 ( i INT ) ENGINE=Aria PARTITION BY HASH(i) PARTITIONS 2;
+INSERT INTO t1 VALUES (1),(2),(2),(3),(4);
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+SELECT * from t1 order by i;
+i
+1
+2
+2
+3
+4
+DROP TABLE t1;
diff --git a/mysql-test/r/partition_cache.result b/mysql-test/r/partition_cache.result
index ac2da9bb78a..cd579d00952 100644
--- a/mysql-test/r/partition_cache.result
+++ b/mysql-test/r/partition_cache.result
@@ -27,7 +27,7 @@ a
3
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 0
+Qcache_queries_in_cache 1
drop table t1;
commit;
create table t1 (a int not null) PARTITION BY KEY (a) PARTITIONS 3;
@@ -50,7 +50,7 @@ a
2
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 0
+Qcache_queries_in_cache 3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
@@ -69,7 +69,7 @@ a
2
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 0
+Qcache_queries_in_cache 6
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
@@ -93,14 +93,14 @@ a
2
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 0
+Qcache_queries_in_cache 2
show status like "Qcache_hits";
Variable_name Value
-Qcache_hits 0
+Qcache_hits 1
commit;
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 0
+Qcache_queries_in_cache 2
drop table t3,t2,t1;
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) PARTITION BY HASH (id) PARTITIONS 3;
select count(*) from t1;
@@ -164,7 +164,7 @@ count(*)
2
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 0
+Qcache_queries_in_cache 1
connection connection1
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
@@ -197,9 +197,9 @@ count(*)
2
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 0
+Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
-Qcache_hits 0
+Qcache_hits 1
set @@global.query_cache_size = @save_query_cache_size;
drop table t2;
diff --git a/mysql-test/r/partition_cache_innodb.result b/mysql-test/r/partition_cache_innodb.result
new file mode 100644
index 00000000000..0d0abbb096c
--- /dev/null
+++ b/mysql-test/r/partition_cache_innodb.result
@@ -0,0 +1,151 @@
+SET SESSION STORAGE_ENGINE = innodb;
+drop table if exists t1;
+set @save_query_cache_size = @@global.query_cache_size;
+# Test that partitions works with query cache
+flush query cache;
+SET GLOBAL query_cache_size=1024*1024*512;
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL ,
+`created_at` datetime NOT NULL,
+`cool` tinyint default 0
+);
+ALTER TABLE t1 PARTITION BY RANGE (TO_DAYS(created_at)) (
+PARTITION month_2010_4 VALUES LESS THAN (734258),
+PARTITION month_2010_5 VALUES LESS THAN (734289),
+PARTITION month_max VALUES LESS THAN MAXVALUE
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `created_at` datetime NOT NULL,
+ `cool` tinyint(4) DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (TO_DAYS(created_at))
+(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = InnoDB,
+ PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = InnoDB,
+ PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+INSERT INTO t1 VALUES (1, now(), 0);
+flush status;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+drop table t1;
+# Test that sub-partitions works with query cache
+flush query cache;
+SET GLOBAL query_cache_size=1024*1024*512;
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL ,
+`created_at` datetime NOT NULL,
+`cool` tinyint default 0
+)
+PARTITION BY RANGE (TO_DAYS(created_at))
+subpartition by hash(cool) subpartitions 3 (
+PARTITION month_2010_4 VALUES LESS THAN (734258),
+PARTITION month_2010_5 VALUES LESS THAN (734289),
+PARTITION month_max VALUES LESS THAN MAXVALUE
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `created_at` datetime NOT NULL,
+ `cool` tinyint(4) DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (TO_DAYS(created_at))
+SUBPARTITION BY HASH (cool)
+SUBPARTITIONS 3
+(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = InnoDB,
+ PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = InnoDB,
+ PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+INSERT INTO t1 VALUES (1, now(), 0);
+flush status;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+drop table t1;
+#
+# MySQL bug#53775 Query on partitioned table returns cached result
+# from previous transaction
+#
+flush query cache;
+flush status;
+SET GLOBAL query_cache_size=1024*1024*512;
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL ,
+`created_at` datetime NOT NULL,
+`cool` tinyint default 0
+);
+ALTER TABLE t1 PARTITION BY RANGE (TO_DAYS(created_at)) (
+PARTITION month_2010_4 VALUES LESS THAN (734258),
+PARTITION month_2010_5 VALUES LESS THAN (734289),
+PARTITION month_max VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t1 VALUES (1, now(), 0);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+BEGIN;
+UPDATE `t1` SET `cool` = 1 WHERE `id` = 1;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+1
+ROLLBACK;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+BEGIN;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+ROLLBACK;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+drop table t1;
+set @@global.query_cache_size = @save_query_cache_size;
diff --git a/mysql-test/r/partition_cache_myisam.result b/mysql-test/r/partition_cache_myisam.result
new file mode 100644
index 00000000000..0b617c03590
--- /dev/null
+++ b/mysql-test/r/partition_cache_myisam.result
@@ -0,0 +1,153 @@
+SET SESSION STORAGE_ENGINE = myisam;
+drop table if exists t1;
+set @save_query_cache_size = @@global.query_cache_size;
+# Test that partitions works with query cache
+flush query cache;
+SET GLOBAL query_cache_size=1024*1024*512;
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL ,
+`created_at` datetime NOT NULL,
+`cool` tinyint default 0
+);
+ALTER TABLE t1 PARTITION BY RANGE (TO_DAYS(created_at)) (
+PARTITION month_2010_4 VALUES LESS THAN (734258),
+PARTITION month_2010_5 VALUES LESS THAN (734289),
+PARTITION month_max VALUES LESS THAN MAXVALUE
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `created_at` datetime NOT NULL,
+ `cool` tinyint(4) DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (TO_DAYS(created_at))
+(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = MyISAM,
+ PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = MyISAM,
+ PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+INSERT INTO t1 VALUES (1, now(), 0);
+flush status;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+drop table t1;
+# Test that sub-partitions works with query cache
+flush query cache;
+SET GLOBAL query_cache_size=1024*1024*512;
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL ,
+`created_at` datetime NOT NULL,
+`cool` tinyint default 0
+)
+PARTITION BY RANGE (TO_DAYS(created_at))
+subpartition by hash(cool) subpartitions 3 (
+PARTITION month_2010_4 VALUES LESS THAN (734258),
+PARTITION month_2010_5 VALUES LESS THAN (734289),
+PARTITION month_max VALUES LESS THAN MAXVALUE
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `created_at` datetime NOT NULL,
+ `cool` tinyint(4) DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (TO_DAYS(created_at))
+SUBPARTITION BY HASH (cool)
+SUBPARTITIONS 3
+(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = MyISAM,
+ PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = MyISAM,
+ PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+INSERT INTO t1 VALUES (1, now(), 0);
+flush status;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+0
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+drop table t1;
+#
+# MySQL bug#53775 Query on partitioned table returns cached result
+# from previous transaction
+#
+flush query cache;
+flush status;
+SET GLOBAL query_cache_size=1024*1024*512;
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL ,
+`created_at` datetime NOT NULL,
+`cool` tinyint default 0
+);
+ALTER TABLE t1 PARTITION BY RANGE (TO_DAYS(created_at)) (
+PARTITION month_2010_4 VALUES LESS THAN (734258),
+PARTITION month_2010_5 VALUES LESS THAN (734289),
+PARTITION month_max VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t1 VALUES (1, now(), 0);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+BEGIN;
+UPDATE `t1` SET `cool` = 1 WHERE `id` = 1;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+1
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+1
+BEGIN;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+1
+ROLLBACK;
+SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
+cool
+1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+drop table t1;
+set @@global.query_cache_size = @save_query_cache_size;
diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result
index 4d48b70d26a..ec7fd798d4c 100644
--- a/mysql-test/r/partition_pruning.result
+++ b/mysql-test/r/partition_pruning.result
@@ -787,7 +787,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
+1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
@@ -1116,7 +1116,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
+1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
@@ -1445,7 +1445,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
+1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 7629775b892..95217d9716a 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -3056,7 +3056,7 @@ DROP TABLE t1;
End of 5.1 tests.
#
-# LP bug#1001500 Crash on the second execution of the PS for
+# lp:1001500 Crash on the second execution of the PS for
# a query with degenerated conjunctive condition
# (see also mysql bug#12582849)
#
@@ -3996,108 +3996,4 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
deallocate prepare st;
drop table t1;
-#
-# LP bug#993459 Execution of PS for a query with GROUP BY
-# returns wrong result (see also mysql bug#13805127)
-#
-PREPARE s1 FROM
-"
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2
-";
-
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
-(
-SELECT 3 as c2 FROM dual WHERE @x = 1
-UNION
-SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
-) AS t1,
-(
-SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
-UNION
-SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
-UNION
-SELECT '2012-03-01 01:99345900:00', 2, 1 FROM dual
-) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
-c1 c2 count(c3)
-2012-03-01 01:00:00 3 1
-2012-03-01 01:99345900:00 2 1
-2012-03-01 02:00:00 3 1
-
-EXECUTE s1;
-c1 c2 count(c3)
-2012-03-01 01:00:00 2 1
-2012-03-01 01:00:00 3 1
-2012-03-01 02:00:00 3 1
-
-SET @x = 2;
-SELECT c1, t2.c2, count(c3)
-FROM
-(
-SELECT 3 as c2 FROM dual WHERE @x = 1
-UNION
-SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
-) AS t1,
-(
-SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
-UNION
-SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
-UNION
-SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
-) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
-c1 c2 count(c3)
-2012-03-01 01:00:00 2 1
-
-EXECUTE s1;
-c1 c2 count(c3)
-2012-03-01 01:00:00 2 1
-
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
-(
-SELECT 3 as c2 FROM dual WHERE @x = 1
-UNION
-SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
-) AS t1,
-(
-SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
-UNION
-SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
-UNION
-SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
-) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
-c1 c2 count(c3)
-2012-03-01 01:00:00 2 1
-2012-03-01 01:00:00 3 1
-2012-03-01 02:00:00 3 1
-
-EXECUTE s1;
-c1 c2 count(c3)
-2012-03-01 01:00:00 2 1
-2012-03-01 01:00:00 3 1
-2012-03-01 02:00:00 3 1
-DEALLOCATE PREPARE s1;
# End of 5.3 tests
diff --git a/mysql-test/r/replace.result b/mysql-test/r/replace.result
index 842302c89ac..59b8565f671 100644
--- a/mysql-test/r/replace.result
+++ b/mysql-test/r/replace.result
@@ -13,9 +13,9 @@ drop table t1;
create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value");
insert into t1 values (126,"first"),(63, "middle"),(0,"last");
insert into t1 values (0,"error");
-ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+ERROR 22003: Out of range value for column 'a' at row 1
replace into t1 values (0,"error");
-ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+ERROR 22003: Out of range value for column 'a' at row 1
replace into t1 values (126,"first updated");
replace into t1 values (63,default);
select * from t1;
diff --git a/mysql-test/r/show_explain.result b/mysql-test/r/show_explain.result
new file mode 100644
index 00000000000..bf96ad88f23
--- /dev/null
+++ b/mysql-test/r/show_explain.result
@@ -0,0 +1,1078 @@
+drop table if exists t0, t1, t2, t3, t4;
+drop view if exists v1;
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int);
+insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C;
+alter table t1 add b int, add c int, add filler char(32);
+update t1 set b=a, c=a, filler='fooo';
+alter table t1 add key(a), add key(b);
+show explain for 2000000000;
+ERROR HY000: Unknown thread id: 2000000000
+show explain for (select max(a) from t0);
+ERROR HY000: You may only use constant expressions in this statement
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+show explain for $thr1;
+ERROR HY000: Target is not running an EXPLAINable command
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select count(*) from t1 where a < 100000;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index a a 5 NULL 1000 Using where; Using index
+Warnings:
+Note 1003 select count(*) from t1 where a < 100000
+count(*)
+1000
+select max(c) from t1 where a < 10;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using index condition
+Warnings:
+Note 1003 select max(c) from t1 where a < 10
+max(c)
+9
+# We can catch EXPLAIN, too.
+set @show_expl_tmp= @@optimizer_switch;
+set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
+explain select max(c) from t1 where a < 10;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
+Warnings:
+Note 1003 explain select max(c) from t1 where a < 10
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
+set optimizer_switch= @show_expl_tmp;
+# UNION, first branch
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+explain select a from t0 A union select a+1 from t0 B;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10
+2 UNION B ALL NULL NULL NULL NULL 10
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 explain select a from t0 A union select a+1 from t0 B
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10
+2 UNION B ALL NULL NULL NULL NULL 10
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+# UNION, second branch
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+explain select a from t0 A union select a+1 from t0 B;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10
+2 UNION B ALL NULL NULL NULL NULL 10
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 explain select a from t0 A union select a+1 from t0 B
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10
+2 UNION B ALL NULL NULL NULL NULL 10
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+# Uncorrelated subquery, select
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 B) from t0 A where a<1;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
+2 SUBQUERY B ALL NULL NULL NULL NULL 10
+Warnings:
+Note 1003 select a, (select max(a) from t0 B) from t0 A where a<1
+a (select max(a) from t0 B)
+0 9
+# Uncorrelated subquery, explain
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+explain select a, (select max(a) from t0 B) from t0 A where a<1;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
+2 SUBQUERY B ALL NULL NULL NULL NULL 10
+Warnings:
+Note 1003 explain select a, (select max(a) from t0 B) from t0 A where a<1
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
+2 SUBQUERY B ALL NULL NULL NULL NULL 10
+# correlated subquery, select
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+# correlated subquery, explain
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+# correlated subquery, select, while inside the subquery
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+# correlated subquery, explain, while inside the subquery
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+# correlated subquery, explain, while inside the subquery
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+# Try to do SHOW EXPLAIN for a query that runs a SET command:
+# I've found experimentally that select_id==2 here...
+#
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+set @foo= (select max(a) from t0 where sin(a) >0);
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+#
+# Attempt SHOW EXPLAIN for an UPDATE
+#
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+drop table t2;
+#
+# Attempt SHOW EXPLAIN for a DELETE
+#
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+drop table t2;
+#
+# Multiple SHOW EXPLAIN calls for one select
+#
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Query plan already deleted
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Query plan already deleted
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+a SUBQ
+0 0
+1 0
+2 0
+drop table t2;
+#
+# SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
+#
+explain select * from t0 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort
+set debug_dbug='d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+select * from t0 order by a;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort
+Warnings:
+Note 1003 select * from t0 order by a
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+#
+# SHOW EXPLAIN for SELECT ... with "Using temporary"
+#
+explain select distinct a from t0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
+set debug_dbug='d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+select distinct a from t0;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
+Warnings:
+Note 1003 select distinct a from t0
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+#
+# SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
+#
+explain select distinct a from t0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
+set debug_dbug='d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+select distinct a from t0;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
+Warnings:
+Note 1003 select distinct a from t0
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+set debug_dbug='';
+#
+# MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY
+#
+CREATE TABLE t2 ( a INT );
+INSERT INTO t2 VALUES (1),(2),(1),(4),(2);
+explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
+set debug_dbug='d,show_explain_in_find_all_keys';
+SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
+# FIXED by "conservative assumptions about when QEP is available" fix:
+# NOTE: current code will not show "Using join buffer":
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+a
+1
+2
+4
+set debug_dbug='';
+DROP TABLE t2;
+#
+# MDEV-239: Assertion `field_types == 0 ... ' failed in Protocol_text::store(double, uint32, String*) with
+# SHOW EXPLAIN over EXPLAIN EXTENDED
+#
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (1),(2),(1),(4),(2);
+EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a`
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a`
+set debug_dbug='';
+DROP TABLE t2;
+#
+# MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed in
+# JOIN::print_explain on query with a JOIN, TEMPTABLE view,
+#
+CREATE TABLE t3 (a INT);
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t3;
+INSERT INTO t3 VALUES (8);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9);
+explain SELECT * FROM v1, t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+1 PRIMARY t2 ALL NULL NULL NULL NULL 6
+2 DERIVED t3 system NULL NULL NULL NULL 1
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+SELECT * FROM v1, t2;
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+a b
+8 4
+8 5
+8 6
+8 7
+8 8
+8 9
+set debug_dbug='';
+DROP VIEW v1;
+DROP TABLE t2, t3;
+#
+# MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries
+#
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+select sleep(1);
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sleep(1)
+sleep(1)
+0
+set debug_dbug='';
+#
+# Same as above, but try another reason for JOIN to be degenerate
+#
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+select * from t0 where 1>10;
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+a
+set debug_dbug='';
+#
+# Same as above, but try another reason for JOIN to be degenerate (2)
+#
+create table t3(a int primary key);
+insert into t3 select a from t0;
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+select * from t0,t3 where t3.a=112233;
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+a a
+set debug_dbug='';
+drop table t3;
+#
+# MDEV-270: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with
+# select tables optimized away
+#
+CREATE TABLE t2 (pk INT PRIMARY KEY, a INT ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+(1,4),(2,62),(3,7),(4,1),(5,0),(6,7),(7,7),(8,1),(9,7),(10,1),
+(11,5),(12,2),(13,0),(14,1),(15,8),(16,1),(17,1),(18,9),(19,1),(20,5) ;
+explain SELECT * FROM t2 WHERE a =
+(SELECT MAX(a) FROM t2
+WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using where
+2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1 Using where
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_do_select';
+SELECT * FROM t2 WHERE a =
+(SELECT MAX(a) FROM t2
+WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
+);
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using where
+2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1 Using where
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+Warnings:
+Note 1003 SELECT * FROM t2 WHERE a =
+(SELECT MAX(a) FROM t2
+WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
+)
+pk a
+3 7
+6 7
+7 7
+9 7
+set debug_dbug='';
+drop table t2;
+#
+# MDEV-273: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with impossible WHERE
+#
+CREATE TABLE t2 (a1 INT, KEY(a1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+(4),(6),(7),(1),(0),(7),(7),(1),(7),(1),
+(5),(2),(0),(1),(8),(1),(1),(9),(1),(5);
+CREATE TABLE t3 (b1 INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES
+(4),(5),(8),(4),(8),(2),(9),(6),(4),(8),
+(3),(5),(9),(6),(8),(3),(2),(6),(3),(1),
+(4),(3),(1),(7),(0),(0),(9),(5),(9),(0),
+(2),(2),(5),(9),(1),(4),(8),(6),(5),(5),
+(1),(7),(2),(8),(9),(3),(2),(6),(6),(5),
+(4),(3),(2),(7),(4),(6),(0),(8),(5),(8),
+(2),(9),(7),(5),(7),(0),(4),(3),(1),(0),
+(6),(2),(8),(3),(7),(3),(5),(5),(1),(2),
+(1),(7),(1),(9),(9),(8),(3);
+CREATE TABLE t4 (c1 INT) ENGINE=MyISAM;
+EXPLAIN
+SELECT count(*) FROM t2, t3
+WHERE a1 < ALL (
+SELECT a1 FROM t2
+WHERE a1 IN ( SELECT a1 FROM t2, t4 )
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index NULL a1 5 NULL 20 Using where; Using index
+1 PRIMARY t3 ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join)
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_do_select';
+SELECT count(*) FROM t2, t3
+WHERE a1 < ALL (
+SELECT a1 FROM t2
+WHERE a1 IN ( SELECT a1 FROM t2, t4 )
+);
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index NULL a1 5 NULL 20 Using where; Using index
+1 PRIMARY t3 ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join)
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+Warnings:
+Note 1003 SELECT count(*) FROM t2, t3
+WHERE a1 < ALL (
+SELECT a1 FROM t2
+WHERE a1 IN ( SELECT a1 FROM t2, t4 )
+)
+count(*)
+1740
+set debug_dbug='';
+drop table t2, t3, t4;
+#
+# MDEV-275: SHOW EXPLAIN: server crashes in JOIN::print_explain with IN subquery and aggregate function
+#
+CREATE TABLE t2 ( `pk` INT NOT NULL PRIMARY KEY, `a1` INT NOT NULL, KEY(`a1`)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+(1,5),(2,4),(3,6),(4,9),(5,2),(6,8),(7,4),(8,8),(9,0),(10,43),
+(11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2);
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`);
+show explain for $thr2;
+ERROR HY000: Target is not running an EXPLAINable command
+pk a1
+set debug_dbug='';
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# MDEV-305: SHOW EXPLAIN: ref returned by SHOW EXPLAIN is different from the normal EXPLAIN ('const' vs empty string)
+#
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES (3),(1),(5),(1);
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+SELECT 'test' FROM t1 WHERE a=1;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 1 Using index
+Warnings:
+Note 1003 SELECT 'test' FROM t1 WHERE a=1
+test
+test
+test
+set debug_dbug='';
+DROP TABLE t1;
+#
+# MDEV-299: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN changes back and forth during query execution
+#
+create table t1 (key1 int, col1 int, col2 int, filler char(100), key(key1));
+insert into t1 select A.a+ 10 * B.a, 10, 10, 'filler-data' from t0 A, t0 B;
+update t1 set col1=3, col2=10 where key1=1;
+update t1 set col1=3, col2=1000 where key1=2;
+update t1 set col1=3, col2=10 where key1=3;
+update t1 set col1=3, col2=1000 where key1=4;
+set @tmp_mdev299_jcl= @@join_cache_level;
+set join_cache_level=0;
+explain select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where
+1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1)
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_test_if_quick_select';
+select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where
+1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1)
+Warnings:
+Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where
+1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1)
+Warnings:
+Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where
+1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1)
+Warnings:
+Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where
+1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1)
+Warnings:
+Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100
+count(*)
+212
+set debug_dbug='';
+drop table t1;
+#
+# MDEV-297: SHOW EXPLAIN: Server gets stuck until timeout occurs while
+# executing SHOW INDEX and SHOW EXPLAIN in parallel
+#
+CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c));
+INSERT INTO t1 (a) VALUES (3),(1),(5),(1);
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+SHOW INDEX FROM t1;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE STATISTICS ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases
+Warnings:
+Note 1003 SHOW INDEX FROM t1
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE
+t1 1 b 1 b A NULL NULL NULL YES BTREE
+t1 1 c 1 c A NULL NULL NULL YES BTREE
+set debug_dbug='';
+DROP TABLE t1;
+#
+# MDEV-324: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN for a query with TEMPTABLE view
+# loses 'DERIVED' line on the way without saying that the plan was already deleted
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN SELECT a + 1 FROM v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 2
+set debug_dbug='d,show_explain_probe_join_tab_preread';
+set @show_explain_probe_select_id=1;
+SELECT a + 1 FROM v1;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL Query plan already deleted
+Warnings:
+Note 1003 SELECT a + 1 FROM v1
+a + 1
+2
+3
+set debug_dbug='';
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# MDEV-323: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN loses
+# 'UNION RESULT' line on the way without saying that the plan was already deleted
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (4),(6);
+EXPLAIN
+SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+set debug_dbug='d,show_explain_probe_union_read';
+SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 )
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 )
+a
+set debug_dbug='';
+DROP TABLE t1;
+#
+# MDEV-327: SHOW EXPLAIN: Different select_type in plans produced by SHOW EXPLAIN
+# and standard EXPLAIN: 'SUBQUERY' vs 'DEPENDENT SUBQUERY'
+#
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+INSERT INTO t1 VALUES
+(4),(6),(3),(5),(3),(246),(2),(9),(3),(8),
+(1),(8),(8),(5),(7),(5),(1),(6),(2),(9);
+CREATE TABLE t2 (b INT) ENGINE=Aria;
+INSERT INTO t2 VALUES
+(1),(7),(4),(7),(0),(2),(9),(4),(0),(9),
+(1),(3),(8),(8),(18),(84),(6),(3),(6),(6);
+EXPLAIN
+SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
+WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using where
+1 PRIMARY t2 ALL NULL NULL NULL NULL 20
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 20
+3 SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
+WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using where
+1 PRIMARY t2 ALL NULL NULL NULL NULL 20
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 20
+3 SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where
+Warnings:
+Note 1003 SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
+WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b )
+a b
+set debug_dbug='';
+DROP TABLE t1, t2;
+#
+# Test that SHOW EXPLAIN will print 'Distinct'.
+#
+CREATE TABLE t1 (a int(10) unsigned not null primary key,b int(10) unsigned);
+INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1);
+CREATE TABLE t3 (a int(10) unsigned, key(A), b text);
+INSERT INTO t3 VALUES (1,'1'),(2,'2');
+create temporary table t4 select * from t3;
+insert into t3 select * from t4;
+insert into t4 select * from t3;
+insert into t3 select * from t4;
+insert into t4 select * from t3;
+insert into t3 select * from t4;
+insert into t4 select * from t3;
+insert into t3 select * from t4;
+explain select distinct t1.a from t1,t3 where t1.a=t3.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
+1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select distinct t1.a from t1,t3 where t1.a=t3.a;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
+1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct
+Warnings:
+Note 1003 select distinct t1.a from t1,t3 where t1.a=t3.a
+a
+1
+2
+set debug_dbug='';
+drop table t1,t3,t4;
+#
+# ---------- SHOW EXPLAIN and permissions -----------------
+#
+grant ALL on test.* to test2@localhost;
+grant super on *.* to test2@localhost;
+#
+# First, make sure that user 'test2' cannot do SHOW EXPLAIN on us
+#
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select * from t0 where a < 3;
+show explain for $thr2;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select * from t0 where a < 3
+a
+0
+1
+2
+set debug_dbug='';
+#
+# Check that user test2 can do SHOW EXPLAIN on its own queries
+#
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select * from t0 where a < 3;
+show explain for $thr_con2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select * from t0 where a < 3
+a
+0
+1
+2
+#
+# Now, grant test2 a PROCESSLIST permission, and see that he's able to observe us
+#
+grant process on *.* to test2@localhost;
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select * from t0 where a < 3;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select * from t0 where a < 3
+a
+0
+1
+2
+set debug_dbug='';
+revoke all privileges on test.* from test2@localhost;
+drop user test2@localhost;
+#
+# Test that it is possible to KILL a SHOW EXPLAIN command that's waiting
+# on its target thread
+#
+create table t1 (pk int primary key, data char(64)) engine=innodb;
+insert into t1 select A.a + 10 * B.a + 100 * C.a, 'data1' from t0 A, t0 B, t0 C;
+# Lock two threads
+set autocommit=0;
+select * from t1 where pk between 10 and 20 for update;
+pk data
+10 data1
+11 data1
+12 data1
+13 data1
+14 data1
+15 data1
+16 data1
+17 data1
+18 data1
+19 data1
+20 data1
+set autocommit=0;
+select * from t1 where pk between 10 and 20 for update;
+# do: send_eval show explain for thr2;
+kill query $thr_default;
+ERROR 70100: Query execution was interrupted
+rollback;
+pk data
+10 data1
+11 data1
+12 data1
+13 data1
+14 data1
+15 data1
+16 data1
+17 data1
+18 data1
+19 data1
+20 data1
+drop table t1;
+#
+# Check that the I_S table is invisible
+#
+select table_name from information_schema.tables where table_schema='information_schema' and table_name like '%explain%';
+table_name
+#
+# MDEV-325: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN is different from standard EXPLAIN: type ALL vs 'index_merge'..
+#
+CREATE TABLE t1 (a INT, b INT, KEY(a), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+(8,0),(128,5050),(5372,8),(234,7596),(2,0),(2907,8930),(1,0),
+(0,5224),(8,7638),(960,5),(9872,1534),(0,2295),(3408,9809),
+(7,0),(1168,0),(2089,5570),(0,205),(88,1018),(0,26528),
+(0,0),(4,5567),(1444,145),(6,0),(1,7535),(7793,534),(70,9),
+(178,1),(44,5),(189,0),(3,0);
+EXPLAIN
+SELECT a+SLEEP(0.01) FROM t1
+WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
+ORDER BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+SELECT a+SLEEP(0.01) FROM t1
+WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
+ORDER BY b;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort
+Warnings:
+Note 1003 SELECT a+SLEEP(0.01) FROM t1
+WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
+ORDER BY b
+a+SLEEP(0.01)
+0
+5372
+70
+0
+0
+0
+0
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_do_select';
+SELECT a+SLEEP(0.01) FROM t1
+WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
+ORDER BY b;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort
+Warnings:
+Note 1003 SELECT a+SLEEP(0.01) FROM t1
+WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
+ORDER BY b
+a+SLEEP(0.01)
+0
+5372
+70
+0
+0
+0
+0
+set debug_dbug='';
+drop table t1;
+#
+# MDEV-298: SHOW EXPLAIN: Plan returned by SHOW EXPLAIN only contains
+# 'Using temporary' while the standard EXPLAIN says 'Using temporary; Using filesort'
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),
+(10),(11),(12),(13),(14),(15),(16);
+INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12, t1 t13;
+EXPLAIN SELECT a FROM t1 GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+SELECT a FROM t1 GROUP BY a;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort
+Warnings:
+Note 1003 SELECT a FROM t1 GROUP BY a
+a
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+set debug_dbug='';
+drop table t1;
+#
+# MDEV-408: SHOW EXPLAIN: Some values are chopped off in SHOW EXPLAIN output
+#
+CREATE TABLE t1 (a INT, b VARCHAR(35)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (3989,'Abilene'),(3873,'Akron');
+CREATE TABLE t2 (c INT, d VARCHAR(52) PRIMARY KEY, KEY(c)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (86,'English'),(87,'Russian');
+explain SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t2 index_subquery PRIMARY,c c 5 func 1 Using index; Using where
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t2 index_subquery PRIMARY,c c 5 func 1 Using index; Using where
+Warnings:
+Note 1003 SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'
+SUM(a + SLEEP(0.1))
+7862
+set debug_dbug='';
+drop table t1, t2;
+#
+# MDEV-412: SHOW EXPLAIN: Server crashes in JOIN::print_explain on a query with inner join and ORDER BY the same column twice
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(3), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+(3795,'USA'),(3913,'USA'),(3846,'ITA'),(4021,'USA'),(4005,'RUS'),(4038,'USA'),
+(3825,'USA'),(3840,'USA'),(3987,'USA'),(3807,'USA'),(3896,'USA'),(4052,'USA'),
+(3973,'USA'),(3982,'ITA'),(3965,'USA'),(3852,'RUS'),(4006,'USA'),(3800,'USA'),
+(4020,'USA'),(4040,'USA'),(3916,'USA'),(3817,'USA'),(3885,'USA'),(3802,'USA'),
+(4009,'ITA'),(3895,'USA'),(3963,'RUS'),(4045,'USA'),(3988,'USA'),(3815,'USA'),
+(4063,'USA'),(3978,'USA'),(4019,'USA'),(3954,'USA'),(3950,'USA'),(3974,'ITA'),
+(4054,'USA'),(4061,'RUS'),(3976,'USA'),(3966,'USA'),(3957,'USA'),(3981,'USA'),
+(3923,'USA'),(3876,'USA'),(3819,'USA'),(3877,'USA'),(3829,'ITA'),(3964,'USA'),
+(4053,'RUS'),(3917,'USA'),(3874,'USA'),(4023,'USA'),(4001,'USA'),(3872,'USA'),
+(3890,'USA'),(3962,'USA'),(3886,'USA'),(4026,'ITA'),(3869,'USA'),(3937,'RUS'),
+(3975,'USA'),(3944,'USA'),(3908,'USA'),(3867,'USA'),(3947,'USA'),(3838,'USA'),
+(3796,'USA'),(3893,'USA'),(3920,'ITA'),(3994,'USA'),(3875,'RUS'),(4011,'USA'),
+(4013,'USA'),(3810,'USA'),(3834,'USA'),(3968,'USA'),(3931,'USA'),(3839,'USA'),
+(4042,'USA'),(4039,'ITA'),(3811,'USA'),(3837,'RUS'),(4041,'USA'),(3884,'USA'),
+(3894,'USA'),(3879,'USA'),(3942,'USA'),(3959,'USA'),(3814,'USA'),(4044,'USA'),
+(3971,'ITA'),(3823,'USA'),(3793,'RUS'),(3855,'USA'),(3905,'USA'),(3865,'USA'),
+(4046,'USA'),(3990,'USA'),(4022,'USA'),(3833,'USA'),(3918,'USA'),(4064,'ITA'),
+(3821,'USA'),(3836,'RUS'),(3921,'USA'),(3914,'USA'),(3888,'USA');
+CREATE TABLE t2 (c VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('USA');
+CREATE TABLE t3 (d VARCHAR(3), e VARCHAR(52), PRIMARY KEY (d,e)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES
+('JPN','Japanese'),('KOR','Korean'),('POL','Polish'),('PRT','Portuguese'),
+('ESP','Spanish'),('FRA','French'),('VNM','Vietnamese');
+explain
+SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 system NULL NULL NULL NULL 1 Using filesort
+1 SIMPLE t1 index b b 6 NULL 107 Using where; Using index
+1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_do_select';
+SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 system NULL NULL NULL NULL 1 Using filesort
+1 SIMPLE t1 index b b 6 NULL 107 Using where; Using index
+1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index
+Warnings:
+Note 1003 SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2
+field1 field2
+set debug_dbug='';
+DROP TABLE t1,t2,t3;
+#
+# MDEV-423: SHOW EXPLAIN: 'Using where' for a subquery is shown in EXPLAIN, but not in SHOW EXPLAIN output
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7),(0),(9),(3),(4),(2),(5),(7),(0),(9),(3),(4),(2),(5);
+CREATE TABLE t2 (b INT, c INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+(0,4),(8,6),(1,3),(8,5),(9,3),(24,246),(6,2),(1,9),(6,3),(2,8),
+(4,1),(8,8),(4,8),(4,5),(7,7),(4,5),(1,1),(9,6),(4,2),(8,9);
+create table t3 like t2;
+insert into t3 select * from t2;
+explain
+SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
+WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 14
+1 PRIMARY t2 ALL NULL NULL NULL NULL 20
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 20 Using where
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
+WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 14
+1 PRIMARY t2 ALL NULL NULL NULL NULL 20
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Query plan already deleted
+Warnings:
+Note 1003 SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
+WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10
+max(a+b+c)
+279
+set debug_dbug='';
+DROP TABLE t1,t2,t3;
+#
+# MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree)
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (8),(9);
+EXPLAIN SELECT * FROM t1
+WHERE ( 8, 89 ) IN ( SELECT b, SUM( DISTINCT b ) FROM t2 GROUP BY b );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using filesort
+DROP TABLE t1,t2;
+#
+# Check if queries in non-default charsets work.
+#
+set names cp1251;
+select charset('ãû');
+charset('ãû')
+cp1251
+select hex('ãû');
+hex('ãû')
+E3FB
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select * from t0 where length('ãû') = a;
+set names utf8;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select * from t0 where length('гы') = a
+set names default;
+a
+2
+set debug_dbug='';
+set names default;
+#
+# MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref if FOR contains a non-numeric value
+#
+show explain for foo;
+ERROR HY000: You may only use constant expressions in this statement
+# End
+drop table t0;
diff --git a/mysql-test/r/show_explain_ps.result b/mysql-test/r/show_explain_ps.result
new file mode 100644
index 00000000000..f9b82c85f01
--- /dev/null
+++ b/mysql-test/r/show_explain_ps.result
@@ -0,0 +1,29 @@
+drop table if exists t0, t1;
+select * from performance_schema.setup_instruments where name like '%show_explain%';
+NAME ENABLED TIMED
+wait/synch/cond/sql/show_explain YES YES
+stage/sql/show explain YES YES
+statement/sql/show_explain YES YES
+# We've got no instances
+select * from performance_schema.cond_instances where name like '%show_explain%';
+NAME OBJECT_INSTANCE_BEGIN
+# Check out if our cond is hit.
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+select count(*) from t0 where a < 100000;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select count(*) from t0 where a < 100000
+count(*)
+10
+set debug_dbug='';
+select event_name
+from performance_schema.events_waits_history_long
+where event_name='wait/synch/cond/sql/show_explain';
+event_name
+wait/synch/cond/sql/show_explain
+drop table t0;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index d49c67a35fd..293400ece2f 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -7811,9 +7811,12 @@ DROP FUNCTION f1;
# -- End of 5.1 tests
# ------------------------------------------------------------------
#
-# LP bug#993459 Execution of PS for a query with GROUP BY
+# lp:993459 Execution of PS for a query with GROUP BY
# returns wrong result (see also mysql bug#13805127)
#
+
+# Bug#13805127: Stored program cache produces wrong result in same THD
+
CREATE PROCEDURE p1(x INT UNSIGNED)
BEGIN
SELECT c1, t2.c2, count(c3)
@@ -7850,7 +7853,7 @@ c1 c2 count(c3)
2012-03-01 02:00:00 3 1
DROP PROCEDURE p1;
#
-# LP bug#1002157 : testing stored function
+# lp:1002157 : testing stored function
# bug#62125 result for null incorrectly yields 1292 warning.
#
DROP FUNCTION IF EXISTS f1;
diff --git a/mysql-test/r/str_to_datetime_457.result b/mysql-test/r/str_to_datetime_457.result
new file mode 100644
index 00000000000..4fd0d00691c
--- /dev/null
+++ b/mysql-test/r/str_to_datetime_457.result
@@ -0,0 +1,51 @@
+select cast('01:02:03 ' as time), cast('01:02:03 ' as time);
+cast('01:02:03 ' as time) cast('01:02:03 ' as time)
+01:02:03 00:00:00
+select cast('2002-011-012' as date), cast('2002.11.12' as date), cast('2002.011.012' as date);
+cast('2002-011-012' as date) cast('2002.11.12' as date) cast('2002.011.012' as date)
+2002-11-12 2002-11-12 2002-11-12
+select cast('2012103123595912' as datetime(6)), cast('20121031235959123' as datetime(6));
+cast('2012103123595912' as datetime(6)) cast('20121031235959123' as datetime(6))
+2012-10-31 23:59:59.000000 2012-10-31 23:59:59.000000
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2012103123595912'
+Warning 1292 Truncated incorrect datetime value: '20121031235959123'
+select cast(0 as date), cast('0000-00-00' as date), cast('0' as date);
+cast(0 as date) cast('0000-00-00' as date) cast('0' as date)
+0000-00-00 0000-00-00 NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '0'
+select extract(hour from '100000:02:03'), extract(hour from '100000:02:03 ');
+extract(hour from '100000:02:03') extract(hour from '100000:02:03 ')
+NULL NULL
+Warnings:
+Warning 1292 Truncated incorrect time value: '100000:02:03'
+Warning 1292 Truncated incorrect time value: '100000:02:03 '
+#
+# backward compatibility craziness
+#
+select cast('12:00:00.12.34.56' as time);
+cast('12:00:00.12.34.56' as time)
+12:00:00
+Warnings:
+Warning 1292 Truncated incorrect time value: '12:00:00.12.34.56'
+select cast('12:00:00 12.34.56' as time);
+cast('12:00:00 12.34.56' as time)
+12:34:56
+select cast('12:00:00-12.34.56' as time);
+cast('12:00:00-12.34.56' as time)
+12:00:00
+Warnings:
+Warning 1292 Truncated incorrect time value: '12:00:00-12.34.56'
+select cast('12:00:00.12.34.56' as datetime);
+cast('12:00:00.12.34.56' as datetime)
+2012-00-00 12:34:56
+select cast('12:00:00-12.34.56' as datetime);
+cast('12:00:00-12.34.56' as datetime)
+2012-00-00 12:34:56
+select cast('12:00:00 12.34.56' as datetime);
+cast('12:00:00 12.34.56' as datetime)
+2012-00-00 12:34:56
+select cast('12:00:00.123456' as time);
+cast('12:00:00.123456' as time)
+12:00:00
diff --git a/mysql-test/r/strict_autoinc_1myisam.result b/mysql-test/r/strict_autoinc_1myisam.result
index afcccb1c40f..b22540f295b 100644
--- a/mysql-test/r/strict_autoinc_1myisam.result
+++ b/mysql-test/r/strict_autoinc_1myisam.result
@@ -20,9 +20,7 @@ count(*)
0
set @@sql_mode=@org_mode;
insert into t1 values(null);
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
-127
drop table t1;
diff --git a/mysql-test/r/strict_autoinc_2innodb.result b/mysql-test/r/strict_autoinc_2innodb.result
index e534286e2a2..1cf720da12a 100644
--- a/mysql-test/r/strict_autoinc_2innodb.result
+++ b/mysql-test/r/strict_autoinc_2innodb.result
@@ -20,9 +20,7 @@ count(*)
0
set @@sql_mode=@org_mode;
insert into t1 values(null);
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
-127
drop table t1;
diff --git a/mysql-test/r/strict_autoinc_3heap.result b/mysql-test/r/strict_autoinc_3heap.result
index 0a31da04460..21eea537af5 100644
--- a/mysql-test/r/strict_autoinc_3heap.result
+++ b/mysql-test/r/strict_autoinc_3heap.result
@@ -20,9 +20,7 @@ count(*)
0
set @@sql_mode=@org_mode;
insert into t1 values(null);
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
-127
drop table t1;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 1863cd09c38..f775336299b 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -4196,7 +4196,7 @@ INSERT INTO t1 VALUES (1,1),(2,1);
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
-2 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
DROP TABLE t1;
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -5966,7 +5966,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 SUBQUERY t1 ref a a 5 const 1
+2 SUBQUERY t1 ref a a 5 const 1 Using index
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
@@ -6127,7 +6127,7 @@ set optimizer_switch=@tmp_optimizer_switch;
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 SUBQUERY t1 ref a a 5 const 1
+2 SUBQUERY t1 ref a a 5 const 1 Using index
DROP TABLE t1;
#
@@ -6612,7 +6612,33 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
min_a a
drop table t1;
#
-# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization
#
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
@@ -6768,5 +6794,68 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
a
drop table t1,t2;
-# return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
+#
+# MDEV-410: EXPLAIN shows type=range, while SHOW EXPLAIN and userstat show full table scan is used
+#
+CREATE TABLE t1 (a VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('USA');
+CREATE TABLE t2 (b INT, c VARCHAR(52), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3813,'United States'),(3940,'Russia');
+CREATE TABLE t3 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (12),(22),(9),(45);
+create table t4 like t3;
+insert into t4 select * from t3;
+# This should not show range access for table t2
+explain
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where
+1 PRIMARY t3 ref d d 5 test.t2.b 2 Using where; Using index
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+set @tmp_mdev410=@@global.userstat;
+set global userstat=on;
+flush table_statistics;
+flush index_statistics;
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+MIN(b)
+NULL
+# The following shows that t2 was indeed scanned with a full scan.
+show table_statistics;
+Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes
+test t1 2 0 0
+test t2 3 0 0
+show index_statistics;
+Table_schema Table_name Index_name Rows_read
+test t2 b 1
+set global userstat=@tmp_mdev410;
+DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-430: Server crashes in select_describe on EXPLAIN with
+# materialization+semijoin, 2 nested subqueries, aggregate functions
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
+#
+# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result
index 41c445329cb..ed00e4ef684 100644
--- a/mysql-test/r/subselect2.result
+++ b/mysql-test/r/subselect2.result
@@ -161,18 +161,18 @@ SET optimizer_switch='materialization=on,in_to_exists=on';
EXPLAIN
SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM t1) OR a = b;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index a a 5 NULL 2 Using index
-1 PRIMARY t3 index b b 5 NULL 4 Using where; Using index; Using join buffer (flat, BNL join)
-2 MATERIALIZED t1 index PRIMARY,a a 5 NULL 2 Using index
+1 PRIMARY t2 index a a 5 NULL 2 Using where; Using index
+1 PRIMARY t3 ref b b 5 test.t2.a 2 Using index
+2 SUBQUERY t1 index_subquery PRIMARY,a a 5 const 0 Using index; Using where
SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM t1) OR a = b;
pk a b
0 4 4
EXPLAIN
SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM v1) OR a = b;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index a a 5 NULL 2 Using index
-1 PRIMARY t3 index b b 5 NULL 4 Using where; Using index; Using join buffer (flat, BNL join)
-2 MATERIALIZED t1 index PRIMARY,a a 5 NULL 2 Using index
+1 PRIMARY t2 index a a 5 NULL 2 Using where; Using index
+1 PRIMARY t3 ref b b 5 test.t2.a 2 Using index
+2 SUBQUERY t1 index_subquery PRIMARY,a a 5 const 0 Using index; Using where
SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM v1) OR a = b;
pk a b
0 4 4
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 72b4f34d9de..7f290fb5b03 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -206,6 +206,165 @@ default(a)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP TABLE t;
#
+# LP BUG#1009187, MDEV-373, MYSQL bug#58628
+# Wrong result for a query with [NOT] IN subquery predicate if
+# the left part of the predicate is explicit NULL
+#
+CREATE TABLE t1 (pk INT NOT NULL, i INT NOT NULL);
+INSERT INTO t1 VALUES (0,10), (1,20), (2,30), (3,40);
+CREATE TABLE t2a (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i,pk));
+INSERT INTO t2a VALUES (0,0), (1,1), (2,2), (3,3);
+CREATE TABLE t2b (pk INT, i INT);
+INSERT INTO t2b VALUES (0,0), (1,1), (2,2), (3,3);
+CREATE TABLE t2c (pk INT NOT NULL, i INT NOT NULL);
+INSERT INTO t2c VALUES (0,0), (1,1), (2,2), (3,3);
+create index it2c on t2c (i,pk);
+CREATE TABLE t2d (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i));
+INSERT INTO t2d VALUES (0,0), (1,1), (2,2), (3,3);
+EXPLAIN
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
+2 DEPENDENT SUBQUERY t2a unique_subquery PRIMARY PRIMARY 8 const,test.t1.pk 1 Using index; Using where; Full scan on NULL key
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
+pk i
+SELECT * FROM t1 WHERE 1+NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
+pk i
+SELECT * FROM t1 WHERE NULL IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) IS UNKNOWN;
+pk i
+0 10
+1 20
+2 30
+3 40
+SELECT t1.pk, NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) FROM t1;
+pk NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk)
+0 NULL
+1 NULL
+2 NULL
+3 NULL
+EXPLAIN
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
+2 DEPENDENT SUBQUERY t2b ALL NULL NULL NULL NULL 4 Using where
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk);
+pk i
+SELECT * FROM t1 WHERE NULL IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) IS UNKNOWN;
+pk i
+0 10
+1 20
+2 30
+3 40
+SELECT t1.pk, NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) FROM t1;
+pk NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk)
+0 NULL
+1 NULL
+2 NULL
+3 NULL
+EXPLAIN
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
+2 DEPENDENT SUBQUERY t2c index_subquery it2c it2c 8 const,test.t1.pk 2 Using index; Using where; Full scan on NULL key
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk);
+pk i
+SELECT * FROM t1 WHERE NULL IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) IS UNKNOWN;
+pk i
+0 10
+1 20
+2 30
+3 40
+SELECT t1.pk, NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) FROM t1;
+pk NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk)
+0 NULL
+1 NULL
+2 NULL
+3 NULL
+EXPLAIN
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
+2 DEPENDENT SUBQUERY t2d const PRIMARY PRIMARY 4 const 1 Using where; Full scan on NULL key
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk);
+pk i
+SELECT * FROM t1 WHERE NULL IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) IS UNKNOWN;
+pk i
+0 10
+1 20
+2 30
+3 40
+SELECT t1.pk, NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) FROM t1;
+pk NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk)
+0 NULL
+1 NULL
+2 NULL
+3 NULL
+EXPLAIN
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
+2 DEPENDENT SUBQUERY t2a eq_ref PRIMARY PRIMARY 8 const,test.t1.pk 1 Using where; Using index; Full scan on NULL key
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
+pk i
+0 10
+2 30
+3 40
+SELECT (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk) from t1;
+(NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk)
+1
+NULL
+1
+1
+EXPLAIN
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
+2 DEPENDENT SUBQUERY t2b ALL NULL NULL NULL NULL 4 Using where
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
+pk i
+0 10
+2 30
+3 40
+SELECT (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk) from t1;
+(NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk)
+1
+NULL
+1
+1
+EXPLAIN
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
+2 DEPENDENT SUBQUERY t2c ref it2c it2c 8 const,test.t1.pk 2 Using where; Using index; Full scan on NULL key
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
+pk i
+0 10
+2 30
+3 40
+SELECT (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk) from t1;
+(NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk)
+1
+NULL
+1
+1
+EXPLAIN
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
+2 DEPENDENT SUBQUERY t2d const PRIMARY PRIMARY 4 const 1 Using where; Full scan on NULL key
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
+pk i
+0 10
+2 30
+3 40
+SELECT (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk) from t1;
+(NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk)
+1
+NULL
+1
+1
+drop table t1, t2a, t2b, t2c, t2d;
+#
# End of 5.1 tests.
#
#
@@ -627,51 +786,51 @@ SET @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off';
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 MATERIALIZED t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 MATERIALIZED t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 MATERIALIZED t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2);
f1 f2
EXPLAIN
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
not_in
NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 MATERIALIZED t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 MATERIALIZED t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2);
f1 f2
EXPLAIN
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
not_in
NULL
@@ -679,7 +838,7 @@ EXPLAIN
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
not_in
1
@@ -687,7 +846,7 @@ EXPLAIN
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
not_in
NULL
@@ -695,7 +854,7 @@ EXPLAIN
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
not_in
NULL
@@ -703,7 +862,7 @@ EXPLAIN
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
not_in
NULL
@@ -718,51 +877,51 @@ SET @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2);
f1 f2
EXPLAIN
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
not_in
NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2);
f1 f2
EXPLAIN
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
not_in
NULL
@@ -770,7 +929,7 @@ EXPLAIN
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
not_in
1
@@ -778,7 +937,7 @@ EXPLAIN
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
not_in
NULL
@@ -786,7 +945,7 @@ EXPLAIN
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
not_in
NULL
@@ -794,7 +953,7 @@ EXPLAIN
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
not_in
NULL
@@ -813,21 +972,21 @@ SET @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off';
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10);
f1 f2
@@ -842,14 +1001,14 @@ NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10);
f1 f2
@@ -904,21 +1063,21 @@ SET @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10);
f1 f2
@@ -933,14 +1092,14 @@ NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10);
f1 f2
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10);
f1 f2
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index a0f05a26a46..6c1e52a112e 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -248,6 +248,47 @@ NULL
drop procedure p1;
drop tables t1,t2,t3;
#
+# Bug #58756
+# Crash in heap_rrnd on query with HAVING ... IN (subquery) + LIMIT
+#
+CREATE TABLE t1 (
+col_time_key time DEFAULT NULL,
+col_datetime_key datetime DEFAULT NULL,
+col_varchar_nokey varchar(1) DEFAULT NULL,
+KEY col_time_key (col_time_key),
+KEY col_datetime_key (col_datetime_key)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('17:53:30','2005-11-10 12:40:29','h');
+INSERT INTO t1 VALUES ('11:35:49','2009-04-25 00:00:00','b');
+INSERT INTO t1 VALUES (NULL,'2002-11-27 00:00:00','s');
+INSERT INTO t1 VALUES ('06:01:40','2004-01-26 20:32:32','e');
+INSERT INTO t1 VALUES ('05:45:11','2007-10-26 11:41:40','j');
+INSERT INTO t1 VALUES ('00:00:00','2005-10-07 00:00:00','e');
+INSERT INTO t1 VALUES ('00:00:00','2000-07-15 05:00:34','f');
+INSERT INTO t1 VALUES ('06:11:01','2000-04-03 16:33:32','v');
+INSERT INTO t1 VALUES ('13:02:46',NULL,'x');
+INSERT INTO t1 VALUES ('21:44:25','2001-04-25 01:26:12','m');
+INSERT INTO t1 VALUES ('22:43:58','2000-12-27 00:00:00','c');
+CREATE TABLE t2 (
+col_time_key time DEFAULT NULL,
+col_datetime_key datetime DEFAULT NULL,
+col_varchar_nokey varchar(1) DEFAULT NULL,
+KEY col_time_key (col_time_key),
+KEY col_datetime_key (col_datetime_key)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES ('11:28:45','2004-10-11 18:13:16','w');
+SELECT col_time_key, col_datetime_key
+FROM
+( SELECT * FROM t1 ) AS table1
+HAVING ( 'r' , 'e' ) IN
+( SELECT col_varchar_nokey , col_varchar_nokey FROM t2 )
+ORDER BY col_datetime_key
+LIMIT 10;
+col_time_key col_datetime_key
+DROP TABLE t1;
+DROP TABLE t2;
+# End of Bug #58756
+#
# Bug#60085 crash in Item::save_in_field() with time data type
#
CREATE TABLE t1(a date, b int, unique(b), unique(a), key(b)) engine=innodb;
@@ -333,7 +374,7 @@ WHERE (SELECT DISTINCT b FROM t3) > 0);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using where; Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-3 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 0 Using temporary
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using temporary
SELECT *
FROM t1
WHERE t1.a = (
@@ -386,7 +427,7 @@ select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 gr
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1
2 SUBQUERY t1 ALL NULL NULL NULL NULL 1
-3 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 1 Using temporary; Using filesort
select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1));
1
1
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result
index 45d0b9ee519..9bb26e8a6e0 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -2183,7 +2183,7 @@ NULL
EXPLAIN
SELECT * FROM t2 WHERE (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM t2 WHERE (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1);
diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result
index 5a38fe7ca72..8c95c8637aa 100644
--- a/mysql-test/r/subselect_mat_cost_bugs.result
+++ b/mysql-test/r/subselect_mat_cost_bugs.result
@@ -148,7 +148,7 @@ FROM t2 GROUP BY f1
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY t1 system NULL NULL NULL NULL 1
-3 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
+3 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
drop table t1, t2, t3;
#
# LP BUG#715034 Item_sum_distinct::clear(): Assertion `tree != 0' failed
@@ -162,7 +162,7 @@ EXPLAIN
SELECT * FROM (SELECT * FROM t2) AS a2
WHERE (SELECT distinct SUM(distinct f3 ) FROM t1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
3 SUBQUERY t1 index NULL f3 5 NULL 2 Using index
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
insert into t2 values (1),(2);
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index 78ab87dbfd6..e72d25fdafa 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -4200,7 +4200,7 @@ INSERT INTO t1 VALUES (1,1),(2,1);
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
-2 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
DROP TABLE t1;
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -5967,7 +5967,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 SUBQUERY t1 ref a a 5 const 1
+2 SUBQUERY t1 ref a a 5 const 1 Using index
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
@@ -6126,7 +6126,7 @@ set optimizer_switch=@tmp_optimizer_switch;
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 SUBQUERY t1 ref a a 5 const 1
+2 SUBQUERY t1 ref a a 5 const 1 Using index
DROP TABLE t1;
#
@@ -6611,7 +6611,33 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
min_a a
drop table t1;
#
-# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization
#
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
@@ -6766,8 +6792,71 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
a
drop table t1,t2;
-# return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
+#
+# MDEV-410: EXPLAIN shows type=range, while SHOW EXPLAIN and userstat show full table scan is used
+#
+CREATE TABLE t1 (a VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('USA');
+CREATE TABLE t2 (b INT, c VARCHAR(52), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3813,'United States'),(3940,'Russia');
+CREATE TABLE t3 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (12),(22),(9),(45);
+create table t4 like t3;
+insert into t4 select * from t3;
+# This should not show range access for table t2
+explain
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where
+1 PRIMARY t3 ref d d 5 test.t2.b 2 Using where; Using index
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+set @tmp_mdev410=@@global.userstat;
+set global userstat=on;
+flush table_statistics;
+flush index_statistics;
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+MIN(b)
+NULL
+# The following shows that t2 was indeed scanned with a full scan.
+show table_statistics;
+Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes
+test t1 2 0 0
+test t2 3 0 0
+show index_statistics;
+Table_schema Table_name Index_name Rows_read
+test t2 b 1
+set global userstat=@tmp_mdev410;
+DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-430: Server crashes in select_describe on EXPLAIN with
+# materialization+semijoin, 2 nested subqueries, aggregate functions
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
+#
+# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index f822a4500f4..9030265356b 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -4196,7 +4196,7 @@ INSERT INTO t1 VALUES (1,1),(2,1);
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
-2 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
DROP TABLE t1;
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -5963,7 +5963,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 SUBQUERY t1 ref a a 5 const 1
+2 SUBQUERY t1 ref a a 5 const 1 Using index
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
@@ -6122,7 +6122,7 @@ set optimizer_switch=@tmp_optimizer_switch;
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 SUBQUERY t1 ref a a 5 const 1
+2 SUBQUERY t1 ref a a 5 const 1 Using index
DROP TABLE t1;
#
@@ -6607,7 +6607,33 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
min_a a
drop table t1;
#
-# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization
#
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
@@ -6763,6 +6789,69 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
a
drop table t1,t2;
-# return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
+#
+# MDEV-410: EXPLAIN shows type=range, while SHOW EXPLAIN and userstat show full table scan is used
+#
+CREATE TABLE t1 (a VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('USA');
+CREATE TABLE t2 (b INT, c VARCHAR(52), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3813,'United States'),(3940,'Russia');
+CREATE TABLE t3 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (12),(22),(9),(45);
+create table t4 like t3;
+insert into t4 select * from t3;
+# This should not show range access for table t2
+explain
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where
+1 PRIMARY t3 ref d d 5 test.t2.b 2 Using where; Using index
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+set @tmp_mdev410=@@global.userstat;
+set global userstat=on;
+flush table_statistics;
+flush index_statistics;
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+MIN(b)
+NULL
+# The following shows that t2 was indeed scanned with a full scan.
+show table_statistics;
+Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes
+test t1 2 0 0
+test t2 3 0 0
+show index_statistics;
+Table_schema Table_name Index_name Rows_read
+test t2 b 1
+set global userstat=@tmp_mdev410;
+DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-430: Server crashes in select_describe on EXPLAIN with
+# materialization+semijoin, 2 nested subqueries, aggregate functions
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
+#
+# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
set @optimizer_switch_for_subselect_test=null;
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index cdad363313d..e68f5990c08 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -4202,7 +4202,7 @@ INSERT INTO t1 VALUES (1,1),(2,1);
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
-2 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
DROP TABLE t1;
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -5972,7 +5972,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 SUBQUERY t1 ref a a 5 const 1
+2 SUBQUERY t1 ref a a 5 const 1 Using index
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
@@ -6133,7 +6133,7 @@ set optimizer_switch=@tmp_optimizer_switch;
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 SUBQUERY t1 ref a a 5 const 1
+2 SUBQUERY t1 ref a a 5 const 1 Using index
DROP TABLE t1;
#
@@ -6618,7 +6618,33 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
min_a a
drop table t1;
#
-# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization
#
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
@@ -6774,8 +6800,71 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
a
drop table t1,t2;
-# return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
+#
+# MDEV-410: EXPLAIN shows type=range, while SHOW EXPLAIN and userstat show full table scan is used
+#
+CREATE TABLE t1 (a VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('USA');
+CREATE TABLE t2 (b INT, c VARCHAR(52), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3813,'United States'),(3940,'Russia');
+CREATE TABLE t3 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (12),(22),(9),(45);
+create table t4 like t3;
+insert into t4 select * from t3;
+# This should not show range access for table t2
+explain
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where
+1 PRIMARY t3 ref d d 5 test.t2.b 2 Using where; Using index
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+set @tmp_mdev410=@@global.userstat;
+set global userstat=on;
+flush table_statistics;
+flush index_statistics;
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+MIN(b)
+NULL
+# The following shows that t2 was indeed scanned with a full scan.
+show table_statistics;
+Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes
+test t1 2 0 0
+test t2 3 0 0
+show index_statistics;
+Table_schema Table_name Index_name Rows_read
+test t2 b 1
+set global userstat=@tmp_mdev410;
+DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-430: Server crashes in select_describe on EXPLAIN with
+# materialization+semijoin, 2 nested subqueries, aggregate functions
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
+#
+# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%';
@@optimizer_switch like '%subquery_cache=on%'
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 8e6d4bfccc2..f0ce541294a 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -4196,7 +4196,7 @@ INSERT INTO t1 VALUES (1,1),(2,1);
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
-2 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
DROP TABLE t1;
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -5963,7 +5963,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 SUBQUERY t1 ref a a 5 const 1
+2 SUBQUERY t1 ref a a 5 const 1 Using index
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
@@ -6122,7 +6122,7 @@ set optimizer_switch=@tmp_optimizer_switch;
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 SUBQUERY t1 ref a a 5 const 1
+2 SUBQUERY t1 ref a a 5 const 1 Using index
DROP TABLE t1;
#
@@ -6607,7 +6607,33 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
min_a a
drop table t1;
#
-# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization
#
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
@@ -6763,7 +6789,70 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
a
drop table t1,t2;
-# return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
+#
+# MDEV-410: EXPLAIN shows type=range, while SHOW EXPLAIN and userstat show full table scan is used
+#
+CREATE TABLE t1 (a VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('USA');
+CREATE TABLE t2 (b INT, c VARCHAR(52), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3813,'United States'),(3940,'Russia');
+CREATE TABLE t3 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (12),(22),(9),(45);
+create table t4 like t3;
+insert into t4 select * from t3;
+# This should not show range access for table t2
+explain
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where
+1 PRIMARY t3 ref d d 5 test.t2.b 2 Using where; Using index
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+set @tmp_mdev410=@@global.userstat;
+set global userstat=on;
+flush table_statistics;
+flush index_statistics;
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+MIN(b)
+NULL
+# The following shows that t2 was indeed scanned with a full scan.
+show table_statistics;
+Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes
+test t1 2 0 0
+test t2 3 0 0
+show index_statistics;
+Table_schema Table_name Index_name Rows_read
+test t2 b 1
+set global userstat=@tmp_mdev410;
+DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-430: Server crashes in select_describe on EXPLAIN with
+# materialization+semijoin, 2 nested subqueries, aggregate functions
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
+#
+# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 63193bdedbc..3310209df58 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -165,6 +165,8 @@ select @log;
(BEFORE_INSERT: new=(id=1, data=1))(AFTER_INSERT: new=(id=1, data=1))
set @log:= "";
insert ignore t1 values (1, 2);
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
select @log;
@log
(BEFORE_INSERT: new=(id=1, data=2))
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 40325376fc0..ff4ebd6b15c 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -878,6 +878,8 @@ ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT
CREATE TABLE b15776 (a char(4294967296));
ERROR 42000: Display width out of range for 'a' (max = 4294967295)
CREATE TABLE b15776 (a year(4294967295));
+Warnings:
+Note 1287 'YEAR(4294967295)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
INSERT INTO b15776 VALUES (42);
SELECT * FROM b15776;
a
@@ -886,6 +888,8 @@ DROP TABLE b15776;
CREATE TABLE b15776 (a year(4294967296));
ERROR 42000: Display width out of range for 'a' (max = 4294967295)
CREATE TABLE b15776 (a year(0));
+Warnings:
+Note 1287 'YEAR(0)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
DROP TABLE b15776;
CREATE TABLE b15776 (a year(-2));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2))' at line 1
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 41f590400ea..8a85cd53b2a 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -209,15 +209,11 @@ a
SET SQL_MODE=TRADITIONAL;
EXPLAIN SELECT * FROM t1 WHERE a = '0000-00-00';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref i i 4 const 1 Using where; Using index
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
+1 SIMPLE t1 ref i i 4 const 1 Using index
SELECT * FROM t1 WHERE a = '0000-00-00';
a
0000-00-00
0000-00-00
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
SELECT * FROM t2 WHERE a = '0000-00-00';
a
0000-00-00
@@ -242,15 +238,11 @@ a
SET SQL_MODE=TRADITIONAL;
EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref i i 4 const 1 Using where; Using index
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
+1 SIMPLE t1 ref i i 4 const 1 Using index
SELECT * FROM t1 WHERE a = '1000-00-00';
a
1000-00-00
1000-00-00
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
SELECT * FROM t2 WHERE a = '1000-00-00';
a
1000-00-00
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
index 5d89a1ee407..4b9bf6f433f 100644
--- a/mysql-test/r/type_year.result
+++ b/mysql-test/r/type_year.result
@@ -1,5 +1,7 @@
drop table if exists t1;
create table t1 (y year,y2 year(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
select * from t1;
y y2
@@ -50,6 +52,8 @@ End of 5.0 tests
# Bug #49480: WHERE using YEAR columns returns unexpected results
#
CREATE TABLE t2(yy YEAR(2), c2 CHAR(4));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t4(yyyy YEAR(4), c4 CHAR(4));
INSERT INTO t2 (c2) VALUES (NULL),(1970),(1999),(2000),(2001),(2069);
INSERT INTO t4 (c4) SELECT c2 FROM t2;
@@ -358,9 +362,22 @@ total_rows min_value MAX(c1+0)
3 0 2155
DROP TABLE t1;
#
+# WL#6219: Deprecate and remove YEAR(2) type
+#
+CREATE TABLE t1 (c1 YEAR(2), c2 YEAR(4));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+ALTER TABLE t1 MODIFY COLUMN c2 YEAR(2);
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+DROP TABLE t1;
+#
End of 5.1 tests
create function y2k() returns int deterministic return 2000;
create table t1 (a year(2), b int);
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert t1 values (0,2000);
select a from t1 where a=2000;
a
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index 86f4ba25ab1..27a0d7f0a1b 100644
--- a/mysql-test/r/user_var-binlog.result
+++ b/mysql-test/r/user_var-binlog.result
@@ -34,7 +34,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=10000/*!*/;
INSERT INTO t1 VALUES(@`a b`)
/*!*/;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 008f8f41ada..5af20fd0c3c 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -4674,6 +4674,62 @@ INSERT INTO t2 VALUES (1);
DROP TRIGGER tr;
DROP VIEW v1;
DROP TABLE t1,t2,t3;
+#
+# LP bug#1007622 Server crashes in handler::increment_statistics on
+# inserting into a view over a view
+#
+flush status;
+CREATE TABLE t1 (a INT);
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.* FROM t1 AS a1, t1 AS a2;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
+INSERT INTO v2 (a) VALUES (1) ;
+select * from t1;
+a
+1
+drop view v2,v1;
+drop table t1;
+show status like '%view%';
+Variable_name Value
+Com_create_view 2
+Com_drop_view 1
+Opened_views 3
+show status like 'Opened_table%';
+Variable_name Value
+Opened_table_definitions 2
+Opened_tables 3
+#
+# MDEV-486 LP BUG#1010116 Incorrect query results in
+# view and derived tables
+#
+SELECT
+`Derived1`.`id`,
+`Derived2`.`Val1`
+FROM (select 30631 as `id`) AS `Derived1` LEFT OUTER JOIN (SELECT
+2 as `id`,
+1 AS `Val1`
+FROM (select 30631 as `id`) AS `Derived3`) AS `Derived2` ON `Derived1`.`id` = `Derived2`.`id`;
+id Val1
+30631 NULL
+create table t1 ( id int );
+insert into t1 values (30631);
+create table t2 ( id int );
+insert into t2 values (30631);
+create algorithm=MERGE view v2 as select 2 as id, 1 as val1 from t2;
+select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
+id id val1
+30631 NULL NULL
+drop view v2;
+drop table t1,t2;
+create table t1 ( id int );
+insert into t1 values (30631);
+create table t2 ( id int );
+insert into t2 values (30631);
+create algorithm=MERGE view v2 as select 2 as id, id is null as bbb, id as iddqd, 1 as val1 from t2;
+select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
+id id bbb iddqd val1
+30631 NULL NULL NULL NULL
+drop view v2;
+drop table t1,t2;
# -----------------------------------------------------------------
# -- End of 5.3 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/r/xa_binlog.result b/mysql-test/r/xa_binlog.result
index 3ce64953902..395f0dc62a4 100644
--- a/mysql-test/r/xa_binlog.result
+++ b/mysql-test/r/xa_binlog.result
@@ -18,7 +18,7 @@ a
1
2
3
-SHOW BINLOG EVENTS LIMIT 1,9;
+SHOW BINLOG EVENTS LIMIT 2,9;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
diff --git a/mysql-test/r/xtradb_mrr.result b/mysql-test/r/xtradb_mrr.result
index 069d3c25826..15b750d2fd3 100644
--- a/mysql-test/r/xtradb_mrr.result
+++ b/mysql-test/r/xtradb_mrr.result
@@ -276,6 +276,8 @@ bb-1 NULL cc-2 NULL-1
drop table t1, t2, t3, t4;
create table t1 (a int, b int not null,unique key (a,b),index(b));
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
+Warnings:
+Warning 1062 Duplicate entry '6-6' for key 'a'
create table t2 like t1;
insert into t2 select * from t1;
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result
index 33feb5c7591..f84995cac3b 100644
--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
@@ -35,7 +35,7 @@ DELIMITER /*!*/;
# at 4
<#>ROLLBACK/*!*/;
# at 102
-<#>use test/*!*/;
+<#>use `test`/*!*/;
SET TIMESTAMP=1196959712/*!*/;
<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
diff --git a/mysql-test/suite/binlog/r/binlog_checkpoint.result b/mysql-test/suite/binlog/r/binlog_checkpoint.result
new file mode 100644
index 00000000000..8a4a3af115d
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_checkpoint.result
@@ -0,0 +1,88 @@
+SET @old_max_binlog_size= @@global.max_binlog_size;
+SET GLOBAL max_binlog_size= 4096;
+SET @old_innodb_flush_log_at_trx_commit= @@global.innodb_flush_log_at_trx_commit;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
+CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Myisam;
+*** Test that RESET MASTER waits for pending commit checkpoints to complete.
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go";
+INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
+INSERT INTO t2 VALUES (1, REPEAT("x", 4100));
+INSERT INTO t2 VALUES (2, REPEAT("x", 4100));
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+master-bin.000003 #
+master-bin.000004 #
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000004 # Binlog_checkpoint # # master-bin.000001
+SET DEBUG_SYNC= "execute_command_after_close_tables SIGNAL reset_master_done";
+RESET MASTER;
+This will timeout, as RESET MASTER is blocked
+SET DEBUG_SYNC= "now WAIT_FOR reset_master_done TIMEOUT 1";
+Warnings:
+Warning 1639 debug sync point wait timed out
+SET DEBUG_SYNC= "now SIGNAL con1_go";
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000001 # Binlog_checkpoint # # master-bin.000001
+*** Test that binlog N is active, and commit checkpoint for (N-1) is
+*** done while there is still a pending commit checkpoint for (N-2).
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR con1_continue";
+INSERT INTO t1 VALUES (20, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR con2_continue";
+INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+master-bin.000003 #
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000001 # Binlog_checkpoint # # master-bin.000001
+master-bin.000001 # Query # # 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 # Rotate # # master-bin.000002;pos=POS
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000002 # Binlog_checkpoint # # master-bin.000001
+master-bin.000002 # Query # # BEGIN
+master-bin.000002 # Table_map # # table_id: # (test.t1)
+master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000002 # Xid # # COMMIT /* XID */
+master-bin.000002 # Rotate # # master-bin.000003;pos=POS
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000003 # Binlog_checkpoint # # master-bin.000001
+SET DEBUG_SYNC= "now SIGNAL con2_continue";
+con1 is still pending, no new binlog checkpoint should have been logged.
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000003 # Binlog_checkpoint # # master-bin.000001
+SET DEBUG_SYNC= "now SIGNAL con1_continue";
+No commit checkpoints are pending, a new binlog checkpoint should have been logged.
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000003 # Binlog_checkpoint # # master-bin.000001
+master-bin.000003 # Binlog_checkpoint # # master-bin.000003
+DROP TABLE t1, t2;
+SET GLOBAL max_binlog_size= @old_max_binlog_size;
+SET GLOBAL innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
diff --git a/mysql-test/suite/binlog/r/binlog_drop_if_exists.result b/mysql-test/suite/binlog/r/binlog_drop_if_exists.result
index e461a37c58b..0acd39388cd 100644
--- a/mysql-test/suite/binlog/r/binlog_drop_if_exists.result
+++ b/mysql-test/suite/binlog/r/binlog_drop_if_exists.result
@@ -96,3 +96,21 @@ master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
+CREATE TABLE t1(id int);
+DROP TABLE /* comment */ t1;
+CREATE TABLE t1(id int);
+DROP TABLE IF EXISTS /* comment */ t1;
+CREATE TABLE t1(id int);
+DROP TABLE /**/ t1;
+CREATE TABLE t1(id int);
+DROP TABLE IF EXISTS /* */ t1;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(id int)
+master-bin.000001 # Query # # use `test`; DROP TABLE /* comment */ `t1` /* generated by server */
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(id int)
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS /* comment */ `t1` /* generated by server */
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(id int)
+master-bin.000001 # Query # # use `test`; DROP TABLE /**/ `t1` /* generated by server */
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(id int)
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS /* */ `t1` /* generated by server */
diff --git a/mysql-test/suite/binlog/r/binlog_innodb_row.result b/mysql-test/suite/binlog/r/binlog_innodb_row.result
index 4f1ee073b6d..468a3dd5bd9 100644
--- a/mysql-test/suite/binlog/r/binlog_innodb_row.result
+++ b/mysql-test/suite/binlog/r/binlog_innodb_row.result
@@ -69,6 +69,8 @@ INSERT INTO t1 VALUES (1);
START TRANSACTION;
INSERT INTO t2 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
COMMIT;
INSERT INTO t1 VALUES (2);
START TRANSACTION;
diff --git a/mysql-test/suite/binlog/r/binlog_ioerr.result b/mysql-test/suite/binlog/r/binlog_ioerr.result
index f8e2d189f57..68ff5264aa3 100644
--- a/mysql-test/suite/binlog/r/binlog_ioerr.result
+++ b/mysql-test/suite/binlog/r/binlog_ioerr.result
@@ -16,6 +16,7 @@ a
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
BINLOG POS Format_desc 1 ENDPOS Server ver: #, Binlog ver: #
+BINLOG POS Binlog_checkpoint 1 ENDPOS master-bin.000001
BINLOG POS Query 1 ENDPOS use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb
BINLOG POS Query 1 ENDPOS BEGIN
BINLOG POS Query 1 ENDPOS use `test`; INSERT INTO t1 VALUES(0)
diff --git a/mysql-test/suite/binlog/r/binlog_mdev342.result b/mysql-test/suite/binlog/r/binlog_mdev342.result
index 9cb2b94f59d..0d45cbace91 100644
--- a/mysql-test/suite/binlog/r/binlog_mdev342.result
+++ b/mysql-test/suite/binlog/r/binlog_mdev342.result
@@ -21,6 +21,7 @@ master-bin.000002 #
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000001 # Binlog_checkpoint # # master-bin.000001
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
diff --git a/mysql-test/suite/binlog/r/binlog_row_annotate.result b/mysql-test/suite/binlog/r/binlog_row_annotate.result
index 0c008661784..58cac276c95 100644
--- a/mysql-test/suite/binlog/r/binlog_row_annotate.result
+++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result
@@ -8,6 +8,7 @@
#####################################################################################
show binlog events in 'master-bin.000001' from <start_pos>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test2
master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test3
@@ -67,6 +68,8 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
@@ -293,6 +296,8 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
@@ -437,6 +442,8 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
@@ -653,6 +660,8 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
@@ -879,6 +888,8 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
@@ -1023,6 +1034,8 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
+#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
+# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result
index b162e66137b..58ec82cbb3a 100644
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result
@@ -234,6 +234,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
set @ac = @@autocommit;
set autocommit= 0;
@@ -578,13 +579,46 @@ DROP PROCEDURE p4;
End of 5.0 tests
reset master;
create table t1 (id tinyint auto_increment primary key);
+insert into t1 values(5);
set insert_id=128;
-insert into t1 values(null);
+insert into t1 values(null) /* Not binlogged */;
+ERROR 22003: Out of range value for column 'id' at row 1
+set insert_id=128;
+insert ignore into t1 values(null) /* Insert 128 */;
+Warnings:
+Warning 167 Out of range value for column 'id' at row 1
+set insert_id=5;
+insert into t1 values(null) /* Not binlogged */;
+ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
+set insert_id=5;
+insert ignore into t1 values(null) /* Insert 5 */;
Warnings:
-Warning 1264 Out of range value for column 'id' at row 1
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
select * from t1;
id
-127
+5
+drop table t1;
+create table t1 (id tinyint auto_increment primary key) engine=myisam;
+set insert_id=128;
+insert into t1 values(5),(null) /* Insert_id 128 */;
+ERROR 22003: Out of range value for column 'id' at row 2
+set insert_id=128;
+insert ignore into t1 values (4),(null) /* Insert_id 128 */;
+Warnings:
+Warning 167 Out of range value for column 'id' at row 2
+set insert_id=5;
+insert into t1 values(3),(null) /* Insert_id 5 */;
+ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
+set insert_id=5;
+insert ignore into t1 values(2),(null) /* Insert_id 5 */;
+Warnings:
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+select * from t1 order by id;
+id
+2
+3
+4
+5
drop table t1;
create table t1 (a int);
create table if not exists t2 select * from t1;
@@ -603,36 +637,19 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
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` /* generated by server */
-master-bin.000001 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) engine=myisam
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
- `a` int(11) DEFAULT NULL
-)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
- `a` int(11) DEFAULT NULL
-)
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (mysql.user)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-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: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (mysql.user)
-master-bin.000001 # Delete_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 # # COMMIT
-drop table t1,t2,t3,tt1;
-create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-insert /* before delayed */ delayed /* after delayed */ into t1 values (207);
-insert /*! delayed */ into t1 values (null);
-insert delayed into t1 values (300);
-FLUSH TABLES;
-include/show_binlog_events.inc
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
@@ -659,8 +676,15 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (mysql.user)
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt1` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
+drop table t1,t2,t3,tt1;
+reset master;
+create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
+insert /* before delayed */ delayed /* after delayed */ into t1 values (207);
+insert /*! delayed */ into t1 values (null);
+insert delayed into t1 values (300);
+FLUSH TABLES;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
@@ -728,6 +752,7 @@ BINLOG '
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# # Format_desc 1 # Server ver: #, Binlog ver: #
+# # Binlog_checkpoint 1 # master-bin.000001
# # Query 1 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
# # Query 1 # BEGIN
# # Table_map 1 # table_id: # (test.t1)
diff --git a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
index d4a3503b1f2..55f4154574b 100644
--- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
+++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
@@ -35,7 +35,9 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
-use new_test1/*!*/;
+#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
+# at #
+use `new_test1`/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
@@ -72,7 +74,7 @@ COMMIT
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test2/*!*/;
+use `test2`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
CREATE TABLE t2 (a INT)
/*!*/;
@@ -115,7 +117,7 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
-use new_test3/*!*/;
+use `new_test3`/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
CREATE TABLE t3 (a INT)
@@ -229,7 +231,9 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
-use new_test1/*!*/;
+#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
+# at #
+use `new_test1`/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
@@ -266,7 +270,7 @@ COMMIT
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
-use test2/*!*/;
+use `test2`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
CREATE TABLE t2 (a INT)
/*!*/;
@@ -309,7 +313,7 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
-use new_test3/*!*/;
+use `new_test3`/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
CREATE TABLE t3 (a INT)
diff --git a/mysql-test/suite/binlog/r/binlog_server_id.result b/mysql-test/suite/binlog/r/binlog_server_id.result
index f7d778a288b..34e32c8a29f 100644
--- a/mysql-test/suite/binlog/r/binlog_server_id.result
+++ b/mysql-test/suite/binlog/r/binlog_server_id.result
@@ -5,8 +5,9 @@ create table t1 (a int);
select @@server_id;
@@server_id
1
-show binlog events from <binlog_start>;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
set global server_id=2;
@@ -14,8 +15,9 @@ create table t2 (b int);
select @@server_id;
@@server_id
2
-show binlog events from <binlog_start>;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
master-bin.000001 # Query 2 # use `test`; create table t2 (b int)
@@ -24,8 +26,9 @@ create table t3 (c int);
select @@server_id;
@@server_id
3
-show binlog events from <binlog_start>;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
master-bin.000001 # Query 2 # use `test`; create table t2 (b int)
diff --git a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result
index 1f4c138eb4e..344dddf78cf 100644
--- a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result
+++ b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result
@@ -1,3 +1,4 @@
+reset master;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
insert /* before delayed */ delayed /* after delayed */ into t1 values (207);
insert /*! delayed */ into t1 values (null);
@@ -5,9 +6,6 @@ insert delayed into t1 values (300);
FLUSH TABLES;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT' COLLATE 'latin1_swedish_ci'))
-master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert /* before delayed */ /* after delayed */ into t1 values (207)
diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
index fd6a98cabc4..06442245d3b 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
@@ -145,6 +145,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
set @ac = @@autocommit;
set autocommit= 0;
@@ -387,13 +388,46 @@ DROP PROCEDURE p4;
End of 5.0 tests
reset master;
create table t1 (id tinyint auto_increment primary key);
+insert into t1 values(5);
set insert_id=128;
-insert into t1 values(null);
+insert into t1 values(null) /* Not binlogged */;
+ERROR 22003: Out of range value for column 'id' at row 1
+set insert_id=128;
+insert ignore into t1 values(null) /* Insert 128 */;
+Warnings:
+Warning 167 Out of range value for column 'id' at row 1
+set insert_id=5;
+insert into t1 values(null) /* Not binlogged */;
+ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
+set insert_id=5;
+insert ignore into t1 values(null) /* Insert 5 */;
Warnings:
-Warning 1264 Out of range value for column 'id' at row 1
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
select * from t1;
id
-127
+5
+drop table t1;
+create table t1 (id tinyint auto_increment primary key) engine=myisam;
+set insert_id=128;
+insert into t1 values(5),(null) /* Insert_id 128 */;
+ERROR 22003: Out of range value for column 'id' at row 2
+set insert_id=128;
+insert ignore into t1 values (4),(null) /* Insert_id 128 */;
+Warnings:
+Warning 167 Out of range value for column 'id' at row 2
+set insert_id=5;
+insert into t1 values(3),(null) /* Insert_id 5 */;
+ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
+set insert_id=5;
+insert ignore into t1 values(2),(null) /* Insert_id 5 */;
+Warnings:
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+select * from t1 order by id;
+id
+2
+3
+4
+5
drop table t1;
create table t1 (a int);
create table if not exists t2 select * from t1;
@@ -408,35 +442,33 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Intvar # # INSERT_ID=127
-master-bin.000001 # Query # # use `test`; insert into t1 values(null)
+master-bin.000001 # Query # # use `test`; insert into t1 values(5)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=128
+master-bin.000001 # Query # # use `test`; insert ignore into t1 values(null) /* Insert 128 */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert ignore into t1 values(null) /* Insert 5 */
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
-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 `test`; create table t1 (id tinyint auto_increment primary key) engine=myisam
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
+master-bin.000001 # Intvar # # INSERT_ID=128
+master-bin.000001 # Query # # use `test`; insert into t1 values(5),(null) /* Insert_id 128 */
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
+master-bin.000001 # Intvar # # INSERT_ID=128
+master-bin.000001 # Query # # use `test`; insert ignore into t1 values (4),(null) /* Insert_id 128 */
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert into t1 values(3),(null) /* Insert_id 5 */
master-bin.000001 # Query # # COMMIT
-drop table t1,t2,t3,tt1;
-create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-insert /* before delayed */ delayed /* after delayed */ into t1 values (207);
-insert /*! delayed */ into t1 values (null);
-insert delayed into t1 values (300);
-FLUSH TABLES;
-include/show_binlog_events.inc
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Intvar # # INSERT_ID=127
-master-bin.000001 # Query # # use `test`; insert into t1 values(null)
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert ignore into t1 values(2),(null) /* Insert_id 5 */
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (a int)
@@ -452,8 +484,15 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt1` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
+drop table t1,t2,t3,tt1;
+reset master;
+create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
+insert /* before delayed */ delayed /* after delayed */ into t1 values (207);
+insert /*! delayed */ into t1 values (null);
+insert delayed into t1 values (300);
+FLUSH TABLES;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
@@ -521,6 +560,7 @@ BINLOG '
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# # Format_desc 1 # Server ver: #, Binlog ver: #
+# # Binlog_checkpoint 1 # master-bin.000001
# # Query 1 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
# # Query 1 # BEGIN
# # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
diff --git a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
index 755fd3e3761..2144a8bf649 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
@@ -173,8 +173,9 @@ set insert_id= 3;
insert into t1 values (NULL), (33), (NULL);
set insert_id= 5;
insert into t1 values (55), (NULL);
-show binlog events from <binlog_start>;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
master-bin.000001 # Query 1 # use `test`; create table t1 (a int auto_increment, primary key (a)) engine=blackhole
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Intvar 1 # INSERT_ID=1
diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
index 796e6d0588f..cfeca4811cb 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
@@ -26,7 +26,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=10000/*!*/;
insert into t2 values (@v)
/*!*/;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
index d7148ea0293..b162323194b 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
@@ -700,7 +700,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
-master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`= @b + bug27417(2) ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @`b`) SET `b`= @b + bug27417(2) ;file_id=#
master-bin.000001 # Query # # ROLLBACK
/* the output must denote there is the query */;
drop trigger trg_del_t2;
@@ -952,7 +952,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
-master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`= @b + bug27417(2) ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @`b`) SET `b`= @b + bug27417(2) ;file_id=#
master-bin.000001 # Query # # ROLLBACK
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result
index b69dcb642b8..f192bae7ac0 100644
--- a/mysql-test/suite/binlog/r/binlog_unsafe.result
+++ b/mysql-test/suite/binlog/r/binlog_unsafe.result
@@ -2682,6 +2682,7 @@ CREATE TABLE insert_2_keys (a INT UNIQUE KEY, b INT UNIQUE KEY);
INSERT INTO insert_2_keys values (1, 1);
INSERT IGNORE INTO insert_table SELECT * FROM filler_table;
Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
TRUNCATE TABLE insert_table;
INSERT INTO insert_table SELECT * FROM filler_table ON DUPLICATE KEY UPDATE a = 1;
diff --git a/mysql-test/suite/binlog/r/binlog_xa_recover.result b/mysql-test/suite/binlog/r/binlog_xa_recover.result
new file mode 100644
index 00000000000..1231a034ec6
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_xa_recover.result
@@ -0,0 +1,198 @@
+SET GLOBAL max_binlog_size= 4096;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
+INSERT INTO t1 VALUES (100, REPEAT("x", 4100));
+INSERT INTO t1 VALUES (101, REPEAT("x", 4100));
+INSERT INTO t1 VALUES (102, REPEAT("x", 4100));
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont";
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever";
+INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR con1_wait";
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont";
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever";
+INSERT INTO t1 VALUES (2, NULL);
+SET DEBUG_SYNC= "now WAIT_FOR con2_wait";
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont";
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever";
+INSERT INTO t1 VALUES (3, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR con3_wait";
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont";
+SET SESSION debug_dbug="+d,crash_commit_after_log";
+INSERT INTO t1 VALUES (4, NULL);
+SET DEBUG_SYNC= "now WAIT_FOR con4_wait";
+SET DEBUG_SYNC= "now SIGNAL con1_cont";
+SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
+SET DEBUG_SYNC= "now SIGNAL con2_cont";
+SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
+SET DEBUG_SYNC= "now SIGNAL con3_cont";
+SET DEBUG_SYNC= "now WAIT_FOR con3_ready";
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+master-bin.000003 #
+master-bin.000004 #
+master-bin.000005 #
+master-bin.000006 #
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000003 # Binlog_checkpoint # # master-bin.000002
+master-bin.000003 # Binlog_checkpoint # # master-bin.000003
+master-bin.000003 # Query # # BEGIN
+master-bin.000003 # Table_map # # table_id: # (test.t1)
+master-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000003 # Xid # # COMMIT /* XID */
+master-bin.000003 # Rotate # # master-bin.000004;pos=POS
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000004 # Binlog_checkpoint # # master-bin.000003
+master-bin.000004 # Binlog_checkpoint # # master-bin.000004
+master-bin.000004 # Query # # BEGIN
+master-bin.000004 # Table_map # # table_id: # (test.t1)
+master-bin.000004 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000004 # Xid # # COMMIT /* XID */
+master-bin.000004 # Rotate # # master-bin.000005;pos=POS
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000005 # Binlog_checkpoint # # master-bin.000004
+master-bin.000005 # Query # # BEGIN
+master-bin.000005 # Table_map # # table_id: # (test.t1)
+master-bin.000005 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000005 # Xid # # COMMIT /* XID */
+master-bin.000005 # Query # # BEGIN
+master-bin.000005 # Table_map # # table_id: # (test.t1)
+master-bin.000005 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000005 # Xid # # COMMIT /* XID */
+master-bin.000005 # Rotate # # master-bin.000006;pos=POS
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000006 # Binlog_checkpoint # # master-bin.000004
+PURGE BINARY LOGS TO "master-bin.000006";
+show binary logs;
+Log_name File_size
+master-bin.000004 #
+master-bin.000005 #
+master-bin.000006 #
+SET DEBUG_SYNC= "now SIGNAL con4_cont";
+Got one of the listed errors
+SELECT a FROM t1 ORDER BY a;
+a
+1
+2
+3
+4
+100
+101
+102
+Test that with multiple binlog checkpoints, recovery starts from the last one.
+SET GLOBAL max_binlog_size= 4096;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont";
+INSERT INTO t1 VALUES (10, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR con10_ready";
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont";
+INSERT INTO t1 VALUES (11, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR con11_ready";
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont";
+INSERT INTO t1 VALUES (12, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR con12_ready";
+INSERT INTO t1 VALUES (13, NULL);
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+master-bin.000003 #
+master-bin.000004 #
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000004 # Binlog_checkpoint # # master-bin.000001
+master-bin.000004 # Query # # BEGIN
+master-bin.000004 # Table_map # # table_id: # (test.t1)
+master-bin.000004 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000004 # Xid # # COMMIT /* XID */
+SET DEBUG_SYNC= "now SIGNAL con10_cont";
+SET DEBUG_SYNC= "now SIGNAL con12_cont";
+SET DEBUG_SYNC= "now SIGNAL con11_cont";
+Checking that master-bin.000004 is the last binlog checkpoint
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000004 # Binlog_checkpoint # # master-bin.000001
+master-bin.000004 # Query # # BEGIN
+master-bin.000004 # Table_map # # table_id: # (test.t1)
+master-bin.000004 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000004 # Xid # # COMMIT /* XID */
+master-bin.000004 # Binlog_checkpoint # # master-bin.000002
+master-bin.000004 # Binlog_checkpoint # # master-bin.000004
+Now crash the server
+SET SESSION debug_dbug="+d,crash_commit_after_log";
+INSERT INTO t1 VALUES (14, NULL);
+Got one of the listed errors
+SELECT a FROM t1 ORDER BY a;
+a
+1
+2
+3
+4
+10
+11
+12
+13
+14
+100
+101
+102
+*** Check that recovery works if we crashed early during rotate, before
+*** binlog checkpoint event could be written.
+SET GLOBAL max_binlog_size= 4096;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
+INSERT INTO t1 VALUES (22, REPEAT("x", 4100));
+INSERT INTO t1 VALUES (23, REPEAT("x", 4100));
+SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event";
+INSERT INTO t1 VALUES (24, REPEAT("x", 4100));
+Got one of the listed errors
+SELECT a FROM t1 ORDER BY a;
+a
+1
+2
+3
+4
+10
+11
+12
+13
+14
+21
+22
+23
+24
+100
+101
+102
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+master-bin.000003 #
+master-bin.000004 #
+master-bin.000005 #
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+master-bin.000004 # Binlog_checkpoint # # master-bin.000003
+master-bin.000004 # Binlog_checkpoint # # master-bin.000004
+master-bin.000004 # Query # # BEGIN
+master-bin.000004 # Table_map # # table_id: # (test.t1)
+master-bin.000004 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000004 # Xid # # COMMIT /* XID */
+master-bin.000004 # Rotate # # master-bin.000005;pos=POS
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/t/binlog_checkpoint.test b/mysql-test/suite/binlog/t/binlog_checkpoint.test
new file mode 100644
index 00000000000..557791c77e5
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_checkpoint.test
@@ -0,0 +1,108 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_binlog_format_row.inc
+
+SET @old_max_binlog_size= @@global.max_binlog_size;
+SET GLOBAL max_binlog_size= 4096;
+SET @old_innodb_flush_log_at_trx_commit= @@global.innodb_flush_log_at_trx_commit;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
+CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Myisam;
+
+--echo *** Test that RESET MASTER waits for pending commit checkpoints to complete.
+
+# con1 will hang before doing commit checkpoint, blocking RESET MASTER.
+connect(con1,localhost,root,,);
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go";
+send INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
+# Let's add a few binlog rotations just for good measure.
+INSERT INTO t2 VALUES (1, REPEAT("x", 4100));
+INSERT INTO t2 VALUES (2, REPEAT("x", 4100));
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000004
+--let $binlog_start= 4
+--source include/show_binlog_events.inc
+SET DEBUG_SYNC= "execute_command_after_close_tables SIGNAL reset_master_done";
+send RESET MASTER;
+
+connect(con2,localhost,root,,);
+--echo This will timeout, as RESET MASTER is blocked
+SET DEBUG_SYNC= "now WAIT_FOR reset_master_done TIMEOUT 1";
+# Wake up transaction to allow RESET MASTER to complete.
+SET DEBUG_SYNC= "now SIGNAL con1_go";
+
+connection con1;
+reap;
+
+connection default;
+reap;
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000001
+--let $binlog_start= 4
+--source include/show_binlog_events.inc
+
+--echo *** Test that binlog N is active, and commit checkpoint for (N-1) is
+--echo *** done while there is still a pending commit checkpoint for (N-2).
+
+connection con1;
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR con1_continue";
+send INSERT INTO t1 VALUES (20, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
+
+connection con2;
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR con2_continue";
+send INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000001
+--source include/show_binlog_events.inc
+--let $binlog_file= master-bin.000002
+--source include/show_binlog_events.inc
+--let $binlog_file= master-bin.000003
+--source include/show_binlog_events.inc
+
+SET DEBUG_SYNC= "now SIGNAL con2_continue";
+
+connection con2;
+reap;
+
+connection default;
+--echo con1 is still pending, no new binlog checkpoint should have been logged.
+--let $binlog_file= master-bin.000003
+--source include/show_binlog_events.inc
+
+SET DEBUG_SYNC= "now SIGNAL con1_continue";
+
+connection con1;
+reap;
+
+connection default;
+
+--echo No commit checkpoints are pending, a new binlog checkpoint should have been logged.
+--let $binlog_file= master-bin.000003
+
+# Wait for the master-bin.000003 binlog checkpoint to appear.
+--let $wait_for_all= 0
+--let $show_statement= SHOW BINLOG EVENTS IN "$binlog_file"
+--let $field= Info
+--let $condition= = "master-bin.000003"
+--source include/wait_show_condition.inc
+
+--source include/show_binlog_events.inc
+
+
+# Cleanup
+connection default;
+DROP TABLE t1, t2;
+SET GLOBAL max_binlog_size= @old_max_binlog_size;
+SET GLOBAL innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
diff --git a/mysql-test/suite/binlog/t/binlog_drop_if_exists.test b/mysql-test/suite/binlog/t/binlog_drop_if_exists.test
index 6b2b37ae791..26910432428 100644
--- a/mysql-test/suite/binlog/t/binlog_drop_if_exists.test
+++ b/mysql-test/suite/binlog/t/binlog_drop_if_exists.test
@@ -113,3 +113,18 @@ if($fixed_bug_25705)
--source include/show_binlog_events.inc
enable_warnings;
+
+# Drop comments in binlog
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+CREATE TABLE t1(id int);
+DROP TABLE /* comment */ t1;
+CREATE TABLE t1(id int);
+DROP TABLE IF EXISTS /* comment */ t1;
+
+CREATE TABLE t1(id int);
+DROP TABLE /**/ t1;
+CREATE TABLE t1(id int);
+DROP TABLE IF EXISTS /* */ t1;
+
+--source include/show_binlog_events.inc
+
diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test
index 9b6420df4b4..ff558ee2948 100644
--- a/mysql-test/suite/binlog/t/binlog_killed.test
+++ b/mysql-test/suite/binlog/t/binlog_killed.test
@@ -59,8 +59,8 @@ reap;
let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
let $MYSQLD_DATADIR= `select @@datadir`;
---let $binlog_killed_pos=query_get_value(SHOW BINLOG EVENTS, Pos, 4)
---let $binlog_killed_end_log_pos=query_get_value(SHOW BINLOG EVENTS, End_log_pos, 4)
+--let $binlog_killed_pos=query_get_value(SHOW BINLOG EVENTS, Pos, 5)
+--let $binlog_killed_end_log_pos=query_get_value(SHOW BINLOG EVENTS, End_log_pos, 5)
--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_killed_pos --stop-position=$binlog_killed_end_log_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--disable_result_log
@@ -270,8 +270,8 @@ select * from t4 order by b /* must be (1,1), (1,2) */;
select @b /* must be 1 at the end of a stmt calling bug27563() */;
--echo must have the update query event on the 4th line
source include/show_binlog_events.inc;
---let $binlog_killed_pos= query_get_value(SHOW BINLOG EVENTS, Pos, 4)
---let $binlog_killed_end_log_pos= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 4)
+--let $binlog_killed_pos= query_get_value(SHOW BINLOG EVENTS, Pos, 5)
+--let $binlog_killed_end_log_pos= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 5)
--echo *** a proof the query is binlogged with an error ***
@@ -318,8 +318,8 @@ select count(*) from t4 /* must be 1 */;
select @b /* must be 1 at the end of a stmt calling bug27563() */;
--echo must have the delete query event on the 4th line
source include/show_binlog_events.inc;
---let $binlog_killed_pos= query_get_value(SHOW BINLOG EVENTS, Pos, 4)
---let $binlog_killed_end_log_pos= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 4)
+--let $binlog_killed_pos= query_get_value(SHOW BINLOG EVENTS, Pos, 5)
+--let $binlog_killed_end_log_pos= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 5)
# a proof the query is binlogged with an error
diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
index ba111fd0145..33037710379 100644
--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
@@ -50,8 +50,8 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil
# a proof the query is binlogged with an error
---let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 3)
---let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 4)
+--let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 4)
+--let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 5)
source include/show_binlog_events.inc;
--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_load_data --stop-position=$binlog_end $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
diff --git a/mysql-test/suite/binlog/t/binlog_xa_recover-master.opt b/mysql-test/suite/binlog/t/binlog_xa_recover-master.opt
new file mode 100644
index 00000000000..3c44f9fad10
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_xa_recover-master.opt
@@ -0,0 +1 @@
+--skip-stack-trace --skip-core-file --loose-debug-dbug=+d,xa_recover_expect_master_bin_000004
diff --git a/mysql-test/suite/binlog/t/binlog_xa_recover.test b/mysql-test/suite/binlog/t/binlog_xa_recover.test
new file mode 100644
index 00000000000..36b2ddecb4f
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_xa_recover.test
@@ -0,0 +1,239 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_binlog_format_row.inc
+# Valgrind does not work well with test that crashes the server
+--source include/not_valgrind.inc
+
+# (We do not need to restore these settings, as we crash the server).
+SET GLOBAL max_binlog_size= 4096;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
+# Insert some data to force a couple binlog rotations (3), so we get some
+# normal binlog checkpoints before starting the test.
+INSERT INTO t1 VALUES (100, REPEAT("x", 4100));
+INSERT INTO t1 VALUES (101, REPEAT("x", 4100));
+INSERT INTO t1 VALUES (102, REPEAT("x", 4100));
+
+# Now start a bunch of transactions that span multiple binlog
+# files. Leave then in the state prepared-but-not-committed in the engine
+# and crash the server. Check that crash recovery is able to recover all
+# of them.
+#
+# We use debug_sync to get all the transactions into the prepared state before
+# we commit any of them. This is because the prepare step flushes the InnoDB
+# redo log - including any commits made before, so recovery would become
+# unnecessary, decreasing the value of this test.
+#
+# We arrange to have con1 with a prepared transaction in master-bin.000004,
+# con2 and con3 with a prepared transaction in master-bin.000005, and a new
+# empty master-bin.000006. So the latest binlog checkpoint should be
+# master-bin.000006.
+
+connect(con1,localhost,root,,);
+# First wait after prepare and before write to binlog.
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont";
+# Then complete InnoDB commit in memory (but not commit checkpoint / write to
+# disk), and hang until crash, leaving a transaction to be XA recovered.
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever";
+send INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con1_wait";
+
+connect(con2,localhost,root,,);
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont";
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever";
+send INSERT INTO t1 VALUES (2, NULL);
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con2_wait";
+
+connect(con3,localhost,root,,);
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont";
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever";
+send INSERT INTO t1 VALUES (3, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con3_wait";
+
+connect(con4,localhost,root,,);
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont";
+SET SESSION debug_dbug="+d,crash_commit_after_log";
+send INSERT INTO t1 VALUES (4, NULL);
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con4_wait";
+
+SET DEBUG_SYNC= "now SIGNAL con1_cont";
+SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
+SET DEBUG_SYNC= "now SIGNAL con2_cont";
+SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
+SET DEBUG_SYNC= "now SIGNAL con3_cont";
+SET DEBUG_SYNC= "now WAIT_FOR con3_ready";
+
+# Check that everything is committed in binary log.
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000003
+--let $binlog_start= 4
+--source include/show_binlog_events.inc
+--let $binlog_file= master-bin.000004
+--source include/show_binlog_events.inc
+--let $binlog_file= master-bin.000005
+--source include/show_binlog_events.inc
+--let $binlog_file= master-bin.000006
+--source include/show_binlog_events.inc
+
+
+# Check that server will not purge too much.
+PURGE BINARY LOGS TO "master-bin.000006";
+--source include/show_binary_logs.inc
+
+# Now crash the server with one more transaction in prepared state.
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait-binlog_xa_recover.test
+EOF
+SET DEBUG_SYNC= "now SIGNAL con4_cont";
+connection con4;
+--error 2006,2013
+reap;
+
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart-group_commit_binlog_pos.test
+EOF
+
+connection default;
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+# Check that all transactions are recovered.
+SELECT a FROM t1 ORDER BY a;
+
+--echo Test that with multiple binlog checkpoints, recovery starts from the last one.
+SET GLOBAL max_binlog_size= 4096;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+
+# Rotate to binlog master-bin.000003 while delaying binlog checkpoints.
+# So we get multiple binlog checkpoints in master-bin.000003.
+# Then complete the checkpoints, crash, and check that we only scan
+# the necessary binlog file (ie. that we use the _last_ checkpoint).
+
+connect(con10,localhost,root,,);
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont";
+send INSERT INTO t1 VALUES (10, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con10_ready";
+
+connect(con11,localhost,root,,);
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont";
+send INSERT INTO t1 VALUES (11, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con11_ready";
+
+connect(con12,localhost,root,,);
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont";
+send INSERT INTO t1 VALUES (12, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con12_ready";
+INSERT INTO t1 VALUES (13, NULL);
+
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000004
+--let $binlog_start= 4
+--source include/show_binlog_events.inc
+
+SET DEBUG_SYNC= "now SIGNAL con10_cont";
+connection con10;
+reap;
+connection default;
+SET DEBUG_SYNC= "now SIGNAL con12_cont";
+connection con12;
+reap;
+connection default;
+SET DEBUG_SYNC= "now SIGNAL con11_cont";
+connection con11;
+reap;
+
+connection default;
+# Wait for the last (master-bin.000004) binlog checkpoint to appear.
+--let $wait_for_all= 0
+--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
+--let $field= Info
+--let $condition= = "master-bin.000004"
+--source include/wait_show_condition.inc
+
+--echo Checking that master-bin.000004 is the last binlog checkpoint
+--source include/show_binlog_events.inc
+
+--echo Now crash the server
+# It is not too easy to test XA recovery, as it runs early during server
+# startup, before any connections can be made.
+# What we do is set a DBUG error insert which will crash if XA recovery
+# starts from any other binlog than master-bin.000004 (check the file
+# binlog_xa_recover-master.opt). Then we will fail here if XA recovery
+# would start from the wrong place.
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait-binlog_xa_recover.test
+EOF
+SET SESSION debug_dbug="+d,crash_commit_after_log";
+--error 2006,2013
+INSERT INTO t1 VALUES (14, NULL);
+
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart-group_commit_binlog_pos.test
+EOF
+
+connection default;
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+# Check that all transactions are recovered.
+SELECT a FROM t1 ORDER BY a;
+
+
+--echo *** Check that recovery works if we crashed early during rotate, before
+--echo *** binlog checkpoint event could be written.
+
+SET GLOBAL max_binlog_size= 4096;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+
+# We need some initial data to reach binlog master-bin.000004. Otherwise
+# crash recovery fails due to the error insert used for previous test.
+INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
+INSERT INTO t1 VALUES (22, REPEAT("x", 4100));
+INSERT INTO t1 VALUES (23, REPEAT("x", 4100));
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait-binlog_xa_recover.test
+EOF
+SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event";
+--error 2006,2013
+INSERT INTO t1 VALUES (24, REPEAT("x", 4100));
+
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart-group_commit_binlog_pos.test
+EOF
+
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+# Check that all transactions are recovered.
+SELECT a FROM t1 ORDER BY a;
+
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000004
+--let $binlog_start= 4
+--source include/show_binlog_events.inc
+
+# Cleanup
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/engines/funcs/r/an_calendar.result b/mysql-test/suite/engines/funcs/r/an_calendar.result
index e974a67444e..f057c3b618f 100644
--- a/mysql-test/suite/engines/funcs/r/an_calendar.result
+++ b/mysql-test/suite/engines/funcs/r/an_calendar.result
@@ -16,7 +16,13 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NULL, c2 TIME NULL);
SET TIMESTAMP=1171346973;
INSERT INTO t1 VALUES(NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
INSERT INTO t1 VALUES(NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
diff --git a/mysql-test/suite/engines/funcs/r/datetime_function.result b/mysql-test/suite/engines/funcs/r/datetime_function.result
index 182f61f67f0..583552edc7d 100644
--- a/mysql-test/suite/engines/funcs/r/datetime_function.result
+++ b/mysql-test/suite/engines/funcs/r/datetime_function.result
@@ -25,7 +25,15 @@ INSERT INTO t3 VALUES('2008-02-29 13:13:13');
DROP TABLE t3;
CREATE TABLE t3(c1 TIME NOT NULL);
INSERT INTO t3 VALUES('1000-01-01 00:00:00');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t3 VALUES('1999-12-31 23:59:59');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t3 VALUES('2000-01-01 00:00:00');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t3 VALUES('2008-02-29 13:13:13');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
DROP TABLE t3;
diff --git a/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result b/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result
index 6a9bfae27db..9792236af0a 100644
--- a/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result
+++ b/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result
@@ -77,6 +77,7 @@ utf8_persian_ci utf8 208 # #
utf8_esperanto_ci utf8 209 # #
utf8_hungarian_ci utf8 210 # #
utf8_sinhala_ci utf8 211 # #
+utf8_croatian_ci utf8 213 # #
utf8_general_mysql500_ci utf8 223 # #
ucs2_general_ci ucs2 35 Yes # #
ucs2_bin ucs2 90 # #
@@ -100,6 +101,7 @@ ucs2_persian_ci ucs2 144 # #
ucs2_esperanto_ci ucs2 145 # #
ucs2_hungarian_ci ucs2 146 # #
ucs2_sinhala_ci ucs2 147 # #
+ucs2_croatian_ci ucs2 149 # #
ucs2_general_mysql500_ci ucs2 159 # #
cp866_general_ci cp866 36 Yes # #
cp866_bin cp866 68 # #
@@ -137,6 +139,7 @@ utf8mb4_persian_ci utf8mb4 240 # #
utf8mb4_esperanto_ci utf8mb4 241 # #
utf8mb4_hungarian_ci utf8mb4 242 # #
utf8mb4_sinhala_ci utf8mb4 243 # #
+utf8mb4_croatian_ci utf8mb4 245 # #
cp1251_bulgarian_ci cp1251 14 # #
cp1251_ukrainian_ci cp1251 23 # #
cp1251_bin cp1251 50 # #
@@ -164,6 +167,7 @@ utf16_persian_ci utf16 117 # #
utf16_esperanto_ci utf16 118 # #
utf16_hungarian_ci utf16 119 # #
utf16_sinhala_ci utf16 120 # #
+utf16_croatian_ci utf16 215 # #
cp1256_general_ci cp1256 57 Yes # #
cp1256_bin cp1256 67 # #
cp1257_lithuanian_ci cp1257 29 # #
@@ -191,6 +195,7 @@ utf32_persian_ci utf32 176 # #
utf32_esperanto_ci utf32 177 # #
utf32_hungarian_ci utf32 178 # #
utf32_sinhala_ci utf32 179 # #
+utf32_croatian_ci utf32 214 # #
binary binary 63 Yes # #
geostd8_general_ci geostd8 92 Yes # #
geostd8_bin geostd8 93 # #
diff --git a/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result b/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result
index 79d1d4cbac2..9490446e83d 100644
--- a/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result
+++ b/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result
@@ -77,6 +77,7 @@ utf8_persian_ci utf8 208 # #
utf8_esperanto_ci utf8 209 # #
utf8_hungarian_ci utf8 210 # #
utf8_sinhala_ci utf8 211 # #
+utf8_croatian_ci utf8 213 # #
utf8_general_mysql500_ci utf8 223 # #
ucs2_general_ci ucs2 35 Yes # #
ucs2_bin ucs2 90 # #
@@ -100,6 +101,7 @@ ucs2_persian_ci ucs2 144 # #
ucs2_esperanto_ci ucs2 145 # #
ucs2_hungarian_ci ucs2 146 # #
ucs2_sinhala_ci ucs2 147 # #
+ucs2_croatian_ci ucs2 149 # #
ucs2_general_mysql500_ci ucs2 159 # #
cp866_general_ci cp866 36 Yes # #
cp866_bin cp866 68 # #
@@ -137,6 +139,7 @@ utf8mb4_persian_ci utf8mb4 240 # #
utf8mb4_esperanto_ci utf8mb4 241 # #
utf8mb4_hungarian_ci utf8mb4 242 # #
utf8mb4_sinhala_ci utf8mb4 243 # #
+utf8mb4_croatian_ci utf8mb4 245 # #
cp1251_bulgarian_ci cp1251 14 # #
cp1251_ukrainian_ci cp1251 23 # #
cp1251_bin cp1251 50 # #
@@ -164,6 +167,7 @@ utf16_persian_ci utf16 117 # #
utf16_esperanto_ci utf16 118 # #
utf16_hungarian_ci utf16 119 # #
utf16_sinhala_ci utf16 120 # #
+utf16_croatian_ci utf16 215 # #
cp1256_general_ci cp1256 57 Yes # #
cp1256_bin cp1256 67 # #
cp1257_lithuanian_ci cp1257 29 # #
@@ -191,6 +195,7 @@ utf32_persian_ci utf32 176 # #
utf32_esperanto_ci utf32 177 # #
utf32_hungarian_ci utf32 178 # #
utf32_sinhala_ci utf32 179 # #
+utf32_croatian_ci utf32 214 # #
binary binary 63 Yes # #
geostd8_general_ci geostd8 92 Yes # #
geostd8_bin geostd8 93 # #
diff --git a/mysql-test/suite/engines/funcs/r/db_use_error.result b/mysql-test/suite/engines/funcs/r/db_use_error.result
index 03c41e927ac..2051b56b19e 100644
--- a/mysql-test/suite/engines/funcs/r/db_use_error.result
+++ b/mysql-test/suite/engines/funcs/r/db_use_error.result
@@ -9,7 +9,7 @@ mysql
performance_schema
test
USE DATABASE nond6;
-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 'DATABASE nond6' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATABASE nond6' at line 1
DROP DATABASE d6;
SHOW DATABASES;
Database
diff --git a/mysql-test/suite/engines/funcs/r/de_calendar_range.result b/mysql-test/suite/engines/funcs/r/de_calendar_range.result
index 07543e0c8c4..ab39556e6ce 100644
--- a/mysql-test/suite/engines/funcs/r/de_calendar_range.result
+++ b/mysql-test/suite/engines/funcs/r/de_calendar_range.result
@@ -33,10 +33,20 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL PRIMARY KEY);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'2 02:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'3 03:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'4 04:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
SELECT * FROM t1 ORDER BY c1;
c1
09:09:33
@@ -47,8 +57,6 @@ c1
DELETE FROM t1 WHERE c1 <= ADDTIME(NOW(),'2 02:01:01');
SELECT * FROM t1 ORDER BY c1;
c1
-12:10:34
-13:10:34
DROP TABLE t1;
CREATE TABLE t1(c1 DATETIME NOT NULL PRIMARY KEY);
SET TIMESTAMP=1171346973;
diff --git a/mysql-test/suite/engines/funcs/r/in_calendar_2_unique_constraints_duplicate_update.result b/mysql-test/suite/engines/funcs/r/in_calendar_2_unique_constraints_duplicate_update.result
index 9c56e23574d..c68baf685e2 100644
--- a/mysql-test/suite/engines/funcs/r/in_calendar_2_unique_constraints_duplicate_update.result
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_2_unique_constraints_duplicate_update.result
@@ -66,12 +66,42 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 TIME NULL, PRIMARY KEY(c1), UNIQUE(c2));
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'4 04:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'1 01:01:01'),ADDTIME(NOW(),'3 03:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'2 02:01:01'),ADDTIME(NOW(),'2 02:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'3 03:01:01'),ADDTIME(NOW(),'1 01:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'4 04:01:01'),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'2 02:01:01'),ADDTIME(NOW(),'2 02:01:01'),NOW()) ON DUPLICATE KEY UPDATE c3=ADDTIME(NOW(),'6 06:01:01');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW()) ON DUPLICATE KEY UPDATE c3=ADDTIME(NOW(),'6 06:01:01');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
SELECT * FROM t1;
c1 c2 c3
09:09:33 13:10:34 15:10:34
diff --git a/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_duplicate_update.result b/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_duplicate_update.result
index 47355681eae..6e3f717e93d 100644
--- a/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_duplicate_update.result
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_duplicate_update.result
@@ -29,8 +29,15 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL PRIMARY KEY);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(NOW()) ON DUPLICATE KEY UPDATE c1=ADDTIME(NOW(),'2 02:01:01');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c1' at row 1
SELECT * FROM t1;
c1
10:10:34
diff --git a/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_error.result b/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_error.result
index f8bff355901..4644894beec 100644
--- a/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_error.result
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_error.result
@@ -28,7 +28,11 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL PRIMARY KEY);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(NOW());
ERROR 23000: Duplicate entry '09:09:33' for key 'PRIMARY'
SELECT * FROM t1;
diff --git a/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_ignore.result b/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_ignore.result
index f8bff355901..4644894beec 100644
--- a/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_ignore.result
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_ignore.result
@@ -28,7 +28,11 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL PRIMARY KEY);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(NOW());
ERROR 23000: Duplicate entry '09:09:33' for key 'PRIMARY'
SELECT * FROM t1;
diff --git a/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_duplicate_update.result b/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_duplicate_update.result
index 5c4307158fa..8af6ff6af13 100644
--- a/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_duplicate_update.result
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_duplicate_update.result
@@ -29,8 +29,15 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NULL UNIQUE);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(NOW()) ON DUPLICATE KEY UPDATE c1=ADDTIME(NOW(),'2 02:01:01');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c1' at row 1
SELECT * FROM t1;
c1
10:10:34
diff --git a/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_error.result b/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_error.result
index 9f6a205530c..c96cd4ba8a8 100644
--- a/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_error.result
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_error.result
@@ -28,7 +28,11 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NULL UNIQUE);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(NOW());
ERROR 23000: Duplicate entry '09:09:33' for key 'c1'
SELECT * FROM t1;
diff --git a/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_ignore.result b/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_ignore.result
index 5469527b762..210460d33f1 100644
--- a/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_ignore.result
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_ignore.result
@@ -28,8 +28,14 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NULL UNIQUE);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT IGNORE INTO t1 (c1) VALUES(NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
SELECT * FROM t1;
c1
09:09:33
diff --git a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_duplicate_update.result b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_duplicate_update.result
index d7dfc9d794c..209f61440cd 100644
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_duplicate_update.result
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_duplicate_update.result
@@ -61,11 +61,40 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NOT NULL, c3 TIME NOT NULL, PRIMARY KEY(c1,c2,c3));
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'1 01:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'1 01:01:01'),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW()) ON DUPLICATE KEY UPDATE c1=ADDTIME(NOW(),'2 02:01:01'),c2=ADDTIME(NOW(),'2 02:01:01'),c3=ADDTIME(NOW(),'2 02:01:01');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01')) ON DUPLICATE KEY UPDATE c1=ADDTIME(NOW(),'2 02:01:01'),c2=ADDTIME(NOW(),'2 02:01:01');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
SELECT * FROM t1;
c1 c2 c3
09:09:33 10:10:34 09:09:33
diff --git a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_error.result b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_error.result
index d71af8d6375..9c310d3d457 100644
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_error.result
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_error.result
@@ -52,9 +52,25 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NOT NULL, c3 TIME NOT NULL, PRIMARY KEY(c1,c2,c3));
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'1 01:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'1 01:01:01'),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
ERROR 23000: Duplicate entry '09:09:33-09:09:33-09:09:33' for key 'PRIMARY'
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
diff --git a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_ignore.result b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_ignore.result
index d71af8d6375..9c310d3d457 100644
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_ignore.result
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_ignore.result
@@ -52,9 +52,25 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NOT NULL, c3 TIME NOT NULL, PRIMARY KEY(c1,c2,c3));
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'1 01:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'1 01:01:01'),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
ERROR 23000: Duplicate entry '09:09:33-09:09:33-09:09:33' for key 'PRIMARY'
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
diff --git a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_duplicate_update.result b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_duplicate_update.result
index edad4bb218d..fe509a0615c 100644
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_duplicate_update.result
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_duplicate_update.result
@@ -61,11 +61,40 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NULL, c2 TIME NULL, c3 TIME NULL, UNIQUE(c1,c2,c3));
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'1 01:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'1 01:01:01'),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW()) ON DUPLICATE KEY UPDATE c1=ADDTIME(NOW(),'2 02:01:01'),c2=ADDTIME(NOW(),'2 02:01:01'),c3=ADDTIME(NOW(),'2 02:01:01');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01')) ON DUPLICATE KEY UPDATE c1=ADDTIME(NOW(),'2 02:01:01'),c2=ADDTIME(NOW(),'2 02:01:01');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
SELECT * FROM t1;
c1 c2 c3
09:09:33 10:10:34 09:09:33
diff --git a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_error.result b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_error.result
index 4d7cadac70c..78b0e81cd56 100644
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_error.result
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_error.result
@@ -52,9 +52,25 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NULL, c2 TIME NULL, c3 TIME NULL, UNIQUE(c1,c2,c3));
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'1 01:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'1 01:01:01'),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
ERROR 23000: Duplicate entry '09:09:33-09:09:33-09:09:33' for key 'c1'
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
diff --git a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_ignore.result b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_ignore.result
index 31f7db1dc9a..a884345be84 100644
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_ignore.result
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_ignore.result
@@ -56,11 +56,35 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NULL, c2 TIME NULL, c3 TIME NULL, UNIQUE(c1,c2,c3));
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'1 01:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'1 01:01:01'),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
SELECT * FROM t1;
c1 c2 c3
09:09:33 09:09:33 09:09:33
diff --git a/mysql-test/suite/engines/funcs/r/in_multicolumn_number_pk_constraint_duplicate_update.result b/mysql-test/suite/engines/funcs/r/in_multicolumn_number_pk_constraint_duplicate_update.result
index d7dfc9d794c..209f61440cd 100644
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_number_pk_constraint_duplicate_update.result
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_number_pk_constraint_duplicate_update.result
@@ -61,11 +61,40 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NOT NULL, c3 TIME NOT NULL, PRIMARY KEY(c1,c2,c3));
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'1 01:01:01'),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'1 01:01:01'),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW()) ON DUPLICATE KEY UPDATE c1=ADDTIME(NOW(),'2 02:01:01'),c2=ADDTIME(NOW(),'2 02:01:01'),c3=ADDTIME(NOW(),'2 02:01:01');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01')) ON DUPLICATE KEY UPDATE c1=ADDTIME(NOW(),'2 02:01:01'),c2=ADDTIME(NOW(),'2 02:01:01');
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
SELECT * FROM t1;
c1 c2 c3
09:09:33 10:10:34 09:09:33
diff --git a/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result b/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result
index 556b5a05764..53964697506 100644
--- a/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result
+++ b/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result
@@ -7,7 +7,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR HY000: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
@@ -26,7 +26,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR HY000: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
@@ -45,7 +45,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR HY000: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
@@ -64,7 +64,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR HY000: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
@@ -83,7 +83,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR HY000: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
@@ -102,7 +102,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR HY000: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
diff --git a/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result b/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result
index fe7fc0e38d7..62ad9a568f9 100644
--- a/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result
+++ b/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result
@@ -7,7 +7,7 @@ INSERT INTO t5 (c1) VALUES(0);
INSERT INTO t5 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES('x');
-ERROR HY000: Incorrect decimal value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES(999999);
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT COUNT(c1) AS total_rows FROM t5;
@@ -27,7 +27,7 @@ INSERT INTO t5 (c1) VALUES(0);
INSERT INTO t5 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES('x');
-ERROR HY000: Incorrect decimal value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES(999999);
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT COUNT(c1) AS total_rows FROM t5;
@@ -47,7 +47,7 @@ INSERT INTO t5 (c1) VALUES(0);
INSERT INTO t5 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES('x');
-ERROR HY000: Incorrect decimal value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES(999999);
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT COUNT(c1) AS total_rows FROM t5;
@@ -67,7 +67,7 @@ INSERT INTO t5 (c1) VALUES(0);
INSERT INTO t5 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES('x');
-ERROR HY000: Incorrect decimal value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES(999999);
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT COUNT(c1) AS total_rows FROM t5;
diff --git a/mysql-test/suite/engines/funcs/r/ld_all_number_string_calendar_types.result b/mysql-test/suite/engines/funcs/r/ld_all_number_string_calendar_types.result
index 63d36edd3aa..4776a3ac748 100644
--- a/mysql-test/suite/engines/funcs/r/ld_all_number_string_calendar_types.result
+++ b/mysql-test/suite/engines/funcs/r/ld_all_number_string_calendar_types.result
@@ -61,6 +61,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -77,6 +81,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -93,6 +101,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -325,6 +337,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -341,6 +357,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -357,6 +377,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -589,6 +613,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -605,6 +633,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -621,6 +653,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -853,6 +889,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -869,6 +909,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -885,6 +929,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1117,6 +1165,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1133,6 +1185,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1149,6 +1205,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1381,6 +1441,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1397,6 +1461,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1413,6 +1481,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1645,6 +1717,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1661,6 +1737,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1677,6 +1757,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1909,6 +1993,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1925,6 +2013,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -1941,6 +2033,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2173,6 +2269,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2189,6 +2289,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2205,6 +2309,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2437,6 +2545,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2453,6 +2565,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2469,6 +2585,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2701,6 +2821,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2717,6 +2841,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2733,6 +2861,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2965,6 +3097,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2981,6 +3117,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -2997,6 +3137,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -3229,6 +3373,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -3245,6 +3393,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -3261,6 +3413,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -3493,6 +3649,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -3509,6 +3669,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -3525,6 +3689,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 CHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -3757,6 +3925,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -3773,6 +3945,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -3789,6 +3965,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4021,6 +4201,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4037,6 +4221,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4053,6 +4241,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4285,6 +4477,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4301,6 +4497,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4317,6 +4517,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4549,6 +4753,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4565,6 +4773,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4581,6 +4793,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4813,6 +5029,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4829,6 +5049,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -4845,6 +5069,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5077,6 +5305,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5093,6 +5325,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5109,6 +5345,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5341,6 +5581,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5357,6 +5601,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5373,6 +5621,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5605,6 +5857,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5621,6 +5877,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5637,6 +5897,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5869,6 +6133,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5885,6 +6153,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -5901,6 +6173,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6133,6 +6409,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6149,6 +6429,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6165,6 +6449,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6397,6 +6685,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6413,6 +6705,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6429,6 +6725,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6661,6 +6961,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6677,6 +6981,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6693,6 +7001,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6925,6 +7237,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6941,6 +7257,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -6957,6 +7277,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7189,6 +7513,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7205,6 +7533,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7221,6 +7553,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7453,6 +7789,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7469,6 +7809,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7485,6 +7829,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7717,6 +8065,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7733,6 +8085,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7749,6 +8105,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7981,6 +8341,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -7997,6 +8361,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -8013,6 +8381,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -8245,6 +8617,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -8261,6 +8637,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -8277,6 +8657,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -8509,6 +8893,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -8525,6 +8913,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -8541,6 +8933,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -8773,6 +9169,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -8789,6 +9189,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -8805,6 +9209,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9037,6 +9445,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9053,6 +9465,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9069,6 +9485,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9301,6 +9721,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9317,6 +9741,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9333,6 +9761,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9565,6 +9997,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9581,6 +10017,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9597,6 +10037,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9829,6 +10273,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9845,6 +10293,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -9861,6 +10313,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10093,6 +10549,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10109,6 +10569,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10125,6 +10589,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10357,6 +10825,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10373,6 +10845,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10389,6 +10865,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10621,6 +11101,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10637,6 +11121,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10653,6 +11141,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10885,6 +11377,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10901,6 +11397,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -10917,6 +11417,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 BINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11149,6 +11653,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11165,6 +11673,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11181,6 +11693,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11413,6 +11929,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11429,6 +11949,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11445,6 +11969,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11677,6 +12205,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11693,6 +12225,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11709,6 +12245,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11941,6 +12481,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11957,6 +12501,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -11973,6 +12521,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -12205,6 +12757,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -12221,6 +12777,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -12237,6 +12797,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -12469,6 +13033,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -12485,6 +13053,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -12501,6 +13073,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -12733,6 +13309,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -12749,6 +13329,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -12765,6 +13349,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -12997,6 +13585,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13013,6 +13605,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13029,6 +13625,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DEC NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13261,6 +13861,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13277,6 +13881,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13293,6 +13901,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FIXED NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13525,6 +14137,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13541,6 +14157,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13557,6 +14177,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 NUMERIC NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13789,6 +14413,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13805,6 +14433,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -13821,6 +14453,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -14053,6 +14689,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -14069,6 +14709,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -14085,6 +14729,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -14317,6 +14965,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -14333,6 +14985,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -14349,6 +15005,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 DOUBLE PRECISION NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -14581,6 +15241,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -14597,6 +15261,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
@@ -14613,6 +15281,10 @@ c1 c2 c3
DROP TABLE t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL PRIMARY KEY, c2 VARBINARY(10), c3 TIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_simple.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+Note 1265 Data truncated for column 'c3' at row 3
SELECT * INTO OUTFILE '../../tmp/t1.dat' FIELDS ENCLOSED BY '"' OPTIONALLY ENCLOSED BY ':' LINES TERMINATED BY '\r\n' FROM t1;
SELECT * FROM t1 ORDER BY c1;
c1 c2 c3
diff --git a/mysql-test/suite/engines/funcs/r/sq_all.result b/mysql-test/suite/engines/funcs/r/sq_all.result
index ac1908b7b1b..24e62a3f3ba 100644
--- a/mysql-test/suite/engines/funcs/r/sq_all.result
+++ b/mysql-test/suite/engines/funcs/r/sq_all.result
@@ -13,13 +13,10 @@ SELECT c1 FROM t1 WHERE c1 > ALL (SELECT c1 FROM t2);
c1
SELECT c1 FROM t1 WHERE c1 >= ALL (SELECT c1 FROM t2);
c1
-100
SELECT c1 FROM t1 WHERE c1 = ALL (SELECT c1 FROM t2);
c1
SELECT c1 FROM t1 WHERE c1 <= ALL (SELECT c1 FROM t2);
c1
-1
-2
SELECT c1 FROM t1 WHERE c1 <> ALL (SELECT c1 FROM t2);
c1
DROP TABLE t1;
@@ -37,13 +34,10 @@ SELECT c1 FROM t1 WHERE c1 > ALL (SELECT c1 FROM t2);
c1
SELECT c1 FROM t1 WHERE c1 >= ALL (SELECT c1 FROM t2);
c1
-100
SELECT c1 FROM t1 WHERE c1 = ALL (SELECT c1 FROM t2);
c1
SELECT c1 FROM t1 WHERE c1 <= ALL (SELECT c1 FROM t2);
c1
-1
-2
SELECT c1 FROM t1 WHERE c1 <> ALL (SELECT c1 FROM t2);
c1
DROP TABLE t1;
@@ -61,13 +55,10 @@ SELECT c1 FROM t1 WHERE c1 > ALL (SELECT c1 FROM t2);
c1
SELECT c1 FROM t1 WHERE c1 >= ALL (SELECT c1 FROM t2);
c1
-100
SELECT c1 FROM t1 WHERE c1 = ALL (SELECT c1 FROM t2);
c1
SELECT c1 FROM t1 WHERE c1 <= ALL (SELECT c1 FROM t2);
c1
-1
-2
SELECT c1 FROM t1 WHERE c1 <> ALL (SELECT c1 FROM t2);
c1
DROP TABLE t1;
@@ -85,13 +76,10 @@ SELECT c1 FROM t1 WHERE c1 > ALL (SELECT c1 FROM t2);
c1
SELECT c1 FROM t1 WHERE c1 >= ALL (SELECT c1 FROM t2);
c1
-100
SELECT c1 FROM t1 WHERE c1 = ALL (SELECT c1 FROM t2);
c1
SELECT c1 FROM t1 WHERE c1 <= ALL (SELECT c1 FROM t2);
c1
-1
-2
SELECT c1 FROM t1 WHERE c1 <> ALL (SELECT c1 FROM t2);
c1
DROP TABLE t1;
diff --git a/mysql-test/suite/engines/funcs/r/sq_error.result b/mysql-test/suite/engines/funcs/r/sq_error.result
index 5ce36f50e49..c983ff73d12 100644
--- a/mysql-test/suite/engines/funcs/r/sq_error.result
+++ b/mysql-test/suite/engines/funcs/r/sq_error.result
@@ -11,7 +11,7 @@ INSERT INTO t2 VALUES (2,'abcde');
SELECT * FROM t1 WHERE c2 IN (SELECT c2 FROM t2 ORDER BY c1 LIMIT 1)
--error 1241
SELECT (SELECT c1, c2 FROM t2) FROM t1;
-ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
SELECT * FROM t1 WHERE c1 = (SELECT c1 FROM t2);
ERROR 21000: Subquery returns more than 1 row
UPDATE t1 SET c2 = (SELECT MAX(c1) FROM t2);
@@ -30,7 +30,7 @@ INSERT INTO t2 VALUES (2,'abcde');
SELECT * FROM t1 WHERE c2 IN (SELECT c2 FROM t2 ORDER BY c1 LIMIT 1)
--error 1241
SELECT (SELECT c1, c2 FROM t2) FROM t1;
-ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
SELECT * FROM t1 WHERE c1 = (SELECT c1 FROM t2);
ERROR 21000: Subquery returns more than 1 row
UPDATE t1 SET c2 = (SELECT MAX(c1) FROM t2);
@@ -49,7 +49,7 @@ INSERT INTO t2 VALUES (2,'abcde');
SELECT * FROM t1 WHERE c2 IN (SELECT c2 FROM t2 ORDER BY c1 LIMIT 1)
--error 1241
SELECT (SELECT c1, c2 FROM t2) FROM t1;
-ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
SELECT * FROM t1 WHERE c1 = (SELECT c1 FROM t2);
ERROR 21000: Subquery returns more than 1 row
UPDATE t1 SET c2 = (SELECT MAX(c1) FROM t2);
@@ -68,7 +68,7 @@ INSERT INTO t2 VALUES (2,'abcde');
SELECT * FROM t1 WHERE c2 IN (SELECT c2 FROM t2 ORDER BY c1 LIMIT 1)
--error 1241
SELECT (SELECT c1, c2 FROM t2) FROM t1;
-ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
SELECT * FROM t1 WHERE c1 = (SELECT c1 FROM t2);
ERROR 21000: Subquery returns more than 1 row
UPDATE t1 SET c2 = (SELECT MAX(c1) FROM t2);
diff --git a/mysql-test/suite/engines/funcs/r/up_calendar_range.result b/mysql-test/suite/engines/funcs/r/up_calendar_range.result
index dbd6e2cf8a6..10bef827a88 100644
--- a/mysql-test/suite/engines/funcs/r/up_calendar_range.result
+++ b/mysql-test/suite/engines/funcs/r/up_calendar_range.result
@@ -39,10 +39,20 @@ DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'2 02:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'3 03:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'4 04:01:01'));
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
SELECT * FROM t1 ORDER BY c1;
c1
09:09:33
@@ -54,10 +64,10 @@ UPDATE t1 SET c1 = NOW() WHERE c1 >= ADDTIME(NOW(),'2 02:01:01');
SELECT * FROM t1 ORDER BY c1;
c1
09:09:33
-09:09:33
-09:09:33
-09:09:33
10:10:34
+11:10:34
+12:10:34
+13:10:34
DROP TABLE t1;
CREATE TABLE t1(c1 DATETIME NOT NULL);
SET TIMESTAMP=1171346973;
diff --git a/mysql-test/suite/engines/funcs/t/se_join_left.test b/mysql-test/suite/engines/funcs/t/se_join_left.test
index 005936acb3b..792f2cdd699 100644
--- a/mysql-test/suite/engines/funcs/t/se_join_left.test
+++ b/mysql-test/suite/engines/funcs/t/se_join_left.test
@@ -12,8 +12,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -27,8 +30,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -42,8 +48,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -57,8 +66,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -72,8 +84,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -87,8 +102,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -102,8 +120,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -117,8 +138,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -132,8 +156,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -147,8 +174,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -162,8 +192,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -177,8 +210,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -192,8 +228,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -207,8 +246,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -222,8 +264,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -237,8 +282,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -252,8 +300,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -267,8 +318,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -282,8 +336,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -297,8 +354,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -312,8 +372,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -327,8 +390,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -342,8 +408,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -357,8 +426,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -372,8 +444,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -387,8 +462,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -402,8 +480,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -417,8 +498,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -432,8 +516,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -447,8 +534,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -462,8 +552,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -477,8 +570,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -492,8 +588,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -507,8 +606,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -522,8 +624,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -537,8 +642,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -552,8 +660,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -567,8 +678,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -582,8 +696,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -597,8 +714,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -612,8 +732,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -627,8 +750,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -642,8 +768,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -657,8 +786,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -672,8 +804,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -687,8 +822,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -702,8 +840,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -717,8 +858,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -732,8 +876,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -747,8 +894,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -762,8 +912,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -777,8 +930,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -792,8 +948,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -807,8 +966,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -822,8 +984,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -837,8 +1002,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -852,8 +1020,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -867,8 +1038,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -882,8 +1056,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -897,8 +1074,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -912,8 +1092,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -927,8 +1110,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -942,8 +1128,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -957,8 +1146,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -972,8 +1164,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -987,8 +1182,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1002,8 +1200,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1017,8 +1218,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1032,8 +1236,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1047,8 +1254,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1062,8 +1272,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1077,8 +1290,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1092,8 +1308,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1107,8 +1326,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1122,8 +1344,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1137,8 +1362,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1152,8 +1380,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1167,8 +1398,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1182,8 +1416,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1197,8 +1434,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1212,8 +1452,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1227,8 +1470,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1242,8 +1488,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1257,8 +1506,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1272,8 +1524,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1287,8 +1542,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1302,8 +1560,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1317,8 +1578,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1332,8 +1596,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1347,8 +1614,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1362,8 +1632,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1377,8 +1650,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1392,8 +1668,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1407,8 +1686,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1422,8 +1704,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1437,8 +1722,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1452,8 +1740,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1467,8 +1758,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1482,8 +1776,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1497,8 +1794,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1512,8 +1812,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1527,8 +1830,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1542,8 +1848,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1557,8 +1866,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1572,8 +1884,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1587,8 +1902,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1602,8 +1920,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1617,8 +1938,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1632,8 +1956,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1647,8 +1974,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1662,8 +1992,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1677,8 +2010,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1692,8 +2028,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1707,8 +2046,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1722,8 +2064,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1737,8 +2082,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1752,8 +2100,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1767,8 +2118,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1782,8 +2136,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1797,8 +2154,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1812,8 +2172,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1827,8 +2190,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1842,8 +2208,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1857,8 +2226,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1872,8 +2244,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1887,8 +2262,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1902,8 +2280,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1917,8 +2298,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1932,8 +2316,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1947,8 +2334,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1962,8 +2352,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1977,8 +2370,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1992,8 +2388,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2007,8 +2406,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2022,8 +2424,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2037,8 +2442,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2052,8 +2460,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2067,8 +2478,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2082,8 +2496,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2097,8 +2514,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2112,8 +2532,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2127,8 +2550,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2142,8 +2568,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2157,8 +2586,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2172,8 +2604,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2187,8 +2622,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2202,8 +2640,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2217,8 +2658,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2232,8 +2676,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2247,8 +2694,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2262,8 +2712,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2277,8 +2730,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2292,8 +2748,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2307,8 +2766,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2322,8 +2784,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2337,8 +2802,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2352,8 +2820,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2367,8 +2838,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2382,8 +2856,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2397,8 +2874,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2412,8 +2892,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2427,8 +2910,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2442,8 +2928,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2457,8 +2946,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2472,8 +2964,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2487,8 +2982,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2502,8 +3000,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2517,8 +3018,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2532,8 +3036,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2547,8 +3054,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2562,8 +3072,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2577,8 +3090,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2592,8 +3108,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2607,8 +3126,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2622,8 +3144,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2637,8 +3162,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2652,8 +3180,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2667,8 +3198,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2682,8 +3216,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2697,8 +3234,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2712,8 +3252,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2727,8 +3270,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2742,8 +3288,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2757,8 +3306,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2772,8 +3324,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2787,8 +3342,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 USING (c1);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2802,8 +3360,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2817,8 +3378,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2832,8 +3396,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2847,8 +3414,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2862,8 +3432,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2877,8 +3450,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 USING (c1);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2892,8 +3468,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2907,8 +3486,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2922,8 +3504,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2937,8 +3522,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2952,8 +3540,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2967,8 +3558,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 USING (c1);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2982,8 +3576,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2997,8 +3594,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -3012,8 +3612,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -3027,8 +3630,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -3042,8 +3648,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -3057,8 +3666,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 USING (c1);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -3072,8 +3684,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -3087,8 +3702,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -3102,8 +3720,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -3117,8 +3738,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -3132,8 +3756,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -3147,8 +3774,11 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 USING (c1);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
diff --git a/mysql-test/suite/engines/funcs/t/se_join_left_outer.test b/mysql-test/suite/engines/funcs/t/se_join_left_outer.test
index d986159078b..5e6b8af633b 100644
--- a/mysql-test/suite/engines/funcs/t/se_join_left_outer.test
+++ b/mysql-test/suite/engines/funcs/t/se_join_left_outer.test
@@ -12,7 +12,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -26,7 +28,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -40,7 +44,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -54,7 +60,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -68,7 +76,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -82,7 +92,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -96,7 +108,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -110,7 +124,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -124,7 +140,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -138,7 +156,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -152,7 +172,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -166,7 +188,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -180,7 +204,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -194,7 +220,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -208,7 +236,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -222,7 +252,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -236,7 +268,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -250,7 +284,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -264,7 +300,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -278,7 +316,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -292,7 +332,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -306,7 +348,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -320,7 +364,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -334,7 +380,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -348,7 +396,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -362,7 +412,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -376,7 +428,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -390,7 +444,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -404,7 +460,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -418,7 +476,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -432,7 +492,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -446,7 +508,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -460,7 +524,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -474,7 +540,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -488,7 +556,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -502,7 +572,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -516,7 +588,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -530,7 +604,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -544,7 +620,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -558,7 +636,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -572,7 +652,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -586,7 +668,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -600,7 +684,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -614,7 +700,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -628,7 +716,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -642,7 +732,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -656,7 +748,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -670,7 +764,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -684,7 +780,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -698,7 +796,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -712,7 +812,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -726,7 +828,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -740,7 +844,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -754,7 +860,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -768,7 +876,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -782,7 +892,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -796,7 +908,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -810,7 +924,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -824,7 +940,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -838,7 +956,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -852,7 +972,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -866,7 +988,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -880,7 +1004,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -894,7 +1020,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -908,7 +1036,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -922,7 +1052,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -936,7 +1068,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -950,7 +1084,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -964,7 +1100,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -978,7 +1116,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -992,7 +1132,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1006,7 +1148,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1020,7 +1164,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1034,7 +1180,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1048,7 +1196,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1062,7 +1212,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1076,7 +1228,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1090,7 +1244,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1104,7 +1260,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1118,7 +1276,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1132,7 +1292,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1146,7 +1308,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1160,7 +1324,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1174,7 +1340,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1188,7 +1356,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1202,7 +1372,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1216,7 +1388,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1230,7 +1404,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1244,7 +1420,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1258,7 +1436,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1272,7 +1452,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1286,7 +1468,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1300,7 +1484,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1314,7 +1500,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1328,7 +1516,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1342,7 +1532,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1356,7 +1548,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1370,7 +1564,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1384,7 +1580,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1398,7 +1596,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1412,7 +1612,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1426,7 +1628,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1440,7 +1644,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1454,7 +1660,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1468,7 +1676,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1482,7 +1692,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1496,7 +1708,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1510,7 +1724,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1524,7 +1740,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1538,7 +1756,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1552,7 +1772,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1566,7 +1788,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1580,7 +1804,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1594,7 +1820,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1608,7 +1836,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1622,7 +1852,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1636,7 +1868,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1650,7 +1884,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1664,7 +1900,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1678,7 +1916,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1692,7 +1932,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1706,7 +1948,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1720,7 +1964,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1734,7 +1980,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1748,7 +1996,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1762,7 +2012,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1776,7 +2028,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1790,7 +2044,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1804,7 +2060,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1818,7 +2076,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1832,7 +2092,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1846,7 +2108,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1860,7 +2124,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1874,7 +2140,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1888,7 +2156,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1902,7 +2172,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1916,7 +2188,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1930,7 +2204,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1944,7 +2220,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1958,7 +2236,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1972,7 +2252,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1986,7 +2268,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2000,7 +2284,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2014,7 +2300,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2028,7 +2316,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2042,7 +2332,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2056,7 +2348,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2070,7 +2364,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2084,7 +2380,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2098,7 +2396,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2112,7 +2412,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2126,7 +2428,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2140,7 +2444,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2154,7 +2460,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2168,7 +2476,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2182,7 +2492,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2196,7 +2508,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2210,7 +2524,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2224,7 +2540,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2238,7 +2556,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2252,7 +2572,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2266,7 +2588,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2280,7 +2604,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2294,7 +2620,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2308,7 +2636,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2322,7 +2652,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2336,7 +2668,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2350,7 +2684,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2364,7 +2700,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2378,7 +2716,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2392,7 +2732,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2406,7 +2748,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2420,7 +2764,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2434,7 +2780,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2448,7 +2796,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2462,7 +2812,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2476,7 +2828,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2490,7 +2844,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2504,7 +2860,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2518,7 +2876,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2532,7 +2892,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2546,7 +2908,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2560,7 +2924,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2574,7 +2940,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2588,7 +2956,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2602,7 +2972,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2616,7 +2988,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2630,7 +3004,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2644,7 +3020,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2658,7 +3036,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2672,7 +3052,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2686,7 +3068,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 LEFT OUTER JOIN t3 ON t1.c1 = t3.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2700,7 +3084,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2714,7 +3100,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2728,7 +3116,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2742,7 +3132,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2756,7 +3148,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2770,7 +3164,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 LEFT OUTER JOIN t4 ON t1.c1 = t4.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2784,7 +3180,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2798,7 +3196,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2812,7 +3212,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2826,7 +3228,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2840,7 +3244,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2854,7 +3260,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 LEFT OUTER JOIN t5 ON t1.c1 = t5.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2868,7 +3276,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2882,7 +3292,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2896,7 +3308,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2910,7 +3324,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2924,7 +3340,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2938,7 +3356,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 LEFT OUTER JOIN t6 ON t1.c1 = t6.c1 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
diff --git a/mysql-test/suite/engines/funcs/t/se_join_natural_left.test b/mysql-test/suite/engines/funcs/t/se_join_natural_left.test
index 2ff6276cfa5..7b9deea3cb6 100644
--- a/mysql-test/suite/engines/funcs/t/se_join_natural_left.test
+++ b/mysql-test/suite/engines/funcs/t/se_join_natural_left.test
@@ -12,7 +12,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -26,7 +28,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -40,7 +44,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -54,7 +60,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -68,7 +76,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -82,7 +92,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -96,7 +108,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -110,7 +124,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -124,7 +140,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -138,7 +156,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -152,7 +172,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -166,7 +188,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -180,7 +204,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -194,7 +220,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -208,7 +236,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -222,7 +252,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -236,7 +268,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -250,7 +284,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -264,7 +300,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -278,7 +316,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -292,7 +332,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -306,7 +348,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -320,7 +364,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -334,7 +380,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -348,7 +396,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -362,7 +412,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -376,7 +428,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -390,7 +444,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -404,7 +460,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -418,7 +476,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -432,7 +492,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -446,7 +508,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -460,7 +524,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -474,7 +540,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -488,7 +556,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -502,7 +572,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -516,7 +588,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -530,7 +604,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -544,7 +620,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -558,7 +636,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -572,7 +652,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -586,7 +668,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -600,7 +684,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -614,7 +700,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -628,7 +716,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -642,7 +732,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -656,7 +748,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -670,7 +764,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -684,7 +780,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -698,7 +796,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -712,7 +812,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -726,7 +828,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -740,7 +844,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -754,7 +860,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -768,7 +876,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -782,7 +892,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -796,7 +908,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -810,7 +924,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -824,7 +940,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -838,7 +956,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -852,7 +972,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -866,7 +988,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -880,7 +1004,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -894,7 +1020,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -908,7 +1036,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -922,7 +1052,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -936,7 +1068,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -950,7 +1084,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -964,7 +1100,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -978,7 +1116,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -992,7 +1132,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1006,7 +1148,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1020,7 +1164,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1034,7 +1180,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1048,7 +1196,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1062,7 +1212,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1076,7 +1228,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1090,7 +1244,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1104,7 +1260,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1118,7 +1276,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1132,7 +1292,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1146,7 +1308,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1160,7 +1324,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1174,7 +1340,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1188,7 +1356,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1202,7 +1372,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1216,7 +1388,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1230,7 +1404,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1244,7 +1420,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1258,7 +1436,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1272,7 +1452,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1286,7 +1468,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1300,7 +1484,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1314,7 +1500,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1328,7 +1516,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1342,7 +1532,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1356,7 +1548,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1370,7 +1564,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1384,7 +1580,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1398,7 +1596,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1412,7 +1612,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1426,7 +1628,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1440,7 +1644,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1454,7 +1660,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1468,7 +1676,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1482,7 +1692,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1496,7 +1708,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1510,7 +1724,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1524,7 +1740,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1538,7 +1756,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1552,7 +1772,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1566,7 +1788,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1580,7 +1804,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1594,7 +1820,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1608,7 +1836,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1622,7 +1852,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1636,7 +1868,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1650,7 +1884,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1664,7 +1900,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1678,7 +1916,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1692,7 +1932,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1706,7 +1948,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1720,7 +1964,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1734,7 +1980,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1748,7 +1996,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1762,7 +2012,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1776,7 +2028,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1790,7 +2044,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1804,7 +2060,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1818,7 +2076,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1832,7 +2092,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1846,7 +2108,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1860,7 +2124,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1874,7 +2140,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1888,7 +2156,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1902,7 +2172,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1916,7 +2188,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1930,7 +2204,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1944,7 +2220,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1958,7 +2236,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1972,7 +2252,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1986,7 +2268,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2000,7 +2284,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2014,7 +2300,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2028,7 +2316,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2042,7 +2332,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2056,7 +2348,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2070,7 +2364,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2084,7 +2380,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2098,7 +2396,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2112,7 +2412,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2126,7 +2428,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2140,7 +2444,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2154,7 +2460,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2168,7 +2476,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2182,7 +2492,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2196,7 +2508,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2210,7 +2524,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2224,7 +2540,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2238,7 +2556,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2252,7 +2572,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2266,7 +2588,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2280,7 +2604,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2294,7 +2620,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2308,7 +2636,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2322,7 +2652,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2336,7 +2668,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2350,7 +2684,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2364,7 +2700,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2378,7 +2716,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2392,7 +2732,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2406,7 +2748,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2420,7 +2764,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2434,7 +2780,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2448,7 +2796,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2462,7 +2812,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2476,7 +2828,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2490,7 +2844,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2504,7 +2860,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2518,7 +2876,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2532,7 +2892,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2546,7 +2908,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2560,7 +2924,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2574,7 +2940,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2588,7 +2956,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2602,7 +2972,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2616,7 +2988,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2630,7 +3004,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2644,7 +3020,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2658,7 +3036,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2672,7 +3052,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2686,7 +3068,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2700,7 +3084,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2714,7 +3100,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2728,7 +3116,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2742,7 +3132,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2756,7 +3148,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2770,7 +3164,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2784,7 +3180,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2798,7 +3196,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2812,7 +3212,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2826,7 +3228,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2840,7 +3244,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2854,7 +3260,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2868,7 +3276,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2882,7 +3292,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2896,7 +3308,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2910,7 +3324,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2924,7 +3340,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2938,7 +3356,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
diff --git a/mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test b/mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test
index 93384418d80..d484cbe5216 100644
--- a/mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test
+++ b/mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test
@@ -12,7 +12,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -26,7 +28,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -40,7 +44,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -54,7 +60,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -68,7 +76,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -82,7 +92,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -96,7 +108,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -110,7 +124,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -124,7 +140,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -138,7 +156,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -152,7 +172,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -166,7 +188,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -180,7 +204,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -194,7 +220,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -208,7 +236,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -222,7 +252,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -236,7 +268,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -250,7 +284,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -264,7 +300,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -278,7 +316,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -292,7 +332,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -306,7 +348,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -320,7 +364,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -334,7 +380,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -348,7 +396,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -362,7 +412,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -376,7 +428,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -390,7 +444,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -404,7 +460,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -418,7 +476,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 < 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -432,7 +492,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -446,7 +508,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -460,7 +524,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -474,7 +540,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -488,7 +556,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -502,7 +572,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -516,7 +588,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -530,7 +604,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -544,7 +620,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -558,7 +636,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -572,7 +652,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -586,7 +668,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -600,7 +684,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -614,7 +700,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -628,7 +716,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -642,7 +732,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -656,7 +748,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -670,7 +764,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -684,7 +780,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -698,7 +796,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -712,7 +812,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -726,7 +828,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -740,7 +844,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -754,7 +860,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -768,7 +876,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -782,7 +892,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -796,7 +908,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -810,7 +924,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -824,7 +940,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -838,7 +956,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -852,7 +972,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -866,7 +988,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -880,7 +1004,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -894,7 +1020,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -908,7 +1036,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -922,7 +1052,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -936,7 +1068,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -950,7 +1084,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -964,7 +1100,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -978,7 +1116,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -992,7 +1132,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1006,7 +1148,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1020,7 +1164,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1034,7 +1180,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1048,7 +1196,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1062,7 +1212,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1076,7 +1228,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1090,7 +1244,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1104,7 +1260,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1118,7 +1276,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1132,7 +1292,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1146,7 +1308,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1160,7 +1324,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1174,7 +1340,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1188,7 +1356,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1202,7 +1372,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1216,7 +1388,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1230,7 +1404,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1244,7 +1420,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1258,7 +1436,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 = 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1272,7 +1452,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1286,7 +1468,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1300,7 +1484,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1314,7 +1500,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1328,7 +1516,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1342,7 +1532,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1356,7 +1548,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1370,7 +1564,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1384,7 +1580,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1398,7 +1596,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1412,7 +1612,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1426,7 +1628,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1440,7 +1644,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1454,7 +1660,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1468,7 +1676,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1482,7 +1692,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1496,7 +1708,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1510,7 +1724,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1524,7 +1740,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1538,7 +1756,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1552,7 +1772,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1566,7 +1788,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1580,7 +1804,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1594,7 +1820,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1608,7 +1836,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1622,7 +1852,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1636,7 +1868,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1650,7 +1884,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1664,7 +1900,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1678,7 +1916,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 >= 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1692,7 +1932,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1706,7 +1948,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1720,7 +1964,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1734,7 +1980,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1748,7 +1996,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1762,7 +2012,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1776,7 +2028,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1790,7 +2044,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1804,7 +2060,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1818,7 +2076,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1832,7 +2092,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1846,7 +2108,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1860,7 +2124,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1874,7 +2140,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1888,7 +2156,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1902,7 +2172,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -1916,7 +2188,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -1930,7 +2204,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -1944,7 +2220,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -1958,7 +2236,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -1972,7 +2252,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -1986,7 +2268,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2000,7 +2284,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2014,7 +2300,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2028,7 +2316,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2042,7 +2332,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2056,7 +2348,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2070,7 +2364,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2084,7 +2380,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2098,7 +2396,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 != 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2112,7 +2412,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2126,7 +2428,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2140,7 +2444,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2154,7 +2460,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2168,7 +2476,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2182,7 +2492,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2196,7 +2508,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2210,7 +2524,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2224,7 +2540,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2238,7 +2556,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2252,7 +2572,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2266,7 +2588,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2280,7 +2604,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2294,7 +2620,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2308,7 +2636,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2322,7 +2652,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2336,7 +2668,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2350,7 +2684,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2364,7 +2700,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2378,7 +2716,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2392,7 +2732,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2406,7 +2748,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2420,7 +2764,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2434,7 +2780,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2448,7 +2796,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2462,7 +2812,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2476,7 +2828,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2490,7 +2844,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2504,7 +2860,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2518,7 +2876,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2532,7 +2892,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2546,7 +2908,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2560,7 +2924,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2574,7 +2940,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2588,7 +2956,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2602,7 +2972,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2;
+--sorted_result
SELECT t1.c1,t2.c1 FROM t1 NATURAL LEFT OUTER JOIN t2 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2616,7 +2988,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2630,7 +3004,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2644,7 +3020,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2658,7 +3036,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2672,7 +3052,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2686,7 +3068,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3;
+--sorted_result
SELECT t1.c1,t3.c1 FROM t1 NATURAL LEFT OUTER JOIN t3 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2700,7 +3084,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2714,7 +3100,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2728,7 +3116,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2742,7 +3132,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2756,7 +3148,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2770,7 +3164,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4;
+--sorted_result
SELECT t1.c1,t4.c1 FROM t1 NATURAL LEFT OUTER JOIN t4 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2784,7 +3180,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2798,7 +3196,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2812,7 +3212,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2826,7 +3228,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2840,7 +3244,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2854,7 +3260,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5;
+--sorted_result
SELECT t1.c1,t5.c1 FROM t1 NATURAL LEFT OUTER JOIN t5 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 TINYINT NOT NULL);
@@ -2868,7 +3276,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 SMALLINT NOT NULL);
@@ -2882,7 +3292,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 MEDIUMINT NOT NULL);
@@ -2896,7 +3308,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT NOT NULL);
@@ -2910,7 +3324,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INTEGER NOT NULL);
@@ -2924,7 +3340,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 BIGINT NOT NULL);
@@ -2938,7 +3356,9 @@ INSERT INTO t2 (c1) VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t3 (c1) VALUES(1),(3),(5),(7),(9);
INSERT INTO t4 (c1) VALUES(10);
INSERT INTO t5 (c1) VALUES(10),(11),(12),(13),(14);
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6;
+--sorted_result
SELECT t1.c1,t6.c1 FROM t1 NATURAL LEFT OUTER JOIN t6 WHERE t1.c1 <=> 5;
DROP TABLE t1,t2,t3,t4,t5,t6;
diff --git a/mysql-test/suite/engines/iuds/r/delete_time.result b/mysql-test/suite/engines/iuds/r/delete_time.result
index 619b31bf4ce..00b2262e07b 100644
--- a/mysql-test/suite/engines/iuds/r/delete_time.result
+++ b/mysql-test/suite/engines/iuds/r/delete_time.result
@@ -497,10 +497,10 @@ c2
00:13:13
00:51:51
01:01:01
-02:02:02
03:03:00
08:08:08
100:04:04
+11:11:11
11:11:27
125:00:00
125:05:00
@@ -644,7 +644,7 @@ c1 c2
-838:59:59 -838:59:59
00:04:00 00:04:00
00:54:54 00:54:54
-11:11:11 11:11:11
+02:02:02 02:02:02
12:34:56 NULL
SELECT * FROM t2;
c1 c2
diff --git a/mysql-test/suite/engines/iuds/r/delete_year.result b/mysql-test/suite/engines/iuds/r/delete_year.result
index 02cbe24ecc9..c82f0dae7d9 100644
--- a/mysql-test/suite/engines/iuds/r/delete_year.result
+++ b/mysql-test/suite/engines/iuds/r/delete_year.result
@@ -2,7 +2,13 @@ DROP TABLE IF EXISTS t1,t2,t3,t4;
CREATE TABLE t1(c1 YEAR NOT NULL,c2 YEAR, PRIMARY KEY(c1));
CREATE TABLE t2(c1 YEAR NOT NULL, c2 YEAR, UNIQUE INDEX idx(c1,c2));
CREATE TABLE t3(c1 YEAR(2) NOT NULL,c2 YEAR(2), PRIMARY KEY(c1));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t4(c1 YEAR(2), c2 YEAR(2), UNIQUE INDEX idx(c1,c2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
INSERT INTO t1 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
INSERT INTO t2 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
INSERT INTO t3 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result
index 6aa7f5aab01..50fde80d81d 100644
--- a/mysql-test/suite/engines/iuds/r/insert_decimal.result
+++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result
@@ -1013,7 +1013,7 @@ ROUND(c1,c2) TRUNCATE(c1,c2)
1.133000 1.132000
DROP TABLE t5;
CREATE TABLE t7(c1 DECIMAL(66,0));
-ERROR 42000: Too big precision 66 specified for column 'c1'. Maximum is 65.
+ERROR 42000: Too big precision 66 specified for 'c1'. Maximum is 65.
CREATE TABLE t7(c1 DECIMAL(5,10));
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1').
DROP TABLE t1,t2;
diff --git a/mysql-test/suite/engines/iuds/r/insert_number.result b/mysql-test/suite/engines/iuds/r/insert_number.result
index fed2e0f683b..ce6a2af6d5f 100644
--- a/mysql-test/suite/engines/iuds/r/insert_number.result
+++ b/mysql-test/suite/engines/iuds/r/insert_number.result
@@ -5316,12 +5316,20 @@ c1 c2 c3 c4 c5 c6 c7
0 -128 26 27 28 29 30
SELECT * FROM t3 WHERE c2 = 128 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 128 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 128 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 128 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 128 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -128 1 2 3 4 5
@@ -11010,12 +11018,20 @@ c1 c2 c3 c4 c5 c6 c7
0 -32768 26 27 28 29 30
SELECT * FROM t3 WHERE c2 = 32768 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 32768 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 32768 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 32768 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 32768 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -32768 1 2 3 4 5
@@ -16809,12 +16825,20 @@ c1 c2 c3 c4 c5 c6 c7
0 -8388608 26 27 28 29 30
SELECT * FROM t3 WHERE c2 = 8388608 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 8388608 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 8388608 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 8388608 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 8388608 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -8388608 1 2 3 4 5
@@ -22713,12 +22737,20 @@ c1 c2 c3 c4 c5 c6 c7
0 -2147483648 26 27 28 29 30
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 2147483648 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -2147483648 1 2 3 4 5
@@ -28627,12 +28659,20 @@ c1 c2 c3 c4 c5 c6 c7
0 -2147483648 26 27 28 29 30
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 2147483648 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -2147483648 1 2 3 4 5
@@ -32275,8 +32315,6 @@ total_rows min_value max(c1)
23 0 18446744073709551615
SELECT * FROM t2 WHERE c2 = -9223372036854775809;
c1 c2 c3 c4 c5 c6 c7
-Warning 1292 Truncated incorrect DECIMAL value: ''
-Warnings:
SELECT c1,c6 FROM t2;
c1 c6
0 0
@@ -34112,20 +34150,12 @@ c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
SELECT * FROM t3 WHERE c2 = -9223372036854775809 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 = -9223372036854775809 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 = -9223372036854775809 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 = -9223372036854775809 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <> -9223372036854775809 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
@@ -34149,14 +34179,10 @@ c1 c2 c3 c4 c5 c6 c7
0 124 27 28 29 30 31
18446744073709551615 9223372036854775807 26 27 28 29 30
18446744073709551615 9223372036854775807 36 37 38 39 40
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <> -9223372036854775809 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 > -9223372036854775809 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
@@ -34180,14 +34206,10 @@ c1 c2 c3 c4 c5 c6 c7
0 124 27 28 29 30 31
18446744073709551615 9223372036854775807 26 27 28 29 30
18446744073709551615 9223372036854775807 36 37 38 39 40
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 > -9223372036854775809 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
@@ -34211,38 +34233,22 @@ c1 c2 c3 c4 c5 c6 c7
0 124 27 28 29 30 31
18446744073709551615 9223372036854775807 26 27 28 29 30
18446744073709551615 9223372036854775807 36 37 38 39 40
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 < -9223372036854775809 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 < -9223372036854775809 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <= -9223372036854775809 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <= -9223372036854775809 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <=> -9223372036854775809 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <=> -9223372036854775809 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 BETWEEN -9223372036854775809 AND 9223372036854775808 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
@@ -34266,14 +34272,10 @@ c1 c2 c3 c4 c5 c6 c7
0 124 27 28 29 30 31
18446744073709551615 9223372036854775807 26 27 28 29 30
18446744073709551615 9223372036854775807 36 37 38 39 40
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 BETWEEN -9223372036854775809 AND 9223372036854775808 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 IN (-9223372036854775809,9223372036854775808) ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
@@ -34285,13 +34287,9 @@ c1 c2 c3 c4 c5 c6 c7
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 AND c2 < 9223372036854775808 AND c7 = 35 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 AND c2 < 9223372036854775808 AND c7 = 35 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
105 NULL 102 103 104 105 106
@@ -34348,14 +34346,10 @@ c1 c2 c3 c4 c5 c6 c7
0 124 22 23 24 25 26
18446744073709551615 9223372036854775807 36 37 38 39 40
18446744073709551615 9223372036854775807 26 27 28 29 30
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <> -9223372036854775809 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
0 -9223372036854775808 1 2 3 4 5
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 > -9223372036854775809 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
@@ -34379,14 +34373,10 @@ c1 c2 c3 c4 c5 c6 c7
0 124 22 23 24 25 26
18446744073709551615 9223372036854775807 36 37 38 39 40
18446744073709551615 9223372036854775807 26 27 28 29 30
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 > -9223372036854775809 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
0 -9223372036854775808 1 2 3 4 5
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
@@ -34410,38 +34400,22 @@ c1 c2 c3 c4 c5 c6 c7
0 124 22 23 24 25 26
18446744073709551615 9223372036854775807 36 37 38 39 40
18446744073709551615 9223372036854775807 26 27 28 29 30
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
0 -9223372036854775808 1 2 3 4 5
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 < -9223372036854775809 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 < -9223372036854775809 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <= -9223372036854775809 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <= -9223372036854775809 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <=> -9223372036854775809 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 <=> -9223372036854775809 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 BETWEEN -9223372036854775809 AND 9223372036854775808 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
@@ -34465,14 +34439,10 @@ c1 c2 c3 c4 c5 c6 c7
0 124 22 23 24 25 26
18446744073709551615 9223372036854775807 36 37 38 39 40
18446744073709551615 9223372036854775807 26 27 28 29 30
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 BETWEEN -9223372036854775809 AND 9223372036854775808 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
0 -9223372036854775808 1 2 3 4 5
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 IN (-9223372036854775809,9223372036854775808) ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
@@ -34484,13 +34454,9 @@ c1 c2 c3 c4 c5 c6 c7
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 AND c2 < 9223372036854775808 AND c7 = 35 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 AND c2 < 9223372036854775808 AND c7 = 35 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
105 NULL 102 103 104 105 106
@@ -34611,12 +34577,20 @@ c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
SELECT * FROM t3 WHERE c2 = 9223372036854775808 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 9223372036854775808 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 9223372036854775808 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 9223372036854775808 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 9223372036854775808 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
@@ -34733,14 +34707,10 @@ c1 c2 c3 c4 c5 c6 c7
0 124 27 28 29 30 31
18446744073709551615 9223372036854775807 26 27 28 29 30
18446744073709551615 9223372036854775807 36 37 38 39 40
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 BETWEEN -9223372036854775809 AND 9223372036854775808 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 IN (-9223372036854775809,9223372036854775808) ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
@@ -34752,13 +34722,9 @@ c1 c2 c3 c4 c5 c6 c7
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 AND c2 < 9223372036854775808 AND c7 = 35 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 AND c2 < 9223372036854775808 AND c7 = 35 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
105 NULL 102 103 104 105 106
@@ -34908,14 +34874,10 @@ c1 c2 c3 c4 c5 c6 c7
0 124 22 23 24 25 26
18446744073709551615 9223372036854775807 36 37 38 39 40
18446744073709551615 9223372036854775807 26 27 28 29 30
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 BETWEEN -9223372036854775809 AND 9223372036854775808 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
0 -9223372036854775808 1 2 3 4 5
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 IN (-9223372036854775809,9223372036854775808) ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
@@ -34927,13 +34889,9 @@ c1 c2 c3 c4 c5 c6 c7
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 AND c2 < 9223372036854775808 AND c7 = 35 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 >= -9223372036854775809 AND c2 < 9223372036854775808 AND c7 = 35 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
-Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
105 NULL 102 103 104 105 106
diff --git a/mysql-test/suite/engines/iuds/r/insert_time.result b/mysql-test/suite/engines/iuds/r/insert_time.result
index bb7ad5d7c0b..39bbb0f179d 100644
--- a/mysql-test/suite/engines/iuds/r/insert_time.result
+++ b/mysql-test/suite/engines/iuds/r/insert_time.result
@@ -40,12 +40,12 @@ INSERT INTO t4 VALUES('10.22.22','10.22.22','2009-01-26'),(1234567,1234567,'2009
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
-Warning 1264 Out of range value for column 'c1' at row 2
-Warning 1264 Out of range value for column 'c2' at row 2
-Warning 1264 Out of range value for column 'c1' at row 3
-Warning 1264 Out of range value for column 'c2' at row 3
-Warning 1264 Out of range value for column 'c1' at row 4
-Warning 1264 Out of range value for column 'c2' at row 4
+Warning 1265 Data truncated for column 'c1' at row 2
+Warning 1265 Data truncated for column 'c2' at row 2
+Warning 1265 Data truncated for column 'c1' at row 3
+Warning 1265 Data truncated for column 'c2' at row 3
+Warning 1265 Data truncated for column 'c1' at row 4
+Warning 1265 Data truncated for column 'c2' at row 4
Warning 1265 Data truncated for column 'c1' at row 6
Warning 1265 Data truncated for column 'c2' at row 6
INSERT INTO t1 VALUES('8:29:45',NULL,'2009-02-01');
@@ -135,6 +135,8 @@ c1 c2 c3
-838:59:59 -838:59:59 2009-01-08
00:00:00 00:00:00 2009-01-09
00:00:00 00:00:00 2009-01-27
+00:00:00 00:00:00 2009-01-28
+00:00:00 00:00:00 2009-01-29
00:00:10 00:00:10 2009-01-26
00:00:11 00:00:11 2009-01-20
00:00:12 00:00:12 2009-01-13
@@ -160,8 +162,6 @@ c1 c2 c3
491:22:33 491:22:33 2009-01-04
825:23:00 825:23:00 2009-01-05
838:59:59 838:59:59 2009-01-10
-838:59:59 838:59:59 2009-01-28
-838:59:59 838:59:59 2009-01-29
SELECT * FROM t1;
c1 c2 c3
-838:59:59 -838:59:59 2009-01-21
@@ -1650,8 +1650,10 @@ SELECT * FROM t1 WHERE c2 BETWEEN NULL AND '10:22:33' ORDER BY c2 LIMIT 2;
c1 c2 c3
SELECT * FROM t1 WHERE c2 IN (NULL,'10:22:33') ORDER BY c2;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t1 WHERE c2 IN (NULL,'10:22:33') ORDER BY c2 LIMIT 2;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t1 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c2;
c1 c2 c3
SELECT * FROM t1 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c2 LIMIT 2;
@@ -1723,8 +1725,10 @@ SELECT * FROM t1 WHERE c2 BETWEEN NULL AND '10:22:33' ORDER BY c2 DESC LIMIT 2;
c1 c2 c3
SELECT * FROM t1 WHERE c2 IN (NULL,'10:22:33') ORDER BY c2 DESC;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t1 WHERE c2 IN (NULL,'10:22:33') ORDER BY c2 DESC LIMIT 2;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t1 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c2 DESC;
c1 c2 c3
SELECT * FROM t1 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c2 DESC LIMIT 2;
@@ -3218,8 +3222,10 @@ SELECT * FROM t2 WHERE c2 BETWEEN NULL AND '10:22:33' ORDER BY c1,c2 LIMIT 2;
c1 c2 c3
SELECT * FROM t2 WHERE c2 IN (NULL,'10:22:33') ORDER BY c1,c2;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t2 WHERE c2 IN (NULL,'10:22:33') ORDER BY c1,c2 LIMIT 2;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c1,c2;
c1 c2 c3
SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c1,c2 LIMIT 2;
@@ -3287,8 +3293,10 @@ SELECT * FROM t2 WHERE c2 BETWEEN NULL AND '10:22:33' ORDER BY c1,c2 DESC LIMIT
c1 c2 c3
SELECT * FROM t2 WHERE c2 IN (NULL,'10:22:33') ORDER BY c1,c2 DESC;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t2 WHERE c2 IN (NULL,'10:22:33') ORDER BY c1,c2 DESC LIMIT 2;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c1,c2 DESC;
c1 c2 c3
SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c1,c2 DESC LIMIT 2;
@@ -4814,8 +4822,10 @@ SELECT * FROM t3 WHERE c2 BETWEEN NULL AND '10:22:33' ORDER BY c1,c2 LIMIT 2;
c1 c2 c3
SELECT * FROM t3 WHERE c2 IN (NULL,'10:22:33') ORDER BY c1,c2;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t3 WHERE c2 IN (NULL,'10:22:33') ORDER BY c1,c2 LIMIT 2;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c1,c2;
c1 c2 c3
SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c1,c2 LIMIT 2;
@@ -4887,8 +4897,10 @@ SELECT * FROM t3 WHERE c2 BETWEEN NULL AND '10:22:33' ORDER BY c1,c2 DESC LIMIT
c1 c2 c3
SELECT * FROM t3 WHERE c2 IN (NULL,'10:22:33') ORDER BY c1,c2 DESC;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t3 WHERE c2 IN (NULL,'10:22:33') ORDER BY c1,c2 DESC LIMIT 2;
c1 c2 c3
+10:22:33 10:22:33 2009-01-02
SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c1,c2 DESC;
c1 c2 c3
SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '10:22:33' AND c1 = '491:22:33' ORDER BY c1,c2 DESC LIMIT 2;
@@ -5008,28 +5020,24 @@ c1 MIN(c2)
838:59:59 838:59:59
SELECT CAST(235959.123456 AS TIME);
CAST(235959.123456 AS TIME)
-23:59:59.123456
+23:59:59
SELECT CAST(0.235959123456e+6 AS TIME);
CAST(0.235959123456e+6 AS TIME)
-23:59:59.123456
+23:59:59
SELECT CAST(235959123456e-6 AS TIME);
CAST(235959123456e-6 AS TIME)
-23:59:59.123456
+23:59:59
SELECT CAST(235959.1234567 AS TIME);
CAST(235959.1234567 AS TIME)
-23:59:59.123456
-Warnings:
-Warning 1292 Truncated incorrect time value: '235959.1234567'
+23:59:59
SELECT CAST(0.2359591234567e6 AS TIME);
CAST(0.2359591234567e6 AS TIME)
-23:59:59.123456
-Warnings:
-Warning 1292 Truncated incorrect time value: '235959.1234567'
+23:59:59
SELECT CAST(0.2359591234567e+30 AS TIME);
CAST(0.2359591234567e+30 AS TIME)
NULL
Warnings:
-Warning 1292 Truncated incorrect time value: '2.359591234567e29'
+Warning 1292 Incorrect datetime value: '2.359591234567e29'
select cast('100:55:50' as time) < cast('24:00:00' as time);
cast('100:55:50' as time) < cast('24:00:00' as time)
0
@@ -5077,7 +5085,6 @@ c1 c2 c3
INSERT INTO t2(c1,c2) VALUES('12:34:56.78','12:34:56.78') ON DUPLICATE KEY UPDATE c1='12:34:56.79',c2='12:34:57.78';
SELECT * FROM t2 WHERE c1='12:34:56.79' AND c2='12:34:57.78' /* 1 row */;
c1 c2 c3
-12:34:56 12:34:57 2009-01-01
SELECT * FROM t1 WHERE c1='10:22:35' AND c2='33 9:23' /* no rows */;
c1 c2 c3
INSERT INTO t1(c1,c2) VALUES('10:22:34','34 9:23') ON DUPLICATE KEY UPDATE c1='10:22:35',c2='33 9:23';
@@ -5137,8 +5144,8 @@ c1 c2 c3
09:36:00 09:36:00 2009-01-25
00:00:10 00:00:10 2009-01-26
00:00:00 00:00:00 2009-01-27
-838:59:59 838:59:59 2009-01-28
-838:59:59 838:59:59 2009-01-29
+00:00:00 00:00:00 2009-01-28
+00:00:00 00:00:00 2009-01-29
262:22:00 262:22:00 2009-01-30
00:00:12 00:00:12 2009-01-31
08:29:45 NULL 2009-02-01
@@ -5146,15 +5153,39 @@ c1 c2 c3
TRUNCATE TABLE t5;
INSERT INTO t5 SELECT * FROM t4 WHERE c1 >='12colon34colon56';
Warnings:
-Warning 1292 Incorrect time value: '12colon34colon56' for column 'c1' at row 1
+Warning 1292 Truncated incorrect time value: '12colon34colon56'
SELECT * FROM t5;
c1 c2 c3
+12:34:56 12:34:56 2009-01-01
+10:22:33 10:22:33 2009-01-02
+01:23:00 01:23:00 2009-01-03
491:22:33 491:22:33 2009-01-04
825:23:00 825:23:00 2009-01-05
+10:00:00 10:00:00 2009-01-06
+00:00:45 00:00:45 2009-01-07
+00:00:00 00:00:00 2009-01-09
838:59:59 838:59:59 2009-01-10
-838:59:59 838:59:59 2009-01-28
-838:59:59 838:59:59 2009-01-29
+10:11:12 10:11:12 2009-01-11
+11:11:12 11:11:12 2009-01-12
+00:00:12 00:00:12 2009-01-13
+00:12:34 00:12:34 2009-01-14
+12:34:58 12:34:58 2009-01-15
+12:35:56 12:35:56 2009-01-16
+11:11:27 11:11:27 2009-01-17
+08:03:02 08:03:02 2009-01-18
+00:11:12 00:11:12 2009-01-19
+00:00:11 00:00:11 2009-01-20
+00:12:30 00:12:30 2009-01-23
+09:00:45 09:00:45 2009-01-24
+09:36:00 09:36:00 2009-01-25
+00:00:10 00:00:10 2009-01-26
+00:00:00 00:00:00 2009-01-27
+00:00:00 00:00:00 2009-01-28
+00:00:00 00:00:00 2009-01-29
262:22:00 262:22:00 2009-01-30
+00:00:12 00:00:12 2009-01-31
+08:29:45 NULL 2009-02-01
+00:00:00 07:23:55 NULL
TRUNCATE TABLE t5;
DROP TABLE t5;
DROP TABLE t1,t2,t3,t4;
diff --git a/mysql-test/suite/engines/iuds/r/insert_year.result b/mysql-test/suite/engines/iuds/r/insert_year.result
index 386c8090434..b9618ba4e2d 100644
--- a/mysql-test/suite/engines/iuds/r/insert_year.result
+++ b/mysql-test/suite/engines/iuds/r/insert_year.result
@@ -3235,9 +3235,21 @@ c1 c2 c3 c4
1999 1999 1998-12-30 1998-12-30 11:30:45
DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t2(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1,c2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t3(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, UNIQUE INDEX idx(c1,c2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t4(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME);
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
INSERT INTO t1 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
INSERT INTO t2 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
INSERT INTO t3 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
diff --git a/mysql-test/suite/engines/iuds/r/type_bit_iuds.result b/mysql-test/suite/engines/iuds/r/type_bit_iuds.result
index 47e5234f795..e01c7d78680 100644
--- a/mysql-test/suite/engines/iuds/r/type_bit_iuds.result
+++ b/mysql-test/suite/engines/iuds/r/type_bit_iuds.result
@@ -55941,7 +55941,7 @@ SELECT 0 + (101010101010101010101010101010<<0);
0 + (101010101010101010101010101010<<0)
9223372036854775807
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(0));
CREATE TABLE t2(c1 BIT(0), c2 BIT(0), c3 BIT(0));
INSERT INTO t1 VALUES (b'101010101010101010101010101010');
@@ -56712,7 +56712,7 @@ SELECT 0 + (101010101010101010101010101010<<1);
0 + (101010101010101010101010101010<<1)
18446744073709551614
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(1));
CREATE TABLE t2(c1 BIT(1), c2 BIT(1), c3 BIT(1));
set @v1=1;
@@ -57532,7 +57532,7 @@ SELECT 0 + (101010101010101010101010101010<<2);
0 + (101010101010101010101010101010<<2)
18446744073709551612
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(2));
CREATE TABLE t2(c1 BIT(2), c2 BIT(2), c3 BIT(2));
set @v1=2;
@@ -58375,7 +58375,7 @@ SELECT 0 + (101010101010101010101010101010<<4);
0 + (101010101010101010101010101010<<4)
18446744073709551600
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(4));
CREATE TABLE t2(c1 BIT(4), c2 BIT(4), c3 BIT(4));
set @v1=4;
@@ -59296,7 +59296,7 @@ SELECT 0 + (101010101010101010101010101010<<8);
0 + (101010101010101010101010101010<<8)
18446744073709551360
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(8));
CREATE TABLE t2(c1 BIT(8), c2 BIT(8), c3 BIT(8));
set @v1=8;
@@ -60503,7 +60503,7 @@ SELECT 0 + (101010101010101010101010101010<<16);
0 + (101010101010101010101010101010<<16)
18446744073709486080
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(16));
CREATE TABLE t2(c1 BIT(16), c2 BIT(16), c3 BIT(16));
set @v1=16;
@@ -61915,7 +61915,7 @@ SELECT 0 + (101010101010101010101010101010<<32);
0 + (101010101010101010101010101010<<32)
18446744069414584320
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(32));
CREATE TABLE t2(c1 BIT(32), c2 BIT(32), c3 BIT(32));
set @v1=32;
@@ -63988,7 +63988,7 @@ SELECT 0 + (101010101010101010101010101010<<64);
0 + (101010101010101010101010101010<<64)
0
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(64));
CREATE TABLE t2(c1 BIT(64), c2 BIT(64), c3 BIT(64));
set @v1=64;
@@ -67165,7 +67165,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<0)
0 + (1010101010101010101010101010101010101010101010101010101010101010<<0)
9223372036854775807
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(0));
CREATE TABLE t2(c1 BIT(0), c2 BIT(0), c3 BIT(0));
INSERT INTO t1 VALUES (b'1010101010101010101010101010101010101010101010101010101010101010');
@@ -67933,7 +67933,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<1)
0 + (1010101010101010101010101010101010101010101010101010101010101010<<1)
18446744073709551614
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(1));
CREATE TABLE t2(c1 BIT(1), c2 BIT(1), c3 BIT(1));
set @v1=1;
@@ -68750,7 +68750,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<2)
0 + (1010101010101010101010101010101010101010101010101010101010101010<<2)
18446744073709551612
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(2));
CREATE TABLE t2(c1 BIT(2), c2 BIT(2), c3 BIT(2));
set @v1=2;
@@ -69590,7 +69590,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<4)
0 + (1010101010101010101010101010101010101010101010101010101010101010<<4)
18446744073709551600
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(4));
CREATE TABLE t2(c1 BIT(4), c2 BIT(4), c3 BIT(4));
set @v1=4;
@@ -70508,7 +70508,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<8)
0 + (1010101010101010101010101010101010101010101010101010101010101010<<8)
18446744073709551360
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(8));
CREATE TABLE t2(c1 BIT(8), c2 BIT(8), c3 BIT(8));
set @v1=8;
@@ -71712,7 +71712,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<16
0 + (1010101010101010101010101010101010101010101010101010101010101010<<16)
18446744073709486080
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(16));
CREATE TABLE t2(c1 BIT(16), c2 BIT(16), c3 BIT(16));
set @v1=16;
@@ -73121,7 +73121,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<32
0 + (1010101010101010101010101010101010101010101010101010101010101010<<32)
18446744069414584320
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(32));
CREATE TABLE t2(c1 BIT(32), c2 BIT(32), c3 BIT(32));
set @v1=32;
@@ -75197,7 +75197,7 @@ SELECT 0 + (1010101010101010101010101010101010101010101010101010101010101010<<64
0 + (1010101010101010101010101010101010101010101010101010101010101010<<64)
0
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '1010101010101010101010101010101010101010101010101010101010101010' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(64));
CREATE TABLE t2(c1 BIT(64), c2 BIT(64), c3 BIT(64));
set @v1=64;
@@ -78374,7 +78374,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<0
0 + (10101010101010101010101010101010101010101010101010101010101010101<<0)
9223372036854775807
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(0));
CREATE TABLE t2(c1 BIT(0), c2 BIT(0), c3 BIT(0));
INSERT INTO t1 VALUES (b'10101010101010101010101010101010101010101010101010101010101010101');
@@ -79142,7 +79142,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<1
0 + (10101010101010101010101010101010101010101010101010101010101010101<<1)
18446744073709551614
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(1));
CREATE TABLE t2(c1 BIT(1), c2 BIT(1), c3 BIT(1));
set @v1=1;
@@ -79959,7 +79959,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<2
0 + (10101010101010101010101010101010101010101010101010101010101010101<<2)
18446744073709551612
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(2));
CREATE TABLE t2(c1 BIT(2), c2 BIT(2), c3 BIT(2));
set @v1=2;
@@ -80799,7 +80799,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<4
0 + (10101010101010101010101010101010101010101010101010101010101010101<<4)
18446744073709551600
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(4));
CREATE TABLE t2(c1 BIT(4), c2 BIT(4), c3 BIT(4));
set @v1=4;
@@ -81717,7 +81717,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<8
0 + (10101010101010101010101010101010101010101010101010101010101010101<<8)
18446744073709551360
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(8));
CREATE TABLE t2(c1 BIT(8), c2 BIT(8), c3 BIT(8));
set @v1=8;
@@ -82921,7 +82921,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<1
0 + (10101010101010101010101010101010101010101010101010101010101010101<<16)
18446744073709486080
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(16));
CREATE TABLE t2(c1 BIT(16), c2 BIT(16), c3 BIT(16));
set @v1=16;
@@ -84330,7 +84330,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<3
0 + (10101010101010101010101010101010101010101010101010101010101010101<<32)
18446744069414584320
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(32));
CREATE TABLE t2(c1 BIT(32), c2 BIT(32), c3 BIT(32));
set @v1=32;
@@ -86406,7 +86406,7 @@ SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<6
0 + (10101010101010101010101010101010101010101010101010101010101010101<<64)
0
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1916 Got overflow when converting '10101010101010101010101010101010101010101010101010101010101010101' to INT. Value truncated.
CREATE TABLE t1(c1 BIT(64));
CREATE TABLE t2(c1 BIT(64), c2 BIT(64), c3 BIT(64));
set @v1=64;
diff --git a/mysql-test/suite/engines/iuds/r/update_delete_calendar.result b/mysql-test/suite/engines/iuds/r/update_delete_calendar.result
index a04585dfd72..e8324c8b368 100644
--- a/mysql-test/suite/engines/iuds/r/update_delete_calendar.result
+++ b/mysql-test/suite/engines/iuds/r/update_delete_calendar.result
@@ -71,13 +71,6 @@ Warning 1265 Data truncated for column 'c2' at row 1
SELECT count(*) FROM t1 WHERE c2='10:45:15' OR c2='2009-01-32' OR c2='2009-02-30' OR c2='2009-04-31' OR c2='2009-06-31' OR c2='2009-09-31' /* returns 0 */;
count(*)
0
-Warnings:
-Warning 1292 Incorrect date value: '10:45:15' for column 'c2' at row 1
-Warning 1292 Incorrect date value: '2009-01-32' for column 'c2' at row 1
-Warning 1292 Incorrect date value: '10:45:15' for column 'c2' at row 1
-Warning 1292 Incorrect date value: '2009-01-32' for column 'c2' at row 1
-Warning 1292 Incorrect date value: '10:45:15' for column 'c2' at row 1
-Warning 1292 Incorrect date value: '2009-01-32' for column 'c2' at row 1
UPDATE t1 SET c2='2009-11-31' WHERE c2='2001-01-16';
Warnings:
Warning 1265 Data truncated for column 'c2' at row 1
@@ -108,8 +101,7 @@ c1 c2 c3
2001-01-16 0000-00-00 12
2001-01-17 0000-00-00 13
Warnings:
-Warning 1292 Incorrect date value: '0000-00-00' for column 'c2' at row 1
-Warning 1292 Incorrect date value: '0000-00-00' for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
UPDATE t1 SET c2='0000-00-00' WHERE c2='2001-01-18';
ERROR 22007: Incorrect date value: '0000-00-00' for column 'c2' at row 1
SET SQL_MODE=DEFAULT;
@@ -774,20 +766,17 @@ c1 c2 c3
INSERT INTO t1 VALUES('2001-01-09','2001-01-10',6),('2001-01-11','2001-01-12',7);
UPDATE t1 SET c1='2001-01-09 24:59:59',c2='2009-01-10 23:60:59' WHERE c1='2001-01-09';
Warnings:
-Warning 1264 Out of range value for column 'c1' at row 1
-Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
UPDATE t1 SET c2='2001-01-11 23:59:60' WHERE c1='2001-01-11';
Warnings:
-Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
SELECT count(*) FROM t1 WHERE c1='2001-01-09 24:59:59' AND c2='2009-01-10 23:60:59';
count(*)
1
Warnings:
-Warning 1292 Incorrect datetime value: '2001-01-09 24:59:59' for column 'c1' at row 1
-Warning 1292 Incorrect datetime value: '2009-01-10 23:60:59' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '2001-01-09 24:59:59' for column 'c1' at row 1
-Warning 1292 Truncated incorrect datetime value: '2001-01-09 24:59:59'
-Warning 1292 Truncated incorrect datetime value: '2009-01-10 23:60:59'
+Warning 1292 Incorrect datetime value: '2001-01-09 24:59:59'
+Warning 1292 Incorrect datetime value: '2009-01-10 23:60:59'
SELECT count(*) FROM t1 WHERE c2='2001-01-11 23:59:60' /* returns 0 */;
count(*)
0
@@ -806,8 +795,7 @@ c1 c2 c3
2001-01-11 00:00:00 0000-00-00 00:00:00 7
2001-01-17 00:00:00 0000-00-00 00:00:00 8
Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
UPDATE t1 SET c2='0000-00-00 00:00:00' WHERE c2='2001-01-18 07:35';
ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'c2' at row 1
SET SQL_MODE=DEFAULT;
@@ -949,15 +937,13 @@ c1 c2 c3
2003-01-01 01:02:03 2002-01-09 01:30:30 10
UPDATE t1 SET c1='2003-01-01 1:2:3' WHERE c2 BETWEEN '20020109 01:30:40' AND '20020109 01:30:50' ORDER BY c2 LIMIT 2;
Warnings:
-Warning 1292 Incorrect datetime value: '20020109 01:30:40' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '20020109 01:30:40' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '20020109 01:30:50' for column 'c2' at row 1
+Warning 1292 Incorrect datetime value: '20020109 01:30:40'
+Warning 1292 Incorrect datetime value: '20020109 01:30:50'
SELECT * FROM t1 WHERE c2 BETWEEN '20020109 01:30:40' AND '20020109 01:30:50' ORDER BY c2;
c1 c2 c3
Warnings:
-Warning 1292 Incorrect datetime value: '20020109 01:30:40' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '20020109 01:30:40' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '20020109 01:30:50' for column 'c2' at row 1
+Warning 1292 Incorrect datetime value: '20020109 01:30:40'
+Warning 1292 Incorrect datetime value: '20020109 01:30:50'
UPDATE t1 SET c1='2003-01-01 1:2:3' WHERE c2 IN('2002-01-09 1:30:55','2002-01-09 2:00') ORDER BY c2 DESC LIMIT 2;
SELECT * FROM t1 WHERE c2 IN('2002-01-09 1:30:55','2002-01-09 2:00') ORDER BY c2 DESC;
c1 c2 c3
@@ -1389,17 +1375,13 @@ SELECT count(*) FROM t1 WHERE c1='2001-01-09 24:59:59' AND c2='2009-01-10 23:60:
count(*)
1
Warnings:
-Warning 1292 Incorrect datetime value: '2001-01-09 24:59:59' for column 'c1' at row 1
-Warning 1292 Incorrect datetime value: '2009-01-10 23:60:59' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '2001-01-09 24:59:59' for column 'c1' at row 1
-Warning 1292 Truncated incorrect datetime value: '2001-01-09 24:59:59'
-Warning 1292 Truncated incorrect datetime value: '2009-01-10 23:60:59'
+Warning 1292 Incorrect datetime value: '2001-01-09 24:59:59'
+Warning 1292 Incorrect datetime value: '2009-01-10 23:60:59'
SELECT count(*) FROM t1 WHERE c1='2001-01-11 23:59:59' AND c2='2001-01-11 23:59:60';
count(*)
1
Warnings:
-Warning 1292 Incorrect datetime value: '2001-01-11 23:59:60' for column 'c2' at row 1
-Warning 1292 Truncated incorrect datetime value: '2001-01-11 23:59:60'
+Warning 1292 Incorrect datetime value: '2001-01-11 23:59:60'
SELECT * FROM t1 WHERE c1='0000-00-00 00:00:00' OR c2='0000-00-00 00:00:00';
c1 c2 c3
0000-00-00 00:00:00 0000-00-00 00:00:00 6
@@ -1412,8 +1394,7 @@ c1 c2 c3
2001-01-11 23:59:59 0000-00-00 00:00:00 7
2001-01-17 00:00:00 0000-00-00 00:00:00 8
Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
UPDATE t1 SET c1='1972-01-01 07:35',c2='0000-00-00 00:00:00' WHERE c2='2001-01-18 07:35';
ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'c2' at row 1
SET SQL_MODE=DEFAULT;
@@ -1552,15 +1533,13 @@ c1 c2 c3
2003-01-01 01:02:03 2002-01-09 01:30:30 10
UPDATE t1 SET c1='2003-01-01 1:2:3' WHERE c2 BETWEEN '20020109 01:30:40' AND '20020109 01:30:50' ORDER BY c2 LIMIT 2;
Warnings:
-Warning 1292 Incorrect datetime value: '20020109 01:30:40' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '20020109 01:30:40' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '20020109 01:30:50' for column 'c2' at row 1
+Warning 1292 Incorrect datetime value: '20020109 01:30:40'
+Warning 1292 Incorrect datetime value: '20020109 01:30:50'
SELECT * FROM t1 WHERE c2 BETWEEN '20020109 01:30:40' AND '20020109 01:30:50' ORDER BY c2;
c1 c2 c3
Warnings:
-Warning 1292 Incorrect datetime value: '20020109 01:30:40' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '20020109 01:30:40' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '20020109 01:30:50' for column 'c2' at row 1
+Warning 1292 Incorrect datetime value: '20020109 01:30:40'
+Warning 1292 Incorrect datetime value: '20020109 01:30:50'
UPDATE t1 SET c1='2003-01-01 1:2:3' WHERE c2 IN('2002-01-09 1:30:55','2002-01-09 2:00') ORDER BY c2 DESC LIMIT 2;
SELECT * FROM t1 WHERE c2 IN('2002-01-09 1:30:55','2002-01-09 2:00') ORDER BY c2 DESC;
c1 c2 c3
diff --git a/mysql-test/suite/engines/iuds/r/update_delete_number.result b/mysql-test/suite/engines/iuds/r/update_delete_number.result
index 8e190870092..7c183068724 100644
--- a/mysql-test/suite/engines/iuds/r/update_delete_number.result
+++ b/mysql-test/suite/engines/iuds/r/update_delete_number.result
@@ -56,6 +56,8 @@ Warning 1264 Out of range value for column 'c2' at row 3
SELECT COUNT(*) FROM t1 WHERE c1=4294967296 AND c2=2147483648 /* no rows */;
COUNT(*)
0
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t1 WHERE c1=4294967295 AND c2=2147483647;
c1 c2 c3
4294967295 2147483647 10
@@ -1150,6 +1152,8 @@ Warning 1264 Out of range value for column 'c2' at row 3
SELECT COUNT(*) FROM t1 WHERE c1=256 AND c2=128 /* no rows */;
COUNT(*)
0
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t1 WHERE c1=255 AND c2=127;
c1 c2 c3
255 127 10
@@ -1922,6 +1926,8 @@ Warning 1264 Out of range value for column 'c2' at row 3
SELECT COUNT(*) FROM t1 WHERE c1=65536 AND c2=32768 /* no rows */;
COUNT(*)
0
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t1 WHERE c1=65535 AND c2=32767;
c1 c2 c3
65535 32767 10
@@ -2669,6 +2675,8 @@ Warning 1264 Out of range value for column 'c2' at row 3
SELECT COUNT(*) FROM t1 WHERE c1=16777216 AND c2=8388608 /* no rows */;
COUNT(*)
0
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t1 WHERE c1=16777215 AND c2=8388607;
c1 c2 c3
16777215 8388607 10
@@ -3416,6 +3424,8 @@ Warning 1264 Out of range value for column 'c2' at row 3
SELECT COUNT(*) FROM t1 WHERE c1=18446744073709551616 AND c2=9223372036854775808 /* no rows */;
COUNT(*)
0
+Warnings:
+Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t1 WHERE c1=18446744073709551615 AND c2=9223372036854775807;
c1 c2 c3
18446744073709551615 9223372036854775807 10
diff --git a/mysql-test/suite/engines/iuds/r/update_time.result b/mysql-test/suite/engines/iuds/r/update_time.result
index 3073f3c985f..09a7cbf0c7f 100644
--- a/mysql-test/suite/engines/iuds/r/update_time.result
+++ b/mysql-test/suite/engines/iuds/r/update_time.result
@@ -793,10 +793,10 @@ c2
00:09:09
00:11:11
00:11:11
+00:11:11
00:13:13
00:51:51
01:01:01
-02:02:02
03:03:00
08:08:08
100:04:04
@@ -1122,7 +1122,7 @@ c2
838:59:59
NULL
UPDATE t4 SET c1=11:11:11 WHERE c2=NULL;
-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 ':11:11 WHERE c2=NULL' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':11:11 WHERE c2=NULL' at line 1
SELECT c1 FROM t4;
c1
00:00:01
@@ -1262,7 +1262,7 @@ c1 c2
838:59:59 838:59:59
UPDATE t1 SET c1=c1+1,c2=c2-1 WHERE c1 IN (222222,8385955,1500000) ORDER BY c1;
Warnings:
-Warning 1264 Out of range value for column 'c2' at row 2
+Warning 1265 Data truncated for column 'c2' at row 2
SELECT * FROM t1;
c1 c2
-12:12:12 12:12:12
@@ -1332,7 +1332,7 @@ c1 c2
00:51:51 02:22:22
00:54:54 00:54:54
01:01:01 02:22:22
-02:02:02 02:22:22
+02:02:02 02:02:02
03:03:00 02:22:22
08:08:08 00:00:00
100:04:04 100:04:04
@@ -1374,7 +1374,7 @@ c1 c2
00:51:51 00:51:51
00:54:54 00:11:11
01:01:01 01:01:01
-02:02:02 02:02:02
+02:02:02 00:11:11
03:03:00 03:03:00
08:08:08 08:08:08
11:11:11 00:11:11
diff --git a/mysql-test/suite/engines/iuds/r/update_year.result b/mysql-test/suite/engines/iuds/r/update_year.result
index 1b0ead45314..c762d70a276 100644
--- a/mysql-test/suite/engines/iuds/r/update_year.result
+++ b/mysql-test/suite/engines/iuds/r/update_year.result
@@ -2,7 +2,13 @@ DROP TABLE IF EXISTS t1,t2,t3,t4;
CREATE TABLE t1(c1 YEAR NOT NULL,c2 YEAR, PRIMARY KEY(c1));
CREATE TABLE t2(c1 YEAR NOT NULL, c2 YEAR, UNIQUE INDEX idx(c1,c2));
CREATE TABLE t3(c1 YEAR(2) NOT NULL,c2 YEAR(2), PRIMARY KEY(c1));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t4(c1 YEAR(2), c2 YEAR(2), UNIQUE INDEX idx(c1,c2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
INSERT INTO t1 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
INSERT INTO t2 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
INSERT INTO t3 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result
index dd376154100..5504ec7efc2 100644
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result
@@ -3801,7 +3801,7 @@ NULL NULL 1
00:00:00 2
00:00:00 <--------30 characters-------> 3
-00:00:00 ---äÖüß@µ*$-- 4
-NULL -1 5
+-00:00:01 -1 5
41:58:00 1 17:58 22
Warnings:
Warning 1292 Truncated incorrect time value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
@@ -3820,7 +3820,7 @@ NULL NULL 1
00:00:00
00:00:00 <--------30 characters-------> 3
-00:00:00 ---äÖüß@µ*$--
-NULL -1
+-00:00:01 -1
41:58:00 1 17:58
Warnings:
Warning 1292 Truncated incorrect time value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index d9cd0f1e7f8..b50f5640520 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -53,6 +53,8 @@ f107 year(4) not null default 2000,
f108 enum("1enum","2enum") not null default "1enum",
f109 set("1set","2set") not null default "1set"
) engine = innodb;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
into table tb2;
DROP DATABASE IF EXISTS test1;
@@ -112,6 +114,8 @@ f107 year(4) not null default 2000,
f108 enum("1enum","2enum") not null default "1enum",
f109 set("1set","2set") not null default "1set"
) engine = innodb;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
into table tb2;
USE test;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result
index f3d3c6b7bad..085017fb529 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result
@@ -132,6 +132,8 @@ f107 year(4) not null default 2000,
f108 enum("1enum","2enum") not null default "1enum",
f109 set("1set","2set") not null default "1set"
) engine = innodb;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
into table tb2;
drop table if exists tb3 ;
@@ -262,6 +264,8 @@ f239 varchar(20000) binary,
f240 varchar(2000),
f241 char(100)
) engine = innodb;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb4.txt'
into table tb4;
USE test1;
@@ -319,6 +323,8 @@ f107 year(4) not null default 2000,
f108 enum("1enum","2enum") not null default "1enum",
f109 set("1set","2set") not null default "1set"
) engine = innodb;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
into table tb2;
USE test;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_memory.result b/mysql-test/suite/funcs_1/r/is_columns_memory.result
index 39a5dcd0b0c..7521a9857a6 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_memory.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_memory.result
@@ -128,6 +128,8 @@ f107 year(4) not null default 2000,
f108 enum("1enum","2enum") not null default "1enum",
f109 set("1set","2set") not null default "1set"
) engine = memory;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
into table tb2 ;
drop table if exists tb3;
@@ -251,6 +253,8 @@ f238 varchar(25000) binary,
f239 varbinary(0),
f240 varchar(1200)
) engine = memory;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb4.txt'
into table tb4;
USE test1;
@@ -308,6 +312,8 @@ f107 year(4) not null default 2000,
f108 enum("1enum","2enum") not null default "1enum",
f109 set("1set","2set") not null default "1set"
) engine = memory;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
into table tb2 ;
USE test;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam.result b/mysql-test/suite/funcs_1/r/is_columns_myisam.result
index 03af4ebb89f..6c2586cc3c1 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_myisam.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_myisam.result
@@ -144,6 +144,8 @@ f115 VARBINARY(27) null ,
f116 VARBINARY(64) null,
f117 VARBINARY(192) null
) engine = myisam;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
into table tb2;
drop table if exists tb3 ;
@@ -283,6 +285,8 @@ f240 varchar(120),
f241 char(100),
f242 bit(30)
) engine = myisam;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb4.txt'
into table tb4;
USE test1;
@@ -348,6 +352,8 @@ f115 VARBINARY(27) null ,
f116 VARBINARY(64) null,
f117 VARBINARY(192) null
) engine = myisam;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
into table tb2;
USE test;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result
index dd8e508e821..150469a4a2f 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result
@@ -144,6 +144,8 @@ f115 VARBINARY(27) null ,
f116 VARBINARY(64) null,
f117 VARBINARY(192) null
) engine = myisam;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
into table tb2;
drop table if exists tb3 ;
@@ -283,6 +285,8 @@ f240 varchar(120),
f241 char(100),
f242 bit(30)
) engine = myisam;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb4.txt'
into table tb4;
USE test1;
@@ -348,6 +352,8 @@ f115 VARBINARY(27) null ,
f116 VARBINARY(64) null,
f117 VARBINARY(192) null
) engine = myisam;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
into table tb2;
USE test;
diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result
index 03e4c647d6d..7f7baf65d1f 100644
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result
@@ -3802,7 +3802,7 @@ NULL NULL 1
00:00:00 2
00:00:00 <--------30 characters-------> 3
-00:00:00 ---äÖüß@µ*$-- 4
-NULL -1 5
+-00:00:01 -1 5
41:58:00 1 17:58 22
Warnings:
Warning 1292 Truncated incorrect time value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
@@ -3821,7 +3821,7 @@ NULL NULL 1
00:00:00
00:00:00 <--------30 characters-------> 3
-00:00:00 ---äÖüß@µ*$--
-NULL -1
+-00:00:01 -1
41:58:00 1 17:58
Warnings:
Warning 1292 Truncated incorrect time value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 864cbb93b29..a718f986648 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -54,6 +54,8 @@ f107 year(4) not null default 2000,
f108 enum("1enum","2enum") not null default "1enum",
f109 set("1set","2set") not null default "1set"
) engine = memory;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
into table tb2 ;
DROP DATABASE IF EXISTS test1;
@@ -113,6 +115,8 @@ f107 year(4) not null default 2000,
f108 enum("1enum","2enum") not null default "1enum",
f109 set("1set","2set") not null default "1set"
) engine = memory;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
into table tb2 ;
USE test;
diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result
index 03e4c647d6d..7f7baf65d1f 100644
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result
@@ -3802,7 +3802,7 @@ NULL NULL 1
00:00:00 2
00:00:00 <--------30 characters-------> 3
-00:00:00 ---äÖüß@µ*$-- 4
-NULL -1 5
+-00:00:01 -1 5
41:58:00 1 17:58 22
Warnings:
Warning 1292 Truncated incorrect time value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
@@ -3821,7 +3821,7 @@ NULL NULL 1
00:00:00
00:00:00 <--------30 characters-------> 3
-00:00:00 ---äÖüß@µ*$--
-NULL -1
+-00:00:01 -1
41:58:00 1 17:58
Warnings:
Warning 1292 Truncated incorrect time value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
diff --git a/mysql-test/suite/funcs_1/r/myisam_views-big.result b/mysql-test/suite/funcs_1/r/myisam_views-big.result
index f4025dfef2a..1ee9c6e0cd6 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views-big.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views-big.result
@@ -62,6 +62,8 @@ f115 VARBINARY(27) null ,
f116 VARBINARY(64) null,
f117 VARBINARY(192) null
) engine = myisam;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
into table tb2;
DROP DATABASE IF EXISTS test1;
@@ -129,6 +131,8 @@ f115 VARBINARY(27) null ,
f116 VARBINARY(64) null,
f117 VARBINARY(192) null
) engine = myisam;
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
into table tb2;
USE test;
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 7b45ec4c9e1..179d0cd814e 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -7499,9 +7499,13 @@ BEGIN
declare x, y, z year(3) default 2005;
SELECT x, y, z;
END//
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CALL sp1();
x y z
2005 2005 2005
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
diff --git a/mysql-test/suite/heap/heap.result b/mysql-test/suite/heap/heap.result
index f058c9f9c72..ae562a0dda1 100644
--- a/mysql-test/suite/heap/heap.result
+++ b/mysql-test/suite/heap/heap.result
@@ -738,3 +738,55 @@ SELECT c2 FROM t1;
c2
0
DROP TABLE t1;
+CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100;
+insert into t1 values(1);
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+data_length index_length
+1600 2400
+drop table t1;
+CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000;
+insert into t1 values(1);
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+data_length index_length
+16000 24000
+drop table t1;
+CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000;
+insert into t1 values(1);
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+data_length index_length
+48000 72000
+drop table t1;
+CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000;
+insert into t1 values(1);
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+data_length index_length
+24000 36000
+drop table t1;
+create table t1 (c1 int, index(c1)) engine=heap max_rows=10000;
+insert into t1 select rand(100000000);
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1 limit 488;
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+data_length index_length
+16000 24000
+insert into t1 select rand(100000000) from t1 limit 1;
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+data_length index_length
+33024 49024
+insert into t1 select rand(100000000) from t1 limit 1000;
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+data_length index_length
+49024 73024
+insert into t1 select rand(100000000) from t1;
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+data_length index_length
+81024 121024
+drop table t1;
diff --git a/mysql-test/suite/heap/heap.test b/mysql-test/suite/heap/heap.test
index 7d56425799a..6f5046af139 100644
--- a/mysql-test/suite/heap/heap.test
+++ b/mysql-test/suite/heap/heap.test
@@ -485,3 +485,55 @@ INSERT INTO t1 VALUES('', 0);
ALTER TABLE t1 MODIFY c1 VARCHAR(101);
SELECT c2 FROM t1;
DROP TABLE t1;
+
+#
+# Show that MIN_ROWS and MAX_ROWS have an effect on how data_length
+# and index_length are allocated.
+# Result is different for 32 / 64 bit machines as pointer lengths are different
+#
+
+CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100;
+insert into t1 values(1);
+--replace_result 800 1600 1200 2400
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+drop table t1;
+CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000;
+insert into t1 values(1);
+--replace_result 8000 16000 12000 24000
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+drop table t1;
+CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000;
+insert into t1 values(1);
+--replace_result 24000 48000 36000 72000
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+drop table t1;
+CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000;
+insert into t1 values(1);
+--replace_result 12000 24000 18000 36000
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+drop table t1;
+
+create table t1 (c1 int, index(c1)) engine=heap max_rows=10000;
+insert into t1 select rand(100000000);
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1;
+insert into t1 select rand(100000000) from t1 limit 488;
+--replace_result 8000 16000 12000 24000
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+insert into t1 select rand(100000000) from t1 limit 1;
+--replace_result 16512 33024 24512 49024
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+insert into t1 select rand(100000000) from t1 limit 1000;
+--replace_result 24512 49024 36512 73024
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+insert into t1 select rand(100000000) from t1;
+--replace_result 40512 81024 60512 121024
+select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
+drop table t1;
diff --git a/mysql-test/suite/heap/heap_hash.result b/mysql-test/suite/heap/heap_hash.result
index 453bfc0c165..ac62427c81c 100644
--- a/mysql-test/suite/heap/heap_hash.result
+++ b/mysql-test/suite/heap/heap_hash.result
@@ -427,4 +427,23 @@ INDEX(col_int_key) USING HASH) ENGINE = HEAP;
INSERT INTO t1 (col_int_nokey, col_int_key) VALUES (3, 0), (4, 0), (3, 1);
DELETE FROM t1 WHERE col_int_nokey = 5 ORDER BY col_int_key LIMIT 2;
DROP TABLE t1;
+#
+# Bug #1002564: Wrong result for a lookup query from a heap table
+#
+CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, KEY i1 (c1(3))) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3');
+explain SELECT * FROM t1 WHERE c1='bar2';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i1 i1 5 const 2 Using where
+SELECT * FROM t1 WHERE c1='bar2';
+c1
+bar2
+ALTER TABLE t1 DROP KEY i1, ADD KEY il (c1(3)) using btree;
+explain SELECT * FROM t1 WHERE c1='bar2';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref il il 5 const 1 Using where
+SELECT * FROM t1 WHERE c1='bar2';
+c1
+bar2
+DROP TABLE t1;
End of 5.5 tests
diff --git a/mysql-test/suite/heap/heap_hash.test b/mysql-test/suite/heap/heap_hash.test
index 80ae01e9547..80d6ef9c8f2 100644
--- a/mysql-test/suite/heap/heap_hash.test
+++ b/mysql-test/suite/heap/heap_hash.test
@@ -316,4 +316,17 @@ DELETE FROM t1 WHERE col_int_nokey = 5 ORDER BY col_int_key LIMIT 2;
DROP TABLE t1;
+--echo #
+--echo # Bug #1002564: Wrong result for a lookup query from a heap table
+--echo #
+
+CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, KEY i1 (c1(3))) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3');
+explain SELECT * FROM t1 WHERE c1='bar2';
+SELECT * FROM t1 WHERE c1='bar2';
+ALTER TABLE t1 DROP KEY i1, ADD KEY il (c1(3)) using btree;
+explain SELECT * FROM t1 WHERE c1='bar2';
+SELECT * FROM t1 WHERE c1='bar2';
+DROP TABLE t1;
+
--echo End of 5.5 tests
diff --git a/mysql-test/suite/innodb/r/auto_increment_dup.result b/mysql-test/suite/innodb/r/auto_increment_dup.result
new file mode 100644
index 00000000000..5bf901cb212
--- /dev/null
+++ b/mysql-test/suite/innodb/r/auto_increment_dup.result
@@ -0,0 +1,33 @@
+drop table if exists t1;
+CREATE TABLE t1(
+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+k INT,
+c CHAR(1),
+UNIQUE KEY(k)) ENGINE=InnoDB;
+#
+# Connection 1
+#
+SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
+affected rows: 0
+INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
+#
+# Connection 2
+#
+SET DEBUG_SYNC='start_ha_write_row WAIT_FOR continue2';
+affected rows: 0
+SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
+affected rows: 0
+INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+affected rows: 4
+info: Records: 3 Duplicates: 1 Warnings: 0
+SET DEBUG_SYNC='RESET';
+SELECT * FROM t1 ORDER BY k;
+id k c
+1 1 NULL
+4 2 1
+2 3 NULL
+5 4 NULL
+6 5 NULL
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/binlog_consistent.result b/mysql-test/suite/innodb/r/binlog_consistent.result
index 2e523c40a5b..f0b665b5ac9 100644
--- a/mysql-test/suite/innodb/r/binlog_consistent.result
+++ b/mysql-test/suite/innodb/r/binlog_consistent.result
@@ -3,11 +3,11 @@ RESET MASTER;
CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb;
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 380
+master-bin.000001 421
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
binlog_snapshot_file master-bin.000001
-binlog_snapshot_position 380
+binlog_snapshot_position 421
BEGIN;
INSERT INTO t1 VALUES (0, "");
# Connection con1
@@ -38,10 +38,10 @@ a b
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
binlog_snapshot_file master-bin.000001
-binlog_snapshot_position 904
+binlog_snapshot_position 945
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 1316
+master-bin.000001 1357
SELECT * FROM t2 ORDER BY a;
a
2
@@ -60,44 +60,45 @@ a b
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
binlog_snapshot_file master-bin.000001
-binlog_snapshot_position 904
+binlog_snapshot_position 945
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 245
+master-bin.000002 326
COMMIT;
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
binlog_snapshot_file master-bin.000002
-binlog_snapshot_position 245
+binlog_snapshot_position 326
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 245
+master-bin.000002 326
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 245 Server ver: #, Binlog ver: #
-master-bin.000001 245 Query 1 380 use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb
-master-bin.000001 380 Query 1 492 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam
-master-bin.000001 492 Query 1 560 BEGIN
-master-bin.000001 560 Query 1 648 use `test`; INSERT INTO t2 VALUES (2)
-master-bin.000001 648 Query 1 717 COMMIT
-master-bin.000001 717 Query 1 785 BEGIN
-master-bin.000001 785 Query 1 877 use `test`; INSERT INTO t1 VALUES (0, "")
-master-bin.000001 877 Xid 1 904 COMMIT /* XID */
-master-bin.000001 904 Query 1 972 BEGIN
-master-bin.000001 972 Query 1 1060 use `test`; INSERT INTO t2 VALUES (3)
-master-bin.000001 1060 Query 1 1129 COMMIT
-master-bin.000001 1129 Query 1 1197 BEGIN
-master-bin.000001 1197 Query 1 1289 use `test`; INSERT INTO t1 VALUES (4, "")
-master-bin.000001 1289 Xid 1 1316 COMMIT /* XID */
-master-bin.000001 1316 Query 1 1384 BEGIN
-master-bin.000001 1384 Query 1 1476 use `test`; INSERT INTO t1 VALUES (1, "")
-master-bin.000001 1476 Xid 1 1503 COMMIT /* XID */
-master-bin.000001 1503 Query 1 1571 BEGIN
-master-bin.000001 1571 Query 1 1668 use `test`; INSERT INTO t1 VALUES (2, "first")
-master-bin.000001 1668 Query 1 1766 use `test`; INSERT INTO t1 VALUES (2, "second")
-master-bin.000001 1766 Xid 1 1793 COMMIT /* XID */
-master-bin.000001 1793 Query 1 1861 BEGIN
-master-bin.000001 1861 Query 1 1953 use `test`; INSERT INTO t1 VALUES (3, "")
-master-bin.000001 1953 Xid 1 1980 COMMIT /* XID */
-master-bin.000001 1980 Rotate 1 2024 master-bin.000002;pos=4
+master-bin.000001 4 Format_desc 1 246 Server ver: #, Binlog ver: #
+master-bin.000001 246 Binlog_checkpoint 1 286 master-bin.000001
+master-bin.000001 286 Query 1 421 use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb
+master-bin.000001 421 Query 1 533 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam
+master-bin.000001 533 Query 1 601 BEGIN
+master-bin.000001 601 Query 1 689 use `test`; INSERT INTO t2 VALUES (2)
+master-bin.000001 689 Query 1 758 COMMIT
+master-bin.000001 758 Query 1 826 BEGIN
+master-bin.000001 826 Query 1 918 use `test`; INSERT INTO t1 VALUES (0, "")
+master-bin.000001 918 Xid 1 945 COMMIT /* XID */
+master-bin.000001 945 Query 1 1013 BEGIN
+master-bin.000001 1013 Query 1 1101 use `test`; INSERT INTO t2 VALUES (3)
+master-bin.000001 1101 Query 1 1170 COMMIT
+master-bin.000001 1170 Query 1 1238 BEGIN
+master-bin.000001 1238 Query 1 1330 use `test`; INSERT INTO t1 VALUES (4, "")
+master-bin.000001 1330 Xid 1 1357 COMMIT /* XID */
+master-bin.000001 1357 Query 1 1425 BEGIN
+master-bin.000001 1425 Query 1 1517 use `test`; INSERT INTO t1 VALUES (1, "")
+master-bin.000001 1517 Xid 1 1544 COMMIT /* XID */
+master-bin.000001 1544 Query 1 1612 BEGIN
+master-bin.000001 1612 Query 1 1709 use `test`; INSERT INTO t1 VALUES (2, "first")
+master-bin.000001 1709 Query 1 1807 use `test`; INSERT INTO t1 VALUES (2, "second")
+master-bin.000001 1807 Xid 1 1834 COMMIT /* XID */
+master-bin.000001 1834 Query 1 1902 BEGIN
+master-bin.000001 1902 Query 1 1994 use `test`; INSERT INTO t1 VALUES (3, "")
+master-bin.000001 1994 Xid 1 2021 COMMIT /* XID */
+master-bin.000001 2021 Rotate 1 2065 master-bin.000002;pos=4
DROP TABLE t1,t2;
diff --git a/mysql-test/suite/innodb/r/group_commit_binlog_pos.result b/mysql-test/suite/innodb/r/group_commit_binlog_pos.result
index d28ad1fd70e..ccf458809d8 100644
--- a/mysql-test/suite/innodb/r/group_commit_binlog_pos.result
+++ b/mysql-test/suite/innodb/r/group_commit_binlog_pos.result
@@ -1,3 +1,4 @@
+SET GLOBAL innodb_flush_log_at_trx_commit=3;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES (0);
SET DEBUG_SYNC= "commit_after_get_LOCK_log SIGNAL con1_waiting WAIT_FOR con3_queued";
@@ -30,6 +31,6 @@ a
1
2
3
-InnoDB: Last MySQL binlog file position 0 906, file name ./master-bin.000001
+InnoDB: Last MySQL binlog file position 0 947, file name ./master-bin.000001
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result b/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result
index da8cff142b8..44cf2f3979d 100644
--- a/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result
+++ b/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result
@@ -1,3 +1,4 @@
+SET GLOBAL innodb_flush_log_at_trx_commit=3;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES (0);
SET DEBUG_SYNC= "commit_after_get_LOCK_log SIGNAL con1_waiting WAIT_FOR con3_queued";
@@ -31,6 +32,6 @@ a
1
2
3
-InnoDB: Last MySQL binlog file position 0 906, file name ./master-bin.000001
+InnoDB: Last MySQL binlog file position 0 947, file name ./master-bin.000001
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/group_commit_crash.result b/mysql-test/suite/innodb/r/group_commit_crash.result
index cd47ba62ff2..c084f854e79 100644
--- a/mysql-test/suite/innodb/r/group_commit_crash.result
+++ b/mysql-test/suite/innodb/r/group_commit_crash.result
@@ -36,7 +36,7 @@ COMMIT;
Got one of the listed errors
SELECT * FROM t1 ORDER BY id;
a b c d id
-SHOW BINLOG EVENTS LIMIT 2,1;
+SHOW BINLOG EVENTS LIMIT 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
SET binlog_format= mixed;
@@ -58,7 +58,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
-SHOW BINLOG EVENTS LIMIT 2,1;
+SHOW BINLOG EVENTS LIMIT 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@@ -81,7 +81,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
-SHOW BINLOG EVENTS LIMIT 2,1;
+SHOW BINLOG EVENTS LIMIT 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@@ -104,7 +104,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
-SHOW BINLOG EVENTS LIMIT 2,1;
+SHOW BINLOG EVENTS LIMIT 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@@ -117,7 +117,7 @@ COMMIT;
Got one of the listed errors
SELECT * FROM t1 ORDER BY id;
a b c d id
-SHOW BINLOG EVENTS LIMIT 2,1;
+SHOW BINLOG EVENTS LIMIT 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result b/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result
index c1ae510d45b..40c270a76d3 100644
--- a/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result
+++ b/mysql-test/suite/innodb/r/group_commit_crash_no_optimize_thread.result
@@ -36,7 +36,7 @@ COMMIT;
Got one of the listed errors
SELECT * FROM t1 ORDER BY id;
a b c d id
-SHOW BINLOG EVENTS LIMIT 2,1;
+SHOW BINLOG EVENTS LIMIT 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
SET binlog_format= mixed;
@@ -58,7 +58,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
-SHOW BINLOG EVENTS LIMIT 2,1;
+SHOW BINLOG EVENTS LIMIT 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@@ -81,7 +81,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
-SHOW BINLOG EVENTS LIMIT 2,1;
+SHOW BINLOG EVENTS LIMIT 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@@ -104,7 +104,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
-SHOW BINLOG EVENTS LIMIT 2,1;
+SHOW BINLOG EVENTS LIMIT 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@@ -117,7 +117,7 @@ COMMIT;
Got one of the listed errors
SELECT * FROM t1 ORDER BY id;
a b c d id
-SHOW BINLOG EVENTS LIMIT 2,1;
+SHOW BINLOG EVENTS LIMIT 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index d4b6c6839c2..8c4c1c20590 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -2,7 +2,7 @@ drop table if exists t1;
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (9223372036854775807, null);
INSERT INTO t1 (c2) VALUES ('innodb');
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1 c2
9223372036854775807 NULL
@@ -10,7 +10,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (127, null);
INSERT INTO t1 (c2) VALUES ('innodb');
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1 c2
127 NULL
@@ -18,7 +18,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (255, null);
INSERT INTO t1 (c2) VALUES ('innodb');
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1 c2
255 NULL
@@ -26,7 +26,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (32767, null);
INSERT INTO t1 (c2) VALUES ('innodb');
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1 c2
32767 NULL
@@ -34,7 +34,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (65535, null);
INSERT INTO t1 (c2) VALUES ('innodb');
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1 c2
65535 NULL
@@ -42,7 +42,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (8388607, null);
INSERT INTO t1 (c2) VALUES ('innodb');
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1 c2
8388607 NULL
@@ -50,7 +50,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (16777215, null);
INSERT INTO t1 (c2) VALUES ('innodb');
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1 c2
16777215 NULL
@@ -58,7 +58,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (2147483647, null);
INSERT INTO t1 (c2) VALUES ('innodb');
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1 c2
2147483647 NULL
@@ -66,7 +66,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (4294967295, null);
INSERT INTO t1 (c2) VALUES ('innodb');
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1 c2
4294967295 NULL
@@ -74,7 +74,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (9223372036854775807, null);
INSERT INTO t1 (c2) VALUES ('innodb');
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1 c2
9223372036854775807 NULL
@@ -366,7 +366,7 @@ c1
310
400
1000
-1110
+1010
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
@@ -567,7 +567,7 @@ Variable_name Value
auto_increment_increment 65535
auto_increment_offset 65535
INSERT INTO t1 VALUES (NULL),(NULL);
-ERROR 22003: Out of range value for column 't1' at row 167
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1
1
@@ -648,7 +648,7 @@ t2 CREATE TABLE `t2` (
`n` int(10) unsigned NOT NULL,
`o` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`m`)
-) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1;
Table Create Table
@@ -858,7 +858,7 @@ PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 SELECT c1 FROM t1;
Got one of the listed errors
INSERT INTO t2 SELECT NULL FROM t1;
-Got one of the listed errors
+ERROR 22003: Out of range value for column 'c1' at row 1
DROP TABLE t1;
DROP TABLE t2;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
diff --git a/mysql-test/suite/innodb/r/innodb-lock.result b/mysql-test/suite/innodb/r/innodb-lock.result
index 439a8d6513c..7191bcd238a 100644
--- a/mysql-test/suite/innodb/r/innodb-lock.result
+++ b/mysql-test/suite/innodb/r/innodb-lock.result
@@ -98,8 +98,12 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
INSERT INTO t1 VALUES(3,1);
BEGIN;
INSERT IGNORE INTO t1 VALUES(3,14);
+Warnings:
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
BEGIN;
INSERT IGNORE INTO t1 VALUES(3,23);
+Warnings:
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
SELECT * FROM t1 FOR UPDATE;
COMMIT;
a b
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
index b5e4d5cfae8..2f2f81db204 100644
--- a/mysql-test/suite/innodb/r/innodb.result
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -816,6 +816,8 @@ id
1
2
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
+Warnings:
+Warning 1062 Duplicate entry '1-1' for key 'PRIMARY'
commit;
select id,id3 from t1;
id id3
diff --git a/mysql-test/suite/innodb/r/innodb_bug52745.result b/mysql-test/suite/innodb/r/innodb_bug52745.result
index 74db8b0c20a..927ba0e0e53 100644
--- a/mysql-test/suite/innodb/r/innodb_bug52745.result
+++ b/mysql-test/suite/innodb/r/innodb_bug52745.result
@@ -58,6 +58,7 @@ col89 float unsigned zerofill DEFAULT NULL,
col90 tinyblob
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
Note 1291 Column 'col82' has duplicated value '' in ENUM
Note 1291 Column 'col82' has duplicated value '' in ENUM
INSERT INTO bug52745 SET
diff --git a/mysql-test/suite/innodb/r/innodb_bug56947.result b/mysql-test/suite/innodb/r/innodb_bug56947.result
index b279069d834..8b864b62e81 100644
--- a/mysql-test/suite/innodb/r/innodb_bug56947.result
+++ b/mysql-test/suite/innodb/r/innodb_bug56947.result
@@ -3,6 +3,6 @@ SET GLOBAL innodb_file_per_table=0;
create table bug56947(a int not null) engine = innodb;
CREATE TABLE `bug56947#1`(a int) ENGINE=InnoDB;
alter table bug56947 add unique index (a);
-ERROR HY000: Table 'test.bug56947#1' already exists
+ERROR 42S01: Table 'test.bug56947#1' already exists
drop table `bug56947#1`;
drop table bug56947;
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 2b3d24551c7..be2b4b28f6a 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -1480,10 +1480,15 @@ k a c
1 6 2
2 7 NULL
insert ignore into t2 values (null,6,1),(10,8,1);
+Warnings:
+Warning 1062 Duplicate entry '6' for key 'idx_1'
select last_insert_id();
last_insert_id()
0
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
+Warnings:
+Warning 1062 Duplicate entry '6' for key 'idx_1'
+Warning 1062 Duplicate entry '8' for key 'idx_1'
select last_insert_id();
last_insert_id()
11
diff --git a/mysql-test/suite/innodb/t/auto_increment_dup.test b/mysql-test/suite/innodb/t/auto_increment_dup.test
new file mode 100644
index 00000000000..ad439024f65
--- /dev/null
+++ b/mysql-test/suite/innodb/t/auto_increment_dup.test
@@ -0,0 +1,51 @@
+##########################################################################
+# LP bug #1035225 / MySQL bug #66301: INSERT ... ON DUPLICATE KEY UPDATE +
+# innodb_autoinc_lock_mode=1 is broken
+##########################################################################
+
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1(
+ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ k INT,
+ c CHAR(1),
+ UNIQUE KEY(k)) ENGINE=InnoDB;
+
+--enable_info
+
+--connect(con1, localhost, root)
+--connect(con2, localhost, root)
+
+--connection con1
+
+--echo #
+--echo # Connection 1
+--echo #
+SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
+--send INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'
+
+--connection con2
+--echo #
+--echo # Connection 2
+--echo #
+SET DEBUG_SYNC='start_ha_write_row WAIT_FOR continue2';
+SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
+INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
+
+--connection con1
+--reap
+--disable_info
+SET DEBUG_SYNC='RESET';
+SELECT * FROM t1 ORDER BY k;
+
+--disconnect con1
+--disconnect con2
+
+--connection default
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/group_commit_binlog_pos.test b/mysql-test/suite/innodb/t/group_commit_binlog_pos.test
index 72798a68a1e..213dbc9d3d8 100644
--- a/mysql-test/suite/innodb/t/group_commit_binlog_pos.test
+++ b/mysql-test/suite/innodb/t/group_commit_binlog_pos.test
@@ -17,6 +17,19 @@
# Test that we get the correct position when we group commit several
# transactions together.
+# What we really want to test here is what happens when a group of
+# transactions get written only partially to disk inside InnoDB before
+# the crash. But that is hard to test in mysql-test-run automated
+# tests. Instead, we use debug_sync to tightly control when each
+# transaction is written to the redo log. And we set
+# innodb_flush_log_at_trx_commit=3 so that we can write out
+# transactions individually - as with
+# innodb_flush_log_at_trx_commit=1, all commits are written together,
+# as part of a commit_checkpoint.
+# (Note that we do not have to restore innodb_flush_log_at_trx_commit, as
+# we crash the server).
+SET GLOBAL innodb_flush_log_at_trx_commit=3;
+
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES (0);
diff --git a/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test
index e9a234577e2..3ae3c50085d 100644
--- a/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test
+++ b/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test
@@ -17,6 +17,19 @@
# Test that we get the correct position when we group commit several
# transactions together.
+# What we really want to test here is what happens when a group of
+# transactions get written only partially to disk inside InnoDB before
+# the crash. But that is hard to test in mysql-test-run automated
+# tests. Instead, we use debug_sync to tightly control when each
+# transaction is written to the redo log. And we set
+# innodb_flush_log_at_trx_commit=3 so that we can write out
+# transactions individually - as with
+# innodb_flush_log_at_trx_commit=1, all commits are written together,
+# as part of a commit_checkpoint.
+# (Note that we do not have to restore innodb_flush_log_at_trx_commit, as
+# we crash the server).
+SET GLOBAL innodb_flush_log_at_trx_commit=3;
+
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES (0);
diff --git a/mysql-test/suite/innodb/t/group_commit_crash.test b/mysql-test/suite/innodb/t/group_commit_crash.test
index 12c92d19244..0a297e3c570 100644
--- a/mysql-test/suite/innodb/t/group_commit_crash.test
+++ b/mysql-test/suite/innodb/t/group_commit_crash.test
@@ -66,7 +66,7 @@ while ($numtests)
# table and binlog should be in sync.
SELECT * FROM t1 ORDER BY id;
--replace_column 2 # 5 #
- SHOW BINLOG EVENTS LIMIT 2,1;
+ SHOW BINLOG EVENTS LIMIT 3,1;
delete from t1;
diff --git a/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test
index 2de09d6b0b6..4214c2a6b03 100644
--- a/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test
+++ b/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test
@@ -66,7 +66,7 @@ while ($numtests)
# table and binlog should be in sync.
SELECT * FROM t1 ORDER BY id;
--replace_column 2 # 5 #
- SHOW BINLOG EVENTS LIMIT 2,1;
+ SHOW BINLOG EVENTS LIMIT 3,1;
delete from t1;
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index 4f54a8ff957..888c73bacdf 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -11,7 +11,7 @@ drop table if exists t1;
#
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (9223372036854775807, null);
--- error ER_DUP_ENTRY,1062
+-- error 167
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -22,14 +22,14 @@ DROP TABLE t1;
# TINYINT
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (127, null);
--- error ER_DUP_ENTRY,1062
+-- error 167
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (255, null);
--- error ER_DUP_ENTRY,1062
+-- error 167
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -38,14 +38,14 @@ DROP TABLE t1;
#
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (32767, null);
--- error ER_DUP_ENTRY,1062
+-- error 167
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (65535, null);
--- error ER_DUP_ENTRY,1062
+-- error 167
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -54,14 +54,14 @@ DROP TABLE t1;
#
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (8388607, null);
--- error ER_DUP_ENTRY,1062
+-- error 167
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (16777215, null);
--- error ER_DUP_ENTRY,1062
+-- error 167
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -70,14 +70,14 @@ DROP TABLE t1;
#
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (2147483647, null);
--- error ER_DUP_ENTRY,1062
+-- error 167
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (4294967295, null);
--- error ER_DUP_ENTRY,1062
+-- error 167
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -86,7 +86,7 @@ DROP TABLE t1;
#
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (9223372036854775807, null);
--- error ER_DUP_ENTRY,1062
+-- error 167
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -349,7 +349,7 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
SHOW VARIABLES LIKE "%auto_inc%";
---error ER_WARN_DATA_OUT_OF_RANGE
+--error 167
INSERT INTO t1 VALUES (NULL),(NULL);
SELECT * FROM t1;
DROP TABLE t1;
@@ -437,7 +437,7 @@ CREATE TABLE t2(
PRIMARY KEY) ENGINE=InnoDB;
-- error ER_DUP_ENTRY,1062
INSERT INTO t2 SELECT c1 FROM t1;
--- error ER_DUP_ENTRY,1467
+-- error 167
INSERT INTO t2 SELECT NULL FROM t1;
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/innodb/t/innodb_bug14007649.test b/mysql-test/suite/innodb/t/innodb_bug14007649.test
index 5f613cad6f1..da413e0ce59 100644
--- a/mysql-test/suite/innodb/t/innodb_bug14007649.test
+++ b/mysql-test/suite/innodb/t/innodb_bug14007649.test
@@ -1,9 +1,9 @@
--source include/have_innodb.inc
--source include/have_debug.inc
-if (`select plugin_auth_version <= "1.1.8-26.0" from information_schema.plugins where plugin_name='innodb'`)
+if (`select plugin_auth_version <= "1.0.17-13.01" from information_schema.plugins where plugin_name='innodb'`)
{
- --skip Not fixed in XtraDB 1.1.8-26.0 or earlier
+ --skip Not fixed in XtraDB 1.0.17-13.01 or earlier
}
create table t1 (
diff --git a/mysql-test/suite/maria/lock.result b/mysql-test/suite/maria/lock.result
index 101347c7d4c..b67d1ab7b0d 100644
--- a/mysql-test/suite/maria/lock.result
+++ b/mysql-test/suite/maria/lock.result
@@ -27,3 +27,6 @@ i
drop table t2;
unlock tables;
drop table t1;
+CREATE TABLE t1 (i INT) ENGINE=Aria;
+LOCK TABLES t1 WRITE, t1 AS t1a WRITE;
+DROP TABLE t1;
diff --git a/mysql-test/suite/maria/lock.test b/mysql-test/suite/maria/lock.test
index 6116f0b5f08..5b6d17069e7 100644
--- a/mysql-test/suite/maria/lock.test
+++ b/mysql-test/suite/maria/lock.test
@@ -42,3 +42,11 @@ select * from t1;
drop table t2;
unlock tables;
drop table t1;
+
+#
+# MDEV-366: lock table twice with LOCK TABLES and then drop it
+#
+
+CREATE TABLE t1 (i INT) ENGINE=Aria;
+LOCK TABLES t1 WRITE, t1 AS t1a WRITE;
+DROP TABLE t1;
diff --git a/mysql-test/suite/maria/maria-connect.result b/mysql-test/suite/maria/maria-connect.result
index ed626a003f5..d79ebbdb86c 100644
--- a/mysql-test/suite/maria/maria-connect.result
+++ b/mysql-test/suite/maria/maria-connect.result
@@ -16,6 +16,7 @@ a
4
SHOW BINLOG EVENTS FROM <start_pos>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a int primary key)
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Query 1 # use `test`; insert t1 values (1),(2),(3)
diff --git a/mysql-test/suite/maria/maria3.result b/mysql-test/suite/maria/maria3.result
index 37613875f38..27d72b75930 100644
--- a/mysql-test/suite/maria/maria3.result
+++ b/mysql-test/suite/maria/maria3.result
@@ -452,6 +452,8 @@ 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");
INSERT IGNORE INTO t1 (f1) VALUES ("test1");
+Warnings:
+Warning 1062 Duplicate entry 'test1' for key 'f1'
INSERT IGNORE INTO t1 (f1) VALUES ("test2");
SELECT * FROM t1;
id f1
diff --git a/mysql-test/suite/maria/mrr.result b/mysql-test/suite/maria/mrr.result
index af7789eebff..06be64566e5 100644
--- a/mysql-test/suite/maria/mrr.result
+++ b/mysql-test/suite/maria/mrr.result
@@ -277,6 +277,8 @@ bb-1 NULL cc-2 NULL-1
drop table t1, t2, t3, t4;
create table t1 (a int, b int not null,unique key (a,b),index(b));
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
+Warnings:
+Warning 1062 Duplicate entry '6-6' for key 'a'
create table t2 like t1;
insert into t2 select * from t1;
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
diff --git a/mysql-test/suite/mtr2/combinations b/mysql-test/suite/mtr2/combinations
new file mode 100644
index 00000000000..b26eab8ce1d
--- /dev/null
+++ b/mysql-test/suite/mtr2/combinations
@@ -0,0 +1,5 @@
+[1st]
+lock-wait-timeout=5
+
+[2nd]
+lock-wait-timeout=3
diff --git a/mysql-test/suite/multi_source/info_logs-master.opt b/mysql-test/suite/multi_source/info_logs-master.opt
new file mode 100644
index 00000000000..da4e6d3c455
--- /dev/null
+++ b/mysql-test/suite/multi_source/info_logs-master.opt
@@ -0,0 +1 @@
+--relay-log=relay.bin --relay-log-info=relay.bin.info
diff --git a/mysql-test/suite/multi_source/info_logs.result b/mysql-test/suite/multi_source/info_logs.result
new file mode 100644
index 00000000000..3c99c755af9
--- /dev/null
+++ b/mysql-test/suite/multi_source/info_logs.result
@@ -0,0 +1,115 @@
+#
+# List of files matching '*info*' pattern before starting any slaves
+multi-master.info
+# End of list
+#
+# Contents of multi-master.info
+# EOF
+#
+change master 'master1' to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+start slave 'master1';
+set default_master_connection = 'master1';
+include/wait_for_slave_to_start.inc
+#
+# List of files matching '*info*' pattern while 'master1' is running
+master-master1.info
+multi-master.info
+relay.bin-master1.info
+# End of list
+#
+# Contents of multi-master.info
+master1
+# EOF
+#
+change master 'MASTER 2.2' to
+master_port=MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+start slave 'MASTER 2.2';
+set default_master_connection = 'MASTER 2.2';
+include/wait_for_slave_to_start.inc
+#
+# List of files matching '*info*' pattern
+# while 'master1' and 'MASTER 2.2' are running
+master-master1.info
+master-master@00202@002e2.info
+multi-master.info
+relay.bin-master1.info
+relay.bin-master@00202@002e2.info
+# End of list
+#
+# Contents of multi-master.info
+master1
+MASTER 2.2
+# EOF
+#
+stop slave 'master1';
+set default_master_connection = 'master1';
+include/wait_for_slave_to_stop.inc
+reset slave 'master1' all;
+#
+# List of files matching '*info*' pattern
+# after 'master1' was completely reset, 'MASTER 2.2' still running
+master-master@00202@002e2.info
+multi-master.info
+relay.bin-master@00202@002e2.info
+# End of list
+#
+# Contents of multi-master.info
+MASTER 2.2
+# EOF
+#
+set default_master_connection = '';
+change master to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+start slave;
+include/wait_for_slave_to_start.inc
+#
+# List of files matching '*info*' pattern
+# while 'MASTER 2.2' and '' are running
+master-master@00202@002e2.info
+master.info
+multi-master.info
+relay.bin-master@00202@002e2.info
+relay.bin.info
+# End of list
+#
+# Contents of multi-master.info
+MASTER 2.2
+# EOF
+#
+show all slaves status;
+Connection_name Slave_SQL_State 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
+ Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 relay.000002 572 master-bin.000001 Yes Yes 0 0 286 857 None 0 No 0 No 0 0 1 0 1073741824 6 0 60.000
+MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 relay-master@00202@002e2.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 0 0 2 0 1073741824 6 0 60.000
+include/wait_for_slave_to_start.inc
+set default_master_connection = 'MASTER 2.2';
+include/wait_for_slave_to_start.inc
+set default_master_connection = '';
+show all slaves status;
+Connection_name Slave_SQL_State 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
+ Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 relay.000004 532 master-bin.000001 Yes Yes 0 0 286 817 None 0 No 0 No 0 0 1 0 1073741824 6 0 60.000
+MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 relay-master@00202@002e2.000004 532 master-bin.000001 Yes Yes 0 0 286 836 None 0 No 0 No 0 0 2 0 1073741824 6 0 60.000
+#
+# List of files matching '*info*' pattern
+# after slave server restart
+# while 'MASTER 2.2' and '' are running
+master-master@00202@002e2.info
+master.info
+multi-master.info
+relay.bin-master@00202@002e2.info
+relay.bin.info
+# End of list
+#
+# Contents of multi-master.info
+MASTER 2.2
+# EOF
+#
+include/reset_master_slave.inc
+include/reset_master_slave.inc
+include/reset_master_slave.inc
diff --git a/mysql-test/suite/multi_source/info_logs.test b/mysql-test/suite/multi_source/info_logs.test
new file mode 100644
index 00000000000..73e6ee73722
--- /dev/null
+++ b/mysql-test/suite/multi_source/info_logs.test
@@ -0,0 +1,178 @@
+#
+# Check log files with multi-source
+#
+
+--source include/not_embedded.inc
+
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+--let $datadir = `SELECT @@datadir`
+
+#
+# Check creation and updating of multi-source *info* logs
+#
+
+--echo #
+--echo # List of files matching '*info*' pattern before starting any slaves
+--list_files $datadir *info*
+--echo # End of list
+--echo #
+--echo # Contents of multi-master.info
+--cat_file $datadir/multi-master.info
+--echo # EOF
+--echo #
+
+# Start replication from the first master
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master 'master1' to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+
+start slave 'master1';
+set default_master_connection = 'master1';
+--source include/wait_for_slave_to_start.inc
+
+# Check the files
+
+--echo #
+--echo # List of files matching '*info*' pattern while 'master1' is running
+--list_files $datadir *info*
+--echo # End of list
+--echo #
+--echo # Contents of multi-master.info
+--cat_file $datadir/multi-master.info
+--echo # EOF
+--echo #
+
+# Start replication from the second master
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+eval change master 'MASTER 2.2' to
+master_port=$SERVER_MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+
+start slave 'MASTER 2.2';
+set default_master_connection = 'MASTER 2.2';
+--source include/wait_for_slave_to_start.inc
+
+--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'MASTER 2.2'
+
+# Check the files
+
+--echo #
+--echo # List of files matching '*info*' pattern
+--echo # while 'master1' and 'MASTER 2.2' are running
+--list_files $datadir *info*
+--echo # End of list
+--echo #
+--echo # Contents of multi-master.info
+--cat_file $datadir/multi-master.info
+--echo # EOF
+--echo #
+
+# Remove master1 configuration
+
+stop slave 'master1';
+set default_master_connection = 'master1';
+--source include/wait_for_slave_to_stop.inc
+reset slave 'master1' all;
+
+# Check the files
+
+--echo #
+--echo # List of files matching '*info*' pattern
+--echo # after 'master1' was completely reset, 'MASTER 2.2' still running
+--list_files $datadir *info*
+--echo # End of list
+--echo #
+--echo # Contents of multi-master.info
+--cat_file $datadir/multi-master.info
+--echo # EOF
+--echo #
+
+# Start replication from the first master,
+# now with the default empty name
+
+set default_master_connection = '';
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+
+start slave;
+--source include/wait_for_slave_to_start.inc
+
+--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+--save_master_pos
+
+--connection slave
+--sync_with_master
+
+# Check the files
+
+--echo #
+--echo # List of files matching '*info*' pattern
+--echo # while 'MASTER 2.2' and '' are running
+--list_files $datadir *info*
+--echo # End of list
+--echo #
+--echo # Contents of multi-master.info
+--cat_file $datadir/multi-master.info
+--echo # EOF
+--echo #
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+show all slaves status;
+
+# Restart the slave server
+
+--enable_reconnect
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
+restart
+EOF
+--shutdown_server 60
+--source include/wait_until_connected_again.inc
+--source include/wait_for_slave_to_start.inc
+set default_master_connection = 'MASTER 2.2';
+--source include/wait_for_slave_to_start.inc
+set default_master_connection = '';
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+show all slaves status;
+
+# Check the files
+
+--echo #
+--echo # List of files matching '*info*' pattern
+--echo # after slave server restart
+--echo # while 'MASTER 2.2' and '' are running
+--list_files $datadir *info*
+--echo # End of list
+--echo #
+--echo # Contents of multi-master.info
+--cat_file $datadir/multi-master.info
+--echo # EOF
+--echo #
+
+
+# Cleanup
+
+--source reset_master_slave.inc
+--disconnect slave
+
+--connection master1
+--source reset_master_slave.inc
+--disconnect master1
+
+--connection master2
+--source reset_master_slave.inc
+--disconnect master2
+
diff --git a/mysql-test/suite/multi_source/multisource.result b/mysql-test/suite/multi_source/multisource.result
new file mode 100644
index 00000000000..b190a0b525d
--- /dev/null
+++ b/mysql-test/suite/multi_source/multisource.result
@@ -0,0 +1,140 @@
+change master 'master1' to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+start slave 'master1';
+set default_master_connection = 'master1';
+include/wait_for_slave_to_start.inc
+show slave 'master1' 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath
+Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin-master1.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath
+Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin-master1.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 0 0 1
+show all slaves status;
+Connection_name Slave_SQL_State 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
+master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin-master1.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 0 0 1 0 1073741824 6 0 60.000
+drop database if exists db1;
+create database db1;
+use db1;
+create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM;
+insert into t1 (f1) values ('one'),('two');
+select * from db1.t1;
+i f1
+1 one
+2 two
+# List of relay log files in the datadir
+mysqld-relay-bin-master1.000001
+mysqld-relay-bin-master1.000002
+mysqld-relay-bin-master1.index
+show relaylog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin-master1.000001 4 Format_desc 3 246 Server version
+mysqld-relay-bin-master1.000001 246 Rotate 3 304 mysqld-relay-bin-master1.000002;pos=4
+show relaylog events in 'mysqld-relay-bin-master1.000002';
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin-master1.000002 4 Format_desc 3 246 Server version
+mysqld-relay-bin-master1.000002 246 Rotate 1 0 master-bin.000001;pos=4
+mysqld-relay-bin-master1.000002 290 Format_desc 1 246 Server version
+mysqld-relay-bin-master1.000002 532 Binlog_checkpoint 1 286 master-bin.000001
+mysqld-relay-bin-master1.000002 572 Query 1 375 drop database if exists db1
+mysqld-relay-bin-master1.000002 661 Query 1 456 create database db1
+mysqld-relay-bin-master1.000002 742 Query 1 609 use `db1`; create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM
+mysqld-relay-bin-master1.000002 895 Query 1 676 BEGIN
+mysqld-relay-bin-master1.000002 962 Intvar 1 704 INSERT_ID=1
+mysqld-relay-bin-master1.000002 990 Query 1 808 use `db1`; insert into t1 (f1) values ('one'),('two')
+mysqld-relay-bin-master1.000002 1094 Query 1 876 COMMIT
+change master 'master1' to
+master_port=MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first
+change master to
+master_port=MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first
+change master 'master2' to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+ERROR HY000: Connection 'master2' conflicts with existing connection 'master1'
+set default_master_connection = '';
+change master to
+master_port=MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+start slave;
+include/wait_for_slave_to_start.inc
+show all slaves status;
+Connection_name Slave_SQL_State 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
+ Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin.000002 572 master-bin.000001 Yes Yes 0 0 286 868 None 0 No 0 No 0 0 2 0 1073741824 6 0 60.000
+master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 876 mysqld-relay-bin-master1.000002 1162 master-bin.000001 Yes Yes 0 0 876 1466 None 0 No 0 No 0 0 1 0 1073741824 13 0 60.000
+insert into t1 (f1) values ('three');
+drop database if exists db2;
+create database db2;
+use db2;
+create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB;
+begin;
+insert into t1 (f1) values (1),(2);
+select * from db1.t1;
+i f1
+1 one
+2 two
+3 three
+select * from db2.t1;
+pk f1
+commit;
+select * from db2.t1;
+pk f1
+1 1
+2 2
+flush logs;
+purge binary logs to 'master-bin.000002';
+show binary logs;
+Log_name File_size
+master-bin.000002 326
+insert into t1 (f1) values ('four');
+create table db1.t3 (f1 int) engine=InnoDB;
+show all slaves status;
+Connection_name Slave_SQL_State 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
+ Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 809 mysqld-relay-bin.000002 1095 master-bin.000001 Yes Yes 0 0 809 1391 None 0 No 0 No 0 0 2 0 1073741824 13 0 60.000
+master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000002 690 mysqld-relay-bin-master1.000004 976 master-bin.000002 Yes Yes 0 0 690 1324 None 0 No 0 No 0 0 1 0 1073741824 31 0 60.000
+select * from db1.t1;
+i f1
+1 one
+2 two
+3 three
+4 four
+show relaylog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin.000001 4 Format_desc 3 246 Server version
+mysqld-relay-bin.000001 246 Rotate 3 296 mysqld-relay-bin.000002;pos=4
+show relaylog events in 'mysqld-relay-bin.000002';
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin.000002 4 Format_desc 3 246 Server version
+mysqld-relay-bin.000002 246 Rotate 2 0 master-bin.000001;pos=4
+mysqld-relay-bin.000002 290 Format_desc 2 246 Server version
+mysqld-relay-bin.000002 532 Binlog_checkpoint 2 286 master-bin.000001
+mysqld-relay-bin.000002 572 Query 2 375 drop database if exists db2
+mysqld-relay-bin.000002 661 Query 2 456 create database db2
+mysqld-relay-bin.000002 742 Query 2 591 use `db2`; create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB
+mysqld-relay-bin.000002 877 Query 2 658 BEGIN
+mysqld-relay-bin.000002 944 Intvar 2 686 INSERT_ID=1
+mysqld-relay-bin.000002 972 Query 2 782 use `db2`; insert into t1 (f1) values (1),(2)
+mysqld-relay-bin.000002 1068 Xid 2 809 COMMIT /* xid=<num> */
+stop slave io_thread;
+show status like 'Slave_running';
+Variable_name Value
+Slave_running OFF
+set default_master_connection = 'master1';
+show status like 'Slave_running';
+Variable_name Value
+Slave_running ON
+drop database db1;
+drop database db2;
+include/reset_master_slave.inc
+drop database db1;
+include/reset_master_slave.inc
+drop database db2;
+include/reset_master_slave.inc
diff --git a/mysql-test/suite/multi_source/multisource.test b/mysql-test/suite/multi_source/multisource.test
new file mode 100644
index 00000000000..e9d672a9ae3
--- /dev/null
+++ b/mysql-test/suite/multi_source/multisource.test
@@ -0,0 +1,229 @@
+#
+# Test basic replication functionality
+# in multi-source setup
+#
+
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+# Start replication from the first master
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master 'master1' to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+
+start slave 'master1';
+set default_master_connection = 'master1';
+--source include/wait_for_slave_to_start.inc
+
+--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'master1'
+
+# Here and further: add an extra check on SQL thread status
+# as the normal sync is not always enough
+--source wait_for_sql_thread_read_all.inc
+
+# each of the 3 commands should produce
+# 'master1' status
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+show slave 'master1' status;
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+show slave status;
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+show all slaves status;
+
+
+# Check that replication actually works
+
+--connection master1
+
+--disable_warnings
+drop database if exists db1;
+--enable_warnings
+create database db1;
+use db1;
+create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM;
+insert into t1 (f1) values ('one'),('two');
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'master1'
+
+--sorted_result
+select * from db1.t1;
+
+--let $datadir = `SELECT @@datadir`
+
+--echo # List of relay log files in the datadir
+--list_files $datadir mysqld-relay-bin-master1.*
+
+# Check that relay logs are recognizable
+
+--replace_regex /Server ver:.*/Server version/ /xid=[0-9]+/xid=<num>/
+show relaylog events;
+--replace_regex /Server ver:.*/Server version/ /xid=[0-9]+/xid=<num>/
+show relaylog events in 'mysqld-relay-bin-master1.000002';
+
+
+# Try to configure connection with the same name again,
+# should get an error because the slave is running
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+--error ER_SLAVE_MUST_STOP
+eval change master 'master1' to
+master_port=$SERVER_MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+
+# Try to configure using the default connection name
+# (which is 'master1' at the moment),
+# again, should get an error
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+--error ER_SLAVE_MUST_STOP
+eval change master to
+master_port=$SERVER_MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+
+# Try to configure a connection with the same master
+# using a different name, should get a conflict
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+--error ER_CONNECTION_ALREADY_EXISTS
+eval change master 'master2' to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+
+
+# Set up a proper 'default' connection to master2
+
+set default_master_connection = '';
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+eval change master to
+master_port=$SERVER_MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+
+start slave;
+--source include/wait_for_slave_to_start.inc
+
+--source wait_for_sql_thread_read_all.inc
+
+# See both connections in the same status output
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+show all slaves status;
+
+# Check that replication from two servers actually works
+
+--connection master1
+
+insert into t1 (f1) values ('three');
+--save_master_pos
+
+--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+
+--disable_warnings
+drop database if exists db2;
+--enable_warnings
+create database db2;
+use db2;
+create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB;
+begin;
+insert into t1 (f1) values (1),(2);
+
+--connection slave
+--sync_with_master 0,'master1'
+
+--connection master2
+--save_master_pos
+
+--connection slave
+--sync_with_master 0
+--sorted_result
+select * from db1.t1;
+select * from db2.t1;
+
+--connection master2
+commit;
+--save_master_pos
+
+--connection slave
+--sync_with_master 0
+--sorted_result
+select * from db2.t1;
+
+# Flush and purge logs on one master,
+# make sure slaves don't get confused
+
+--connection master1
+flush logs;
+--save_master_pos
+--connection slave
+--sync_with_master 0, 'master1'
+
+--connection master1
+purge binary logs to 'master-bin.000002';
+show binary logs;
+insert into t1 (f1) values ('four');
+create table db1.t3 (f1 int) engine=InnoDB;
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'master1'
+
+--source wait_for_sql_thread_read_all.inc
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+show all slaves status;
+
+--sorted_result
+select * from db1.t1;
+
+# This should show relay log events for the default master
+# (the one with the empty name)
+--replace_regex /Server ver:.*/Server version/ /xid=[0-9]+/xid=<num>/
+show relaylog events;
+--replace_regex /Server ver:.*/Server version/ /xid=[0-9]+/xid=<num>/
+show relaylog events in 'mysqld-relay-bin.000002';
+
+# Make sure we don't lose control over replication connections
+# after reconnecting to the slave
+
+--disconnect slave
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+stop slave io_thread;
+show status like 'Slave_running';
+set default_master_connection = 'master1';
+show status like 'Slave_running';
+
+# Cleanup
+
+drop database db1;
+drop database db2;
+
+--source reset_master_slave.inc
+--disconnect slave
+
+--connection master1
+drop database db1;
+--source reset_master_slave.inc
+--disconnect master1
+
+--connection master2
+drop database db2;
+--source reset_master_slave.inc
+--disconnect master2
+
diff --git a/mysql-test/suite/multi_source/my.cnf b/mysql-test/suite/multi_source/my.cnf
new file mode 100644
index 00000000000..826967b52f9
--- /dev/null
+++ b/mysql-test/suite/multi_source/my.cnf
@@ -0,0 +1,25 @@
+# cat t/multisource1.cnf
+!include include/default_mysqld.cnf
+!include include/default_client.cnf
+
+[mysqld.1]
+server-id=1
+log-bin=master-bin
+log-warnings=2
+
+[mysqld.2]
+server-id=2
+log-bin=master-bin
+log-warnings=2
+
+[mysqld.3]
+server-id=3
+log-warnings=2
+
+[ENV]
+SERVER_MYPORT_1= @mysqld.1.port
+SERVER_MYSOCK_1= @mysqld.1.socket
+SERVER_MYPORT_2= @mysqld.2.port
+SERVER_MYSOCK_2= @mysqld.2.socket
+SERVER_MYPORT_3= @mysqld.3.port
+SERVER_MYSOCK_3= @mysqld.3.socket
diff --git a/mysql-test/suite/multi_source/relaylog_events.result b/mysql-test/suite/multi_source/relaylog_events.result
new file mode 100644
index 00000000000..1f3b57b045d
--- /dev/null
+++ b/mysql-test/suite/multi_source/relaylog_events.result
@@ -0,0 +1,27 @@
+change master 'master1' to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+start slave 'master1';
+set default_master_connection = 'master1';
+include/wait_for_slave_to_start.inc
+drop table if exists t1;
+create table t1 (i int) engine=MyISAM;
+mysqld-relay-bin-master1.000001
+mysqld-relay-bin-master1.000002
+mysqld-relay-bin-master1.index
+show relaylog events in 'mysqld-relay-bin-master1.000002';
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin-master1.000002 4 Format_desc 3 246 Server version
+mysqld-relay-bin-master1.000002 246 Rotate 1 0 master-bin.000001;pos=4
+mysqld-relay-bin-master1.000002 290 Format_desc 1 246 Server version
+mysqld-relay-bin-master1.000002 532 Binlog_checkpoint 1 286 master-bin.000001
+mysqld-relay-bin-master1.000002 572 Query 1 400 use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+mysqld-relay-bin-master1.000002 686 Query 1 500 use `test`; create table t1 (i int) engine=MyISAM
+show relaylog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin-master1.000001 4 Format_desc 3 246 Server version
+mysqld-relay-bin-master1.000001 246 Rotate 3 304 mysqld-relay-bin-master1.000002;pos=4
+drop table t1;
+include/reset_master_slave.inc
+include/reset_master_slave.inc
diff --git a/mysql-test/suite/multi_source/relaylog_events.test b/mysql-test/suite/multi_source/relaylog_events.test
new file mode 100644
index 00000000000..ba13a4dd7e9
--- /dev/null
+++ b/mysql-test/suite/multi_source/relaylog_events.test
@@ -0,0 +1,51 @@
+#
+# Check that SHOW RELAYLOG EVENTS can be used
+# for a named master connection
+#
+
+--source include/not_embedded.inc
+
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master 'master1' to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+
+start slave 'master1';
+set default_master_connection = 'master1';
+--source include/wait_for_slave_to_start.inc
+
+--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (i int) engine=MyISAM;
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'master1'
+
+--let $datadir = `SELECT @@datadir`
+--list_files $datadir mysqld-relay-bin-master1.*
+
+--replace_regex /Server ver:.*/Server version/
+show relaylog events in 'mysqld-relay-bin-master1.000002';
+--replace_regex /Server ver:.*/Server version/
+show relaylog events;
+
+--connection master1
+drop table t1;
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'master1'
+
+--source reset_master_slave.inc
+--disconnect slave
+
+--connection master1
+--source reset_master_slave.inc
+--disconnect master1
+
diff --git a/mysql-test/suite/multi_source/reset_master_slave.inc b/mysql-test/suite/multi_source/reset_master_slave.inc
new file mode 100644
index 00000000000..63ba3ee00af
--- /dev/null
+++ b/mysql-test/suite/multi_source/reset_master_slave.inc
@@ -0,0 +1,29 @@
+#
+# The include file runs RESET ALL for every replication connection
+# currently present in SHOW FULL SLAVE STATUS output on the server,
+# and also runs RESET MASTER on the same server.
+#
+
+--let $include_filename= reset_master_slave.inc
+--source include/begin_include_file.inc
+
+--disable_query_log
+--disable_result_log
+--disable_warnings
+--let $default_master = `SELECT @@default_master_connection`
+--let $con_name = query_get_value(show all slaves status, Connection_name, 1)
+while ($con_name != 'No such row')
+{
+ eval set default_master_connection = '$con_name';
+ stop slave;
+ --source include/wait_for_slave_to_stop.inc
+ reset slave all;
+ --let $con_name = query_get_value(show all slaves status, Connection_name, 1)
+}
+
+--error 0,ER_FLUSH_MASTER_BINLOG_CLOSED
+reset master;
+eval set default_master_connection = '$default_master';
+
+--source include/end_include_file.inc
+
diff --git a/mysql-test/suite/multi_source/reset_slave.result b/mysql-test/suite/multi_source/reset_slave.result
new file mode 100644
index 00000000000..498188db6cd
--- /dev/null
+++ b/mysql-test/suite/multi_source/reset_slave.result
@@ -0,0 +1,28 @@
+change master 'master1' to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+start slave 'master1';
+set default_master_connection = 'master1';
+include/wait_for_slave_to_start.inc
+drop table if exists t1;
+create table t1 (i int) engine=MyISAM;
+insert into t1 values (1),(2);
+stop slave 'master1';
+show slave 'master1' 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath
+ 127.0.0.1 root MYPORT_1 60 master-bin.000001 729 mysqld-relay-bin-master1.000002 1015 master-bin.000001 No No 0 0 729 1319 None 0 No NULL No 0 0 1
+mysqld-relay-bin-master1.000001
+mysqld-relay-bin-master1.000002
+mysqld-relay-bin-master1.index
+reset slave 'master1';
+show slave 'master1' 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath
+ 127.0.0.1 root MYPORT_1 60 4 1015 No No 0 0 0 1319 None 0 No NULL No 0 0 1
+reset slave 'master1' all;
+show slave 'master1' status;
+ERROR HY000: There is no master connection 'master1'
+drop table t1;
+include/reset_master_slave.inc
+drop table t1;
+include/reset_master_slave.inc
diff --git a/mysql-test/suite/multi_source/reset_slave.test b/mysql-test/suite/multi_source/reset_slave.test
new file mode 100644
index 00000000000..bcc0560fe5b
--- /dev/null
+++ b/mysql-test/suite/multi_source/reset_slave.test
@@ -0,0 +1,68 @@
+#
+# Check RESET SLAVE [name] [ALL] for multi-source replication
+#
+
+--source include/not_embedded.inc
+
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master 'master1' to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+
+start slave 'master1';
+
+set default_master_connection = 'master1';
+--source include/wait_for_slave_to_start.inc
+
+--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (i int) engine=MyISAM;
+insert into t1 values (1),(2);
+
+--save_master_pos
+
+--connection slave
+
+--sync_with_master 0,'master1'
+stop slave 'master1';
+
+--wait_for_slave_to_stop
+
+--let $datadir = `SELECT @@datadir`
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+show slave 'master1' status;
+--list_files $datadir mysqld*
+
+reset slave 'master1';
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+show slave 'master1' status;
+--list_files $datadir mysqld*
+
+reset slave 'master1' all;
+
+--error WARN_NO_MASTER_INFO
+show slave 'master1' status;
+--list_files $datadir mysqld*
+
+# Cleanup
+
+drop table t1;
+--source reset_master_slave.inc
+--disconnect slave
+
+--connection master1
+drop table t1;
+--source reset_master_slave.inc
+--disconnect master1
+
+
+
diff --git a/mysql-test/suite/multi_source/simple.result b/mysql-test/suite/multi_source/simple.result
new file mode 100644
index 00000000000..d38b3087263
--- /dev/null
+++ b/mysql-test/suite/multi_source/simple.result
@@ -0,0 +1,79 @@
+change master 'slave1' to master_port=MYPORT_1, master_host='127.0.0.1', master_user='root';
+change master 'slave2' to master_port=MYPORT_2, master_host='127.0.0.1', master_user='root';
+start slave 'slave1';
+set default_master_connection = 'slave1';
+include/wait_for_slave_to_start.inc
+set default_master_connection = 'slave2';
+start all slaves;
+Warnings:
+Note 1937 SLAVE 'slave2' started
+include/wait_for_slave_to_start.inc
+set default_master_connection = '';
+show all slaves status;
+Connection_name Slave_SQL_State 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
+slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin-slave1.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 1 0 1073741824 6 0 60.000
+slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 2 0 1073741824 6 0 60.000
+start all slaves;
+stop slave 'slave1';
+show slave 'slave1' status;
+Slave_IO_State
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MYPORT_1
+Connect_Retry 60
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 286
+Relay_Log_File mysqld-relay-bin-slave1.000002
+Relay_Log_Pos 572
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 286
+Relay_Log_Space 875
+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 NULL
+Master_SSL_Verify_Server_Cert No
+Last_IO_Errno 0
+Last_IO_Error
+Last_SQL_Errno 0
+Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
+Master_SSL_Crl
+Master_SSL_Crlpath
+reset slave 'slave1';
+show all slaves status;
+Connection_name Slave_SQL_State 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
+slave1 127.0.0.1 root MYPORT_1 60 4 572 No No 0 0 0 875 None 0 No NULL No 0 0 1 0 1073741824 6 0 60.000
+slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 2 0 1073741824 6 0 60.000
+reset slave 'slave1' all;
+show all slaves status;
+Connection_name Slave_SQL_State 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
+slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 2 0 1073741824 6 0 60.000
+stop all slaves;
+Warnings:
+Note 1938 SLAVE 'slave2' stopped
+show all slaves status;
+Connection_name Slave_SQL_State 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
+slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 No No 0 0 286 875 None 0 No NULL No 0 0 2 0 1073741824 6 0 60.000
+stop all slaves;
+include/reset_master_slave.inc
+include/reset_master_slave.inc
+include/reset_master_slave.inc
diff --git a/mysql-test/suite/multi_source/simple.test b/mysql-test/suite/multi_source/simple.test
new file mode 100644
index 00000000000..915cbd73941
--- /dev/null
+++ b/mysql-test/suite/multi_source/simple.test
@@ -0,0 +1,73 @@
+#
+# Simple multi-master test
+#
+
+--source include/not_embedded.inc
+
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+--connection slave
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master 'slave1' to master_port=$SERVER_MYPORT_1, master_host='127.0.0.1', master_user='root';
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+eval change master 'slave2' to master_port=$SERVER_MYPORT_2, master_host='127.0.0.1', master_user='root';
+start slave 'slave1';
+set default_master_connection = 'slave1';
+--source include/wait_for_slave_to_start.inc
+set default_master_connection = 'slave2';
+start all slaves;
+
+--source include/wait_for_slave_to_start.inc
+set default_master_connection = '';
+
+# Ensure that all data is in the relay log
+--connection master1
+--save_master_pos
+--connection slave
+--sync_with_master 0,'slave1'
+--connection master2
+--save_master_pos
+--connection slave
+--sync_with_master 0,'slave2'
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+show all slaves status;
+
+# Ensure that start all slaves doesn't do anything as all slaves are started
+start all slaves;
+
+stop slave 'slave1';
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+query_vertical show slave 'slave1' status;
+
+reset slave 'slave1';
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+show all slaves status;
+
+reset slave 'slave1' all;
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+show all slaves status;
+
+stop all slaves;
+--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
+show all slaves status;
+
+# Ensure that start all slaves doesn't do anything as all slaves are stopped
+stop all slaves;
+
+#
+# clean up
+#
+
+--source reset_master_slave.inc
+--disconnect slave
+--connection master1
+--source reset_master_slave.inc
+--disconnect master1
+--connection master2
+--source reset_master_slave.inc
+--disconnect master2
+
diff --git a/mysql-test/suite/multi_source/skip_counter.result b/mysql-test/suite/multi_source/skip_counter.result
new file mode 100644
index 00000000000..42ad961d6dd
--- /dev/null
+++ b/mysql-test/suite/multi_source/skip_counter.result
@@ -0,0 +1,113 @@
+drop database if exists db;
+create database db;
+create table db.t1 (i int) engine=MyISAM;
+drop database if exists db;
+create database db;
+create table db.t2 (i int) engine=MyISAM;
+change master 'master1' to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+start slave 'master1';
+set default_master_connection = 'master1';
+include/wait_for_slave_to_start.inc
+set default_master_connection = 'master2';
+change master 'master2' to
+master_port=MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+set global sql_slave_skip_counter = 2;
+select @@global.sql_slave_skip_counter;
+@@global.sql_slave_skip_counter
+2
+select @@session.sql_slave_skip_counter;
+@@session.sql_slave_skip_counter
+2
+set session sql_slave_skip_counter = 3;
+select @@global.sql_slave_skip_counter;
+@@global.sql_slave_skip_counter
+3
+select @@session.sql_slave_skip_counter;
+@@session.sql_slave_skip_counter
+3
+set global sql_slave_skip_counter= default;
+select @@global.sql_slave_skip_counter;
+@@global.sql_slave_skip_counter
+0
+select @@session.sql_slave_skip_counter;
+@@session.sql_slave_skip_counter
+0
+set global sql_slave_skip_counter= 3;
+set default_master_connection = 'master1';
+select @@session.sql_slave_skip_counter;
+@@session.sql_slave_skip_counter
+0
+set default_master_connection = 'qqq';
+select @@session.sql_slave_skip_counter;
+@@session.sql_slave_skip_counter
+0
+Warnings:
+Warning 1617 There is no master connection 'qqq'
+set default_master_connection = 'master2';
+select @@session.sql_slave_skip_counter;
+@@session.sql_slave_skip_counter
+3
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size
+1073741824
+set global max_relay_log_size = 1*1024*1024;
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size
+1048576
+select @@session.max_relay_log_size;
+@@session.max_relay_log_size
+1048576
+set session max_relay_log_size = 3*1024*1024;
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size
+3145728
+select @@session.max_relay_log_size;
+@@session.max_relay_log_size
+3145728
+set global max_relay_log_size= default;
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size
+1073741824
+select @@session.max_relay_log_size;
+@@session.max_relay_log_size
+1073741824
+set global max_relay_log_size= 3*1024*1024;
+set default_master_connection = 'master1';
+select @@session.max_relay_log_size;
+@@session.max_relay_log_size
+1073741824
+set default_master_connection = 'qqq';
+select @@session.max_relay_log_size;
+@@session.max_relay_log_size
+0
+Warnings:
+Warning 1617 There is no master connection 'qqq'
+set default_master_connection = 'master2';
+select @@session.max_relay_log_size;
+@@session.max_relay_log_size
+3145728
+set global max_binlog_size= 4*1024*1024;
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size
+3145728
+start slave 'master2';
+include/wait_for_slave_to_start.inc
+set default_master_connection = '';
+show tables in db;
+Tables_in_db
+t1
+t2
+drop database db;
+set global sql_slave_skip_counter = 0;
+set global max_relay_log_size = 1073741824;
+set global max_binlog_size = 1073741824;
+include/reset_master_slave.inc
+drop database db;
+include/reset_master_slave.inc
+drop database db;
+include/reset_master_slave.inc
diff --git a/mysql-test/suite/multi_source/skip_counter.test b/mysql-test/suite/multi_source/skip_counter.test
new file mode 100644
index 00000000000..d158f382a97
--- /dev/null
+++ b/mysql-test/suite/multi_source/skip_counter.test
@@ -0,0 +1,143 @@
+#
+# Test of sql_slave_skip_counter and rpl_max_size
+#
+
+# Create a schema and a table i
+# on the 1st master
+
+--source include/not_embedded.inc
+
+--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+
+--disable_warnings
+drop database if exists db;
+--enable_warnings
+create database db;
+create table db.t1 (i int) engine=MyISAM;
+--save_master_pos
+
+# Create the same schema and another table
+# on the 2nd master
+
+--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+
+--disable_warnings
+drop database if exists db;
+--enable_warnings
+create database db;
+create table db.t2 (i int) engine=MyISAM;
+
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+# Start replication from the first master
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master 'master1' to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+
+start slave 'master1';
+set default_master_connection = 'master1';
+--source include/wait_for_slave_to_start.inc
+--sync_with_master 0,'master1'
+
+# Start replication from the second master
+
+set default_master_connection = 'master2';
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+eval change master 'master2' to
+master_port=$SERVER_MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+
+# the schema creation will be replicated from the 1st master,
+# so we want to skip it in the second replication connection.
+
+# Normally it should have been 2 events, but
+# currently Binlog_checkpoint also counts. Maybe we'll need
+# to modify the test later
+
+--let $skip_counter_saved = `select @@global.sql_slave_skip_counter`
+--let $max_relay_log_size_saved= `select @@global.max_relay_log_size`
+--let $max_binlog_size_saved= `select @@global.max_binlog_size`
+set global sql_slave_skip_counter = 2;
+select @@global.sql_slave_skip_counter;
+select @@session.sql_slave_skip_counter;
+set session sql_slave_skip_counter = 3;
+select @@global.sql_slave_skip_counter;
+select @@session.sql_slave_skip_counter;
+set global sql_slave_skip_counter= default;
+select @@global.sql_slave_skip_counter;
+select @@session.sql_slave_skip_counter;
+set global sql_slave_skip_counter= 3;
+set default_master_connection = 'master1';
+select @@session.sql_slave_skip_counter;
+set default_master_connection = 'qqq';
+select @@session.sql_slave_skip_counter;
+set default_master_connection = 'master2';
+select @@session.sql_slave_skip_counter;
+
+# Test of setting max_relay_log_size
+select @@global.max_relay_log_size;
+set global max_relay_log_size = 1*1024*1024;
+select @@global.max_relay_log_size;
+select @@session.max_relay_log_size;
+set session max_relay_log_size = 3*1024*1024;
+select @@global.max_relay_log_size;
+select @@session.max_relay_log_size;
+set global max_relay_log_size= default;
+select @@global.max_relay_log_size;
+select @@session.max_relay_log_size;
+set global max_relay_log_size= 3*1024*1024;
+set default_master_connection = 'master1';
+select @@session.max_relay_log_size;
+set default_master_connection = 'qqq';
+select @@session.max_relay_log_size;
+set default_master_connection = 'master2';
+select @@session.max_relay_log_size;
+set global max_binlog_size= 4*1024*1024;
+select @@global.max_relay_log_size;
+
+
+start slave 'master2';
+--source include/wait_for_slave_to_start.inc
+set default_master_connection = '';
+
+--connection master2
+--save_master_pos
+
+--connection slave
+
+--sync_with_master 0,'master2'
+
+# If the skip_counter worked as expected, we should
+# get here (replication shouldn't have broken)
+# and should see both tables here
+# (drop database which came from master2 shoudn't have been executed
+# so t1 should still exist)
+
+show tables in db;
+
+# Cleanup
+
+drop database db;
+
+--eval set global sql_slave_skip_counter = $skip_counter_saved
+--eval set global max_relay_log_size = $max_relay_log_size_saved
+--eval set global max_binlog_size = $max_binlog_size_saved
+
+--source reset_master_slave.inc
+--disconnect slave
+
+--connection master1
+drop database db;
+--source reset_master_slave.inc
+--disconnect master1
+
+--connection master2
+drop database db;
+--source reset_master_slave.inc
+--disconnect master2
+
diff --git a/mysql-test/suite/multi_source/status_vars.result b/mysql-test/suite/multi_source/status_vars.result
new file mode 100644
index 00000000000..12917f94140
--- /dev/null
+++ b/mysql-test/suite/multi_source/status_vars.result
@@ -0,0 +1,97 @@
+call mtr.add_suppression("Connection 'master1' already exists");
+change master 'master1' to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root',
+master_heartbeat_period = 25;
+start slave 'master1';
+set default_master_connection = 'master1';
+include/wait_for_slave_to_start.inc
+set default_master_connection = '';
+change master to
+master_port=MYPORT_2,
+master_host='127.0.0.1',
+master_user='root',
+master_heartbeat_period=35;
+start slave;
+include/wait_for_slave_to_start.inc
+#
+# Check how status works for the default connection, anonymous or named
+#
+# Slave_running and Slave_heartbeat_period should be local for a connection
+#
+set default_master_connection = '';
+show status like 'Slave_running';
+Variable_name Value
+Slave_running ON
+show status like 'Slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 35.000
+stop slave io_thread;
+include/wait_for_slave_io_to_stop.inc
+show status like 'Slave_running';
+Variable_name Value
+Slave_running OFF
+set default_master_connection = 'master1';
+show status like 'Slave_running';
+Variable_name Value
+Slave_running ON
+show status like 'Slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 25.000
+#
+# Slave_received_heartbeats should also be local
+#
+set default_master_connection = '';
+stop slave sql_thread;
+include/wait_for_slave_sql_to_stop.inc
+change master to master_heartbeat_period=1;
+show status like 'Slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 0
+start slave;
+include/wait_for_slave_to_start.inc
+show status like 'Slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 2
+stop slave;
+include/wait_for_slave_to_stop.inc
+set default_master_connection = 'master1';
+show status like 'Slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 0
+stop slave;
+include/wait_for_slave_to_stop.inc
+change master to master_heartbeat_period=2;
+start slave;
+include/wait_for_slave_to_start.inc
+show status like 'Slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 1
+#
+# Slave_open_temp_tables should be global
+#
+set default_master_connection = '';
+start slave;
+include/wait_for_slave_to_start.inc
+set binlog_format = statement;
+create temporary table tmp1 (i int) engine=MyISAM;
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 1
+set default_master_connection = 'master1';
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 1
+set binlog_format = statement;
+create temporary table tmp1 (i int) engine=MyISAM;
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 2
+set default_master_connection = '';
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 2
+include/reset_master_slave.inc
+include/reset_master_slave.inc
+include/reset_master_slave.inc
diff --git a/mysql-test/suite/multi_source/status_vars.test b/mysql-test/suite/multi_source/status_vars.test
new file mode 100644
index 00000000000..eec89ee4e81
--- /dev/null
+++ b/mysql-test/suite/multi_source/status_vars.test
@@ -0,0 +1,138 @@
+#
+# Status variables related to a replication connection
+#
+
+--source include/not_embedded.inc
+
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+call mtr.add_suppression("Connection 'master1' already exists");
+
+# Start replication from the first master
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master 'master1' to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root',
+master_heartbeat_period = 25;
+
+start slave 'master1';
+set default_master_connection = 'master1';
+--source include/wait_for_slave_to_start.inc
+
+
+# Set up a proper 'default' connection to master2
+
+set default_master_connection = '';
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+eval change master to
+master_port=$SERVER_MYPORT_2,
+master_host='127.0.0.1',
+master_user='root',
+master_heartbeat_period=35;
+
+start slave;
+--source include/wait_for_slave_to_start.inc
+
+--echo #
+--echo # Check how status works for the default connection, anonymous or named
+--echo #
+
+--echo # Slave_running and Slave_heartbeat_period should be local for a connection
+--echo #
+
+set default_master_connection = '';
+show status like 'Slave_running';
+show status like 'Slave_heartbeat_period';
+stop slave io_thread;
+--source include/wait_for_slave_io_to_stop.inc
+show status like 'Slave_running';
+
+set default_master_connection = 'master1';
+show status like 'Slave_running';
+show status like 'Slave_heartbeat_period';
+
+--echo #
+--echo # Slave_received_heartbeats should also be local
+--echo #
+
+set default_master_connection = '';
+stop slave sql_thread;
+--source include/wait_for_slave_sql_to_stop.inc
+change master to master_heartbeat_period=1;
+show status like 'Slave_received_heartbeats';
+start slave;
+--source include/wait_for_slave_to_start.inc
+
+--let $status_var = Slave_received_heartbeats
+--let $status_var_value = 2
+# The units are tens of seconds
+--let $status_timeout = 30
+--source include/wait_for_status_var.inc
+show status like 'Slave_received_heartbeats';
+stop slave;
+--source include/wait_for_slave_to_stop.inc
+
+set default_master_connection = 'master1';
+show status like 'Slave_received_heartbeats';
+
+stop slave;
+--source include/wait_for_slave_to_stop.inc
+change master to master_heartbeat_period=2;
+start slave;
+--source include/wait_for_slave_to_start.inc
+
+--let $status_var = Slave_received_heartbeats
+--let $status_var_value = 1
+--let $status_timeout = 30
+--source include/wait_for_status_var.inc
+show status like 'Slave_received_heartbeats';
+
+
+--echo #
+--echo # Slave_open_temp_tables should be global
+--echo #
+
+set default_master_connection = '';
+start slave;
+--source include/wait_for_slave_to_start.inc
+
+--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+set binlog_format = statement;
+create temporary table tmp1 (i int) engine=MyISAM;
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'master1'
+show status like 'Slave_open_temp_tables';
+
+set default_master_connection = 'master1';
+show status like 'Slave_open_temp_tables';
+
+--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+set binlog_format = statement;
+create temporary table tmp1 (i int) engine=MyISAM;
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,''
+show status like 'Slave_open_temp_tables';
+
+set default_master_connection = '';
+show status like 'Slave_open_temp_tables';
+
+
+# Cleanup
+
+--source reset_master_slave.inc
+--disconnect slave
+--connection master1
+--source reset_master_slave.inc
+--disconnect master1
+--connection master2
+--source reset_master_slave.inc
+--disconnect master2
+
+
diff --git a/mysql-test/suite/multi_source/syntax.result b/mysql-test/suite/multi_source/syntax.result
new file mode 100644
index 00000000000..3d91bfea753
--- /dev/null
+++ b/mysql-test/suite/multi_source/syntax.result
@@ -0,0 +1,87 @@
+include/master-slave.inc
+[connection master]
+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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath
+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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath
+show all slaves status;
+Connection_name Slave_SQL_State 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
+#
+# Check error handling
+#
+show slave 'qqq' status;
+ERROR HY000: There is no master connection 'qqq'
+show slave 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' status;
+ERROR HY000: There is no master connection 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'
+show slave 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' status;
+ERROR HY000: Incorrect arguments to MASTER_CONNECTION_NAME
+change master 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' to master_host='dummy';
+ERROR HY000: Incorrect arguments to MASTER_CONNECTION_NAME
+start slave 'qqq';
+ERROR HY000: There is no master connection 'qqq'
+stop slave 'qqq';
+ERROR HY000: There is no master connection 'qqq'
+slave 'qqq' start;
+ERROR HY000: There is no master connection 'qqq'
+slave 'qqq' stop;
+ERROR HY000: There is no master connection 'qqq'
+flush slave 'qqq';
+ERROR HY000: There is no master connection 'qqq'
+reset slave 'qqq';
+ERROR HY000: There is no master connection 'qqq'
+select master_pos_wait('master-bin.999999',0,2,'qqq');
+master_pos_wait('master-bin.999999',0,2,'qqq')
+NULL
+Warnings:
+Warning 1617 There is no master connection 'qqq'
+select master_pos_wait('master-bin.999999',0,2,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc');
+master_pos_wait('master-bin.999999',0,2,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc')
+NULL
+Warnings:
+Warning 1210 Incorrect arguments to MASTER_CONNECTION_NAME
+#
+# checking usage of default_master_connection;
+#
+select @@default_master_connection;
+@@default_master_connection
+
+select @@global.default_master_connection;
+ERROR HY000: Variable 'default_master_connection' is a SESSION variable
+set @@global.default_master_connection='qqq';
+ERROR HY000: Variable 'default_master_connection' is a SESSION variable and can't be used with SET GLOBAL
+set @@default_master_connection='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
+ERROR 42000: Variable 'default_master_connection' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'
+select @@default_master_connection;
+@@default_master_connection
+
+set @@default_master_connection='qqq';
+select @@default_master_connection;
+@@default_master_connection
+qqq
+show variables like "default_master_connection";
+Variable_name Value
+default_master_connection qqq
+show slave status;
+ERROR HY000: There is no master connection 'qqq'
+select master_pos_wait('master-bin.999999',0,2);
+master_pos_wait('master-bin.999999',0,2)
+NULL
+Warnings:
+Warning 1617 There is no master connection 'qqq'
+set @@default_master_connection='';
+select master_pos_wait('master-bin.999999',0,2);
+master_pos_wait('master-bin.999999',0,2)
+-1
+set @@default_master_connection='';
+#
+# checking variables
+#
+show status like "Slave_running";
+Variable_name Value
+Slave_running ON
+set @@default_master_connection='qqq';
+show status like "Slave_running";
+Variable_name Value
+Slave_running
+set @@default_master_connection='';
+include/rpl_end.inc
diff --git a/mysql-test/suite/multi_source/syntax.test b/mysql-test/suite/multi_source/syntax.test
new file mode 100644
index 00000000000..ae493200bf1
--- /dev/null
+++ b/mysql-test/suite/multi_source/syntax.test
@@ -0,0 +1,79 @@
+# Test multi master syntax
+
+--source include/not_embedded.inc
+--source include/master-slave.inc
+
+# Check syntax of multi source replication
+
+show slave status;
+show slave '' status;
+show all slaves status;
+
+--echo #
+--echo # Check error handling
+--echo #
+
+--error WARN_NO_MASTER_INFO
+show slave 'qqq' status;
+--error WARN_NO_MASTER_INFO
+show slave 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' status;
+--error ER_WRONG_ARGUMENTS
+show slave 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' status;
+--error ER_WRONG_ARGUMENTS
+change master 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' to master_host='dummy';
+
+--error WARN_NO_MASTER_INFO
+start slave 'qqq';
+--error WARN_NO_MASTER_INFO
+stop slave 'qqq';
+--error WARN_NO_MASTER_INFO
+slave 'qqq' start;
+--error WARN_NO_MASTER_INFO
+slave 'qqq' stop;
+--error WARN_NO_MASTER_INFO
+flush slave 'qqq';
+--error WARN_NO_MASTER_INFO
+reset slave 'qqq';
+
+select master_pos_wait('master-bin.999999',0,2,'qqq');
+select master_pos_wait('master-bin.999999',0,2,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc');
+
+save_master_pos;
+connection slave;
+sync_with_master 0,'';
+sync_with_master 0 ,'';
+sync_with_master 0, '';
+
+--echo #
+--echo # checking usage of default_master_connection;
+--echo #
+select @@default_master_connection;
+
+--error 1238
+select @@global.default_master_connection;
+--error 1228
+set @@global.default_master_connection='qqq';
+--error 1231
+set @@default_master_connection='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
+select @@default_master_connection;
+set @@default_master_connection='qqq';
+select @@default_master_connection;
+show variables like "default_master_connection";
+
+--error WARN_NO_MASTER_INFO
+show slave status;
+select master_pos_wait('master-bin.999999',0,2);
+set @@default_master_connection='';
+select master_pos_wait('master-bin.999999',0,2);
+
+set @@default_master_connection='';
+
+--echo #
+--echo # checking variables
+--echo #
+show status like "Slave_running";
+set @@default_master_connection='qqq';
+show status like "Slave_running";
+set @@default_master_connection='';
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/multi_source/wait_for_sql_thread_read_all.inc b/mysql-test/suite/multi_source/wait_for_sql_thread_read_all.inc
new file mode 100644
index 00000000000..ec5ecd0cb17
--- /dev/null
+++ b/mysql-test/suite/multi_source/wait_for_sql_thread_read_all.inc
@@ -0,0 +1,6 @@
+--let $show_statement = show all slaves status
+--let $field = Slave_SQL_State
+--let $condition = = 'Slave has read all relay log; waiting for the slave I/O thread to update it'
+--let $wait_for_all = 1
+--source include/wait_show_condition.inc
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result
index 3c19a37c95d..505dd587d0b 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result
@@ -38,7 +38,11 @@ c1 c2 c3 c4
2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00
2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
INSERT IGNORE INTO t1(c1,c2) VALUES('20070525','20070527') /* doesnt throw error */;
+Warnings:
+Warning 1062 Duplicate entry '2007-05-25 00:00:00' for key 'PRIMARY'
INSERT IGNORE INTO t1(c1,c2) VALUES(19840905,830907) /* doesnt throw error */;
+Warnings:
+Warning 1062 Duplicate entry '1983-09-07 00:00:00' for key 'c2'
SELECT * FROM t1 WHERE c1='20070527' /* Returns no rows */;
c1 c2 c3 c4
INSERT INTO t1(c1) VALUES('20070525') ON DUPLICATE KEY UPDATE c1='20070527';
diff --git a/mysql-test/suite/perfschema/disabled.def b/mysql-test/suite/perfschema/disabled.def
index 065e13d374a..a72014a652b 100644
--- a/mysql-test/suite/perfschema/disabled.def
+++ b/mysql-test/suite/perfschema/disabled.def
@@ -9,7 +9,6 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-
ddl_host_cache:
dml_host_cache:
hostcache_ipv4_addrinfo_again_allow:
diff --git a/mysql-test/suite/perfschema/r/digest_table_full.result b/mysql-test/suite/perfschema/r/digest_table_full.result
index f7d9d7116c0..dcc62e0d5c4 100644
--- a/mysql-test/suite/perfschema/r/digest_table_full.result
+++ b/mysql-test/suite/perfschema/r/digest_table_full.result
@@ -76,7 +76,7 @@ SELECT DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS,
SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS
NULL NULL 29 21 1 2
-05a0fd27e76f6e38420b5dcae970c1d1 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
+b94bc8f50c92e01784d3148b3d2086c8 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
SHOW VARIABLES LIKE "performance_schema_digests_size";
Variable_name Value
performance_schema_digests_size 2
diff --git a/mysql-test/suite/perfschema/r/func_file_io.result b/mysql-test/suite/perfschema/r/func_file_io.result
index b66ab0b4eaa..2b39c4c1ab9 100644
--- a/mysql-test/suite/perfschema/r/func_file_io.result
+++ b/mysql-test/suite/perfschema/r/func_file_io.result
@@ -17,6 +17,9 @@ SET @before_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD'));
+SELECT (@before_count >= 0) as have_before_count;
+have_before_count
+1
SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation;
has_instrumentation
Success
@@ -29,6 +32,9 @@ SET @after_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1));
+SELECT (@after_count >= 0) as have_after_count;
+have_after_count
+1
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed;
test_ff1_timed
Success
@@ -37,6 +43,9 @@ SET @before_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2));
+SELECT (@before_count >= 0) as have_before_count;
+have_before_count
+1
SELECT * FROM t1 WHERE id < 6;
id b
1 initial value
@@ -48,6 +57,9 @@ SET @after_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3));
+SELECT (@after_count >= 0) as have_after_count;
+have_after_count
+1
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed;
test_ff2_timed
Success
diff --git a/mysql-test/suite/perfschema/r/nesting.result b/mysql-test/suite/perfschema/r/nesting.result
index 0414b5d0fc1..a7b26b34776 100644
--- a/mysql-test/suite/perfschema/r/nesting.result
+++ b/mysql-test/suite/perfschema/r/nesting.result
@@ -106,7 +106,7 @@ and (end_event_id <= @marker_end)
) all_events
order by relative_event_id asc;
relative_event_id relative_end_event_id event_name comment nesting_event_type relative_nesting_event_id
-0 17 statement/sql/select select "MARKER_BEGIN" as marker NULL NULL
+0 19 statement/sql/select select "MARKER_BEGIN" as marker NULL NULL
1 5 stage/sql/init (stage) STATEMENT 0
2 2 wait/io/socket/sql/client_connection recv STAGE 1
3 3 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 1
@@ -116,116 +116,130 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
7 7 stage/sql/Opening tables (stage) STATEMENT 0
8 8 stage/sql/init (stage) STATEMENT 0
9 9 stage/sql/optimizing (stage) STATEMENT 0
-10 10 stage/sql/executing (stage) STATEMENT 0
-11 11 stage/sql/end (stage) STATEMENT 0
-12 12 stage/sql/query end (stage) STATEMENT 0
-13 13 stage/sql/closing tables (stage) STATEMENT 0
-14 15 stage/sql/freeing items (stage) STATEMENT 0
-15 15 wait/io/socket/sql/client_connection send STAGE 14
-16 17 stage/sql/cleaning up (stage) STATEMENT 0
-17 17 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 16
-18 18 idle idle NULL NULL
-19 36 statement/sql/select select "This is simple statement one" as payload NULL NULL
-20 24 stage/sql/init (stage) STATEMENT 19
-21 21 wait/io/socket/sql/client_connection recv STAGE 20
-22 22 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 20
-23 23 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 20
-24 24 wait/io/file/sql/query_log write STAGE 20
-25 25 stage/sql/checking permissions (stage) STATEMENT 19
-26 26 stage/sql/Opening tables (stage) STATEMENT 19
-27 27 stage/sql/init (stage) STATEMENT 19
-28 28 stage/sql/optimizing (stage) STATEMENT 19
-29 29 stage/sql/executing (stage) STATEMENT 19
-30 30 stage/sql/end (stage) STATEMENT 19
-31 31 stage/sql/query end (stage) STATEMENT 19
-32 32 stage/sql/closing tables (stage) STATEMENT 19
-33 34 stage/sql/freeing items (stage) STATEMENT 19
-34 34 wait/io/socket/sql/client_connection send STAGE 33
-35 36 stage/sql/cleaning up (stage) STATEMENT 19
-36 36 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 35
-37 37 idle idle NULL NULL
-38 55 statement/sql/select select "This is simple statement two" as payload NULL NULL
-39 43 stage/sql/init (stage) STATEMENT 38
-40 40 wait/io/socket/sql/client_connection recv STAGE 39
-41 41 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 39
-42 42 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 39
-43 43 wait/io/file/sql/query_log write STAGE 39
-44 44 stage/sql/checking permissions (stage) STATEMENT 38
-45 45 stage/sql/Opening tables (stage) STATEMENT 38
-46 46 stage/sql/init (stage) STATEMENT 38
-47 47 stage/sql/optimizing (stage) STATEMENT 38
-48 48 stage/sql/executing (stage) STATEMENT 38
-49 49 stage/sql/end (stage) STATEMENT 38
-50 50 stage/sql/query end (stage) STATEMENT 38
-51 51 stage/sql/closing tables (stage) STATEMENT 38
-52 53 stage/sql/freeing items (stage) STATEMENT 38
-53 53 wait/io/socket/sql/client_connection send STAGE 52
-54 55 stage/sql/cleaning up (stage) STATEMENT 38
-55 55 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 54
-56 56 idle idle NULL NULL
-57 72 statement/sql/select select "This is the first part of a multi query" as payload;
+10 12 stage/sql/executing (stage) STATEMENT 0
+11 11 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 10
+12 12 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 10
+13 13 stage/sql/end (stage) STATEMENT 0
+14 14 stage/sql/query end (stage) STATEMENT 0
+15 15 stage/sql/closing tables (stage) STATEMENT 0
+16 16 stage/sql/freeing items (stage) STATEMENT 0
+17 17 wait/io/socket/sql/client_connection send STATEMENT 0
+18 19 stage/sql/cleaning up (stage) STATEMENT 0
+19 19 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 18
+20 20 idle idle NULL NULL
+21 40 statement/sql/select select "This is simple statement one" as payload NULL NULL
+22 26 stage/sql/init (stage) STATEMENT 21
+23 23 wait/io/socket/sql/client_connection recv STAGE 22
+24 24 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 22
+25 25 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 22
+26 26 wait/io/file/sql/query_log write STAGE 22
+27 27 stage/sql/checking permissions (stage) STATEMENT 21
+28 28 stage/sql/Opening tables (stage) STATEMENT 21
+29 29 stage/sql/init (stage) STATEMENT 21
+30 30 stage/sql/optimizing (stage) STATEMENT 21
+31 33 stage/sql/executing (stage) STATEMENT 21
+32 32 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 31
+33 33 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 31
+34 34 stage/sql/end (stage) STATEMENT 21
+35 35 stage/sql/query end (stage) STATEMENT 21
+36 36 stage/sql/closing tables (stage) STATEMENT 21
+37 37 stage/sql/freeing items (stage) STATEMENT 21
+38 38 wait/io/socket/sql/client_connection send STATEMENT 21
+39 40 stage/sql/cleaning up (stage) STATEMENT 21
+40 40 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 39
+41 41 idle idle NULL NULL
+42 61 statement/sql/select select "This is simple statement two" as payload NULL NULL
+43 47 stage/sql/init (stage) STATEMENT 42
+44 44 wait/io/socket/sql/client_connection recv STAGE 43
+45 45 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 43
+46 46 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 43
+47 47 wait/io/file/sql/query_log write STAGE 43
+48 48 stage/sql/checking permissions (stage) STATEMENT 42
+49 49 stage/sql/Opening tables (stage) STATEMENT 42
+50 50 stage/sql/init (stage) STATEMENT 42
+51 51 stage/sql/optimizing (stage) STATEMENT 42
+52 54 stage/sql/executing (stage) STATEMENT 42
+53 53 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 52
+54 54 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 52
+55 55 stage/sql/end (stage) STATEMENT 42
+56 56 stage/sql/query end (stage) STATEMENT 42
+57 57 stage/sql/closing tables (stage) STATEMENT 42
+58 58 stage/sql/freeing items (stage) STATEMENT 42
+59 59 wait/io/socket/sql/client_connection send STATEMENT 42
+60 61 stage/sql/cleaning up (stage) STATEMENT 42
+61 61 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 60
+62 62 idle idle NULL NULL
+63 80 statement/sql/select select "This is the first part of a multi query" as payload;
select "And this is the second part of a multi query" as payload;
select "With a third part to make things complete" as payload NULL NULL
-58 62 stage/sql/init (stage) STATEMENT 57
-59 59 wait/io/socket/sql/client_connection recv STAGE 58
-60 60 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 58
-61 61 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 58
-62 62 wait/io/file/sql/query_log write STAGE 58
-63 63 stage/sql/checking permissions (stage) STATEMENT 57
-64 64 stage/sql/Opening tables (stage) STATEMENT 57
-65 65 stage/sql/init (stage) STATEMENT 57
-66 66 stage/sql/optimizing (stage) STATEMENT 57
-67 67 stage/sql/executing (stage) STATEMENT 57
-68 68 stage/sql/end (stage) STATEMENT 57
-69 69 stage/sql/query end (stage) STATEMENT 57
-70 70 stage/sql/closing tables (stage) STATEMENT 57
-71 72 stage/sql/freeing items (stage) STATEMENT 57
-72 72 wait/io/socket/sql/client_connection send STAGE 71
-73 85 statement/sql/select select "And this is the second part of a multi query" as payload;
+64 68 stage/sql/init (stage) STATEMENT 63
+65 65 wait/io/socket/sql/client_connection recv STAGE 64
+66 66 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 64
+67 67 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 64
+68 68 wait/io/file/sql/query_log write STAGE 64
+69 69 stage/sql/checking permissions (stage) STATEMENT 63
+70 70 stage/sql/Opening tables (stage) STATEMENT 63
+71 71 stage/sql/init (stage) STATEMENT 63
+72 72 stage/sql/optimizing (stage) STATEMENT 63
+73 75 stage/sql/executing (stage) STATEMENT 63
+74 74 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 73
+75 75 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 73
+76 76 stage/sql/end (stage) STATEMENT 63
+77 77 stage/sql/query end (stage) STATEMENT 63
+78 78 stage/sql/closing tables (stage) STATEMENT 63
+79 80 stage/sql/freeing items (stage) STATEMENT 63
+80 80 wait/io/socket/sql/client_connection send STAGE 79
+81 95 statement/sql/select select "And this is the second part of a multi query" as payload;
select "With a third part to make things complete" as payload NULL NULL
-74 75 stage/sql/init (stage) STATEMENT 73
-75 75 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 74
-76 76 stage/sql/checking permissions (stage) STATEMENT 73
-77 77 stage/sql/Opening tables (stage) STATEMENT 73
-78 78 stage/sql/init (stage) STATEMENT 73
-79 79 stage/sql/optimizing (stage) STATEMENT 73
-80 80 stage/sql/executing (stage) STATEMENT 73
-81 81 stage/sql/end (stage) STATEMENT 73
-82 82 stage/sql/query end (stage) STATEMENT 73
-83 83 stage/sql/closing tables (stage) STATEMENT 73
-84 85 stage/sql/freeing items (stage) STATEMENT 73
-85 85 wait/io/socket/sql/client_connection send STAGE 84
-86 100 statement/sql/select select "With a third part to make things complete" as payload NULL NULL
-87 88 stage/sql/init (stage) STATEMENT 86
-88 88 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 87
-89 89 stage/sql/checking permissions (stage) STATEMENT 86
-90 90 stage/sql/Opening tables (stage) STATEMENT 86
-91 91 stage/sql/init (stage) STATEMENT 86
-92 92 stage/sql/optimizing (stage) STATEMENT 86
-93 93 stage/sql/executing (stage) STATEMENT 86
-94 94 stage/sql/end (stage) STATEMENT 86
-95 95 stage/sql/query end (stage) STATEMENT 86
-96 96 stage/sql/closing tables (stage) STATEMENT 86
-97 98 stage/sql/freeing items (stage) STATEMENT 86
-98 98 wait/io/socket/sql/client_connection send STAGE 97
-99 100 stage/sql/cleaning up (stage) STATEMENT 86
-100 100 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 99
-101 101 idle idle NULL NULL
-102 119 statement/sql/select select "MARKER_END" as marker NULL NULL
-103 107 stage/sql/init (stage) STATEMENT 102
-104 104 wait/io/socket/sql/client_connection recv STAGE 103
+82 83 stage/sql/init (stage) STATEMENT 81
+83 83 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 82
+84 84 stage/sql/checking permissions (stage) STATEMENT 81
+85 85 stage/sql/Opening tables (stage) STATEMENT 81
+86 86 stage/sql/init (stage) STATEMENT 81
+87 87 stage/sql/optimizing (stage) STATEMENT 81
+88 90 stage/sql/executing (stage) STATEMENT 81
+89 89 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 88
+90 90 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 88
+91 91 stage/sql/end (stage) STATEMENT 81
+92 92 stage/sql/query end (stage) STATEMENT 81
+93 93 stage/sql/closing tables (stage) STATEMENT 81
+94 95 stage/sql/freeing items (stage) STATEMENT 81
+95 95 wait/io/socket/sql/client_connection send STAGE 94
+96 112 statement/sql/select select "With a third part to make things complete" as payload NULL NULL
+97 98 stage/sql/init (stage) STATEMENT 96
+98 98 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 97
+99 99 stage/sql/checking permissions (stage) STATEMENT 96
+100 100 stage/sql/Opening tables (stage) STATEMENT 96
+101 101 stage/sql/init (stage) STATEMENT 96
+102 102 stage/sql/optimizing (stage) STATEMENT 96
+103 105 stage/sql/executing (stage) STATEMENT 96
+104 104 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 103
105 105 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 103
-106 106 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 103
-107 107 wait/io/file/sql/query_log write STAGE 103
-108 108 stage/sql/checking permissions (stage) STATEMENT 102
-109 109 stage/sql/Opening tables (stage) STATEMENT 102
-110 110 stage/sql/init (stage) STATEMENT 102
-111 111 stage/sql/optimizing (stage) STATEMENT 102
-112 112 stage/sql/executing (stage) STATEMENT 102
-113 113 stage/sql/end (stage) STATEMENT 102
-114 114 stage/sql/query end (stage) STATEMENT 102
-115 115 stage/sql/closing tables (stage) STATEMENT 102
-116 117 stage/sql/freeing items (stage) STATEMENT 102
-117 117 wait/io/socket/sql/client_connection send STAGE 116
-118 119 stage/sql/cleaning up (stage) STATEMENT 102
-119 119 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 118
+106 106 stage/sql/end (stage) STATEMENT 96
+107 107 stage/sql/query end (stage) STATEMENT 96
+108 108 stage/sql/closing tables (stage) STATEMENT 96
+109 109 stage/sql/freeing items (stage) STATEMENT 96
+110 110 wait/io/socket/sql/client_connection send STATEMENT 96
+111 112 stage/sql/cleaning up (stage) STATEMENT 96
+112 112 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 111
+113 113 idle idle NULL NULL
+114 133 statement/sql/select select "MARKER_END" as marker NULL NULL
+115 119 stage/sql/init (stage) STATEMENT 114
+116 116 wait/io/socket/sql/client_connection recv STAGE 115
+117 117 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 115
+118 118 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 115
+119 119 wait/io/file/sql/query_log write STAGE 115
+120 120 stage/sql/checking permissions (stage) STATEMENT 114
+121 121 stage/sql/Opening tables (stage) STATEMENT 114
+122 122 stage/sql/init (stage) STATEMENT 114
+123 123 stage/sql/optimizing (stage) STATEMENT 114
+124 126 stage/sql/executing (stage) STATEMENT 114
+125 125 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 124
+126 126 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 124
+127 127 stage/sql/end (stage) STATEMENT 114
+128 128 stage/sql/query end (stage) STATEMENT 114
+129 129 stage/sql/closing tables (stage) STATEMENT 114
+130 130 stage/sql/freeing items (stage) STATEMENT 114
+131 131 wait/io/socket/sql/client_connection send STATEMENT 114
+132 133 stage/sql/cleaning up (stage) STATEMENT 114
+133 133 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 132
diff --git a/mysql-test/suite/perfschema/r/ortho_iter.result b/mysql-test/suite/perfschema/r/ortho_iter.result
index d4ba3477c7c..6a4fde4287a 100644
--- a/mysql-test/suite/perfschema/r/ortho_iter.result
+++ b/mysql-test/suite/perfschema/r/ortho_iter.result
@@ -115,7 +115,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result
index 9dda2e321de..92c5d36ed9f 100644
--- a/mysql-test/suite/perfschema/r/privilege_table_io.result
+++ b/mysql-test/suite/perfschema/r/privilege_table_io.result
@@ -40,7 +40,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result
index 9496dcc5aee..8786cd055ca 100644
--- a/mysql-test/suite/perfschema/r/query_cache.result
+++ b/mysql-test/suite/perfschema/r/query_cache.result
@@ -36,9 +36,9 @@ Qcache_hits 1
select spins from performance_schema.events_waits_current order by event_name limit 1;
spins
NULL
-select name from performance_schema.setup_instruments order by name limit 1;
-name
-idle
+select * from performance_schema.setup_timers where name='wait';
+NAME TIMER_NAME
+wait CYCLE
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
@@ -51,9 +51,9 @@ Qcache_hits 1
select spins from performance_schema.events_waits_current order by event_name limit 1;
spins
NULL
-select name from performance_schema.setup_instruments order by name limit 1;
-name
-idle
+select * from performance_schema.setup_timers where name='wait';
+NAME TIMER_NAME
+wait CYCLE
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
diff --git a/mysql-test/suite/perfschema/r/relaylog.result b/mysql-test/suite/perfschema/r/relaylog.result
index c276507820a..8e4039c00c6 100644
--- a/mysql-test/suite/perfschema/r/relaylog.result
+++ b/mysql-test/suite/perfschema/r/relaylog.result
@@ -56,10 +56,10 @@ where event_name like "%MYSQL_BIN_LOG%"
and event_name not like "%MYSQL_BIN_LOG::update_cond"
order by event_name;
EVENT_NAME COUNT_STAR
-wait/synch/cond/sql/MYSQL_BIN_LOG::COND_prep_xids NONE
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_queue_busy NONE
+wait/synch/cond/sql/MYSQL_BIN_LOG::COND_xid_list NONE
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index MANY
-wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_prep_xids NONE
+wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_xid_list MANY
"Expect no slave relay log"
select * from performance_schema.file_summary_by_instance
where event_name like "%relaylog%" order by file_name;
@@ -131,10 +131,10 @@ where event_name like "%MYSQL_BIN_LOG%"
and event_name not like "%MYSQL_BIN_LOG::update_cond"
order by event_name;
EVENT_NAME COUNT_STAR
-wait/synch/cond/sql/MYSQL_BIN_LOG::COND_prep_xids NONE
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_queue_busy NONE
+wait/synch/cond/sql/MYSQL_BIN_LOG::COND_xid_list NONE
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index MANY
-wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_prep_xids NONE
+wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_xid_list MANY
"Expect a slave relay log"
select
substring(file_name, locate("slave-", file_name)) as FILE_NAME,
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_idle.result b/mysql-test/suite/perfschema/r/start_server_disable_idle.result
index 64648a79330..48501d2ae26 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_idle.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_idle.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_stages.result b/mysql-test/suite/perfschema/r/start_server_disable_stages.result
index 905e27f1347..f03b7b27546 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_stages.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_stages.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_statements.result b/mysql-test/suite/perfschema/r/start_server_disable_statements.result
index 512fa6fe462..46ddeb32c08 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_statements.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_statements.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_waits.result b/mysql-test/suite/perfschema/r/start_server_disable_waits.result
index d9150ec9ac7..00d98b6af78 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_waits.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_waits.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_innodb.result b/mysql-test/suite/perfschema/r/start_server_innodb.result
index 13b6406250a..da836c0f933 100644
--- a/mysql-test/suite/perfschema/r/start_server_innodb.result
+++ b/mysql-test/suite/perfschema/r/start_server_innodb.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_account.result b/mysql-test/suite/perfschema/r/start_server_no_account.result
index cda9ca9722c..201df2c98bd 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_account.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_account.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
index 689c9ec94c0..e8ee3d0e429 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
index 3cc5dba7376..5bc02d14e7e 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
index 27c76d3ede1..64d99d2109a 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
index c1b3c14058d..388ab1796b6 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_host.result b/mysql-test/suite/perfschema/r/start_server_no_host.result
index 51e693b53b4..b09adcfe953 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_host.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_host.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
index 79131abc2e5..e4264ad0554 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
index 0756da7589c..4a642fda1e1 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
index a89f7a0ad1a..79636014743 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
index 5399344f675..88003d2978c 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 0
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
index 38d5eb3cd81..47b5c326703 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
index 489884a179e..66adafb7dd5 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
index d114de58c3e..612cc625132 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 0
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
index eed4a67f74d..981b322041c 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 0
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
index 8ec63865763..172f3e87d13 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 0
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
index 1633a413ae9..8f3bd08a5de 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
index 2218358dfad..1cd07ad93a6 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
index 423b7c07af0..d2d0bd012c7 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
index 162036c67b6..16eb55d80e4 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
index 5f7bb2b7728..23248e97911 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 0
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
index b3ba8940d46..4cfe58e360a 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 0
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
index 03e3823c6d7..98cc88ec36a 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 0
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
index db3ce741da7..dd22fb22773 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_user.result b/mysql-test/suite/perfschema/r/start_server_no_user.result
index f04cbe1358f..de1f2dc0b6f 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_user.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_user.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
index 3781f25d8f1..36a8307de13 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
index 524c8b12872..5954fe64333 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result
index 030448ecaa5..ad019bbc650 100644
--- a/mysql-test/suite/perfschema/r/start_server_off.result
+++ b/mysql-test/suite/perfschema/r/start_server_off.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result
index 13b6406250a..da836c0f933 100644
--- a/mysql-test/suite/perfschema/r/start_server_on.result
+++ b/mysql-test/suite/perfschema/r/start_server_on.result
@@ -90,7 +90,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/statement_digest.result b/mysql-test/suite/perfschema/r/statement_digest.result
index c6ffea69148..00476d957f6 100644
--- a/mysql-test/suite/perfschema/r/statement_digest.result
+++ b/mysql-test/suite/perfschema/r/statement_digest.result
@@ -75,28 +75,28 @@ Warning 1265 Data truncated for column 'c' at row 1
SELECT DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS,
SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS
-05a0fd27e76f6e38420b5dcae970c1d1 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
-cc0d093a57fbe1694ee003da61a18f50 SELECT ? FROM t1 1 0 0 0
-0bf450b7940cf3dd7fc720fdd6281d77 SELECT ? FROM `t1` 1 0 0 0
-3ea6d9e2c71e6fe84643d647f257ef22 SELECT ?, ... FROM t1 2 0 0 0
-e9d6214db9270d8e3b12694483a7ece0 SELECT ? FROM t2 1 0 0 0
-8bfd768d8ce6c88ca3ace9e9eaf74fad SELECT ?, ... FROM t2 2 0 0 0
-49358f164df227c622fa9438e17c5a45 INSERT INTO t1 VALUES (?) 1 1 0 0
-b5777ff47c7e7d37c738c3bbc99a5f50 INSERT INTO t2 VALUES (?) 1 1 0 0
-b8f5b0056d36e62b060d605227e26bfb INSERT INTO t3 VALUES (...) 1 1 0 0
-835ec262d10fbedce1e31c397bdae877 INSERT INTO t4 VALUES (...) 1 1 0 0
-c0cfc65392e6ea3d51708967b0795f09 INSERT INTO t5 VALUES (...) 1 1 0 0
-3e743e4d942c7b76fccddbf15211367e INSERT INTO t1 VALUES (?) /* , ... */ 2 7 0 0
-6048c5411fb3037b4db7a24eed82b83c INSERT INTO t3 VALUES (...) /* , ... */ 1 3 0 0
-2312fd042d1232cd30e4172c69b0b2e4 INSERT INTO t5 VALUES (...) /* , ... */ 1 3 0 0
-33ebf25ca2afeea44fd5390801df4a0a SELECT ? + ? 3 0 0 0
-eb4368e66ef2ee0713b22abe1b94b5e7 SELECT ? 1 0 0 0
+b94bc8f50c92e01784d3148b3d2086c8 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
+ea6492426a33544a059bc12766c5ba3d SELECT ? FROM t1 1 0 0 0
+692668ddf608983c586aef1c575ee9c6 SELECT ? FROM `t1` 1 0 0 0
+f630f3ea22832be48798c5e51bb88189 SELECT ?, ... FROM t1 2 0 0 0
+a98062477bd693dacfc0df96c68c5585 SELECT ? FROM t2 1 0 0 0
+12cd65a2242b7643f9ad4418c389677a SELECT ?, ... FROM t2 2 0 0 0
+32d8fa3c3ed3b6c26ac792495188f4a4 INSERT INTO t1 VALUES (?) 1 1 0 0
+8bf0b320418673ba7d23f11f61bae318 INSERT INTO t2 VALUES (?) 1 1 0 0
+a411b3681f67af51cddca60a3d5c260f INSERT INTO t3 VALUES (...) 1 1 0 0
+23d0399fcd03fabcc9eeadb387121a44 INSERT INTO t4 VALUES (...) 1 1 0 0
+c0ec9a3fd081147370256fb6b64e2f67 INSERT INTO t5 VALUES (...) 1 1 0 0
+ba58da885d020e31d8c38b67e0f6da4c INSERT INTO t1 VALUES (?) /* , ... */ 2 7 0 0
+9c272a31286b15643b38fecc33599eea INSERT INTO t3 VALUES (...) /* , ... */ 1 3 0 0
+a7d009150c5da8b925776dea63ed77d7 INSERT INTO t5 VALUES (...) /* , ... */ 1 3 0 0
+b695dab1504c4e588a91af231b9c9e26 SELECT ? + ? 3 0 0 0
+a2635fa56a271bdf473419620249f7ef SELECT ? 1 0 0 0
bce3f7384ae2ab78354b031184fde12d CREATE SCHEMA statements_digest_temp 2 2 0 0
2a0e36afeaac85dc117c3856388a4fae DROP SCHEMA statements_digest_temp 2 0 0 0
-5a6f99b35d55cdcb4c9bd755ff6bed58 SELECT ? FROM t11 1 0 0 1
-88305d7ed153aeef764d4fb992f28034 CREATE TABLE t11 ( c CHARACTER (?) ) 2 0 0 1
-2a533c9f7e3b5d9dac18c4f8a0a49e53 INSERT INTO t11 VALUES (?) 1 1 1 0
-35c70a6aa7abc3da331ef84b3663534b SHOW WARNINGS 1 0 0 0
+bb607bee73d602560af915aa4514eac4 SELECT ? FROM t11 1 0 0 1
+4cd9bc5a9ed1ac12cd380187dab2921a CREATE TABLE t11 ( c CHARACTER (?) ) 2 0 0 1
+bd53dcd5e36e77d74df5358baf658cee INSERT INTO t11 VALUES (?) 1 1 1 0
+f62dd76b64fad47e6558f3d1b03ff215 SHOW WARNINGS 1 0 0 0
####################################
# CLEANUP
####################################
diff --git a/mysql-test/suite/perfschema/r/statement_digest_consumers.result b/mysql-test/suite/perfschema/r/statement_digest_consumers.result
index 70e5c98435a..722a9e4bf2b 100644
--- a/mysql-test/suite/perfschema/r/statement_digest_consumers.result
+++ b/mysql-test/suite/perfschema/r/statement_digest_consumers.result
@@ -88,28 +88,28 @@ Warning 1265 Data truncated for column 'c' at row 1
####################################
SELECT digest, digest_text, count_star FROM performance_schema.events_statements_summary_by_digest;
digest digest_text count_star
-05a0fd27e76f6e38420b5dcae970c1d1 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
-cc0d093a57fbe1694ee003da61a18f50 SELECT ? FROM t1 1
-0bf450b7940cf3dd7fc720fdd6281d77 SELECT ? FROM `t1` 1
-3ea6d9e2c71e6fe84643d647f257ef22 SELECT ?, ... FROM t1 2
-e9d6214db9270d8e3b12694483a7ece0 SELECT ? FROM t2 1
-8bfd768d8ce6c88ca3ace9e9eaf74fad SELECT ?, ... FROM t2 2
-49358f164df227c622fa9438e17c5a45 INSERT INTO t1 VALUES (?) 1
-b5777ff47c7e7d37c738c3bbc99a5f50 INSERT INTO t2 VALUES (?) 1
-b8f5b0056d36e62b060d605227e26bfb INSERT INTO t3 VALUES (...) 1
-835ec262d10fbedce1e31c397bdae877 INSERT INTO t4 VALUES (...) 1
-c0cfc65392e6ea3d51708967b0795f09 INSERT INTO t5 VALUES (...) 1
-3e743e4d942c7b76fccddbf15211367e INSERT INTO t1 VALUES (?) /* , ... */ 2
-6048c5411fb3037b4db7a24eed82b83c INSERT INTO t3 VALUES (...) /* , ... */ 1
-2312fd042d1232cd30e4172c69b0b2e4 INSERT INTO t5 VALUES (...) /* , ... */ 1
-33ebf25ca2afeea44fd5390801df4a0a SELECT ? + ? 3
-eb4368e66ef2ee0713b22abe1b94b5e7 SELECT ? 1
+b94bc8f50c92e01784d3148b3d2086c8 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
+ea6492426a33544a059bc12766c5ba3d SELECT ? FROM t1 1
+692668ddf608983c586aef1c575ee9c6 SELECT ? FROM `t1` 1
+f630f3ea22832be48798c5e51bb88189 SELECT ?, ... FROM t1 2
+a98062477bd693dacfc0df96c68c5585 SELECT ? FROM t2 1
+12cd65a2242b7643f9ad4418c389677a SELECT ?, ... FROM t2 2
+32d8fa3c3ed3b6c26ac792495188f4a4 INSERT INTO t1 VALUES (?) 1
+8bf0b320418673ba7d23f11f61bae318 INSERT INTO t2 VALUES (?) 1
+a411b3681f67af51cddca60a3d5c260f INSERT INTO t3 VALUES (...) 1
+23d0399fcd03fabcc9eeadb387121a44 INSERT INTO t4 VALUES (...) 1
+c0ec9a3fd081147370256fb6b64e2f67 INSERT INTO t5 VALUES (...) 1
+ba58da885d020e31d8c38b67e0f6da4c INSERT INTO t1 VALUES (?) /* , ... */ 2
+9c272a31286b15643b38fecc33599eea INSERT INTO t3 VALUES (...) /* , ... */ 1
+a7d009150c5da8b925776dea63ed77d7 INSERT INTO t5 VALUES (...) /* , ... */ 1
+b695dab1504c4e588a91af231b9c9e26 SELECT ? + ? 3
+a2635fa56a271bdf473419620249f7ef SELECT ? 1
bce3f7384ae2ab78354b031184fde12d CREATE SCHEMA statements_digest_temp 2
2a0e36afeaac85dc117c3856388a4fae DROP SCHEMA statements_digest_temp 2
-5a6f99b35d55cdcb4c9bd755ff6bed58 SELECT ? FROM t11 1
-88305d7ed153aeef764d4fb992f28034 CREATE TABLE t11 ( c CHARACTER (?) ) 2
-2a533c9f7e3b5d9dac18c4f8a0a49e53 INSERT INTO t11 VALUES (?) 1
-35c70a6aa7abc3da331ef84b3663534b SHOW WARNINGS 1
+bb607bee73d602560af915aa4514eac4 SELECT ? FROM t11 1
+4cd9bc5a9ed1ac12cd380187dab2921a CREATE TABLE t11 ( c CHARACTER (?) ) 2
+bd53dcd5e36e77d74df5358baf658cee INSERT INTO t11 VALUES (?) 1
+f62dd76b64fad47e6558f3d1b03ff215 SHOW WARNINGS 1
SELECT digest, digest_text FROM performance_schema.events_statements_current;
digest digest_text
####################################
diff --git a/mysql-test/suite/perfschema/r/statement_digest_long_query.result b/mysql-test/suite/perfschema/r/statement_digest_long_query.result
index 225977a62af..580bf1ef627 100644
--- a/mysql-test/suite/perfschema/r/statement_digest_long_query.result
+++ b/mysql-test/suite/perfschema/r/statement_digest_long_query.result
@@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
####################################
SELECT digest, digest_text, count_star FROM events_statements_summary_by_digest;
digest digest_text count_star
-e56a507698736d9cf34a6b043f9e5ed8 TRUNCATE TABLE events_statements_summary_by_digest 1
-9eef21cb9bfa3ff9732c95e0ef47dbf1 SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ... 1
+551139187583b3dff117e28b5935406c TRUNCATE TABLE events_statements_summary_by_digest 1
+6b577979631439bd015b7675abcd91fe SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ... 1
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
index 1952803291a..98f21895e81 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
@@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
index bd7ac2c995b..6d983b32bd3 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
@@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
index 3bfdf10401c..45935f943ff 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
@@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
index 6a31f6458d9..6feab956ef3 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
@@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
index c630dbc7dcb..50217f4fb32 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
@@ -61,7 +61,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
index bee77262317..47bd8f84455 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
@@ -60,7 +60,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
index 93320407993..26e86a12f24 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
@@ -61,7 +61,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
index d60641bf68f..67a80884008 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
@@ -60,7 +60,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_off.result b/mysql-test/suite/perfschema/r/table_aggregate_off.result
index cf7778b0c3e..8c2ff29c2ce 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_off.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_off.result
@@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
index 1cda3600046..31b43996de4 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
@@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
index 5f951adfb00..1379d07719a 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
@@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
index 6c3c14fe190..3001ad34e68 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
@@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
index 0ee9d266a59..feed7c53c93 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
@@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
index 6703860caa3..dac12573832 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
@@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
index e918764c34c..1f3e0fb9ef1 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
@@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
index c7ea909d1b2..ee7958082f6 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
@@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
index 5f6c7dff212..ee04ee712f0 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
@@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
index 8c003f5e7bc..9c1fbf6d557 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
@@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
index 79cae48d78a..d537088ddfd 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
@@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
index 52f5878c3ea..217cbced878 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
@@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
index 3957481897e..f25669430a0 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
@@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
index 791786246dd..681a9019281 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
@@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
index da16a14a51f..a852647f566 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
@@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
index 5ab36b8f109..caedc66d8a7 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
@@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
index 2393d357c93..1b860c73ae6 100644
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
@@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
index 73bbe77bc1b..df500a28e44 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
@@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
index 9e7427f57f4..4afca2b1133 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
@@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
index 06e910c777b..86cd1d5efe6 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
@@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
index 0d7bca40fbb..fd4d0ef1b93 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
@@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
index fd8d845c0be..3d54f3822ec 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
@@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
index 9b4fe6d14ab..7df9f026f85 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
@@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
index f6ee9067ab3..34a7864fce1 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
@@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
index a6d042bcd4a..051df916023 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
@@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
index f41524bde4a..4f4de1d0416 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
@@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
index d227366563a..c79f6134e0a 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
@@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
index fd780e3204c..777a169c194 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
@@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
index 4acefcaa5b1..ad08341c159 100644
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
@@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_stage_classes 150
-performance_schema_max_statement_classes 170
+performance_schema_max_statement_classes 173
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/t/func_file_io.test b/mysql-test/suite/perfschema/t/func_file_io.test
index a20929481c5..25e84292c97 100644
--- a/mysql-test/suite/perfschema/t/func_file_io.test
+++ b/mysql-test/suite/perfschema/t/func_file_io.test
@@ -44,6 +44,7 @@ SET @before_count = (SELECT SUM(TIMER_WAIT)
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD'));
+SELECT (@before_count >= 0) as have_before_count;
SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation;
SELECT * FROM t1 WHERE id < 4;
@@ -53,6 +54,7 @@ SET @after_count = (SELECT SUM(TIMER_WAIT)
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1));
+SELECT (@after_count >= 0) as have_after_count;
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed;
UPDATE performance_schema.setup_instruments SET enabled='NO';
@@ -62,6 +64,7 @@ SET @before_count = (SELECT SUM(TIMER_WAIT)
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2));
+SELECT (@before_count >= 0) as have_before_count;
SELECT * FROM t1 WHERE id < 6;
SET @after_count = (SELECT SUM(TIMER_WAIT)
@@ -69,6 +72,7 @@ SET @after_count = (SELECT SUM(TIMER_WAIT)
WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile')
AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3));
+SELECT (@after_count >= 0) as have_after_count;
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed;
#
diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test
index 8c9e5fcd0ed..60d4a648222 100644
--- a/mysql-test/suite/perfschema/t/query_cache.test
+++ b/mysql-test/suite/perfschema/t/query_cache.test
@@ -34,7 +34,7 @@ show status like "Qcache_hits";
select spins from performance_schema.events_waits_current order by event_name limit 1;
-select name from performance_schema.setup_instruments order by name limit 1;
+select * from performance_schema.setup_timers where name='wait';
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
@@ -42,7 +42,7 @@ show status like "Qcache_hits";
select spins from performance_schema.events_waits_current order by event_name limit 1;
-select name from performance_schema.setup_instruments order by name limit 1;
+select * from performance_schema.setup_timers where name='wait';
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_send.test b/mysql-test/suite/plugins/t/feedback_plugin_send.test
index 3324ef469fe..45b507f8e78 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_send.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_send.test
@@ -1,3 +1,6 @@
+# Restart of server does not work for embedded.
+--source include/not_embedded.inc
+
source feedback_plugin_load.test;
if (!$MTR_FEEDBACK_PLUGIN) {
diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment.result b/mysql-test/suite/rpl/r/rpl_auto_increment.result
index 8b41a01cb6e..41bacd78f52 100644
--- a/mysql-test/suite/rpl/r/rpl_auto_increment.result
+++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result
@@ -125,6 +125,10 @@ insert into t1 values(600),(NULL),(NULL);
ERROR 23000: Duplicate entry '600' for key 'PRIMARY'
set @@insert_id=600;
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
+Warnings:
+Warning 1062 Duplicate entry '600' for key 'PRIMARY'
+Warning 1062 Duplicate entry '600' for key 'PRIMARY'
+Warning 1062 Duplicate entry '600' for key 'PRIMARY'
select * from t1;
a
1
@@ -186,7 +190,7 @@ set auto_increment_offset=4;
insert into t1 values(null);
insert into t1 values(null);
insert into t1 values(null);
-ERROR 23000: Duplicate entry '125' for key 'PRIMARY'
+ERROR 22003: Out of range value for column 'a' at row 1
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
a mod(a-@@auto_increment_offset,@@auto_increment_increment)
103 0
@@ -196,21 +200,19 @@ create table t2 (a tinyint unsigned not null auto_increment primary key) engine=
set auto_increment_increment=10;
set auto_increment_offset=1;
set insert_id=1000;
+insert into t2 values(10);
insert into t2 values(null);
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
a mod(a-@@auto_increment_offset,@@auto_increment_increment)
-251 0
+10 9
create table t3 like t1;
set auto_increment_increment=1000;
set auto_increment_offset=700;
insert into t3 values(null);
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select * from t3 order by a;
a
-127
select * from t1 order by a;
a
103
@@ -218,10 +220,9 @@ a
125
select * from t2 order by a;
a
-251
+10
select * from t3 order by a;
a
-127
drop table t1,t2,t3;
set auto_increment_increment=1;
set auto_increment_offset=1;
diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result
index ba5cb1b1b2b..fb61f159c80 100644
--- a/mysql-test/suite/rpl/r/rpl_checksum.result
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result
@@ -71,7 +71,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */;
set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 245, the last event read from 'master-bin.000010' at 245, the last byte read from 'master-bin.000010' at 245.''
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 326, the last event read from 'master-bin.000010' at 246, the last byte read from 'master-bin.000010' at 246.''
select count(*) as zero from t1;
zero
0
diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
index 37d209bbcf6..f2128f8d855 100644
--- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
@@ -76,6 +76,8 @@ include/check_slave_is_running.inc
*** Test lock wait timeout and purged relay logs ***
SET @my_max_relay_log_size= @@global.max_relay_log_size;
SET global max_relay_log_size=0;
+Warnings:
+Warning 1292 Truncated incorrect max_relay_log_size value: '0'
include/stop_slave.inc
DELETE FROM t2;
CHANGE MASTER TO MASTER_LOG_POS=<master_pos_begin>;
diff --git a/mysql-test/suite/rpl/r/rpl_filter_dbs_dynamic.result b/mysql-test/suite/rpl/r/rpl_filter_dbs_dynamic.result
index 321b8d912e6..eaa2ed9a61d 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_dbs_dynamic.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_dbs_dynamic.result
@@ -1,9 +1,9 @@
include/master-slave.inc
[connection master]
SET @@GLOBAL.replicate_do_db="db1";
-ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first
+ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
SET @@GLOBAL.replicate_ignore_db="db2";
-ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first
+ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
include/stop_slave.inc
SET @@GLOBAL.replicate_do_db="db1";
SET @@GLOBAL.replicate_ignore_db="db2";
diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result b/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result
index 9eb803d17ea..3d03d36828a 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result
@@ -1,9 +1,9 @@
include/master-slave.inc
[connection master]
SET @@GLOBAL.replicate_do_table="test.t1,test.t2,test.t3";
-ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first
+ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6";
-ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first
+ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
include/stop_slave.inc
SET @@GLOBAL.replicate_do_table="test.t1,test.t2,test.t3";
SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6";
diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
index fcd03ea74b8..baf0cf81cec 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
@@ -114,22 +114,23 @@ id c
3 3
[on master]
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b INT, c INT);
+CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT);
CREATE TABLE test.t1 (a INT);
INSERT INTO test.t1 VALUES(1);
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b INT, c INT);
+CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT);
CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
-INSERT INTO test.t_slave VALUES(NULL, ROUND(RAND() * 1000), @c);
+INSERT INTO test.t_slave VALUES(NULL, RAND(), @c);
SET INSERT_ID=2;
SET @c=2;
SET @@rand_seed1=10000000, @@rand_seed2=1000000;
-INSERT INTO t5 VALUES (NULL, ROUND(RAND() * 1000), @c);
+INSERT INTO t5 VALUES (NULL, RAND(), @c);
SELECT b into @b FROM test.t5;
UPDATE test.t1 SET a=2;
SELECT a AS 'ONE' into @a FROM test.t_slave;
SELECT c AS 'NULL' into @c FROM test.t_slave;
SELECT b into @b FROM test.t_slave;
+include/assert.inc [Random values from master and slave must be different]
drop table test.t5;
drop table test.t1;
drop table test.t_slave;
diff --git a/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result b/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result
index 6858181234e..19d8e513e6f 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result
@@ -1,9 +1,9 @@
include/master-slave.inc
[connection master]
SET @@GLOBAL.replicate_wild_do_table="test.a%";
-ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first
+ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
SET @@GLOBAL.replicate_wild_ignore_table="test.b%";
-ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first
+ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
include/stop_slave.inc
SET @@GLOBAL.replicate_wild_do_table="test.a%";
SET @@GLOBAL.replicate_wild_ignore_table="test.b%";
diff --git a/mysql-test/suite/rpl/r/rpl_flush_logs.result b/mysql-test/suite/rpl/r/rpl_flush_logs.result
index 4fce91a7234..1f543cd9f43 100644
--- a/mysql-test/suite/rpl/r/rpl_flush_logs.result
+++ b/mysql-test/suite/rpl/r/rpl_flush_logs.result
@@ -8,7 +8,7 @@ flush error logs;
# after execute 'flush error logs' statement.
# Test if support 'flush relay logs' statement.
flush relay logs;
-# Check the 'slave-relay-bin.000003' file is created
+# Check the 'slave-relay-bin.000003' file is not created
# after executed 'flush relay logs' statement.
# Make sure binary logs was not be flushed
# after execute 'flush relay logs' statement.
@@ -30,21 +30,21 @@ flush engine logs;
flush binary logs;
# Check the 'master-bin.000002' file is created
# after executed 'flush binary logs' statement.
-# Make sure the 'slave-relay-bin.000006' file does not exist
+# Make sure the 'slave-relay-bin.000005' file does not exist
# exist before execute 'flush error logs, relay logs' statement.
# Test if support to combine all kinds of logs into one statement.
flush error logs, relay logs;
# Make sure binary logs was not be flushed
# after execute 'flush error logs, relay logs' statement.
-# Check the 'slave-relay-bin.000006' file is created after
+# Check the 'slave-relay-bin.000004' file is created after
# execute 'flush error logs, relay logs' statement.
-# Make sure the 'slave-relay-bin.000007' and 'slave-relay-bin.000008'
+# Make sure the 'slave-relay-bin.000005' and 'slave-relay-bin.000006'
# files do not exist before execute 'flush error logs, relay logs'
# statement.
# Test if 'flush logs' statement works fine and flush all the logs.
flush logs;
# Check 'master-bin.000003' is created
# after execute 'flush logs' statement.
-# Check the 'slave-relay-bin.000007' and 'slave-relay-bin.000008'
+# Check the 'slave-relay-bin.000005' and 'slave-relay-bin.000006'
# files are created after execute 'flush logs' statement.
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat.result b/mysql-test/suite/rpl/r/rpl_heartbeat.result
index d4bdb77ef0b..b0f36558d10 100644
--- a/mysql-test/suite/rpl/r/rpl_heartbeat.result
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result
@@ -41,8 +41,6 @@ show status like 'Slave_heartbeat_period';;
Variable_name Slave_heartbeat_period
Value 4.000
set @@global.slave_net_timeout= 3 /* must be a warning */;
-Warnings:
-Warning 1704 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout.
reset slave;
drop table if exists t1;
set @@global.slave_net_timeout= 10;
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
index cc9d1f99f7c..0c274165e1e 100644
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
@@ -33,8 +33,6 @@ RESET SLAVE;
*** Warning if updated slave_net_timeout < slave_heartbeat_timeout ***
SET @@global.slave_net_timeout=FLOOR(SLAVE_HEARTBEAT_TIMEOUT)-1;
-Warnings:
-Warning 1704 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout.
SET @@global.slave_net_timeout=@restore_slave_net_timeout;
RESET SLAVE;
diff --git a/mysql-test/suite/rpl/r/rpl_hrtime.result b/mysql-test/suite/rpl/r/rpl_hrtime.result
index e4a825591bf..fbe4ba28409 100644
--- a/mysql-test/suite/rpl/r/rpl_hrtime.result
+++ b/mysql-test/suite/rpl/r/rpl_hrtime.result
@@ -30,7 +30,7 @@ include/rpl_end.inc
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1293832861/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff b/mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff
index 0c16e9d9bd7..801044d8fcd 100644
--- a/mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff
+++ b/mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff
@@ -1,5 +1,5 @@
---- suite/rpl/r/rpl_insert_delayed.result 2012-02-06 21:37:21.000000000 +0100
-+++ suite/rpl/r/rpl_insert_delayed,stmt.reject 2012-02-06 23:12:55.000000000 +0100
+--- suite/rpl/r/rpl_insert_delayed.result 2012-09-18 01:37:45.317521958 +0300
++++ suite/rpl/r/rpl_insert_delayed,stmt.reject 2012-09-18 01:36:16.637514667 +0300
@@ -15,17 +15,17 @@
insert delayed into t1 values(10, "my name");
flush table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
index 257d5f580e8..16fd3f19c4a 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
@@ -14,6 +14,8 @@ select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key);
load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY a;
a
1
diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result
index 8910f7c8f74..610d18a88c6 100644
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result
@@ -11,7 +11,7 @@ include/stop_slave.inc
change master to master_log_pos=MASTER_LOG_POS;
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
include/stop_slave_sql.inc
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
diff --git a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
new file mode 100644
index 00000000000..0073c71507d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
@@ -0,0 +1,98 @@
+include/master-slave.inc
+[connection master]
+set @old_master_binlog_checksum= @@global.binlog_checksum;
+set @old_slave_dbug= @@global.debug_dbug;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (0);
+# Test slave with no capability gets dummy event, which is ignored.
+include/stop_slave.inc
+SET @@global.debug_dbug='+d,simulate_slave_capability_none';
+include/start_slave.inc
+ALTER TABLE t1 ORDER BY a;
+SET SESSION binlog_annotate_row_events = ON;
+DELETE FROM t1;
+INSERT INTO t1 /* A comment just to make the annotate event sufficiently long that the dummy event will need to get padded with spaces so that we can test that this works */ VALUES(1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Annotate_rows # # DELETE FROM t1
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Annotate_rows # # INSERT INTO t1 /* A comment just to make the annotate event sufficiently long that the dummy event will need to get padded with spaces so that we can test that this works */ VALUES(1)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+SELECT * FROM t1;
+a
+1
+include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000003 # Query # # BEGIN
+slave-relay-bin.000003 # User var # # @`!dummyvar`=NULL
+slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000003 # Delete_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000003 # Query # # COMMIT
+slave-relay-bin.000003 # Query # # BEGIN
+slave-relay-bin.000003 # Query # # # Dummy event replacing event type 160 that slave cannot handle.
+slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000003 # Query # # COMMIT
+set @@global.debug_dbug= @old_slave_dbug;
+# Test dummy event is checksummed correctly.
+set @@global.binlog_checksum = CRC32;
+TRUNCATE t1;
+INSERT INTO t1 VALUES(2);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query # # BEGIN
+master-bin.000002 # Annotate_rows # # INSERT INTO t1 VALUES(2)
+master-bin.000002 # Table_map # # table_id: # (test.t1)
+master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000002 # Query # # COMMIT
+SELECT * FROM t1;
+a
+2
+include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000005 # Query # # BEGIN
+slave-relay-bin.000005 # Query # # # Dummy ev
+slave-relay-bin.000005 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000005 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000005 # Query # # COMMIT
+# Test that slave which cannot tolerate holes in binlog stream but
+# knows the event does not get dummy event
+include/stop_slave.inc
+SET @@global.debug_dbug='+d,simulate_slave_capability_old_53';
+include/start_slave.inc
+ALTER TABLE t1 ORDER BY a;
+UPDATE t1 SET a = 3;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query # # BEGIN
+master-bin.000002 # Annotate_rows # # UPDATE t1 SET a = 3
+master-bin.000002 # Table_map # # table_id: # (test.t1)
+master-bin.000002 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000002 # Query # # COMMIT
+SELECT * FROM t1;
+a
+3
+include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000006 # Query # # BEGIN
+slave-relay-bin.000006 # Annotate_rows # # UPDATE t1 SET a = 3
+slave-relay-bin.000006 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000006 # Update_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000006 # Query # # COMMIT
+select @@global.log_slave_updates;
+@@global.log_slave_updates
+1
+select @@global.replicate_annotate_row_events;
+@@global.replicate_annotate_row_events
+0
+set @@global.debug_dbug= @old_slave_dbug;
+Clean up.
+set @@global.binlog_checksum = @old_master_binlog_checksum;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result
new file mode 100644
index 00000000000..13bf7bf0a3e
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mdev382.result
@@ -0,0 +1,368 @@
+include/master-slave.inc
+[connection master]
+create table t1 (a int primary key) engine=innodb;
+create table t2 (a int primary key) engine=myisam;
+begin;
+insert into t1 values (1);
+SET sql_mode = 'ANSI_QUOTES';
+savepoint `a``; create database couldbebadthingshere; savepoint ``dummy`;
+insert into t1 values (2);
+insert into t2 values (1);
+SET sql_mode = '';
+rollback to savepoint `a``; create database couldbebadthingshere; savepoint ``dummy`;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+insert into t1 values (3);
+commit;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int primary key) engine=innodb
+master-bin.000001 # Query 1 # use `test`; create table t2 (a int primary key) engine=myisam
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t2 values (1)
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (1)
+master-bin.000001 # Query 1 # SAVEPOINT "a`; create database couldbebadthingshere; savepoint `dummy"
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (2)
+master-bin.000001 # Query 1 # ROLLBACK TO `a``; create database couldbebadthingshere; savepoint ``dummy`
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (3)
+master-bin.000001 # Xid 1 # COMMIT /* XID */
+BEGIN;
+insert into t1 values(10);
+set sql_mode = 'ANSI_QUOTES';
+set sql_quote_show_create = 1;
+savepoint a;
+insert into t1 values(11);
+savepoint "a""a";
+insert into t1 values(12);
+set sql_quote_show_create = 0;
+savepoint b;
+insert into t1 values(13);
+savepoint "b""b";
+insert into t1 values(14);
+set sql_mode = '';
+set sql_quote_show_create = 1;
+savepoint c;
+insert into t1 values(15);
+savepoint `c``c`;
+insert into t1 values(16);
+set sql_quote_show_create = 0;
+savepoint d;
+insert into t1 values(17);
+savepoint `d``d`;
+insert into t1 values(18);
+COMMIT;
+set sql_quote_show_create = 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 # Query 1 # use `test`; insert into t1 values(10)
+master-bin.000001 # Query 1 # SAVEPOINT "a"
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(11)
+master-bin.000001 # Query 1 # SAVEPOINT "a""a"
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(12)
+master-bin.000001 # Query 1 # SAVEPOINT b
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(13)
+master-bin.000001 # Query 1 # SAVEPOINT "b""b"
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(14)
+master-bin.000001 # Query 1 # SAVEPOINT `c`
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(15)
+master-bin.000001 # Query 1 # SAVEPOINT `c``c`
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(16)
+master-bin.000001 # Query 1 # SAVEPOINT d
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(17)
+master-bin.000001 # Query 1 # SAVEPOINT `d``d`
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(18)
+master-bin.000001 # Xid 1 # COMMIT /* XID */
+*** Test correct USE statement in SHOW BINLOG EVENTS ***
+set sql_mode = 'ANSI_QUOTES';
+CREATE DATABASE "db1`; select 'oops!'";
+use "db1`; select 'oops!'";
+CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM;
+INSERT INTO t1 VALUES (1);
+set sql_mode = '';
+INSERT INTO t1 VALUES (2);
+set sql_mode = 'ANSI_QUOTES';
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # CREATE DATABASE "db1`; select 'oops!'"
+master-bin.000001 # Query 1 # use "db1`; select 'oops!'"; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Query 1 # use "db1`; select 'oops!'"; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Query 1 # use "db1`; select 'oops!'"; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Query 1 # COMMIT
+set sql_mode = '';
+set sql_quote_show_create = 0;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # CREATE DATABASE "db1`; select 'oops!'"
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Query 1 # COMMIT
+set sql_quote_show_create = 1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # CREATE DATABASE "db1`; select 'oops!'"
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Query 1 # COMMIT
+DROP TABLE t1;
+use test;
+***Test LOAD DATA INFILE with various identifiers that need correct quoting ***
+use `db1``; select 'oops!'`;
+set timestamp=1000000000;
+CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
+`c``3` VARCHAR(7));
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f''le.txt' INTO TABLE `t``1`
+ FIELDS TERMINATED BY ',' ESCAPED BY '\\' ENCLOSED BY ''''
+ LINES TERMINATED BY '\n'
+ (`a``1`, @`b```) SET `b``2` = @`b```, `c``3` = concat('|', "b""a'z", "!");
+SELECT * FROM `t``1`;
+a`1 b`2 c`3
+fo\o bar |b"a'z!
+truncate `t``1`;
+use test;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f''le.txt'
+ INTO TABLE `db1``; select 'oops!'`.`t``1`
+ FIELDS TERMINATED BY ',' ESCAPED BY '\\' ENCLOSED BY ''''
+ LINES TERMINATED BY '\n'
+ (`a``1`, `b``2`) SET `c``3` = concat('|', "b""a'z", "!");
+SELECT * FROM `db1``; select 'oops!'`.`t``1`;
+a`1 b`2 c`3
+fo\o bar |b"a'z!
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
+`c``3` VARCHAR(7))
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=14
+master-bin.000001 # Execute_load_query 1 # use `db1``; select 'oops!'`; LOAD DATA INFILE '/usr/home/serg/Abk/mysql/10.0-monty/mysql-test/var/tmp/f\'le.txt' INTO TABLE `t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, @`b```) SET `b``2`= @`b```, `c``3`= concat('|', "b""a'z", "!") ;file_id=#
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; truncate `t``1`
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=14
+master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '/usr/home/serg/Abk/mysql/10.0-monty/mysql-test/var/tmp/f\'le.txt' INTO TABLE `db1``; select 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!") ;file_id=#
+master-bin.000001 # Query 1 # COMMIT
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+use `db1``; select 'oops!'`/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
+`c``3` VARCHAR(7))
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+LOAD DATA LOCAL INFILE '<name>' INTO TABLE `t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, @`b```) SET `b``2`= @`b```, `c``3`= concat('|', "b""a'z", "!")
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+truncate `t``1`
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+use `test`/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+LOAD DATA LOCAL INFILE '<name>' INTO TABLE `db1``; select 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!")
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+SELECT * FROM `db1``; select 'oops!'`.`t``1`;
+a`1 b`2 c`3
+fo\o bar |b"a'z!
+DROP TABLE `db1``; select 'oops!'`.`t``1`;
+drop table t1,t2;
+*** Test truncation of long SET expression in LOAD DATA ***
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(1000));
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/file.txt' INTO TABLE t1
+FIELDS TERMINATED BY ','
+ (a, @b) SET b = CONCAT(@b, '| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|', @b);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 X| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|X
+2 A| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|A
+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 # Begin_load_query 1 # ;file_id=#;block_len=8
+master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '/usr/home/serg/Abk/mysql/10.0-monty/mysql-test/var/tmp/file.txt' INTO TABLE `t1` FIELDS TERMINATED BY ',' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @`b`) SET `b`= CONCAT(@b, '| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|', @b) ;file_id=#
+master-bin.000001 # Query 1 # COMMIT
+SELECT * FROM t1 ORDER BY a;
+a b
+1 X| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|X
+2 A| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|A
+DROP TABLE t1;
+*** Test user variables whose names require correct quoting ***
+use `db1``; select 'oops!'`;
+CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100));
+INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100));
+SELECT @`a``1`:=a1, @`a``2`:=a2, @`a``3`:=a3, @`a``4`:=a4, @`b```:=b, @```c`:=c, @```d```:=d FROM t1;
+@`a``1`:=a1 @`a``2`:=a2 @`a``3`:=a3 @`a``4`:=a4 @`b```:=b @```c`:=c @```d```:=d
+-9223372036854775808 42 9223372036854775807 18446744073709551615 -1.234560123456789e125 -1234501234567890123456789012345678901234567890123456789.0123456789 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98));
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100))
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100))
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # User var 1 # @`a``1`=-9223372036854775808
+master-bin.000001 # User var 1 # @`a``2`=42
+master-bin.000001 # User var 1 # @`a``3`=9223372036854775807
+master-bin.000001 # User var 1 # @`a``4`=18446744073709551615
+master-bin.000001 # User var 1 # @`b```=-1.234560123456789e125
+master-bin.000001 # User var 1 # @```c`=-1234501234567890123456789012345678901234567890123456789.0123456789
+master-bin.000001 # User var 1 # @```d```=_latin1 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878 COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98))
+master-bin.000001 # Query 1 # COMMIT
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+use `db1``; select 'oops!'`/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100))
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100))
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+SET @`a``1`:=-9223372036854775808/*!*/;
+SET @`a``2`:=42/*!*/;
+SET @`a``3`:=9223372036854775807/*!*/;
+SET @`a``4`:=18446744073709551615/*!*/;
+SET @`b```:=-1.2345601234568e+125/*!*/;
+SET @```c`:=-1234501234567890123456789012345678901234567890123456789.0123456789/*!*/;
+SET @```d```:=_latin1 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878 COLLATE `latin1_swedish_ci`/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98))
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+SELECT * FROM `db1``; select 'oops!'`.t1 ORDER BY a1;
+a1 a2 a3 a4 b c d
+-9223372036854775808 42 9223372036854775807 18446744073709551615 -1.234560123456789e125 -1234501234567890123456789012345678901234567890123456789.0123456789 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+-9223372036854775807 4200 9223372036854775806 18446744073709551614 -6.172800617283945e124 -1234501234567890123456789012345678901234567890123456789.0123456789 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+DROP TABLE t1;
+*** Test correct quoting in foreign key error message ***
+use `db1``; select 'oops!'`;
+CREATE TABLE `t``1` ( `a``` INT PRIMARY KEY) ENGINE=innodb;
+CREATE TABLE `t``2` ( `b``` INT PRIMARY KEY, `c``` INT NOT NULL,
+FOREIGN KEY fk (`c```) REFERENCES `t``1`(`a```)) ENGINE=innodb;
+TRUNCATE `t``1`;
+ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`db1``; select 'oops!'`.`t``2`, CONSTRAINT `INNODB_FOREIGN_KEY_NAME` FOREIGN KEY (`c```) REFERENCES `db1``; select 'oops!'`.`t``1` (`a```))
+DROP TABLE `t``2`;
+DROP TABLE `t``1`;
+*** Test correct quoting of DELETE FROM statement binlogged for HEAP table that is emptied due to server restart
+include/stop_slave.inc
+CREATE TABLE `db1``; select 'oops!'`.`t``1` (`a``` INT PRIMARY KEY) ENGINE=heap;
+INSERT INTO `db1``; select 'oops!'`.`t``1` VALUES (1), (2), (5);
+SELECT * FROM `db1``; select 'oops!'`.`t``1` ORDER BY 1;
+a`
+1
+2
+5
+set timestamp=1000000000;
+# The table should be empty on the master.
+SELECT * FROM `db1``; select 'oops!'`.`t``1`;
+a`
+# The DELETE statement should be correctly quoted
+show binlog events in 'master-bin.000002' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query 1 # DELETE FROM `db1``; select 'oops!'`.`t``1`
+include/start_slave.inc
+# The table should be empty on the slave also.
+SELECT * FROM `db1``; select 'oops!'`.`t``1`;
+a`
+DROP TABLE `db1``; select 'oops!'`.`t``1`;
+use test;
+DROP DATABASE `db1``; select 'oops!'`;
+*** Test correct quoting of mysqlbinlog --rewrite-db option ***
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES(1);
+show binlog events in 'master-bin.000002' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query 1 # BEGIN
+master-bin.000002 # Query 1 # use `test`; INSERT INTO t1 VALUES(1)
+master-bin.000002 # Query 1 # COMMIT
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+BEGIN
+/*!*/;
+use `ts``et`/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+INSERT INTO t1 VALUES(1)
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_packet.result b/mysql-test/suite/rpl/r/rpl_packet.result
index 4d5ffae2d63..65fd2800e7d 100644
--- a/mysql-test/suite/rpl/r/rpl_packet.result
+++ b/mysql-test/suite/rpl/r/rpl_packet.result
@@ -1,7 +1,7 @@
include/master-slave.inc
[connection master]
-call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153");
-call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:");
+call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, Error_code: 1153");
+call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
SET @@global.max_allowed_packet=1024;
@@ -30,14 +30,14 @@ include/start_slave.inc
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
include/wait_for_slave_io_error.inc [errno=1153]
-Last_IO_Error = 'Got a packet bigger than 'max_allowed_packet' bytes'
+Last_IO_Error = 'Got a packet bigger than 'slave_max_allowed_packet' bytes'
include/stop_slave_sql.inc
include/rpl_reset.inc
DROP TABLE t1;
CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
-include/wait_for_slave_io_error.inc [errno=1236]
-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the first event '.' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
+include/wait_for_slave_io_error.inc [errno=1153]
+Last_IO_Error = 'Got a packet bigger than 'slave_max_allowed_packet' bytes'
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
@@ -52,6 +52,7 @@ SET @@global.max_allowed_packet= 1024;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SET @@global.net_buffer_length= 1024;
+SET @@global.slave_max_allowed_packet= 1073741824;
DROP TABLE t1;
RESET SLAVE;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
index 562aac11879..32299cb27c4 100644
--- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result
+++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
@@ -25,8 +25,8 @@ Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
-Warning 1264 Out of range value for column 'a' at row 2
-Warning 1264 Out of range value for column 'b' at row 2
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 2
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
select * from rewrite.t1;
@@ -40,7 +40,7 @@ load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
-Warning 1264 Out of range value for column 'b' at row 2
+Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 2
select * from rewrite.t1;
a b c d
diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
index f10e30c698d..783c02b961c 100644
--- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result
+++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
@@ -2,9 +2,9 @@ CALL mtr.add_suppression("Unsafe statement written to the binary log using state
start slave;
Got one of the listed errors
start slave;
-ERROR HY000: Could not initialize master info structure; more error messages can be found in the MariaDB error log
+ERROR HY000: Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
-ERROR HY000: Could not initialize master info structure; more error messages can be found in the MariaDB error log
+ERROR HY000: Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log
reset slave;
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
reset master;
diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
index a7dc2a569a1..cb1aab28603 100644
--- a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
+++ b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
@@ -55,6 +55,7 @@ a b
FLUSH LOGS;
show binlog events in 'slave-bin.000001' from <start_pos>;
Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Binlog_checkpoint 2 # slave-bin.000001
slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
slave-bin.000001 # Query 1 # CREATE DATABASE test1
slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int)
diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
index 2a3b5b1870e..b7648fd8592 100644
--- a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
+++ b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
@@ -47,6 +47,7 @@ a b
FLUSH LOGS;
show binlog events in 'slave-bin.000001' from <start_pos>;
Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Binlog_checkpoint 2 # slave-bin.000001
slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
slave-bin.000001 # Query 1 # CREATE DATABASE test1
slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int)
diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result
index b2b1417defd..856679e49f6 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result
@@ -205,6 +205,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
master-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM
master-bin.000002 # Query # # BEGIN
@@ -236,6 +237,7 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM
slave-bin.000002 # Query # # BEGIN
slave-bin.000002 # Table_map # # table_id: # (test.t2)
diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
index 333836605d8..404d3e424e6 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
@@ -205,6 +205,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=InnoDB
master-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=InnoDB
master-bin.000002 # Query # # BEGIN
@@ -236,6 +237,7 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=InnoDB
slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=InnoDB
slave-bin.000002 # Query # # BEGIN
slave-bin.000002 # Table_map # # table_id: # (test.t2)
diff --git a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
index 379cea4d3fc..88d68bb50ee 100644
--- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
+++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
@@ -10,7 +10,7 @@ reset slave;
#
# Test 1
#
-set @my_max_binlog_size= @@global.max_binlog_size;
+set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1;
Warnings:
@@ -36,8 +36,10 @@ include/check_slave_is_running.inc
stop slave;
reset slave;
set global max_relay_log_size=0;
+Warnings:
+Warning 1292 Truncated incorrect max_relay_log_size value: '0'
select @@global.max_relay_log_size;
-@@global.max_relay_log_size 0
+@@global.max_relay_log_size 4096
start slave;
include/check_slave_is_running.inc
#
@@ -65,6 +67,7 @@ show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB>
set global max_binlog_size= @my_max_binlog_size;
+set global max_relay_log_size= @my_max_relay_log_size;
#
# End of 4.1 tests
#
diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
index 9e3577e1d5c..1a4d5c7574d 100644
--- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
+++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
@@ -154,7 +154,7 @@ c1 c3 c4 c5
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -176,7 +176,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -287,7 +287,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -318,7 +318,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
index 88812786948..e186fabfff3 100644
--- a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
+++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
@@ -92,48 +92,52 @@ slave-bin.000001 # Query # # COMMIT
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=POS
-slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
-slave-relay-bin.000003 # Query # # BEGIN
-slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
-slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
-slave-relay-bin.000003 # Query # # COMMIT
-slave-relay-bin.000003 # Query # # BEGIN
-slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
-slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
-slave-relay-bin.000003 # Query # # COMMIT
-slave-relay-bin.000003 # Query # # BEGIN
-slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
-slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
-slave-relay-bin.000003 # Query # # COMMIT
+slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=POS
+slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
+slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-relay-bin.000002 # Query # # BEGIN
+slave-relay-bin.000002 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000002 # Query # # COMMIT
+slave-relay-bin.000002 # Query # # BEGIN
+slave-relay-bin.000002 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000002 # Query # # COMMIT
+slave-relay-bin.000002 # Query # # BEGIN
+slave-relay-bin.000002 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000002 # Query # # COMMIT
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=POS
+slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=POS
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
-slave-relay-bin.000003 # Query # # BEGIN
+slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
+slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT)
******** [slave] SHOW RELAYLOG EVENTS ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=POS
+slave-relay-bin.000001 # Rotate # # slave-relay-bin.000002;pos=POS
FLUSH LOGS;
FLUSH LOGS;
DROP TABLE t1;
******** [master] SHOW BINLOG EVENTS IN <FILE> ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [master] SHOW BINLOG EVENTS ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -154,13 +158,16 @@ master-bin.000001 # Rotate # # master-bin.000002;pos=POS
******** [slave] SHOW BINLOG EVENTS IN <FILE> ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [slave] SHOW BINLOG EVENTS ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -181,21 +188,24 @@ slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=POS
-slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=POS
+slave-relay-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000001
+slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000002
+slave-relay-bin.000005 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=POS
+slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=POS
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+slave-relay-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000001
+slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000002
******** [slave] SHOW RELAYLOG EVENTS ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=POS
-slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=POS
+slave-relay-bin.000004 # Rotate # # master-bin.000002;pos=POS
+slave-relay-bin.000004 # Rotate # # slave-relay-bin.000005;pos=POS
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_skip_replication.result b/mysql-test/suite/rpl/r/rpl_skip_replication.result
index c19f9009021..92b5fa5f629 100644
--- a/mysql-test/suite/rpl/r/rpl_skip_replication.result
+++ b/mysql-test/suite/rpl/r/rpl_skip_replication.result
@@ -10,7 +10,7 @@ SELECT @@global.replicate_events_marked_for_skip;
@@global.replicate_events_marked_for_skip
replicate
SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE;
-ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first
+ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
SELECT @@global.replicate_events_marked_for_skip;
@@global.replicate_events_marked_for_skip
replicate
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 331c1e91bd9..c2d3f5ce212 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -670,7 +670,7 @@ drop database if exists mysqltest1
SET TIMESTAMP=t/*!*/;
create database mysqltest1
/*!*/;
-use mysqltest1/*!*/;
+use `mysqltest1`/*!*/;
SET TIMESTAMP=t/*!*/;
create table t1 (a varchar(100))
/*!*/;
@@ -1015,7 +1015,7 @@ drop database mysqltest1
SET TIMESTAMP=t/*!*/;
drop user "zedjzlcsjhd"@127.0.0.1
/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=t/*!*/;
drop function if exists f1
/*!*/;
@@ -1112,7 +1112,7 @@ create database mysqltest
SET TIMESTAMP=t/*!*/;
create database mysqltest2
/*!*/;
-use mysqltest2/*!*/;
+use `mysqltest2`/*!*/;
SET TIMESTAMP=t/*!*/;
create table t ( t integer )
/*!*/;
@@ -1139,7 +1139,7 @@ end
SET TIMESTAMP=t/*!*/;
BEGIN
/*!*/;
-use mysqltest/*!*/;
+use `mysqltest`/*!*/;
SET TIMESTAMP=t/*!*/;
SELECT `mysqltest2`.`f1`()
/*!*/;
@@ -1152,14 +1152,14 @@ drop database mysqltest
SET TIMESTAMP=t/*!*/;
drop database mysqltest2
/*!*/;
-use test/*!*/;
+use `test`/*!*/;
SET TIMESTAMP=t/*!*/;
CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltestbug36570_p1`()
begin
select 1;
end
/*!*/;
-use mysql/*!*/;
+use `mysql`/*!*/;
SET TIMESTAMP=t/*!*/;
CREATE DEFINER=`root`@`localhost` PROCEDURE `test`.` mysqltestbug36570_p2`( a int)
`label`:
diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result
index 6dc199f9295..35b1438bade 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result
@@ -205,6 +205,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
master-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM
master-bin.000002 # Query # # BEGIN
@@ -235,6 +236,7 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM
slave-bin.000002 # Query # # BEGIN
slave-bin.000002 # Query # # use `test`; insert into t2 values (1)
diff --git a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
index 379cea4d3fc..88d68bb50ee 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
@@ -10,7 +10,7 @@ reset slave;
#
# Test 1
#
-set @my_max_binlog_size= @@global.max_binlog_size;
+set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1;
Warnings:
@@ -36,8 +36,10 @@ include/check_slave_is_running.inc
stop slave;
reset slave;
set global max_relay_log_size=0;
+Warnings:
+Warning 1292 Truncated incorrect max_relay_log_size value: '0'
select @@global.max_relay_log_size;
-@@global.max_relay_log_size 0
+@@global.max_relay_log_size 4096
start slave;
include/check_slave_is_running.inc
#
@@ -65,6 +67,7 @@ show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB>
set global max_binlog_size= @my_max_binlog_size;
+set global max_relay_log_size= @my_max_relay_log_size;
#
# End of 4.1 tests
#
diff --git a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
index 7a4a324e580..a722f91e2e7 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
@@ -80,45 +80,49 @@ slave-bin.000001 # Query # # COMMIT
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=POS
-slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
-slave-relay-bin.000003 # Query # # BEGIN
-slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (1)
-slave-relay-bin.000003 # Query # # COMMIT
-slave-relay-bin.000003 # Query # # BEGIN
-slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (2)
-slave-relay-bin.000003 # Query # # COMMIT
-slave-relay-bin.000003 # Query # # BEGIN
-slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (3)
-slave-relay-bin.000003 # Query # # COMMIT
+slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=POS
+slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
+slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-relay-bin.000002 # Query # # BEGIN
+slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+slave-relay-bin.000002 # Query # # COMMIT
+slave-relay-bin.000002 # Query # # BEGIN
+slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+slave-relay-bin.000002 # Query # # COMMIT
+slave-relay-bin.000002 # Query # # BEGIN
+slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+slave-relay-bin.000002 # Query # # COMMIT
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=POS
+slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=POS
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
-slave-relay-bin.000003 # Query # # BEGIN
+slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
+slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT)
******** [slave] SHOW RELAYLOG EVENTS ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=POS
+slave-relay-bin.000001 # Rotate # # slave-relay-bin.000002;pos=POS
FLUSH LOGS;
FLUSH LOGS;
DROP TABLE t1;
******** [master] SHOW BINLOG EVENTS IN <FILE> ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [master] SHOW BINLOG EVENTS ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -136,13 +140,16 @@ master-bin.000001 # Rotate # # master-bin.000002;pos=POS
******** [slave] SHOW BINLOG EVENTS IN <FILE> ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [slave] SHOW BINLOG EVENTS ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -160,21 +167,24 @@ slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=POS
-slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=POS
+slave-relay-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000001
+slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000002
+slave-relay-bin.000005 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=POS
+slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=POS
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+slave-relay-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000001
+slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000002
******** [slave] SHOW RELAYLOG EVENTS ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=POS
-slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=POS
+slave-relay-bin.000004 # Rotate # # master-bin.000002;pos=POS
+slave-relay-bin.000004 # Rotate # # slave-relay-bin.000005;pos=POS
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_trigger.result b/mysql-test/suite/rpl/r/rpl_trigger.result
index 784cd1bcdff..ac6d9155f4b 100644
--- a/mysql-test/suite/rpl/r/rpl_trigger.result
+++ b/mysql-test/suite/rpl/r/rpl_trigger.result
@@ -4,7 +4,7 @@ DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
create table t1 (a int auto_increment, primary key (a), b int, rand_value double not null);
-create table t2 (a int auto_increment, primary key (a), b int);
+create table t2 (a int auto_increment, primary key (a), b int) engine=innodb;
create table t3 (a int auto_increment, primary key (a), name varchar(64) not null, old_a int, old_b int, rand_value double not null);
create trigger t1 before insert on t1 for each row
begin
@@ -29,7 +29,7 @@ a b
1 2
3 0
4 0
-5 0
+6 0
500 0
select a,name, old_a, old_b, truncate(rand_value,4) from t3;
a name old_a old_b truncate(rand_value,4)
@@ -39,7 +39,7 @@ a name old_a old_b truncate(rand_value,4)
103 t2 1 2 0.9164
104 t2 3 0 0.8826
105 t2 4 0 0.6635
-106 t2 5 0 0.6699
+106 t2 6 0 0.6699
107 t2 500 0 0.3593
--- On slave --
@@ -52,7 +52,7 @@ a b
1 2
3 0
4 0
-5 0
+6 0
500 0
select a,name, old_a, old_b, truncate(rand_value,4) from t3;
a name old_a old_b truncate(rand_value,4)
@@ -62,7 +62,7 @@ a name old_a old_b truncate(rand_value,4)
103 t2 1 2 0.9164
104 t2 3 0 0.8826
105 t2 4 0 0.6635
-106 t2 5 0 0.6699
+106 t2 6 0 0.6699
107 t2 500 0 0.3593
drop table t1,t2,t3;
select get_lock("bug12480",2);
diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
index b62a6e96437..3572dd53ea7 100644
--- a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
+++ b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
@@ -215,21 +215,23 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
# be filtered as well.
#
connection master;
-CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b INT, c INT); # ignored on slave
+# Although RAND() is from 0 to 1.0, DECIMAL(M,D), requires that M must be >= D.
+CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT); # ignored on slave
CREATE TABLE test.t1 (a INT); # accepted on slave
INSERT INTO test.t1 VALUES(1);
--sync_slave_with_master
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b INT, c INT);
+# Although RAND() is from 0 to 1.0, DECIMAL(M,D), requires that M must be >= D.
+CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT);
CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
- INSERT INTO test.t_slave VALUES(NULL, ROUND(RAND() * 1000), @c);
+ INSERT INTO test.t_slave VALUES(NULL, RAND(), @c);
connection master;
SET INSERT_ID=2;
SET @c=2;
SET @@rand_seed1=10000000, @@rand_seed2=1000000;
-INSERT INTO t5 VALUES (NULL, ROUND(RAND() * 1000), @c); # to be ignored
+INSERT INTO t5 VALUES (NULL, RAND(), @c); # to be ignored
SELECT b into @b FROM test.t5;
--let $b_master=`select @b`
UPDATE test.t1 SET a=2; # to run trigger on slave
@@ -253,10 +255,9 @@ if (`SELECT @a != 2 and @c != NULL`)
SELECT b into @b FROM test.t_slave;
--let $b_slave=`select @b`
-if (`SELECT $b_slave = $b_master`)
-{
- --echo Might be pure coincidence of two randoms from master and slave table. Don not panic yet.
-}
+--let $assert_text= Random values from master and slave must be different
+--let $assert_cond= $b_master != $b_slave
+--source include/assert.inc
# cleanup BUG#11754117
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_flush_logs.test b/mysql-test/suite/rpl/t/rpl_flush_logs.test
index 6e9de634157..1d19576d47c 100644
--- a/mysql-test/suite/rpl/t/rpl_flush_logs.test
+++ b/mysql-test/suite/rpl/t/rpl_flush_logs.test
@@ -31,8 +31,9 @@ connection master;
flush relay logs;
sync_slave_with_master;
---echo # Check the 'slave-relay-bin.000003' file is created
+--echo # Check the 'slave-relay-bin.000003' file is not created
--echo # after executed 'flush relay logs' statement.
+--error 1
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000003;
connection master;
@@ -89,10 +90,10 @@ file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001;
# Test 'flush error logs, relay logs' statement
sync_slave_with_master;
---echo # Make sure the 'slave-relay-bin.000006' file does not exist
+--echo # Make sure the 'slave-relay-bin.000005' file does not exist
--echo # exist before execute 'flush error logs, relay logs' statement.
--error 1
-file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000006;
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000005;
connection master;
@@ -107,19 +108,18 @@ file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000003;
sync_slave_with_master;
---echo # Check the 'slave-relay-bin.000006' file is created after
+--echo # Check the 'slave-relay-bin.000004' file is created after
--echo # execute 'flush error logs, relay logs' statement.
-file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000006;
-
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004;
# Test 'flush logs' statement
---echo # Make sure the 'slave-relay-bin.000007' and 'slave-relay-bin.000008'
+--echo # Make sure the 'slave-relay-bin.000005' and 'slave-relay-bin.000006'
--echo # files do not exist before execute 'flush error logs, relay logs'
--echo # statement.
--error 1
-file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007;
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000005;
--error 1
-file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008;
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000006;
connection master;
@@ -133,9 +133,9 @@ file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000003;
sync_slave_with_master;
---echo # Check the 'slave-relay-bin.000007' and 'slave-relay-bin.000008'
+--echo # Check the 'slave-relay-bin.000005' and 'slave-relay-bin.000006'
--echo # files are created after execute 'flush logs' statement.
-file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007;
-file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008;
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000005;
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000006;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
new file mode 100644
index 00000000000..251136a2fe1
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
@@ -0,0 +1,104 @@
+--source include/master-slave.inc
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+
+connection master;
+
+set @old_master_binlog_checksum= @@global.binlog_checksum;
+set @old_slave_dbug= @@global.debug_dbug;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (0);
+
+sync_slave_with_master;
+connection slave;
+
+--echo # Test slave with no capability gets dummy event, which is ignored.
+--source include/stop_slave.inc
+SET @@global.debug_dbug='+d,simulate_slave_capability_none';
+--source include/start_slave.inc
+connection master;
+# Add a dummy event just to have something to sync_slave_with_master on.
+# Otherwise we occasionally get different $relaylog_start, depending on
+# whether Format_description_log_event was written to relay log or not
+# at the time of SHOW SLAVE STATUS.
+ALTER TABLE t1 ORDER BY a;
+sync_slave_with_master;
+connection slave;
+let $relaylog_start= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
+
+connection master;
+SET SESSION binlog_annotate_row_events = ON;
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+# A short event, to test when we need to use user_var_event for dummy event.
+DELETE FROM t1;
+INSERT INTO t1 /* A comment just to make the annotate event sufficiently long that the dummy event will need to get padded with spaces so that we can test that this works */ VALUES(1);
+let $binlog_limit= 0, 10;
+--source include/show_binlog_events.inc
+sync_slave_with_master;
+connection slave;
+
+SELECT * FROM t1;
+let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
+let $binlog_start= $relaylog_start;
+let $binlog_limit=0,10;
+--source include/show_relaylog_events.inc
+set @@global.debug_dbug= @old_slave_dbug;
+
+--echo # Test dummy event is checksummed correctly.
+
+connection master;
+set @@global.binlog_checksum = CRC32;
+TRUNCATE t1;
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+INSERT INTO t1 VALUES(2);
+let $binlog_limit= 0, 5;
+--source include/show_binlog_events.inc
+sync_slave_with_master;
+connection slave;
+
+SELECT * FROM t1;
+let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
+let $binlog_start= 0;
+let $binlog_limit=5,5;
+--source include/show_relaylog_events.inc
+
+--echo # Test that slave which cannot tolerate holes in binlog stream but
+--echo # knows the event does not get dummy event
+
+--source include/stop_slave.inc
+SET @@global.debug_dbug='+d,simulate_slave_capability_old_53';
+--source include/start_slave.inc
+connection master;
+ALTER TABLE t1 ORDER BY a;
+sync_slave_with_master;
+connection slave;
+let $relaylog_start= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
+
+connection master;
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+UPDATE t1 SET a = 3;
+let $binlog_limit= 0, 5;
+--source include/show_binlog_events.inc
+sync_slave_with_master;
+connection slave;
+
+SELECT * FROM t1;
+let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
+let $binlog_start= $relaylog_start;
+let $binlog_limit=0,5;
+--source include/show_relaylog_events.inc
+
+select @@global.log_slave_updates;
+select @@global.replicate_annotate_row_events;
+
+set @@global.debug_dbug= @old_slave_dbug;
+
+--echo Clean up.
+connection master;
+set @@global.binlog_checksum = @old_master_binlog_checksum;
+DROP TABLE t1;
+sync_slave_with_master;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mdev382.test b/mysql-test/suite/rpl/t/rpl_mdev382.test
new file mode 100644
index 00000000000..5df382f6f06
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mdev382.test
@@ -0,0 +1,265 @@
+--source include/have_innodb.inc
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+
+# MDEV-382: multiple SQL injections in replication code.
+
+# Test previous SQL injection attack against binlog for SAVEPOINT statement.
+# The test would cause syntax error on slave due to improper quoting of
+# the savepoint name.
+connection master;
+create table t1 (a int primary key) engine=innodb;
+create table t2 (a int primary key) engine=myisam;
+
+begin;
+insert into t1 values (1);
+SET sql_mode = 'ANSI_QUOTES';
+savepoint `a``; create database couldbebadthingshere; savepoint ``dummy`;
+insert into t1 values (2);
+insert into t2 values (1);
+SET sql_mode = '';
+rollback to savepoint `a``; create database couldbebadthingshere; savepoint ``dummy`;
+insert into t1 values (3);
+commit;
+
+--source include/show_binlog_events2.inc
+
+# This failed due to syntax error in query when the bug was not fixed.
+sync_slave_with_master;
+connection slave;
+
+# Test some more combinations of ANSI_QUOTES and sql_quote_show_create
+connection master;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+BEGIN;
+insert into t1 values(10);
+set sql_mode = 'ANSI_QUOTES';
+set sql_quote_show_create = 1;
+savepoint a;
+insert into t1 values(11);
+savepoint "a""a";
+insert into t1 values(12);
+set sql_quote_show_create = 0;
+savepoint b;
+insert into t1 values(13);
+savepoint "b""b";
+insert into t1 values(14);
+set sql_mode = '';
+set sql_quote_show_create = 1;
+savepoint c;
+insert into t1 values(15);
+savepoint `c``c`;
+insert into t1 values(16);
+set sql_quote_show_create = 0;
+savepoint d;
+insert into t1 values(17);
+savepoint `d``d`;
+insert into t1 values(18);
+COMMIT;
+set sql_quote_show_create = 1;
+
+--source include/show_binlog_events2.inc
+
+--echo *** Test correct USE statement in SHOW BINLOG EVENTS ***
+connection master;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+set sql_mode = 'ANSI_QUOTES';
+CREATE DATABASE "db1`; select 'oops!'";
+use "db1`; select 'oops!'";
+CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM;
+INSERT INTO t1 VALUES (1);
+set sql_mode = '';
+INSERT INTO t1 VALUES (2);
+set sql_mode = 'ANSI_QUOTES';
+--source include/show_binlog_events2.inc
+set sql_mode = '';
+set sql_quote_show_create = 0;
+--source include/show_binlog_events2.inc
+set sql_quote_show_create = 1;
+--source include/show_binlog_events2.inc
+DROP TABLE t1;
+
+use test;
+
+--echo ***Test LOAD DATA INFILE with various identifiers that need correct quoting ***
+
+--let $load_file= $MYSQLTEST_VARDIR/tmp/f'le.txt
+--write_file $load_file
+'fo\\o','bar'
+EOF
+
+use `db1``; select 'oops!'`;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+set timestamp=1000000000;
+CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
+ `c``3` VARCHAR(7));
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/f''le.txt' INTO TABLE `t``1`
+ FIELDS TERMINATED BY ',' ESCAPED BY '\\\\' ENCLOSED BY ''''
+ LINES TERMINATED BY '\\n'
+ (`a``1`, @`b```) SET `b``2` = @`b```, `c``3` = concat('|', "b""a'z", "!");
+
+SELECT * FROM `t``1`;
+# Also test when code prefixes table name with database.
+truncate `t``1`;
+use test;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/f''le.txt'
+ INTO TABLE `db1``; select 'oops!'`.`t``1`
+ FIELDS TERMINATED BY ',' ESCAPED BY '\\\\' ENCLOSED BY ''''
+ LINES TERMINATED BY '\\n'
+ (`a``1`, `b``2`) SET `c``3` = concat('|', "b""a'z", "!");
+SELECT * FROM `db1``; select 'oops!'`.`t``1`;
+let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--source include/show_binlog_events2.inc
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_regex /LOCAL INFILE '.*SQL_LOAD.*' INTO/LOCAL INFILE '<name>' INTO/
+--exec $MYSQL_BINLOG --short-form --start-position=$binlog_start --stop-position=$pos2 $MYSQLD_DATADIR/master-bin.000001
+
+sync_slave_with_master;
+connection slave;
+SELECT * FROM `db1``; select 'oops!'`.`t``1`;
+connection master;
+
+DROP TABLE `db1``; select 'oops!'`.`t``1`;
+--remove_file $load_file
+
+connection master;
+drop table t1,t2;
+
+
+--echo *** Test truncation of long SET expression in LOAD DATA ***
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(1000));
+--let $load_file= $MYSQLTEST_VARDIR/tmp/file.txt
+--write_file $load_file
+1,X
+2,A
+EOF
+
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+# The bug was that the SET expression was truncated to 256 bytes, so test with
+# an expression longer than that.
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval LOAD DATA INFILE '$load_file' INTO TABLE t1
+ FIELDS TERMINATED BY ','
+ (a, @b) SET b = CONCAT(@b, '| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|', @b);
+
+SELECT * FROM t1 ORDER BY a;
+--source include/show_binlog_events2.inc
+
+sync_slave_with_master;
+connection slave;
+SELECT * FROM t1 ORDER BY a;
+
+connection master;
+--remove_file $load_file
+DROP TABLE t1;
+
+
+--echo *** Test user variables whose names require correct quoting ***
+use `db1``; select 'oops!'`;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100));
+INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100));
+SELECT @`a``1`:=a1, @`a``2`:=a2, @`a``3`:=a3, @`a``4`:=a4, @`b```:=b, @```c`:=c, @```d```:=d FROM t1;
+INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98));
+let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--source include/show_binlog_events2.inc
+
+--exec $MYSQL_BINLOG --short-form --start-position=$binlog_start --stop-position=$pos2 $MYSQLD_DATADIR/master-bin.000001
+
+sync_slave_with_master;
+connection slave;
+SELECT * FROM `db1``; select 'oops!'`.t1 ORDER BY a1;
+
+connection master;
+DROP TABLE t1;
+
+--echo *** Test correct quoting in foreign key error message ***
+use `db1``; select 'oops!'`;
+CREATE TABLE `t``1` ( `a``` INT PRIMARY KEY) ENGINE=innodb;
+CREATE TABLE `t``2` ( `b``` INT PRIMARY KEY, `c``` INT NOT NULL,
+ FOREIGN KEY fk (`c```) REFERENCES `t``1`(`a```)) ENGINE=innodb;
+--replace_regex /t@[0-9]+_ibfk_[0-9]+/INNODB_FOREIGN_KEY_NAME/
+--error ER_TRUNCATE_ILLEGAL_FK
+TRUNCATE `t``1`;
+DROP TABLE `t``2`;
+DROP TABLE `t``1`;
+
+
+--echo *** Test correct quoting of DELETE FROM statement binlogged for HEAP table that is emptied due to server restart
+
+# Let's keep the slave stopped during master restart, to avoid any potential
+# races between slave reconnect and master restart.
+connection slave;
+--source include/stop_slave.inc
+
+connection master;
+CREATE TABLE `db1``; select 'oops!'`.`t``1` (`a``` INT PRIMARY KEY) ENGINE=heap;
+INSERT INTO `db1``; select 'oops!'`.`t``1` VALUES (1), (2), (5);
+SELECT * FROM `db1``; select 'oops!'`.`t``1` ORDER BY 1;
+
+# Restart the master mysqld.
+# This will cause an implicit truncation of the memory-based table, which will
+# cause logging of an explicit DELETE FROM to binlog.
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait-rpl_mdev382.test
+EOF
+
+--shutdown_server 30
+
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart-rpl_mdev382.test
+EOF
+
+connection default;
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+# rpl_end.inc needs to use the connection server_1
+connection server_1;
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+connection master;
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+set timestamp=1000000000;
+
+--echo # The table should be empty on the master.
+let $binlog_file= master-bin.000002;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+SELECT * FROM `db1``; select 'oops!'`.`t``1`;
+
+--echo # The DELETE statement should be correctly quoted
+--source include/show_binlog_events2.inc
+
+connection slave;
+--source include/start_slave.inc
+
+connection master;
+sync_slave_with_master;
+connection slave;
+--echo # The table should be empty on the slave also.
+SELECT * FROM `db1``; select 'oops!'`.`t``1`;
+
+connection master;
+DROP TABLE `db1``; select 'oops!'`.`t``1`;
+sync_slave_with_master;
+
+
+connection master;
+use test;
+DROP DATABASE `db1``; select 'oops!'`;
+
+--echo *** Test correct quoting of mysqlbinlog --rewrite-db option ***
+CREATE TABLE t1 (a INT PRIMARY KEY);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+INSERT INTO t1 VALUES(1);
+--source include/show_binlog_events2.inc
+let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1);
+--exec $MYSQL_BINLOG --short-form --start-position=$binlog_start --stop-position=$pos2 --rewrite-db='test->ts`et' $MYSQLD_DATADIR/master-bin.000002
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_packet-slave.opt b/mysql-test/suite/rpl/t/rpl_packet-slave.opt
index 412bc079caa..1aed7d07572 100644
--- a/mysql-test/suite/rpl/t/rpl_packet-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_packet-slave.opt
@@ -1 +1 @@
---max_allowed_packet=1024 --net_buffer_length=1024
+--max_allowed_packet=1024 --net_buffer_length=1024 --slave_max_allowed_packet=1024
diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test
index 4f296fed68e..c49d9490bd9 100644
--- a/mysql-test/suite/rpl/t/rpl_packet.test
+++ b/mysql-test/suite/rpl/t/rpl_packet.test
@@ -11,9 +11,8 @@
# max-out size db name
source include/master-slave.inc;
source include/have_binlog_format_row.inc;
-call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153");
-call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:");
-
+call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, Error_code: 1153");
+call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
disable_warnings;
eval drop database if exists $db;
@@ -23,6 +22,7 @@ eval create database $db;
connection master;
let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`;
let $old_net_buffer_length= `SELECT @@global.net_buffer_length`;
+let $old_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`;
SET @@global.max_allowed_packet=1024;
SET @@global.net_buffer_length=1024;
@@ -123,11 +123,9 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), R
connection slave;
# The slave I/O thread must stop after receiving
-# 1236=ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master.
---let $slave_io_errno= 1236
-
-# Mask line numbers
---let $slave_io_error_replace= / at [0-9]*/ at XXX/
+# 1153 = ER_NET_PACKET_TOO_LARGE
+--let $slave_io_errno= 1153
+--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc
# Remove the bad binlog and clear error status on slave.
@@ -167,6 +165,7 @@ connection master;
DROP TABLE t1;
eval SET @@global.max_allowed_packet= $old_max_allowed_packet;
eval SET @@global.net_buffer_length= $old_net_buffer_length;
+eval SET @@global.slave_max_allowed_packet= $old_slave_max_allowed_packet;
# slave is stopped
connection slave;
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
index c9c8f043668..ab388f3eebc 100644
--- a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
@@ -21,6 +21,16 @@
connection slave;
--let $connection_id=`SELECT id FROM information_schema.processlist where state LIKE 'Waiting for master to send event'`
+if(!$connection_id)
+{
+ # Something went wrong (timing)
+ # Show process list so that we can debug. In this case we will abort with
+ # wrong result
+ -- echo "Could not find connect id. Dumping process list for debugging"
+ SELECT * FROM information_schema.processlist;
+ exit;
+}
+
set @time_before_kill := (select CURRENT_TIMESTAMP);
--echo [Time before the query]
diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test
index e2974a21bf7..723fa3e44e2 100644
--- a/mysql-test/suite/rpl/t/rpl_trigger.test
+++ b/mysql-test/suite/rpl/t/rpl_trigger.test
@@ -3,13 +3,10 @@
# Adding statement include due to Bug 12574
# TODO: Remove statement include once 12574 is patched
--source include/have_binlog_format_mixed_or_statement.inc
---source include/master-slave.inc
---source include/have_innodb.inc
-connection slave;
--source include/have_innodb.inc
+--source include/master-slave.inc
connection master;
-
disable_query_log;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
enable_query_log;
@@ -26,7 +23,7 @@ DROP TABLE IF EXISTS t3;
#
create table t1 (a int auto_increment, primary key (a), b int, rand_value double not null);
-create table t2 (a int auto_increment, primary key (a), b int);
+create table t2 (a int auto_increment, primary key (a), b int) engine=innodb;
create table t3 (a int auto_increment, primary key (a), name varchar(64) not null, old_a int, old_b int, rand_value double not null);
delimiter |;
diff --git a/mysql-test/suite/storage_engine/1st.result b/mysql-test/suite/storage_engine/1st.result
new file mode 100644
index 00000000000..6b686c2b2b4
--- /dev/null
+++ b/mysql-test/suite/storage_engine/1st.result
@@ -0,0 +1,11 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW CREATE TABLE t1;
+SHOW COLUMNS IN t1;
+INSERT INTO t1 VALUES (1,'a');
+INSERT INTO t1 (a,b) VALUES (2,'b');
+SELECT * FROM t1;
+a b
+1 a
+2 b
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/1st.test b/mysql-test/suite/storage_engine/1st.test
new file mode 100644
index 00000000000..af7a4503948
--- /dev/null
+++ b/mysql-test/suite/storage_engine/1st.test
@@ -0,0 +1,81 @@
+#
+# This test checks some very basic capabilities
+# which will be used in almost every other test,
+# and will not be checked through support* variables.
+# If this test does not pass, there is no point
+# at executing other ones.
+#
+# Minimal requirements:
+# - supported column types: INT, CHAR (default CHAR(8), INT(11));
+# - column attributes as declared in define_engine.inc ($default_col_opts)
+# (by default empty, which means no additional attributes apart from the type);
+# - table attributes as declared in define_engine.inc ($default_tbl_opts)
+# (by default empty, which means no additional attributes apart from ENGINE);
+# - CREATE TABLE .. (column1 <column options>, column2 <column options>) ENGINE=<storage_engine>;
+# - INSERT INTO TABLE .. VALUES (val1,val2);
+# - DROP TABLE ..
+# - SELECT * FROM ..
+# - SHOW CREATE TABLE ..
+# - SHOW COLUMNS IN ...
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = CREATE TABLE
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --disable_result_log
+ SHOW CREATE TABLE t1;
+ if ($mysql_errname)
+ {
+ --let $functionality = SHOW CREATE TABLE
+ --source unexpected_result.inc
+ }
+ SHOW COLUMNS IN t1;
+ if ($mysql_errname)
+ {
+ --let $functionality = SHOW COLUMNS
+ --source unexpected_result.inc
+ }
+ --enable_result_log
+
+ INSERT INTO t1 VALUES (1,'a');
+ if ($mysql_errname)
+ {
+ --let $functionality = INSERT INTO .. VALUES
+ --source unexpected_result.inc
+ }
+
+ INSERT INTO t1 (a,b) VALUES (2,'b');
+ if ($mysql_errname)
+ {
+ --let $functionality = INSERT INTO .. (column_list) VALUES
+ --source unexpected_result.inc
+ }
+
+ SELECT * FROM t1;
+ if ($mysql_errname)
+ {
+ --let $functionality = SELECT * FROM ..
+ --source unexpected_result.inc
+ }
+
+ DROP TABLE t1;
+ if ($mysql_errname)
+ {
+ --let $functionality = DROP TABLE
+ --source unexpected_result.inc
+ }
+
+}
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/alter_table.inc b/mysql-test/suite/storage_engine/alter_table.inc
new file mode 100644
index 00000000000..0f78c597455
--- /dev/null
+++ b/mysql-test/suite/storage_engine/alter_table.inc
@@ -0,0 +1,91 @@
+##################################
+#
+# This include file will be used for all ALTER TABLE statements in the suite.
+# If you need to add additional steps or change the logic, copy the file
+# to storage/<engine>/mysql-test/storage_engine/ folder and modify it there.
+#
+##################
+#
+# Parameters:
+#
+# --let $alter_definition = <alter definition> # mandatory, everything that goes after the table name in ALTER statement
+# --let $table_name = <table name> # optional, default t1
+# --let $error_codes = <expected error codes, as in --error> # optional, default 0
+# --let $online = [0|1] # optional, default 0 (1 adds ONLINE)
+# --let $rename_to = <new table name> # optional, default empty.
+# # If set, means we are running RENAME TO, then alter definition is ignored
+#
+# Usage examples:
+#
+# --let $alter_definition = ADD COLUMN b $char_col DEFAULT ''
+#
+
+if ($rename_to)
+{
+ --let $alter_definition = RENAME TO $rename_to
+}
+
+if (!$alter_definition)
+{
+ --die # The ALTER statement is empty
+}
+
+--let $alter_statement = ALTER
+
+if ($online)
+{
+ --let $alter_statement = $alter_statement ONLINE
+}
+
+if (!$table_name)
+{
+ --let $table_name = t1
+}
+
+--let $alter_statement = $alter_statement TABLE $table_name $alter_definition
+
+
+# We now have the complete ALTER statement in $alter_statement.
+# If your ALTER statement should be composed differently,
+# modify the logic above.
+
+#####################
+# Here you can add logic needed BEFORE the main statement
+# (e.g. base tables need to be altered, etc.).
+# Surround it by --disable_query_log/--enable_query_log
+# if you don't want it to appear in the result output.
+#####################
+
+--source obfuscate.inc
+
+eval $alter_statement;
+--source check_errors.inc
+
+# Make sure you don't add any statements between the main ALTER (above)
+# and saving mysql_errno and mysql_errname (below)
+# They are saved in case you want to add more logic after the main ALTER,
+# because we need the result code of the statement.
+# Also, do not change $alter_statement after it is executed!
+
+--let $my_errno = $mysql_errno
+--let $my_errname = $mysql_errname
+
+#####################
+# Here you can add logic needed AFTER the main statement.
+# Surround it by --disable_query_log/--enable_query_log
+# if you don't want it to appear in the result output.
+#####################
+
+# Unset the parameters, we don't want them to be accidentally reused later
+--let $alter_definition =
+--let $table_name =
+--let $error_codes =
+--let $online = 0
+--let $rename_to =
+
+# Restore the error codes of the main statement
+--let $mysql_errno = $my_errno
+--let $mysql_errname = $my_errname
+# Make sure you don't add any SQL statements after restoring
+# mysql_errno and mysql_errname (above)
+
diff --git a/mysql-test/suite/storage_engine/alter_table.result b/mysql-test/suite/storage_engine/alter_table.result
new file mode 100644
index 00000000000..6d868a27a36
--- /dev/null
+++ b/mysql-test/suite/storage_engine/alter_table.result
@@ -0,0 +1,147 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,c) VALUES (1,'a'),(5,'z');
+ALTER TABLE t1 ADD COLUMN b <INT_COLUMN>;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `c` char(8) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 ALTER COLUMN a SET DEFAULT '0';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT '0',
+ `c` char(8) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 ALTER a DROP DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11),
+ `c` char(8) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 CHANGE COLUMN b b1 <CHAR_COLUMN> FIRST;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `b1` char(8) DEFAULT NULL,
+ `a` int(11),
+ `c` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 CHANGE b1 b <INT_COLUMN> AFTER c;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11),
+ `c` char(8) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 CHANGE b b <CHAR_COLUMN>;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11),
+ `c` char(8) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 MODIFY COLUMN b <INT_COLUMN>;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11),
+ `c` char(8) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 MODIFY COLUMN b <CHAR_COLUMN> FIRST;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `b` char(8) DEFAULT NULL,
+ `a` int(11),
+ `c` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 MODIFY COLUMN b <INT_COLUMN> AFTER a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11),
+ `b` int(11) DEFAULT NULL,
+ `c` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 DROP COLUMN b;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11),
+ `c` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 RENAME TO t2;
+SHOW CREATE TABLE t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11),
+ `c` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,5),(2,2),(4,3);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 ORDER BY b ASC, a DESC;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+a b
+2 2
+4 3
+1 5
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHARACTER SET latin1 COLLATE latin1_general_cs;
+INSERT INTO t1 (a,b,c) VALUES (5,'z','t');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) COLLATE latin1_general_cs DEFAULT NULL,
+ `c` char(8) COLLATE latin1_general_cs DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
+ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL,
+ `c` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8
+ALTER TABLE t1 DEFAULT CHARACTER SET = latin1 COLLATE latin1_general_ci;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) CHARACTER SET utf8 DEFAULT NULL,
+ `c` char(8) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
+ALTER TABLE t1 FORCE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) CHARACTER SET utf8 DEFAULT NULL,
+ `c` char(8) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/alter_table.test b/mysql-test/suite/storage_engine/alter_table.test
new file mode 100644
index 00000000000..023d8927e16
--- /dev/null
+++ b/mysql-test/suite/storage_engine/alter_table.test
@@ -0,0 +1,148 @@
+#
+# Basic ALTER TABLE statements.
+#
+# USAGE of table options in ALTER statements
+# is covered in tbl_standard_opts and tbl_opt*.tests.
+#
+# Index operations are covered in index* tests.
+#
+# ALTER ONLINE syntax is covered in alter_online_table.test
+# ALTER OFFLINE is not covered as it is not supported, as of 5.5.23
+#
+# ALTER TABLE ... DISCARD|IMPORT TABLESPACE is covered in alter_tablespace.test
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+--let $create_definition = a $int_col, c $char_col
+--source create_table.inc
+INSERT INTO t1 (a,c) VALUES (1,'a'),(5,'z');
+
+# Column operations
+
+--let $alter_definition = ADD COLUMN b $int_col
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = ALTER COLUMN a SET DEFAULT '0'
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = ALTER a DROP DEFAULT
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = CHANGE COLUMN b b1 $char_col FIRST
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = CHANGE b1 b $int_col AFTER c
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = CHANGE b b $char_col
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = MODIFY COLUMN b $int_col
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = MODIFY COLUMN b $char_col FIRST
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = MODIFY COLUMN b $int_col AFTER a
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = DROP COLUMN b
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+
+# Rename table
+
+--let $rename_to = t2
+--source alter_table.inc
+--let $error_codes = ER_NO_SUCH_TABLE
+SHOW CREATE TABLE t1;
+--source check_errors.inc
+if ($mysql_errname != 'ER_NO_SUCH_TABLE')
+{
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ DROP TABLE t1;
+}
+if ($mysql_errname == ER_NO_SUCH_TABLE)
+{
+ --source mask_engine.inc
+ SHOW CREATE TABLE t2;
+ DROP TABLE t2;
+}
+
+# ORDER BY
+--let $create_definition = a $int_col, b $int_col
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,5),(2,2),(4,3);
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = ORDER BY b ASC, a DESC
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Character set, collate
+
+--let $table_options = CHARACTER SET latin1 COLLATE latin1_general_cs
+--let $create_definition = a $int_col, b $char_col, c $char_col
+--source create_table.inc
+INSERT INTO t1 (a,b,c) VALUES (5,'z','t');
+
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = CONVERT TO CHARACTER SET utf8
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = DEFAULT CHARACTER SET = latin1 COLLATE latin1_general_ci
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+# A 'null' ALTER operation
+
+--let $alter_definition = FORCE
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+# Cleanup
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/alter_table_online.result b/mysql-test/suite/storage_engine/alter_table_online.result
new file mode 100644
index 00000000000..0e606bf1f7e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/alter_table_online.result
@@ -0,0 +1,35 @@
+DROP TABLE IF EXISTS t1,t2,t3;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b,c) VALUES (1,100,'a'),(2,200,'b'),(3,300,'c');
+ALTER ONLINE TABLE t1 MODIFY b <INT_COLUMN> DEFAULT 5;
+ALTER ONLINE TABLE t1 CHANGE b new_name <INT_COLUMN>;
+ALTER ONLINE TABLE t1 COMMENT 'new comment';
+ALTER ONLINE TABLE t1 RENAME TO t2;
+DROP TABLE IF EXISTS t2;
+CREATE TEMPORARY TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
+ALTER ONLINE TABLE t1 MODIFY b <INT_COLUMN> DEFAULT 5;
+ERROR HY000: Can't execute the given 'ALTER' command as online
+ALTER ONLINE TABLE t1 CHANGE b new_name <INT_COLUMN>;
+ERROR HY000: Can't execute the given 'ALTER' command as online
+ALTER ONLINE TABLE t1 COMMENT 'new comment';
+ERROR HY000: Can't execute the given 'ALTER' command as online
+ALTER ONLINE TABLE t1 RENAME TO t2;
+ERROR HY000: Can't execute the given 'ALTER' command as online
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b,c) VALUES (1,100,'a'),(2,200,'b'),(3,300,'c');
+ALTER ONLINE TABLE t1 DROP COLUMN b, ADD b <INT_COLUMN>;
+ERROR HY000: Can't execute the given 'ALTER' command as online
+ALTER ONLINE TABLE t1 MODIFY b BIGINT <CUSTOM_COL_OPTIONS>;
+ERROR HY000: Can't execute the given 'ALTER' command as online
+ALTER ONLINE TABLE t1 ENGINE=MEMORY;
+ERROR HY000: Can't execute the given 'ALTER' command as online
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ALTER ONLINE TABLE t1 ADD INDEX (b);
+ERROR HY000: Can't execute the given 'ALTER' command as online
+ALTER TABLE t1 ADD INDEX (b);
+ALTER ONLINE TABLE t1 DROP INDEX b;
+ERROR HY000: Can't execute the given 'ALTER' command as online
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/alter_table_online.test b/mysql-test/suite/storage_engine/alter_table_online.test
new file mode 100644
index 00000000000..94dec2a72bb
--- /dev/null
+++ b/mysql-test/suite/storage_engine/alter_table_online.test
@@ -0,0 +1,160 @@
+#
+# ALTER ONLINE TABLE
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3;
+--enable_warnings
+
+#
+# Test of things that can be done online
+# We are repeating notification here, because for some engines
+# only a part of these ALTER ONLINE statements might be supported.
+#
+
+let $create_definition = a $int_col, b $int_col, c $char_col;
+--source create_table.inc
+
+INSERT INTO t1 (a,b,c) VALUES (1,100,'a'),(2,200,'b'),(3,300,'c');
+
+--let $online = 1
+--let $alter_definition = MODIFY b $int_col DEFAULT 5
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+
+--let $online = 1
+--let $alter_definition = CHANGE b new_name $int_col
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+
+--let $online = 1
+--let $alter_definition = COMMENT 'new comment'
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+
+--let $online = 1
+--let $rename_to = t2
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+ DROP TABLE t1;
+}
+DROP TABLE IF EXISTS t2;
+
+#
+# temporary tables always require a copy
+#
+
+--let $temporary = 1
+--source create_table.inc
+
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
+
+--let $error_codes = ER_CANT_DO_ONLINE
+--let $online = 1
+--let $alter_definition = MODIFY b $int_col DEFAULT 5
+--source alter_table.inc
+if ($mysql_errname != ER_CANT_DO_ONLINE)
+{
+ --source unexpected_result.inc
+}
+
+
+--let $error_codes = ER_CANT_DO_ONLINE
+--let $online = 1
+--let $alter_definition = CHANGE b new_name $int_col
+--source alter_table.inc
+
+--let $error_codes = ER_CANT_DO_ONLINE
+--let $online = 1
+--let $alter_definition = COMMENT 'new comment'
+--source alter_table.inc
+
+--let $error_codes = ER_CANT_DO_ONLINE
+--let $online = 1
+--let $rename_to = t2
+--source alter_table.inc
+
+DROP TABLE t1;
+
+#
+# Test of things that is not possible to do online
+#
+
+--let $create_definition = a $int_col, b $int_col, c $char_col
+--source create_table.inc
+
+INSERT INTO t1 (a,b,c) VALUES (1,100,'a'),(2,200,'b'),(3,300,'c');
+
+--let $error_codes = ER_CANT_DO_ONLINE
+--let $online = 1
+--let $alter_definition = DROP COLUMN b, ADD b $int_col
+--source alter_table.inc
+if ($mysql_errname!=ER_CANT_DO_ONLINE)
+{
+ --source unexpected_result.inc
+}
+
+--let $error_codes = ER_CANT_DO_ONLINE
+--let $online = 1
+--let $alter_definition = MODIFY b BIGINT $default_col_opts
+--source alter_table.inc
+
+--let $alternative_engine = `SELECT engine FROM information_schema.engines WHERE engine != '$storage_engine' AND support IN ('YES','DEFAULT')`
+
+--let $error_codes = ER_CANT_DO_ONLINE
+--let $online = 1
+--let $alter_definition = ENGINE=$alternative_engine
+--source alter_table.inc
+
+DROP TABLE t1;
+
+--let $create_definition = a $int_col, b $int_indexed_col, c $char_col
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Column options
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --let $error_codes = ER_CANT_DO_ONLINE
+ --let $online = 1
+ --let $alter_definition = ADD INDEX (b)
+ --source alter_table.inc
+ if ($mysql_errname!=ER_CANT_DO_ONLINE)
+ {
+ --let $functionality = Adding an index or ALTER ONLINE
+ --source unexpected_result.inc
+ }
+
+ --let $alter_definition = ADD INDEX (b)
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = Adding an index or ALTER TABLE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --let $error_codes = ER_CANT_DO_ONLINE
+ --let $online = 1
+ --let $alter_definition = DROP INDEX b
+ --source alter_table.inc
+ }
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
diff --git a/mysql-test/suite/storage_engine/alter_tablespace.result b/mysql-test/suite/storage_engine/alter_tablespace.result
new file mode 100644
index 00000000000..5d8709b2357
--- /dev/null
+++ b/mysql-test/suite/storage_engine/alter_tablespace.result
@@ -0,0 +1,19 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ALTER TABLE t1 DISCARD TABLESPACE;
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a) VALUES (1),(2);
+SELECT * FROM t1;
+a
+1
+2
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT * FROM t1;
+ERROR HY000: Got error -1 from storage engine
+ALTER TABLE t1 IMPORT TABLESPACE;
+SELECT * FROM t1;
+a
+1
+2
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/alter_tablespace.test b/mysql-test/suite/storage_engine/alter_tablespace.test
new file mode 100644
index 00000000000..6c429bb98ea
--- /dev/null
+++ b/mysql-test/suite/storage_engine/alter_tablespace.test
@@ -0,0 +1,91 @@
+#
+# IMPORT / DISCARD TABLESPACE
+#
+# The test might require additional engine options,
+# e.g. for InnoDB it is --innodb-file-per-table
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+--let $create_definition = a $int_col
+--source create_table.inc
+
+--let $alter_definition = DISCARD TABLESPACE
+
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = Tablespace operations
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ DROP TABLE t1;
+
+ --let $create_definition = a $int_col
+ --source create_table.inc
+ INSERT INTO t1 (a) VALUES (1),(2);
+ --sorted_result
+ SELECT * FROM t1;
+
+# http://dev.mysql.com/doc/mysql-enterprise-backup/3.5/en/partial.restoring.single.html
+# To get a "clean" backup we need to either use innobackup, or to monitor show engine innodb status,
+# and the documented conditions do not look exactly feasible. So, we will go a simple way:
+# just restart the server, and take the backup while the server is down.
+# (And we need to have a really clean backup, see MySQL:65429 / LP:1004910)
+
+ --let $datadir = `SELECT @@datadir`
+
+ --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+wait
+EOF
+
+ --enable_reconnect
+ --shutdown_server 60
+
+ --source include/wait_until_disconnected.inc
+
+ --replace_result $datadir <DATADIR>
+ --copy_file $datadir/test/t1.ibd $datadir/test/t1.ibd.save
+
+ --remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+ --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+
+ --source include/wait_until_connected_again.inc
+
+ --let $alter_definition = DISCARD TABLESPACE
+ --source alter_table.inc
+
+ --let $error_codes = ER_GET_ERRNO
+ SELECT * FROM t1;
+ --source check_errors.inc
+ if ($mysql_errname != ER_GET_ERRNO)
+ {
+ --let $functionality = Tablespace operations
+ --source unexpected_result.inc
+ }
+
+ --move_file $datadir/test/t1.ibd.save $datadir/test/t1.ibd
+ --let $alter_definition = IMPORT TABLESPACE
+ --source alter_table.inc
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Adding a warning suppression based on what InnoDB currently does
+ # when it attempts to access a table without an *.ibd file
+ --disable_query_log
+ eval CALL mtr.add_suppression('$storage_engine: Error:.*');
+ --enable_query_log
+}
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/analyze_table.inc b/mysql-test/suite/storage_engine/analyze_table.inc
new file mode 100644
index 00000000000..2cbfc17aaa9
--- /dev/null
+++ b/mysql-test/suite/storage_engine/analyze_table.inc
@@ -0,0 +1,43 @@
+#
+# ANALYZE TABLE statements
+#
+# Note: the output is likely to be different for the engine under test,
+# in which case rdiff will be needed. Or, the output might say that
+# the storage engine does not support ANALYZE.
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+--let $create_definition = a $int_col, b $char_col
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+--let $create_definition = a $int_col, b $char_col
+--let $table_name = t2
+--source create_table.inc
+
+INSERT INTO t1 (a,b) VALUES (3,'c');
+ANALYZE TABLE t1;
+INSERT INTO t2 (a,b) VALUES (4,'d');
+ANALYZE NO_WRITE_TO_BINLOG TABLE t2;
+INSERT INTO t1 (a,b) VALUES (5,'e');
+INSERT INTO t2 (a,b) VALUES (6,'f');
+ANALYZE LOCAL TABLE t1, t2;
+
+DROP TABLE t1, t2;
+
+--let $continue = 1
+--source have_default_index.inc
+
+if ($have_default_index)
+{
+ --let $create_definition = a $int_indexed_col, $default_index(a)
+ --source create_table.inc
+ INSERT INTO t1 (a) VALUES (1),(2),(4),(7);
+ ANALYZE TABLE t1;
+ INSERT INTO t1 (a) VALUES (8),(10),(11),(12);
+ ANALYZE TABLE t1;
+ DROP TABLE t1;
+}
+
diff --git a/mysql-test/suite/storage_engine/analyze_table.result b/mysql-test/suite/storage_engine/analyze_table.result
new file mode 100644
index 00000000000..42904ed334d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/analyze_table.result
@@ -0,0 +1,29 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (3,'c');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+INSERT INTO t2 (a,b) VALUES (4,'d');
+ANALYZE NO_WRITE_TO_BINLOG TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+INSERT INTO t1 (a,b) VALUES (5,'e');
+INSERT INTO t2 (a,b) VALUES (6,'f');
+ANALYZE LOCAL TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a) VALUES (1),(2),(4),(7);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+INSERT INTO t1 (a) VALUES (8),(10),(11),(12);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/analyze_table.test b/mysql-test/suite/storage_engine/analyze_table.test
new file mode 100644
index 00000000000..5222ec8af54
--- /dev/null
+++ b/mysql-test/suite/storage_engine/analyze_table.test
@@ -0,0 +1,14 @@
+#
+# ANALYZE TABLE statements
+#
+# Note: the output is likely to be different for the engine under test,
+# in which case rdiff will be needed. Or, the output might say that
+# the storage engine does not support ANALYZE.
+#
+
+--source have_engine.inc
+
+--source analyze_table.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/autoinc_secondary.result b/mysql-test/suite/storage_engine/autoinc_secondary.result
new file mode 100644
index 00000000000..ad2b43bc6fe
--- /dev/null
+++ b/mysql-test/suite/storage_engine/autoinc_secondary.result
@@ -0,0 +1,40 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN> AUTO_INCREMENT, b <CHAR_COLUMN>, PRIMARY KEY (a,b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (b) VALUES ('a'),('b'),('b'),('c'),('a');
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1
+SELECT * FROM t1;
+a b
+1 a
+2 b
+3 b
+4 c
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (a <CHAR_COLUMN>, b <INT_COLUMN> AUTO_INCREMENT, PRIMARY KEY (a,b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1
+SELECT * FROM t1;
+a b
+a 1
+a 2
+b 1
+b 2
+c 1
+DROP TABLE t1;
+CREATE TABLE t1 (a <CHAR_COLUMN>, b <INT_COLUMN> AUTO_INCREMENT, PRIMARY KEY (a,b), <CUSTOM_INDEX>(b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1
+SELECT * FROM t1;
+a b
+a 1
+a 5
+b 2
+b 3
+c 4
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/autoinc_secondary.test b/mysql-test/suite/storage_engine/autoinc_secondary.test
new file mode 100644
index 00000000000..8b95f1d859e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/autoinc_secondary.test
@@ -0,0 +1,73 @@
+#
+# AUTO_INCREMENT on a secondary column in a multi-part key
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# AUTO_INCREMENT is the primary column in a multiple-column index
+#
+
+--let $create_definition = a $int_col AUTO_INCREMENT, b $char_col, PRIMARY KEY (a,b)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Multi-part keys or PK or AUTO_INCREMENT (on a primary column)
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (b) VALUES ('a'),('b'),('b'),('c'),('a');
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+#
+# AUTO_INCREMENT is the secondary column in a multiple-column index
+#
+
+--let $create_definition = a $char_col, b $int_col AUTO_INCREMENT, PRIMARY KEY (a,b)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Multi-part keys or PK or AUTO_INCREMENT (on a secondary column)
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+# AUTO_INCREMENT is the secondary column in a multiple-column index,
+# and primary in another index
+#
+
+--let $create_definition = a $char_col, b $int_indexed_col AUTO_INCREMENT, PRIMARY KEY (a,b), $default_index(b)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Multi-part keys or AUTO_INCREMENT (on the secondary column) or multiple keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/autoinc_vars.result b/mysql-test/suite/storage_engine/autoinc_vars.result
new file mode 100644
index 00000000000..60e7d74a22a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/autoinc_vars.result
@@ -0,0 +1,55 @@
+DROP TABLE IF EXISTS t1;
+SET auto_increment_offset = 200;
+CREATE TABLE t1 (a <INT_COLUMN> AUTO_INCREMENT, b <CHAR_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c');
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1
+SELECT * FROM t1;
+a b
+1 a
+2 b
+3 c
+SET auto_increment_increment = 300;
+INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f');
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+200
+SELECT * FROM t1;
+a b
+1 a
+2 b
+200 d
+3 c
+500 e
+800 f
+SET auto_increment_increment = 50;
+INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i');
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+850
+SELECT * FROM t1;
+a b
+1 a
+2 b
+200 d
+3 c
+500 e
+800 f
+850 g
+900 h
+950 i
+DROP TABLE t1;
+SET auto_increment_increment = 500;
+SET auto_increment_offset = 300;
+CREATE TABLE t1 (a TINYINT <CUSTOM_COL_OPTIONS> AUTO_INCREMENT, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a) VALUES (NULL);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+127
+SELECT * FROM t1;
+a
+127
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/autoinc_vars.test b/mysql-test/suite/storage_engine/autoinc_vars.test
new file mode 100644
index 00000000000..ceafcd7138f
--- /dev/null
+++ b/mysql-test/suite/storage_engine/autoinc_vars.test
@@ -0,0 +1,68 @@
+#
+# auto-increment-offset and auto-increment-increment
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# auto_increment_offset
+SET auto_increment_offset = 200;
+--let $create_definition = a $int_indexed_col AUTO_INCREMENT, b $char_col, $default_index(a)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = AUTO_INCREMENT
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ # If auto_increment_offset is greater than auto_increment_increment,
+ # the offset is ignored
+ INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c');
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT * FROM t1;
+
+ # auto_increment_increment
+
+ SET auto_increment_increment = 300;
+ # offset should not be ignored anymore
+ INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f');
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT * FROM t1;
+
+ SET auto_increment_increment = 50;
+ INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i');
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+# offset is greater than the max value
+
+SET auto_increment_increment = 500;
+SET auto_increment_offset = 300;
+--let $create_definition = a TINYINT $default_col_indexed_opts AUTO_INCREMENT, $default_index(a)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = AUTO_INCREMENT
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a) VALUES (NULL);
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/autoincrement.result b/mysql-test/suite/storage_engine/autoincrement.result
new file mode 100644
index 00000000000..bc51a2a82af
--- /dev/null
+++ b/mysql-test/suite/storage_engine/autoincrement.result
@@ -0,0 +1,133 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN> AUTO_INCREMENT, b <CHAR_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `b` char(8) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+INSERT INTO t1 (b) VALUES ('a'),('b');
+SELECT * FROM t1 ORDER BY a;
+a b
+1 a
+2 b
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1
+INSERT INTO t1 (a,b) VALUES (NULL,'c'),(0,'d');
+SELECT * FROM t1 ORDER BY a;
+a b
+1 a
+2 b
+3 c
+4 d
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3
+SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
+INSERT INTO t1 (a,b) VALUES (NULL,'e');
+SELECT * FROM t1 ORDER BY a;
+a b
+1 a
+2 b
+3 c
+4 d
+5 e
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5
+INSERT INTO t1 (a,b) VALUES (0,'f');
+SELECT * FROM t1 ORDER BY a;
+a b
+0 f
+1 a
+2 b
+3 c
+4 d
+5 e
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5
+SET sql_mode = '<INITIAL_SQL_MODE>';
+SHOW TABLE STATUS FROM test 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 <STORAGE_ENGINE> # # # # # # # # 6 # # # # # # #
+INSERT INTO t1 (a,b) VALUES (6,'g'),(7,'h');
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5
+SHOW TABLE STATUS FROM test 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 # # # # # # # # # 8 # # # # # # #
+INSERT INTO t1 (a,b) VALUES (NULL,'i'),(9,'j');
+SELECT * FROM t1 ORDER BY a;
+a b
+0 f
+1 a
+2 b
+3 c
+4 d
+5 e
+6 g
+7 h
+8 i
+9 j
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+8
+SHOW TABLE STATUS FROM test 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 # # # # # # # # # 10 # # # # # # #
+INSERT INTO t1 (a,b) VALUES (20,'k');
+SHOW TABLE STATUS FROM test 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 # # # # # # # # # 21 # # # # # # #
+INSERT INTO t1 (a,b) VALUES (NULL,'l');
+SELECT * FROM t1 ORDER BY a;
+a b
+0 f
+1 a
+2 b
+3 c
+4 d
+5 e
+6 g
+7 h
+8 i
+9 j
+20 k
+21 l
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+21
+SHOW TABLE STATUS FROM test 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 # # # # # # # # # 22 # # # # # # #
+INSERT INTO t1 (a,b) VALUES (-5,'m');
+SELECT * FROM t1 ORDER BY a;
+a b
+-5 m
+0 f
+1 a
+2 b
+3 c
+4 d
+5 e
+6 g
+7 h
+8 i
+9 j
+20 k
+21 l
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN> AUTO_INCREMENT, b <CHAR_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> AUTO_INCREMENT = 100;
+INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b');
+SELECT * FROM t1;
+a b
+100 a
+101 b
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+100
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/autoincrement.test b/mysql-test/suite/storage_engine/autoincrement.test
new file mode 100644
index 00000000000..fb07ea55c57
--- /dev/null
+++ b/mysql-test/suite/storage_engine/autoincrement.test
@@ -0,0 +1,114 @@
+#
+# Basic AUTO_INCREMENT capabilities
+#
+
+--source have_engine.inc
+
+--let $skip = 1
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = a $int_indexed_col AUTO_INCREMENT, b $char_col, $default_index(a)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = AUTO_INCREMENT
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --source mask_engine.inc
+ SHOW CREATE TABLE t1;
+
+ # Automatic values
+
+ INSERT INTO t1 (b) VALUES ('a'),('b');
+ SELECT * FROM t1 ORDER BY a;
+ SELECT LAST_INSERT_ID();
+
+ INSERT INTO t1 (a,b) VALUES (NULL,'c'),(0,'d');
+ SELECT * FROM t1 ORDER BY a;
+ SELECT LAST_INSERT_ID();
+
+ let $sql_mode = `SELECT @@sql_mode`;
+ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
+
+ INSERT INTO t1 (a,b) VALUES (NULL,'e');
+ SELECT * FROM t1 ORDER BY a;
+ SELECT LAST_INSERT_ID();
+
+ INSERT INTO t1 (a,b) VALUES (0,'f');
+ SELECT * FROM t1 ORDER BY a;
+ SELECT LAST_INSERT_ID();
+
+ --replace_result $sql_mode <INITIAL_SQL_MODE>
+ eval SET sql_mode = '$sql_mode';
+
+ # SHOW TABLE STATUS shows the auto-increment value in column 11,
+ # that's all we need here and further
+ --source mask_engine.inc
+ --replace_column 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
+ SHOW TABLE STATUS FROM test LIKE 't1';
+
+ # Mix of automatic and explicit values
+
+ INSERT INTO t1 (a,b) VALUES (6,'g'),(7,'h');
+ SELECT LAST_INSERT_ID();
+
+ --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
+ SHOW TABLE STATUS FROM test LIKE 't1';
+
+
+ INSERT INTO t1 (a,b) VALUES (NULL,'i'),(9,'j');
+ SELECT * FROM t1 ORDER BY a;
+ SELECT LAST_INSERT_ID();
+
+ --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
+ SHOW TABLE STATUS FROM test LIKE 't1';
+
+ # Creating a gap in the sequence
+
+ INSERT INTO t1 (a,b) VALUES (20,'k');
+
+ --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
+ SHOW TABLE STATUS FROM test LIKE 't1';
+
+ INSERT INTO t1 (a,b) VALUES (NULL,'l');
+ SELECT * FROM t1 ORDER BY a;
+ SELECT LAST_INSERT_ID();
+
+ --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
+ SHOW TABLE STATUS FROM test LIKE 't1';
+
+ # Negative values: we will try to insert one just to check that it does not cause a crash,
+ # but won't check what happens to the sequence after that, since the behavior is undefined
+
+ INSERT INTO t1 (a,b) VALUES (-5,'m');
+ SELECT * FROM t1 ORDER BY a;
+
+ DROP TABLE t1;
+}
+
+# Autoincrement with table option AUTO_INCREMENT
+
+--let $create_definition = a $int_indexed_col AUTO_INCREMENT, b $char_col, $default_index(a)
+--let $table_options = AUTO_INCREMENT = 100
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = AUTO_INCREMENT column or table option
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b');
+ --sorted_result
+ SELECT * FROM t1;
+ SELECT LAST_INSERT_ID();
+ DROP TABLE t1;
+}
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/cache_index.result b/mysql-test/suite/storage_engine/cache_index.result
new file mode 100644
index 00000000000..c8cf0ce2090
--- /dev/null
+++ b/mysql-test/suite/storage_engine/cache_index.result
@@ -0,0 +1,69 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE t2 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> (b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CACHE INDEX t1 INDEX (a), t2 IN <CACHE_NAME>;
+ERROR HY000: Unknown key cache '<CACHE_NAME>'
+SET GLOBAL <CACHE_NAME>.key_buffer_size=128*1024;
+CACHE INDEX t1 INDEX (a), t2 IN <CACHE_NAME>;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+test.t2 assign_to_keycache status OK
+LOAD INDEX INTO CACHE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+test.t2 preload_keys status OK
+INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+SET GLOBAL <CACHE_NAME>.key_buffer_size=8*1024;
+LOAD INDEX INTO CACHE t1, t2 IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+test.t2 preload_keys status OK
+SET GLOBAL <CACHE_NAME>.key_cache_age_threshold = 100, <CACHE_NAME>.key_cache_block_size = 512, <CACHE_NAME>.key_cache_division_limit = 1, <CACHE_NAME>.key_cache_segments=2;
+INSERT INTO t1 (a,b) VALUES (5,'e'),(6,'f');
+LOAD INDEX INTO CACHE t1;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+SET GLOBAL new_<CACHE_NAME>.key_buffer_size=128*1024;
+CACHE INDEX t1 IN new_<CACHE_NAME>;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+LOAD INDEX INTO CACHE t1 IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+INSERT INTO t1 (a,b) VALUES (9,'i');
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> (a),
+<CUSTOM_INDEX> (b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CACHE INDEX t1 IN <CACHE_NAME>;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+LOAD INDEX INTO CACHE t1;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> a_b (a,b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CACHE INDEX t1 IN <CACHE_NAME>;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+LOAD INDEX INTO CACHE t1;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+DROP TABLE t1;
+SET GLOBAL <CACHE_NAME>.key_buffer_size=0;
+SET GLOBAL new_<CACHE_NAME>.key_buffer_size=0;
diff --git a/mysql-test/suite/storage_engine/cache_index.test b/mysql-test/suite/storage_engine/cache_index.test
new file mode 100644
index 00000000000..42ba9615a40
--- /dev/null
+++ b/mysql-test/suite/storage_engine/cache_index.test
@@ -0,0 +1,142 @@
+#
+# CACHE INDEX and LOAD INDEX INTO CACHE
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+
+# Due to ancient MySQL bug#16111 we need to generate a unique cache name
+--let $cache_name = `SELECT CONNECTION_ID()`
+--let $cache_name = my_cache_$cache_name
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+let $create_definition =
+ a $int_indexed_col,
+ b $char_col,
+ $default_index (a)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Indexes on INT columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ let $create_definition =
+ a $int_col,
+ b $char_indexed_col,
+ $default_index (b)
+ ;
+ let $table_name = t2;
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = Indexes on CHAR columns
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_result $cache_name <CACHE_NAME>
+ --let $error_codes = ER_UNKNOWN_KEY_CACHE
+ eval CACHE INDEX t1 INDEX (a), t2 IN $cache_name;
+ --source check_errors.inc
+ if ($mysql_errname != ER_UNKNOWN_KEY_CACHE)
+ {
+ --let $functionality = Key cache or indexes
+ --source unexpected_result.inc
+ }
+
+ --replace_result $cache_name <CACHE_NAME>
+ eval SET GLOBAL $cache_name.key_buffer_size=128*1024;
+ --replace_result $cache_name <CACHE_NAME>
+ eval CACHE INDEX t1 INDEX (a), t2 IN $cache_name;
+ if ($mysql_errname)
+ {
+ --let $functionality = Indexes
+ --source unexpected_result.inc
+ }
+
+ LOAD INDEX INTO CACHE t1, t2;
+ if ($mysql_errname)
+ {
+ --let $functionality = Indexes
+ --source unexpected_result.inc
+ }
+
+ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+ --replace_result $cache_name <CACHE_NAME>
+ eval SET GLOBAL $cache_name.key_buffer_size=8*1024;
+ LOAD INDEX INTO CACHE t1, t2 IGNORE LEAVES;
+
+ --replace_result $cache_name <CACHE_NAME>
+ eval SET GLOBAL $cache_name.key_cache_age_threshold = 100, $cache_name.key_cache_block_size = 512, $cache_name.key_cache_division_limit = 1, $cache_name.key_cache_segments=2;
+ INSERT INTO t1 (a,b) VALUES (5,'e'),(6,'f');
+ LOAD INDEX INTO CACHE t1;
+
+ --replace_result $cache_name <CACHE_NAME>
+ eval SET GLOBAL new_$cache_name.key_buffer_size=128*1024;
+ --replace_result $cache_name <CACHE_NAME>
+ eval CACHE INDEX t1 IN new_$cache_name;
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ LOAD INDEX INTO CACHE t1 IGNORE LEAVES;
+ INSERT INTO t1 (a,b) VALUES (9,'i');
+ DROP TABLE t2;
+ }
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ a $int_indexed_col,
+ b $char_indexed_col,
+ $default_index (a),
+ $default_index (b)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Multiple keys or indexes on INT or CHAR columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_result $cache_name <CACHE_NAME>
+ eval CACHE INDEX t1 IN $cache_name;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ LOAD INDEX INTO CACHE t1;
+
+ DROP TABLE t1;
+ let $create_definition =
+ a $int_indexed_col,
+ b $char_indexed_col,
+ $default_index a_b (a,b)
+ ;
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = Multi-part keys
+ --source unexpected_result.inc
+ }
+
+ --replace_result $cache_name <CACHE_NAME>
+ eval CACHE INDEX t1 IN $cache_name;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ LOAD INDEX INTO CACHE t1;
+
+ DROP TABLE t1;
+}
+
+# Cleanup
+
+--replace_result $cache_name <CACHE_NAME>
+eval SET GLOBAL $cache_name.key_buffer_size=0;
+--replace_result $cache_name <CACHE_NAME>
+eval SET GLOBAL new_$cache_name.key_buffer_size=0;
+
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/check_errors.inc b/mysql-test/suite/storage_engine/check_errors.inc
new file mode 100644
index 00000000000..e38ff2962f1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/check_errors.inc
@@ -0,0 +1,80 @@
+#
+# Since we run tests in disable_abort_on_error mode, we cannot use --error command,
+# and need to check the result manually.
+# Usage in a test:
+# --let $error_codes = <comma-separated list> # optional, default ''
+# --let $mysql_errname = <error name> # optional, default current $mysql_errname (from the last SQL command)
+# --let $mysql_errno = <error code> # optional, default current $mysql_errno (from the last SQL command)
+#
+
+if ($error_codes == '0')
+{
+ --let $error_codes =
+}
+if ($error_codes == '')
+{
+ if ($mysql_errname)
+ {
+ --echo # ERROR: Statement ended with errno $mysql_errno, errname $mysql_errname (expected to succeed)
+ }
+
+ # If both error_codes and mysql_errname are false, all is good, no logic needed
+}
+
+if ($error_codes != '')
+{
+ # If mysql_errname or mysql_errno is equal to $error_codes, it's good too, nothing to do
+
+ if ($mysql_errname != $error_codes)
+ {
+ if ($mysql_errno != $error_codes)
+ {
+ --let $save_errno = $mysql_errno
+ --let $save_errname = $mysql_errname
+
+ --let $codeline = `SELECT CONCAT('\'',REPLACE('$error_codes',',','\',\''),'\'')`
+ --let $result = `SELECT '$save_errname' IN($codeline) or '$save_errno' IN ($codeline)`
+
+ --let $mysql_errno = $save_errno
+ --let $mysql_errname = $save_errname
+
+ if (!$result)
+ {
+ if ($mysql_errname)
+ {
+ --echo # ERROR: Statement ended with errno $mysql_errno, errname $mysql_errname (expected results: $error_codes)
+ }
+ if (!$mysql_errname)
+ {
+ --echo # ERROR: Statement succeeded (expected results: $error_codes)
+ }
+ }
+ # If a list contained more than one error, it could be on one of two reasons:
+ # first, we do not care which code it is, as long as it is one of the listed errors.
+ # In this case we will suggest to add an rdiff file if the message differs.
+ # Second, check_errors might be called from a generalized include file or test,
+ # which runs with different parameters and thus might produce different results for the same statement.
+ # Then, the message will be stricter, as the difference with the result file is actually a problem
+ # which needs to be checked at least.
+ if ($result)
+ {
+ if (!$strict_check)
+ {
+ --echo # Statement ended with one of expected results ($error_codes).
+ --echo # If you got a difference in error message, just add it to rdiff file
+ }
+ if ($strict_check)
+ {
+ --echo # WARNING: Statement ended with errno $mysql_errno, errname '$mysql_errname'.
+ --echo # If it differs from the result file, it might indicate a problem.
+ }
+
+ }
+ }
+ }
+}
+
+# Don't want the variables to be accidentally reused later
+--let $error_codes =
+--let $strict_check =
+
diff --git a/mysql-test/suite/storage_engine/check_table.inc b/mysql-test/suite/storage_engine/check_table.inc
new file mode 100644
index 00000000000..54bdf511cb8
--- /dev/null
+++ b/mysql-test/suite/storage_engine/check_table.inc
@@ -0,0 +1,62 @@
+#
+# CHECK TABLE statements
+#
+# Note: the output is likely to be different for the engine under test,
+# in which case rdiff will be needed. Or, the output might say that
+# the storage engine does not support CHECK.
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+--let $create_definition = a $int_col, b $char_col
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+
+--let $table_name = t2
+--let $create_definition = a $int_col, b $char_col
+--source create_table.inc
+
+CHECK TABLE t1;
+INSERT INTO t1 (a,b) VALUES (3,'c');
+INSERT INTO t2 (a,b) VALUES (4,'d');
+CHECK TABLE t1, t2 FOR UPGRADE;
+INSERT INTO t2 (a,b) VALUES (5,'e');
+CHECK TABLE t2 QUICK;
+INSERT INTO t1 (a,b) VALUES (6,'f');
+CHECK TABLE t1 FAST;
+INSERT INTO t1 (a,b) VALUES (7,'g');
+INSERT INTO t2 (a,b) VALUES (8,'h');
+CHECK TABLE t2, t1 MEDIUM;
+INSERT INTO t1 (a,b) VALUES (9,'i');
+INSERT INTO t2 (a,b) VALUES (10,'j');
+CHECK TABLE t1, t2 EXTENDED;
+INSERT INTO t1 (a,b) VALUES (11,'k');
+CHECK TABLE t1 CHANGED;
+
+DROP TABLE t1, t2;
+
+--let $continue = 1
+--source have_default_index.inc
+if ($have_default_index)
+{
+ --let $create_definition = a $int_indexed_col, $default_index(a)
+ --source create_table.inc
+ INSERT INTO t1 (a) VALUES (1),(2),(5);
+ CHECK TABLE t1;
+ INSERT INTO t1 (a) VALUES (6),(8),(12);
+ CHECK TABLE t1 FOR UPGRADE;
+ INSERT INTO t1 (a) VALUES (13),(15),(16);
+ CHECK TABLE t1 QUICK;
+ INSERT INTO t1 (a) VALUES (17),(120),(132);
+ CHECK TABLE t1 FAST;
+ INSERT INTO t1 (a) VALUES (801),(900),(7714);
+ CHECK TABLE t1 MEDIUM;
+ INSERT INTO t1 (a) VALUES (8760),(10023),(12000);
+ CHECK TABLE t1 EXTENDED;
+ INSERT INTO t1 (a) VALUES (13345),(24456),(78302),(143028);
+ CHECK TABLE t1 CHANGED;
+ DROP TABLE t1;
+}
+
diff --git a/mysql-test/suite/storage_engine/check_table.result b/mysql-test/suite/storage_engine/check_table.result
new file mode 100644
index 00000000000..83c32778959
--- /dev/null
+++ b/mysql-test/suite/storage_engine/check_table.result
@@ -0,0 +1,68 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a,b) VALUES (3,'c');
+INSERT INTO t2 (a,b) VALUES (4,'d');
+CHECK TABLE t1, t2 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+test.t2 check status OK
+INSERT INTO t2 (a,b) VALUES (5,'e');
+CHECK TABLE t2 QUICK;
+Table Op Msg_type Msg_text
+test.t2 check status OK
+INSERT INTO t1 (a,b) VALUES (6,'f');
+CHECK TABLE t1 FAST;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a,b) VALUES (7,'g');
+INSERT INTO t2 (a,b) VALUES (8,'h');
+CHECK TABLE t2, t1 MEDIUM;
+Table Op Msg_type Msg_text
+test.t2 check status OK
+test.t1 check status OK
+INSERT INTO t1 (a,b) VALUES (9,'i');
+INSERT INTO t2 (a,b) VALUES (10,'j');
+CHECK TABLE t1, t2 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+test.t2 check status OK
+INSERT INTO t1 (a,b) VALUES (11,'k');
+CHECK TABLE t1 CHANGED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a) VALUES (1),(2),(5);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (6),(8),(12);
+CHECK TABLE t1 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (13),(15),(16);
+CHECK TABLE t1 QUICK;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (17),(120),(132);
+CHECK TABLE t1 FAST;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (801),(900),(7714);
+CHECK TABLE t1 MEDIUM;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (8760),(10023),(12000);
+CHECK TABLE t1 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (13345),(24456),(78302),(143028);
+CHECK TABLE t1 CHANGED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/check_table.test b/mysql-test/suite/storage_engine/check_table.test
new file mode 100644
index 00000000000..243c8e07161
--- /dev/null
+++ b/mysql-test/suite/storage_engine/check_table.test
@@ -0,0 +1,14 @@
+#
+# CHECK TABLE statements
+#
+# Note: the output is likely to be different for the engine under test,
+# in which case rdiff will be needed. Or, the output might say that
+# the storage engine does not support CHECK.
+#
+
+--source have_engine.inc
+
+--source check_table.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/checksum_table.inc b/mysql-test/suite/storage_engine/checksum_table.inc
new file mode 100644
index 00000000000..d4bacce93b7
--- /dev/null
+++ b/mysql-test/suite/storage_engine/checksum_table.inc
@@ -0,0 +1,31 @@
+#
+# CHECKSUM TABLE statements for standard CHECKSUM properties.
+# Live checksums are covered in checksum_table_live.test
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+# For most engines CHECKSUM=0 option will be ignored,
+# but we are setting it here for those which have it 1 by default
+# (there will be another test for live checksum)
+
+--let $table_options = CHECKSUM=0
+--let $create_definition = a $int_col, b $char_col
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+
+--let $table_name = t2
+--let $table_options = CHECKSUM=0
+--let $create_definition = a $int_col, b $char_col
+--source create_table.inc
+
+CHECKSUM TABLE t1;
+CHECKSUM TABLE t2, t1;
+CHECKSUM TABLE t1, t2 QUICK;
+CHECKSUM TABLE t1, t2 EXTENDED;
+
+DROP TABLE t1, t2;
+
+
diff --git a/mysql-test/suite/storage_engine/checksum_table.result b/mysql-test/suite/storage_engine/checksum_table.result
new file mode 100644
index 00000000000..02d70491fa9
--- /dev/null
+++ b/mysql-test/suite/storage_engine/checksum_table.result
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=0;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=0;
+CHECKSUM TABLE t1;
+Table Checksum
+test.t1 4272806499
+CHECKSUM TABLE t2, t1;
+Table Checksum
+test.t2 0
+test.t1 4272806499
+CHECKSUM TABLE t1, t2 QUICK;
+Table Checksum
+test.t1 NULL
+test.t2 NULL
+CHECKSUM TABLE t1, t2 EXTENDED;
+Table Checksum
+test.t1 4272806499
+test.t2 0
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/checksum_table.test b/mysql-test/suite/storage_engine/checksum_table.test
new file mode 100644
index 00000000000..5693e9a1ad3
--- /dev/null
+++ b/mysql-test/suite/storage_engine/checksum_table.test
@@ -0,0 +1,11 @@
+#
+# CHECKSUM TABLE statements for standard CHECKSUM properties.
+# Live checksums are covered in checksum_table_live.test
+#
+
+--source have_engine.inc
+
+--source checksum_table.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/checksum_table_live.inc b/mysql-test/suite/storage_engine/checksum_table_live.inc
new file mode 100644
index 00000000000..9614494e620
--- /dev/null
+++ b/mysql-test/suite/storage_engine/checksum_table_live.inc
@@ -0,0 +1,30 @@
+#
+# CHECKSUM TABLE statements for live CHECKSUM.
+#
+# Note: the feature is likely to be unsupported, in which case
+# instead of numeric values some CHECKSUMs will produce NULL
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+# For most engines CHECKSUM=1 option will be ignored,
+# and the results will be different
+
+--let $table_options = CHECKSUM=1
+--let $create_definition = a $int_col, b $char_col
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+--let $table_name = t2
+--let $table_options = CHECKSUM=1
+--let $create_definition = a $int_col, b $char_col
+--source create_table.inc
+
+CHECKSUM TABLE t1;
+CHECKSUM TABLE t2, t1;
+CHECKSUM TABLE t1, t2 QUICK;
+CHECKSUM TABLE t1, t2 EXTENDED;
+
+DROP TABLE t1, t2;
+
diff --git a/mysql-test/suite/storage_engine/checksum_table_live.result b/mysql-test/suite/storage_engine/checksum_table_live.result
new file mode 100644
index 00000000000..59ab8f1688a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/checksum_table_live.result
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=1;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=1;
+CHECKSUM TABLE t1;
+Table Checksum
+test.t1 4272806499
+CHECKSUM TABLE t2, t1;
+Table Checksum
+test.t2 0
+test.t1 4272806499
+CHECKSUM TABLE t1, t2 QUICK;
+Table Checksum
+test.t1 4272806499
+test.t2 0
+CHECKSUM TABLE t1, t2 EXTENDED;
+Table Checksum
+test.t1 4272806499
+test.t2 0
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/checksum_table_live.test b/mysql-test/suite/storage_engine/checksum_table_live.test
new file mode 100644
index 00000000000..347755f24df
--- /dev/null
+++ b/mysql-test/suite/storage_engine/checksum_table_live.test
@@ -0,0 +1,13 @@
+#
+# CHECKSUM TABLE statements for live CHECKSUM.
+#
+# Note: the feature is likely to be unsupported, in which case
+# instead of numeric values some CHECKSUMs will produce NULL
+#
+
+--source have_engine.inc
+
+--source checksum_table_live.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/cleanup_engine.inc b/mysql-test/suite/storage_engine/cleanup_engine.inc
new file mode 100644
index 00000000000..de3d57eeaeb
--- /dev/null
+++ b/mysql-test/suite/storage_engine/cleanup_engine.inc
@@ -0,0 +1,11 @@
+###########################################
+#
+# This is a stub of the include file cleanup_engine.inc which
+# should be placed in storage/<engine>/mysql-test/storage_engine folder.
+#
+################################
+#
+# Here you can add whatever is needed to cleanup
+# in case your define_engine.inc created any artefacts,
+# e.g. an additional schema and/or tables.
+
diff --git a/mysql-test/suite/storage_engine/col_not_null.inc b/mysql-test/suite/storage_engine/col_not_null.inc
new file mode 100644
index 00000000000..5f980b0a915
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_not_null.inc
@@ -0,0 +1,92 @@
+#
+# NOT NULL attribute in columns
+#
+# Usage:
+# let $col_definition = <column type (and possibly more options)>;
+# let $col_default = <default non-null value for a column>;
+# --source col_not_null.inc
+#
+# We will add NOT NULL at the end of $col;
+#
+# Also, if $col_default is defined,
+# we will create a table with 2 columns
+# (one with DEFAULT $col_default, and one without any default),
+# and will also attempt to add a column with DEFAULT NULL.
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = c $col_definition NOT NULL
+--source create_table.inc
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ SHOW COLUMNS IN t1;
+
+ --let $error_codes = ER_BAD_NULL_ERROR
+ INSERT INTO t1 (c) VALUES (NULL);
+ --source check_errors.inc
+
+ DROP TABLE t1;
+}
+
+if ($col_default != '')
+{
+ let $create_definition =
+ c $col_definition NOT NULL,
+ c2 $col_definition NOT NULL DEFAULT $col_default
+ ;
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ SHOW COLUMNS IN t1;
+
+ --let $error_codes = ER_INVALID_DEFAULT
+ --let $alter_definition = ADD COLUMN err $col_definition NOT NULL DEFAULT NULL
+ --source alter_table.inc
+ if ($mysql_errname != ER_INVALID_DEFAULT)
+ {
+ --let $functionality = ALTER or DEFAULT
+ --source unexpected_result.inc
+ }
+
+ --let $error_codes = ER_BAD_NULL_ERROR
+ INSERT INTO t1 (c) VALUES (NULL);
+ --source check_errors.inc
+ if ($mysql_errname != ER_BAD_NULL_ERROR)
+ {
+ --let $functionality = NOT NULL columns
+ --source unexpected_result.inc
+ }
+
+ # HEX should be universal for all column types
+ SELECT HEX(c), HEX(c2) FROM t1;
+
+ --let $error_codes = ER_BAD_NULL_ERROR
+ INSERT INTO t1 (c2) VALUES (NULL);
+ --source check_errors.inc
+
+ --eval INSERT INTO t1 (c) VALUES ($col_default)
+ if ($mysql_errname)
+ {
+ --let $functionality = DEFAULT
+ --source unexpected_result.inc
+ }
+ SELECT COUNT(c), COUNT(c2) FROM t1;
+
+ DROP TABLE t1;
+ }
+}
+
+# We don't want to preserve it
+let $col_default = ;
+
diff --git a/mysql-test/suite/storage_engine/col_null.inc b/mysql-test/suite/storage_engine/col_null.inc
new file mode 100644
index 00000000000..6f74609869f
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_null.inc
@@ -0,0 +1,65 @@
+#
+# NULL attribute and DEFAULT NULL in columns
+#
+# Usage:
+# let $col_definition = <column type (and possibly more options)>;
+# let $col_default = <default non-null value for a column>;
+# --source col_null.inc
+#
+# We will add NULL at the end of $col;
+#
+# Also, if $col_default is defined,
+# we will create a table with 3 columns (one with DEFAULT NULL,
+# one with DEFAULT $col_default, and one without any default)
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = c $col_definition NULL
+--source create_table.inc
+SHOW COLUMNS IN t1;
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (c) VALUES (NULL);
+ if ($mysql_errname)
+ {
+ --let $functionality = NULLable columns
+ --source unexpected_result.inc
+ }
+ SELECT COUNT(c), COUNT(*) FROM t1;
+
+ DROP TABLE t1;
+}
+
+if ($col_default != '')
+{
+ let $create_definition =
+ c $col_definition NULL,
+ c1 $col_definition NULL DEFAULT NULL,
+ c2 $col_definition NULL DEFAULT $col_default
+ ;
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (c) VALUES (NULL);
+ SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+
+ DROP TABLE t1;
+ }
+}
+
+# We don't want to preserve it
+let $col_default = ;
+
diff --git a/mysql-test/suite/storage_engine/col_opt_default.result b/mysql-test/suite/storage_engine/col_opt_default.result
new file mode 100644
index 00000000000..2d0a8508b99
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_opt_default.result
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN> DEFAULT '0') ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a int(11) # 0
+INSERT INTO t1 (a) VALUES (1);
+SELECT * FROM t1;
+a
+1
+ALTER TABLE t1 ADD COLUMN b <CHAR_COLUMN> DEFAULT '';
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a int(11) # 0
+b char(8) #
+INSERT INTO t1 (b) VALUES ('a');
+SELECT * FROM t1;
+a b
+0 a
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/col_opt_default.test b/mysql-test/suite/storage_engine/col_opt_default.test
new file mode 100644
index 00000000000..f59daef37fc
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_opt_default.test
@@ -0,0 +1,49 @@
+#
+# Check whether DEFAULT column attribute
+# is supported in CREATE and ALTER TABLE.
+# If the attribute is supported at all, it will be covered
+# in more details in col_option_null and col_option_not_null tests.
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = a $int_col DEFAULT '0'
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = DEFAULT values
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (a) VALUES (1);
+ --sorted_result
+ SELECT * FROM t1;
+
+ --let $alter_definition = ADD COLUMN b $char_col DEFAULT ''
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = ALTER or DEFAULT
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_column 3 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (b) VALUES ('a');
+ --sorted_result
+ SELECT * FROM t1;
+ }
+ DROP TABLE t1;
+}
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/col_opt_not_null.result b/mysql-test/suite/storage_engine/col_opt_not_null.result
new file mode 100644
index 00000000000..00a863fccce
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_opt_not_null.result
@@ -0,0 +1,2062 @@
+#
+# BINARY columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b BINARY <CUSTOM_COL_OPTIONS> NOT NULL,
+b0 BINARY(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+b1 BINARY(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+b20 BINARY(20) <CUSTOM_COL_OPTIONS> NOT NULL,
+b255 BINARY(255) <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b binary(1) # # # #
+b0 binary(0) # # # #
+b1 binary(1) # # # #
+b20 binary(20) # # # #
+b255 binary(255) # # # #
+INSERT INTO t1 VALUES ('','','','','');
+INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
+HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255)
+00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
+INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b0' at row 1
+Warning 1265 Data truncated for column 'b1' at row 1
+Warning 1265 Data truncated for column 'b20' at row 1
+Warning 1265 Data truncated for column 'b255' at row 1
+INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b0' at row 1
+Warning 1265 Data truncated for column 'b1' at row 1
+Warning 1265 Data truncated for column 'b20' at row 1
+Warning 1265 Data truncated for column 'b255' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'b0' at row 2
+Warning 1265 Data truncated for column 'b1' at row 2
+Warning 1265 Data truncated for column 'b20' at row 2
+Warning 1265 Data truncated for column 'b255' at row 2
+Warning 1265 Data truncated for column 'b' at row 3
+Warning 1265 Data truncated for column 'b0' at row 3
+Warning 1265 Data truncated for column 'b1' at row 3
+Warning 1265 Data truncated for column 'b20' at row 3
+Warning 1265 Data truncated for column 'b255' at row 3
+SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
+HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255)
+00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+43 43 4372656174696E6720616E2061727469636C6520 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
+61 61 6161616161616161616161616161616161616161 787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878
+61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
+78 78 7878787878787878787878787878787878787878 787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878
+ALTER TABLE t1 ADD COLUMN b257 BINARY(257) <CUSTOM_COL_OPTIONS> NOT NULL;
+ERROR 42000: Column length too big for column 'b257' (max = 255); use BLOB or TEXT instead
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b binary(1) # # # #
+b0 binary(0) # # # #
+b1 binary(1) # # # #
+b20 binary(20) # # # #
+b255 binary(255) # # # #
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c BINARY <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c binary(1) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c BINARY <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 BINARY <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 0
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c binary(1) NO NULL
+c2 binary(1) NO 0
+ALTER TABLE t1 ADD COLUMN err BINARY <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (0);
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# VARBINARY columns
+#
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (v0 VARBINARY(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+v1 VARBINARY(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+v64 VARBINARY(64) <CUSTOM_COL_OPTIONS> NOT NULL,
+v65000 VARBINARY(65000) <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varbinary(0) # # #
+v1 varbinary(1) # # #
+v64 varbinary(64) # # #
+v65000 varbinary(65000) # # #
+CREATE TABLE t2 (v VARBINARY(65532) <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t2;
+Field Type Null Key Default Extra
+v varbinary(65532) # # #
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','','','');
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that an article doesn\'t already exist','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+ For developers who want to code on MariaDB or MySQL
+
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+
+ For MariaDB / MySQL end users
+
+ * MariaDB Crash Course by Ben Forta
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o Free to read in the Knowledgebase!
+
+ * MySQL (4th Edition) by Paul DuBois
+ o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+
+ * MySQL Cookbook by Paul DuBois
+ o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
+SELECT HEX(v0), HEX(v1), HEX(v64), HEX(v65000) FROM t1;
+HEX(v0) HEX(v1) HEX(v64) HEX(v65000)
+
+ 79 4F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C7265616479206578697374 486572652069732061206C697374206F66207265636F6D6D656E64656420626F6F6B73206F6E204D61726961444220616E64204D7953514C2E2057652776652070726F7669646564206C696E6B7320746F20416D617A6F6E2E636F6D206865726520666F7220636F6E76656E69656E63652C2062757420746865792063616E20626520666F756E64206174206D616E79206F7468657220626F6F6B73746F7265732C20626F7468206F6E6C696E6520616E64206F66662E0A0A2020496620796F752077616E7420746F206861766520796F7572206661766F72697465204D7953514C202F204D61726961444220626F6F6B206C697374656420686572652C20706C65617365206C65617665206120636F6D6D656E742E0A2020466F7220646576656C6F706572732077686F2077616E7420746F20636F6465206F6E204D617269614442206F72204D7953514C0A0A2020202020202A20556E6465727374616E64696E67204D7953514C20496E7465726E616C73206279205361736861205061636865762C20666F726D6572204D7953514C20646576656C6F706572206174204D7953514C2041422E0A2020202020202020202020206F205468697320697320746865206F6E6C7920626F6F6B207765206B6E6F772061626F75742074686174206465736372696265732074686520696E7465726E616C73206F66204D617269614442202F204D7953514C2E2041206D757374206861766520666F7220616E796F6E652077686F2077616E747320746F20756E6465727374616E6420616E6420646576656C6F70206F6E204D617269614442210A2020202020202020202020206F204E6F7420616C6C20746F706963732061726520636F766572656420616E6420736F6D652070617274732061726520736C696768746C79206F757464617465642C20627574207374696C6C20746865206265737420626F6F6B206F6E207468697320746F7069632E200A2020202020202A204D7953514C20352E3120506C7567696E20446576656C6F706D656E742062792053657267656920476F6C75626368696B20616E6420416E64726577204875746368696E67730A2020202020202020202020206F2041206D757374207265616420666F7220616E796F6E652077616E74696E6720746F207772697465206120706C7567696E20666F72204D6172696144422C207772697474656E20627920746865205365726765692077686F2064657369676E65642074686520706C7567696E20696E7465726661636520666F72204D7953514C20616E64204D61726961444221200A0A2020466F72204D617269614442202F204D7953514C20656E642075736572730A0A2020202020202A204D61726961444220437261736820436F757273652062792042656E20466F7274610A2020202020202020202020206F204669727374204D61726961444220626F6F6B210A2020202020202020202020206F20466F722070656F706C652077686F2077616E7420746F206C6561726E2053514C20616E642074686520626173696373206F66204D6172696144422E0A2020202020202020202020206F204E6F77207368697070696E672E20507572636861736520617420416D617A6F6E2E636F6D206F7220796F7572206661766F7269746520626F6F6B73656C6C65722E200A0A2020202020202A2053514C2D393920436F6D706C6574652C205265616C6C792062792050657465722047756C75747A616E20262054727564792050656C7A65722E0A2020202020202020202020206F2045766572797468696E6720796F752077616E74656420746F206B6E6F772061626F7574207468652053514C203939207374616E646172642E20457863656C6C656E74207265666572656E636520626F6F6B210A2020202020202020202020206F204672656520746F207265616420696E20746865204B6E6F776C656467656261736521200A0A2020202020202A204D7953514C20283474682045646974696F6E29206279205061756C204475426F69730A2020202020202020202020206F20546865202764656661756C742720626F6F6B20746F207265616420696620796F7520776F6E7420746F206C6561726E20746F20757365204D7953514C202F204D6172696144422E200A0A2020202020202A204D7953514C20436F6F6B626F6F6B206279205061756C204475426F69730A2020202020202020202020206F2041206C6F74206F66206578616D706C6573206F6620686F7720746F20757365204D7953514C2E204173207769746820616C6C206F66205061756C277320626F6F6B732C206974277320776F727468206974732077656967687420696E20676F6C6420616E64206576656E20656E6A6F7961626C652072656164696E6720666F7220737563682061202764727927207375626A6563742E200A0A2020202020202A204869676820506572666F726D616E6365204D7953514C2C205365636F6E642045646974696F6E2C204279204261726F6E20536368776172747A2C205065746572205A6169747365762C20566164696D20546B616368656E6B6F2C204A6572656D7920442E205A61776F646E792C2041726A656E204C656E747A2C20446572656B204A2E2042616C6C696E672C20657420616C2E0A2020202020202020202020206F20224869676820506572666F726D616E6365204D7953514C2069732074686520646566696E697469766520677569646520746F206275696C64696E6720666173742C2072656C6961626C652073797374656D732077697468204D7953514C2E205772697474656E206279206E6F74656420657870657274732077697468207965617273206F66207265616C2D776F726C6420657870657269656E6365206275696C64696E672076657279206C617267652073797374656D732C207468697320626F6F6B20636F7665727320657665727920617370656374206F66204D7953514C20706572666F726D616E636520696E2064657461696C2C20616E6420666F6375736573206F6E20726F627573746E6573732C2073656375726974792C20616E64206461746120696E746567726974792E204C6561726E20616476616E63656420746563686E697175657320696E20646570746820736F20796F752063616E206272696E67206F7574204D7953514C27732066756C6C20706F7765722E22202846726F6D2074686520626F6F6B206465736372697074696F6E206174204F275265696C6C7929200A0A2020202020202A204D7953514C2041646D696E20436F6F6B626F6F6B0A2020202020202020202020206F204120717569636B20737465702D62792D7374657020677569646520666F72204D7953514C20757365727320616E642064617461626173652061646D696E6973747261746F727320746F207461636B6C65207265616C2D776F726C64206368616C6C656E6765732077697468204D7953514C20636F6E66696775726174696F6E20616E642061646D696E697374726174696F6E200A0A2020202020202A204D7953514C20352E302043657274696669636174696F6E2053747564792047756964652C204279205061756C204475426F69732C2053746566616E2048696E7A2C204361727374656E20506564657273656E0A2020202020202020202020206F205468697320697320746865206F6666696369616C20677569646520746F20636F766572207468652070617373696E67206F66207468652074776F204D7953514C2043657274696669636174696F6E206578616D696E6174696F6E732E2049742069732076616C69642074696C6C2076657273696F6E20352E30206F6620746865207365727665722C20736F207768696C65206974206D697373657320616C6C2074686520666561747572657320617661696C61626C6520696E204D7953514C20352E3120616E6420677265617465722028696E636C7564696E67204D61726961444220352E3120616E642067726561746572292C2069742070726F7669646573206120676F6F6420626173696320756E6465727374616E64696E67206F66204D7953514C20666F722074686520656E642D757365722E20
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('y', 'yy', REPEAT('c',65), REPEAT('abcdefghi ',6501));
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 1
+Warning 1265 Data truncated for column 'v1' at row 1
+Warning 1265 Data truncated for column 'v64' at row 1
+Warning 1265 Data truncated for column 'v65000' at row 1
+INSERT INTO t1 (v0,v1,v64,v65000) SELECT v65000, v65000, v65000, CONCAT(v65000,v1) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 2
+Warning 1265 Data truncated for column 'v1' at row 2
+Warning 1265 Data truncated for column 'v64' at row 2
+Warning 1265 Data truncated for column 'v0' at row 3
+Warning 1265 Data truncated for column 'v1' at row 3
+Warning 1265 Data truncated for column 'v64' at row 3
+Warning 1265 Data truncated for column 'v65000' at row 3
+SELECT HEX(v0), HEX(v1), HEX(v64), LENGTH(HEX(v65000)) FROM t1;
+HEX(v0) HEX(v1) HEX(v64) LENGTH(HEX(v65000))
+ 0
+ 0
+ 48 486572652069732061206C697374206F66207265636F6D6D656E64656420626F6F6B73206F6E204D61726961444220616E64204D7953514C2E20576527766520 5932
+ 61 61626364656667686920616263646566676869206162636465666768692061626364656667686920616263646566676869206162636465666768692061626364 130000
+ 79 4F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C7265616479206578697374 5930
+ 79 63636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363 130000
+ALTER TABLE t1 ADD COLUMN v65536 VARBINARY(65536) <CUSTOM_COL_OPTIONS> NOT NULL;
+Warnings:
+Note 1246 Converting column 'v65536' from VARBINARY to BLOB
+Note 1246 Converting column 'v65536' from VARBINARY to BLOB
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varbinary(0) # # #
+v1 varbinary(1) # # #
+v64 varbinary(64) # # #
+v65000 varbinary(65000) # # #
+v65536 mediumblob # # #
+DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c VARBINARY(64) <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c varbinary(64) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c VARBINARY(64) <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 VARBINARY(64) <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 'test'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c varbinary(64) NO NULL
+c2 varbinary(64) NO test
+ALTER TABLE t1 ADD COLUMN err VARBINARY(64) <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('test');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# BIT columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a BIT <CUSTOM_COL_OPTIONS> NOT NULL,
+b BIT(20) <CUSTOM_COL_OPTIONS> NOT NULL,
+c BIT(64) <CUSTOM_COL_OPTIONS> NOT NULL,
+d BIT(1) <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a bit(1) # # #
+b bit(20) # # #
+c bit(64) # # #
+d bit(1) # # #
+ALTER TABLE t1 DROP COLUMN d;
+ALTER TABLE t1 ADD COLUMN d BIT(0) <CUSTOM_COL_OPTIONS> NOT NULL;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a bit(1) # # #
+b bit(20) # # #
+c bit(64) # # #
+d bit(1) # # #
+INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
+SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0;
+BIN(a) HEX(b) c+0
+0 FFFFF 18446744073709551615
+INSERT INTO t1 VALUES (1,0,-1,0);
+SELECT a+0, b+0, c+0 FROM t1 WHERE d<100;
+a+0 b+0 c+0
+0 1048575 18446744073709551615
+1 0 18446744073709551615
+INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0);
+SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2);
+a+0 b+0 c+0
+1 0 18446744073709551615
+1 102 255
+INSERT INTO t1 VALUES (0x10,0,0,1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT * FROM t1;
+a b c d
+INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0);
+Warnings:
+Warning 1264 Out of range value for column 'c' at row 1
+SELECT * FROM t1;
+a b c d
+DROP TABLE t1;
+CREATE TABLE t1 (a BIT(65) <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ERROR 42000: Display width out of range for 'a' (max = 64)
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c BIT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c bit(1) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c BIT <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 BIT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 1
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c bit(1) NO NULL
+c2 bit(1) NO b'1'
+ALTER TABLE t1 ADD COLUMN err BIT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (1);
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# BLOB columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b BLOB <CUSTOM_COL_OPTIONS> NOT NULL,
+b0 BLOB(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+b1 BLOB(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+b300 BLOB(300) <CUSTOM_COL_OPTIONS> NOT NULL,
+bm BLOB(65535) <CUSTOM_COL_OPTIONS> NOT NULL,
+b70k BLOB(70000) <CUSTOM_COL_OPTIONS> NOT NULL,
+b17m BLOB(17000000) <CUSTOM_COL_OPTIONS> NOT NULL,
+t TINYBLOB <CUSTOM_COL_OPTIONS> NOT NULL,
+m MEDIUMBLOB <CUSTOM_COL_OPTIONS> NOT NULL,
+l LONGBLOB <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b blob # # #
+b0 blob # # #
+b1 tinyblob # # #
+b300 blob # # #
+bm blob # # #
+b70k mediumblob # # #
+b17m longblob # # #
+t tinyblob # # #
+m mediumblob # # #
+l longblob # # #
+INSERT INTO t1 VALUES
+('','','','','','','','','',''),
+('a','b','c','d','e','f','g','h','i','j'),
+('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
+( REPEAT('a',65535), REPEAT('b',65535), REPEAT('c',255), REPEAT('d',65535), REPEAT('e',65535), REPEAT('f',1048576), HEX(REPEAT('g',1048576)), REPEAT('h',255), REPEAT('i',1048576), HEX(REPEAT('j',1048576)) );
+SELECT LENGTH(b), LENGTH(b0), LENGTH(b1), LENGTH(b300), LENGTH(bm), LENGTH(b70k), LENGTH(b17m), LENGTH(t), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m) LENGTH(t) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152
+INSERT INTO t1 VALUES
+( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b0' at row 1
+Warning 1265 Data truncated for column 'b1' at row 1
+Warning 1265 Data truncated for column 'b300' at row 1
+Warning 1265 Data truncated for column 'bm' at row 1
+Warning 1265 Data truncated for column 't' at row 1
+SELECT LENGTH(b), LENGTH(b0), LENGTH(b1), LENGTH(b300), LENGTH(bm), LENGTH(b70k), LENGTH(b17m), LENGTH(t), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m) LENGTH(t) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152
+ALTER TABLE t1 ADD COLUMN bbb BLOB(4294967296);
+ERROR 42000: Display width out of range for 'bbb' (max = 4294967295)
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c BLOB <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c blob NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TINYBLOB <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinyblob NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c MEDIUMBLOB <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c mediumblob NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c LONGBLOB <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c longblob NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+#
+# BOOL columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b1 BOOL <CUSTOM_COL_OPTIONS> NOT NULL,
+b2 BOOLEAN <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b1 tinyint(1) # # #
+b2 tinyint(1) # # #
+INSERT INTO t1 VALUES (1,TRUE);
+SELECT * FROM t1;
+b1 b2
+1 1
+INSERT INTO t1 VALUES (FALSE,0);
+SELECT * FROM t1;
+b1 b2
+0 0
+1 1
+INSERT INTO t1 VALUES (2,3);
+SELECT * FROM t1;
+b1 b2
+0 0
+1 1
+2 3
+INSERT INTO t1 VALUES (-1,-2);
+SELECT * FROM t1;
+b1 b2
+-1 -2
+0 0
+1 1
+2 3
+SELECT IF(b1,'true','false') AS a, IF(b2,'true','false') AS b FROM t1;
+a b
+false false
+true true
+true true
+true true
+SELECT * FROM t1 WHERE b1 = TRUE;
+b1 b2
+1 1
+SELECT * FROM t1 WHERE b2 = FALSE;
+b1 b2
+0 0
+INSERT INTO t1 VALUES ('a','b');
+Warnings:
+Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
+Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
+SELECT * FROM t1;
+b1 b2
+-1 -2
+0 0
+0 0
+1 1
+2 3
+INSERT INTO t1 VALUES (128,-129);
+Warnings:
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b2' at row 1
+SELECT * FROM t1;
+b1 b2
+-1 -2
+0 0
+0 0
+1 1
+127 -128
+2 3
+ALTER TABLE t1 ADD COLUMN b3 BOOLEAN UNSIGNED;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNSIGNED' at line 1
+ALTER TABLE t1 ADD COLUMN b3 BOOL ZEROFILL;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ZEROFILL' at line 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c BOOL <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinyint(1) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c BOOL <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 BOOL <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT '0'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinyint(1) NO NULL
+c2 tinyint(1) NO 0
+ALTER TABLE t1 ADD COLUMN err BOOL <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('0');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# CHAR columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS> NOT NULL,
+c0 CHAR(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+c1 CHAR(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+c20 CHAR(20) <CUSTOM_COL_OPTIONS> NOT NULL,
+c255 CHAR(255) <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c char(1) # # #
+c0 char(0) # # #
+c1 char(1) # # #
+c20 char(20) # # #
+c255 char(255) # # #
+INSERT INTO t1 VALUES ('','','','','');
+INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+SELECT * FROM t1;
+c c0 c1 c20 c255
+
+a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.
+INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'c0' at row 1
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c20' at row 1
+Warning 1265 Data truncated for column 'c255' at row 1
+INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 2
+Warning 1265 Data truncated for column 'c0' at row 2
+Warning 1265 Data truncated for column 'c1' at row 2
+Warning 1265 Data truncated for column 'c20' at row 2
+Warning 1265 Data truncated for column 'c' at row 3
+Warning 1265 Data truncated for column 'c0' at row 3
+Warning 1265 Data truncated for column 'c1' at row 3
+Warning 1265 Data truncated for column 'c20' at row 3
+Warning 1265 Data truncated for column 'c255' at row 3
+SELECT * FROM t1;
+c c0 c1 c20 c255
+
+
+C C Creating an article Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.b
+a a aaaaaaaaaaaaaaaaaaaa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.
+x x xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+SELECT DISTINCT c20, REPEAT('a',LENGTH(c20)), COUNT(*) FROM t1 GROUP BY c1, c20;
+c20 REPEAT('a',LENGTH(c20)) COUNT(*)
+ 2
+Creating an article aaaaaaaaaaaaaaaaaaa 1
+aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaa 1
+abcdefghi klmnopqrst aaaaaaaaaaaaaaaaaaaa 1
+xxxxxxxxxxxxxxxxxxxx aaaaaaaaaaaaaaaaaaaa 1
+ALTER TABLE t1 ADD COLUMN c257 CHAR(257) <CUSTOM_COL_OPTIONS> NOT NULL;
+ERROR 42000: Column length too big for column 'c257' (max = 255); use BLOB or TEXT instead
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c char(1) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 CHAR <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT '_'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c char(1) NO NULL
+c2 char(1) NO _
+ALTER TABLE t1 ADD COLUMN err CHAR <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('_');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# VARCHAR columns
+#
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (v0 VARCHAR(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+v1 VARCHAR(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+v64 VARCHAR(64) <CUSTOM_COL_OPTIONS> NOT NULL,
+v65000 VARCHAR(65000) <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varchar(0) # # #
+v1 varchar(1) # # #
+v64 varchar(64) # # #
+v65000 varchar(65000) # # #
+CREATE TABLE t2 (v VARCHAR(65532) <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t2;
+Field Type Null Key Default Extra
+v varchar(65532) # # #
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','','','');
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that an article doesn\'t already exist','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+ For developers who want to code on MariaDB or MySQL
+
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+
+ For MariaDB / MySQL end users
+
+ * MariaDB Crash Course by Ben Forta
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o Free to read in the Knowledgebase!
+
+ * MySQL (4th Edition) by Paul DuBois
+ o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+
+ * MySQL Cookbook by Paul DuBois
+ o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
+SELECT * FROM t1;
+v0 v1 v64 v65000
+
+
+
+
+
+
+
+
+
+
+
+ y Once there, double check that an article doesn't already exist Here is a list of recommended books on MariaDB and MySQL. We've provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+ o "High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL's full power." (From the book description at O'Reilly)
+ o A lot of examples of how to use MySQL. As with all of Paul's books, it's worth its weight in gold and even enjoyable reading for such a 'dry' subject.
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Free to read in the Knowledgebase!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+ o The 'default' book to read if you wont to learn to use MySQL / MariaDB.
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ * MariaDB Crash Course by Ben Forta
+ * MySQL (4th Edition) by Paul DuBois
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ * MySQL Admin Cookbook
+ * MySQL Cookbook by Paul DuBois
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ For MariaDB / MySQL end users
+ For developers who want to code on MariaDB or MySQL
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('y', 'yy', REPEAT('c',65), REPEAT('abcdefghi ',6501));
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 1
+Warning 1265 Data truncated for column 'v1' at row 1
+Warning 1265 Data truncated for column 'v64' at row 1
+Warning 1265 Data truncated for column 'v65000' at row 1
+INSERT INTO t1 (v0,v1,v64,v65000) SELECT v65000, v65000, v65000, CONCAT(v65000,v1) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 2
+Warning 1265 Data truncated for column 'v1' at row 2
+Warning 1265 Data truncated for column 'v64' at row 2
+Warning 1265 Data truncated for column 'v0' at row 3
+Warning 1265 Data truncated for column 'v1' at row 3
+Warning 1265 Data truncated for column 'v64' at row 3
+Warning 1265 Data truncated for column 'v65000' at row 3
+SELECT v0, v1, v64, LENGTH(v65000) FROM t1;
+v0 v1 v64 LENGTH(v65000)
+ 0
+ 0
+ H Here is a list of recommended books on MariaDB and MySQL. We've 2966
+ a abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcd 65000
+ y Once there, double check that an article doesn't already exist 2965
+ y cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 65000
+ALTER TABLE t1 ADD COLUMN v65536 VARCHAR(65536) <CUSTOM_COL_OPTIONS> NOT NULL;
+Warnings:
+Note 1246 Converting column 'v65536' from VARCHAR to TEXT
+Note 1246 Converting column 'v65536' from VARCHAR to TEXT
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varchar(0) # # #
+v1 varchar(1) # # #
+v64 varchar(64) # # #
+v65000 varchar(65000) # # #
+v65536 mediumtext # # #
+DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c VARCHAR(64) <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c varchar(64) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c VARCHAR(64) <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 VARCHAR(64) <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 'test default'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c varchar(64) NO NULL
+c2 varchar(64) NO test default
+ALTER TABLE t1 ADD COLUMN err VARCHAR(64) <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('test default');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# date and time columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS> NOT NULL,
+dt DATETIME <CUSTOM_COL_OPTIONS> NOT NULL,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS> NOT NULL,
+t TIME <CUSTOM_COL_OPTIONS> NOT NULL,
+y YEAR <CUSTOM_COL_OPTIONS> NOT NULL,
+y4 YEAR(4) <CUSTOM_COL_OPTIONS> NOT NULL,
+y2 YEAR(2) <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+d date # # #
+dt datetime # # #
+ts timestamp # # # on update CURRENT_TIMESTAMP
+t time # # #
+y year(4) # # #
+y4 year(4) # # #
+y2 year(2) # # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 VALUES
+('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'),
+('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'),
+('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm));
+SELECT * FROM t1;
+d dt ts t y y4 y2
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
+1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00
+2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
+9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99
+INSERT INTO t1 VALUES
+('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' );
+Warnings:
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'dt' at row 1
+Warning 1265 Data truncated for column 'ts' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 'y' at row 1
+Warning 1264 Out of range value for column 'y4' at row 1
+Warning 1264 Out of range value for column 'y2' at row 1
+SELECT * FROM t1;
+d dt ts t y y4 y2
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
+1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00
+2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
+9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c DATE <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c date NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c DATE <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 DATE <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT '2012-12-21'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c date NO NULL
+c2 date NO 2012-12-21
+ALTER TABLE t1 ADD COLUMN err DATE <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('2012-12-21');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c DATETIME <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c datetime NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c DATETIME <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 DATETIME <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT '2012-12-21 12:21:12'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c datetime NO NULL
+c2 datetime NO 2012-12-21 12:21:12
+ALTER TABLE t1 ADD COLUMN err DATETIME <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('2012-12-21 12:21:12');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+CREATE TABLE t1 (c TIMESTAMP <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 TIMESTAMP <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT '2012-02-21 12:21:12'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ALTER TABLE t1 ADD COLUMN err TIMESTAMP <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+INSERT INTO t1 (c2) VALUES (NULL);
+SELECT c, c2 FROM t1;
+c c2
+<TIMESTAMP> <DEFAULT_TIMESTAMP>
+<TIMESTAMP> <TIMESTAMP>
+DROP TABLE t1;
+CREATE TABLE t1 (c TIMESTAMP <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT * FROM t1;
+c
+<TIMESTAMP>
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TIME <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c time NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c TIME <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 TIME <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT '12:21:12'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c time NO NULL
+c2 time NO 12:21:12
+ALTER TABLE t1 ADD COLUMN err TIME <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('12:21:12');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c YEAR <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c year(4) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c YEAR <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 YEAR <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT '2012'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c year(4) NO NULL
+c2 year(4) NO 2012
+ALTER TABLE t1 ADD COLUMN err YEAR <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('2012');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c YEAR(2) <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c year(2) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c YEAR(2) <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 YEAR(2) <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT '12'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c year(2) NO NULL
+c2 year(2) NO 12
+ALTER TABLE t1 ADD COLUMN err YEAR(2) <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('12');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# ENUM columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a ENUM('') <CUSTOM_COL_OPTIONS> NOT NULL,
+b ENUM('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS> NOT NULL,
+c ENUM('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a enum('') # # #
+b enum('test1','test2','test3','test4','test5') # # #
+c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
+INSERT INTO t1 VALUES ('','test2','4'),('',5,2);
+SELECT * FROM t1;
+a b c
+ test2 4
+ test5 2
+INSERT INTO t1 VALUES (0,'test6',-1);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+SELECT * FROM t1;
+a b c
+
+ test2 4
+ test5 2
+ALTER TABLE t1 ADD COLUMN e ENUM('a','A') <CUSTOM_COL_OPTIONS> NOT NULL;
+Warnings:
+Note 1291 Column 'e' has duplicated value 'a' in ENUM
+Note 1291 Column 'e' has duplicated value 'a' in ENUM
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a enum('') # # #
+b enum('test1','test2','test3','test4','test5') # # #
+c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
+e enum('a','A') # # #
+INSERT INTO t1 VALUES ('','test3','75','A');
+SELECT * FROM t1;
+a b c e
+ a
+ test2 4 a
+ test3 75 a
+ test5 2 a
+SELECT * FROM t1 WHERE b='test2' OR a != '';
+a b c e
+ test2 4 a
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c ENUM('test1','test2','test3') <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c enum('test1','test2','test3') NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c ENUM('test1','test2','test3') <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 ENUM('test1','test2','test3') <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 'test2'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c enum('test1','test2','test3') NO NULL
+c2 enum('test1','test2','test3') NO test2
+ALTER TABLE t1 ADD COLUMN err ENUM('test1','test2','test3') <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('test2');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# Fixed point columns (NUMERIC, DECIMAL)
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (d DECIMAL <CUSTOM_COL_OPTIONS> NOT NULL,
+d0 DECIMAL(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+d1_1 DECIMAL(1,1) <CUSTOM_COL_OPTIONS> NOT NULL,
+d10_2 DECIMAL(10,2) <CUSTOM_COL_OPTIONS> NOT NULL,
+d60_10 DECIMAL(60,10) <CUSTOM_COL_OPTIONS> NOT NULL,
+n NUMERIC <CUSTOM_COL_OPTIONS> NOT NULL,
+n0_0 NUMERIC(0,0) <CUSTOM_COL_OPTIONS> NOT NULL,
+n1 NUMERIC(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+n20_4 NUMERIC(20,4) <CUSTOM_COL_OPTIONS> NOT NULL,
+n65_4 NUMERIC(65,4) <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+d decimal(10,0) # # #
+d0 decimal(10,0) # # #
+d1_1 decimal(1,1) # # #
+d10_2 decimal(10,2) # # #
+d60_10 decimal(60,10) # # #
+n decimal(10,0) # # #
+n0_0 decimal(10,0) # # #
+n1 decimal(1,0) # # #
+n20_4 decimal(20,4) # # #
+n65_4 decimal(65,4) # # #
+INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+Warning 1264 Out of range value for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+Warnings:
+Note 1265 Data truncated for column 'd' at row 1
+Note 1265 Data truncated for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Note 1265 Data truncated for column 'd10_2' at row 1
+Note 1265 Data truncated for column 'd60_10' at row 1
+Note 1265 Data truncated for column 'n' at row 1
+Note 1265 Data truncated for column 'n0_0' at row 1
+Note 1265 Data truncated for column 'n1' at row 1
+Note 1265 Data truncated for column 'n20_4' at row 1
+Note 1265 Data truncated for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.00 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.0000 9999999999999999999999999999999999999999999999999999999999999.1111
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66);
+ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6);
+ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66);
+ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 30.
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c DECIMAL <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c decimal(10,0) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c DECIMAL <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 DECIMAL <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 1.1
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+Warnings:
+Note 1265 Data truncated for column 'c2' at row 1
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c decimal(10,0) NO NULL
+c2 decimal(10,0) NO 1
+ALTER TABLE t1 ADD COLUMN err DECIMAL <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (1.1);
+Warnings:
+Note 1265 Data truncated for column 'c' at row 1
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c NUMERIC <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c decimal(10,0) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c NUMERIC <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 NUMERIC <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 0
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c decimal(10,0) NO NULL
+c2 decimal(10,0) NO 0
+ALTER TABLE t1 ADD COLUMN err NUMERIC <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (0);
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# Floating point columns (FLOAT, DOUBLE)
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f FLOAT <CUSTOM_COL_OPTIONS> NOT NULL,
+f0 FLOAT(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+r1_1 REAL(1,1) <CUSTOM_COL_OPTIONS> NOT NULL,
+f23_0 FLOAT(23) <CUSTOM_COL_OPTIONS> NOT NULL,
+f20_3 FLOAT(20,3) <CUSTOM_COL_OPTIONS> NOT NULL,
+d DOUBLE <CUSTOM_COL_OPTIONS> NOT NULL,
+d1_0 DOUBLE(1,0) <CUSTOM_COL_OPTIONS> NOT NULL,
+d10_10 DOUBLE PRECISION (10,10) <CUSTOM_COL_OPTIONS> NOT NULL,
+d53 DOUBLE(53,0) <CUSTOM_COL_OPTIONS> NOT NULL,
+d53_10 DOUBLE(53,10) <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+f float # # #
+f0 float # # #
+r1_1 double(1,1) # # #
+f23_0 float # # #
+f20_3 float(20,3) # # #
+d double # # #
+d1_0 double(1,0) # # #
+d10_10 double(10,10) # # #
+d53 double(53,0) # # #
+d53_10 double(53,10) # # #
+INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+SELECT * FROM t1;
+f 12345.1
+d 11111111.111
+d10_10 0.0123456789
+d1_0 8
+d53 1234566789123456800
+d53_10 100000000000000000.0000000000
+f0 12345.1
+f20_3 56789.988
+f23_0 123457000
+r1_1 0.9
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (
+99999999999999999999999999999999999999,
+99999999999999999999999999999999999999.9999999999999999,
+0.9,
+99999999999999999999999999999999999999.9,
+99999999999999999.999,
+999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+9,
+0.9999999999,
+1999999999999999999999999999999999999999999999999999999,
+19999999999999999999999999999999999999999999.9999999999
+);
+Warnings:
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 12345.1
+d 0
+d 11111111.111
+d 1e81
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d1_0 0
+d1_0 8
+d1_0 9
+d53 0
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 0
+f 1e38
+f0 0
+f0 12345.1
+f0 1e38
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+SELECT * FROM t1;
+f 12345.1
+d -1e60
+d 0
+d 11111111.111
+d 1e81
+d10_10 -0.9999999999
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d1_0 -9
+d1_0 0
+d1_0 8
+d1_0 9
+d53 -1000000000000000000000000000000
+d53 0
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f -1e24
+f 0
+f 1e38
+f0 -100000000000
+f0 0
+f0 12345.1
+f0 1e38
+f20_3 -99999998430674940.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f23_0 -1000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+r1_1 -0.9
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+SELECT MAX(f), MAX(f0), MAX(r1_1), MAX(f23_0), MAX(f20_3), MAX(d), MAX(d1_0), MAX(d10_10), MAX(d53), MAX(d53_10) FROM t1;
+MAX(f) 9.999999680285692e37
+MAX(d) 1e81
+MAX(d10_10) 0.9999999999
+MAX(d1_0) 9
+MAX(d53) 100000000000000000000000000000000000000000000000000000
+MAX(d53_10) 10000000000000000000000000000000000000000000.0000000000
+MAX(f0) 9.999999680285692e37
+MAX(f20_3) 99999998430674940.000
+MAX(f23_0) 9.999999680285692e37
+MAX(r1_1) 0.9
+INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+Warnings:
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+SELECT * FROM t1;
+f 12345.1
+d -1e60
+d 0
+d 11111111.111
+d 1e43
+d 1e81
+d10_10 -0.9999999999
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d10_10 10000000000000000000000000000000000000000000.0000000000
+d1_0 -9
+d1_0 0
+d1_0 8
+d1_0 9
+d1_0 9
+d53 -1000000000000000000000000000000
+d53 0
+d53 10000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f -1e24
+f 0
+f 1e38
+f 3.40282e38
+f0 -100000000000
+f0 0
+f0 12345.1
+f0 1e38
+f0 3.40282e38
+f20_3 -99999998430674940.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f23_0 -1000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+f23_0 3.40282e38
+r1_1 -0.9
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+INSERT INTO t1 VALUES (
+999999999999999999999999999999999999999,
+999999999999999999999999999999999999999.9999999999999999,
+1.9,
+999999999999999999999999999999999999999.9,
+999999999999999999.999,
+9999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+99,
+1.9999999999,
+1999999999999999999999999999999999999999999999999999999,
+19999999999999999999999999999999999999999999.9999999999
+);
+Warnings:
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+Warning 1264 Out of range value for column 'd10_10' at row 1
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 12345.1
+d -1e60
+d 0
+d 11111111.111
+d 1e43
+d 1e65
+d 1e81
+d10_10 -0.9999999999
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d10_10 0.9999999999
+d10_10 10000000000000000000000000000000000000000000.0000000000
+d1_0 -9
+d1_0 0
+d1_0 8
+d1_0 9
+d1_0 9
+d1_0 9
+d53 -1000000000000000000000000000000
+d53 0
+d53 10000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f -1e24
+f 0
+f 1e38
+f 3.40282e38
+f 3.40282e38
+f0 -100000000000
+f0 0
+f0 12345.1
+f0 1e38
+f0 3.40282e38
+f0 3.40282e38
+f20_3 -99999998430674940.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f23_0 -1000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+f23_0 3.40282e38
+f23_0 3.40282e38
+r1_1 -0.9
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0);
+ERROR 42000: Display width out of range for 'd0_0' (max = 255)
+ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1);
+ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35);
+ERROR 42000: Too big scale 35 specified for 'n66_66'. Maximum is 30.
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c FLOAT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c float NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c FLOAT <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 FLOAT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 1.1
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c float NO NULL
+c2 float NO 1.1
+ALTER TABLE t1 ADD COLUMN err FLOAT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (1.1 );
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c DOUBLE <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c double NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c DOUBLE <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 DOUBLE <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 0
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c double NO NULL
+c2 double NO 0
+ALTER TABLE t1 ADD COLUMN err DOUBLE <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (0);
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# INT columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT <CUSTOM_COL_OPTIONS> NOT NULL,
+i0 INT(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+i1 INT(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+i20 INT(20) <CUSTOM_COL_OPTIONS> NOT NULL,
+t TINYINT <CUSTOM_COL_OPTIONS> NOT NULL,
+t0 TINYINT(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+t1 TINYINT(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+t20 TINYINT(20) <CUSTOM_COL_OPTIONS> NOT NULL,
+s SMALLINT <CUSTOM_COL_OPTIONS> NOT NULL,
+s0 SMALLINT(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+s1 SMALLINT(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+s20 SMALLINT(20) <CUSTOM_COL_OPTIONS> NOT NULL,
+m MEDIUMINT <CUSTOM_COL_OPTIONS> NOT NULL,
+m0 MEDIUMINT(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+m1 MEDIUMINT(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+m20 MEDIUMINT(20) <CUSTOM_COL_OPTIONS> NOT NULL,
+b BIGINT <CUSTOM_COL_OPTIONS> NOT NULL,
+b0 BIGINT(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+b1 BIGINT(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+b20 BIGINT(20) <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+i int(11) # # #
+i0 int(11) # # #
+i1 int(1) # # #
+i20 int(20) # # #
+t tinyint(4) # # #
+t0 tinyint(4) # # #
+t1 tinyint(1) # # #
+t20 tinyint(20) # # #
+s smallint(6) # # #
+s0 smallint(6) # # #
+s1 smallint(1) # # #
+s20 smallint(20) # # #
+m mediumint(9) # # #
+m0 mediumint(9) # # #
+m1 mediumint(1) # # #
+m20 mediumint(20) # # #
+b bigint(20) # # #
+b0 bigint(20) # # #
+b1 bigint(1) # # #
+b20 bigint(20) # # #
+INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'i' at row 2
+Warning 1264 Out of range value for column 'i0' at row 2
+Warning 1264 Out of range value for column 'i1' at row 2
+Warning 1264 Out of range value for column 'i20' at row 2
+Warning 1264 Out of range value for column 't' at row 2
+Warning 1264 Out of range value for column 't0' at row 2
+Warning 1264 Out of range value for column 't1' at row 2
+Warning 1264 Out of range value for column 't20' at row 2
+Warning 1264 Out of range value for column 's' at row 2
+Warning 1264 Out of range value for column 's0' at row 2
+Warning 1264 Out of range value for column 's1' at row 2
+Warning 1264 Out of range value for column 's20' at row 2
+Warning 1264 Out of range value for column 'm' at row 2
+Warning 1264 Out of range value for column 'm0' at row 2
+Warning 1264 Out of range value for column 'm1' at row 2
+Warning 1264 Out of range value for column 'm20' at row 2
+Warning 1264 Out of range value for column 'i' at row 3
+Warning 1264 Out of range value for column 'i0' at row 3
+Warning 1264 Out of range value for column 'i1' at row 3
+Warning 1264 Out of range value for column 'i20' at row 3
+Warning 1264 Out of range value for column 't' at row 3
+Warning 1264 Out of range value for column 't0' at row 3
+Warning 1264 Out of range value for column 't1' at row 3
+Warning 1264 Out of range value for column 't20' at row 3
+Warning 1264 Out of range value for column 's' at row 3
+Warning 1264 Out of range value for column 's0' at row 3
+Warning 1264 Out of range value for column 's1' at row 3
+Warning 1264 Out of range value for column 's20' at row 3
+Warning 1264 Out of range value for column 'm' at row 3
+Warning 1264 Out of range value for column 'm0' at row 3
+Warning 1264 Out of range value for column 'm1' at row 3
+Warning 1264 Out of range value for column 'm20' at row 3
+Warning 1264 Out of range value for column 'i' at row 4
+Warning 1264 Out of range value for column 'i0' at row 4
+Warning 1264 Out of range value for column 'i1' at row 4
+Warning 1264 Out of range value for column 'i20' at row 4
+Warning 1264 Out of range value for column 't' at row 4
+Warning 1264 Out of range value for column 't0' at row 4
+Warning 1264 Out of range value for column 't1' at row 4
+Warning 1264 Out of range value for column 't20' at row 4
+Warning 1264 Out of range value for column 's' at row 4
+Warning 1264 Out of range value for column 's0' at row 4
+Warning 1264 Out of range value for column 's1' at row 4
+Warning 1264 Out of range value for column 's20' at row 4
+Warning 1264 Out of range value for column 'm' at row 4
+Warning 1264 Out of range value for column 'm0' at row 4
+Warning 1264 Out of range value for column 'm1' at row 4
+Warning 1264 Out of range value for column 'm20' at row 4
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+ALTER TABLE t1 ADD COLUMN i257 INT(257);
+ERROR 42000: Display width out of range for 'i257' (max = 255)
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c INT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c int(11) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c INT <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 INT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 2147483647
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c int(11) NO NULL
+c2 int(11) NO 2147483647
+ALTER TABLE t1 ADD COLUMN err INT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (2147483647);
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TINYINT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinyint(4) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c TINYINT <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 TINYINT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 127
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinyint(4) NO NULL
+c2 tinyint(4) NO 127
+ALTER TABLE t1 ADD COLUMN err TINYINT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (127 );
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c SMALLINT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c smallint(6) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c SMALLINT <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 SMALLINT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 0
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c smallint(6) NO NULL
+c2 smallint(6) NO 0
+ALTER TABLE t1 ADD COLUMN err SMALLINT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (0);
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c MEDIUMINT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c mediumint(9) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c MEDIUMINT <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 MEDIUMINT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 1
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c mediumint(9) NO NULL
+c2 mediumint(9) NO 1
+ALTER TABLE t1 ADD COLUMN err MEDIUMINT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (1);
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c BIGINT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c bigint(20) NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c BIGINT <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 BIGINT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 9223372036854775807
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c bigint(20) NO NULL
+c2 bigint(20) NO 9223372036854775807
+ALTER TABLE t1 ADD COLUMN err BIGINT <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES (9223372036854775807);
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# SET columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a SET('') <CUSTOM_COL_OPTIONS> NOT NULL,
+b SET('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS> NOT NULL,
+c SET('01','02','03','04','05','06','07','08','09','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') <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a set('') # # #
+b set('test1','test2','test3','test4','test5') # # #
+c set('01','02','03','04','05','06','07','08','09','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') # # #
+INSERT INTO t1 VALUES
+('','test2,test3','01,34,44,,23'),
+('',5,2),
+(',','test4,test2','');
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+SELECT * FROM t1;
+a b c
+ test1,test3 02
+ test2,test3 01,23,34,44
+ test2,test4
+INSERT INTO t1 VALUES (0,'test6',-1);
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+SELECT * FROM t1;
+a b c
+ 01,02,03,04,05,06,07,08,09,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
+ test1,test3 02
+ test2,test3 01,23,34,44
+ test2,test4
+ALTER TABLE t1 ADD COLUMN e SET('a','A') <CUSTOM_COL_OPTIONS> NOT NULL;
+Warnings:
+Note 1291 Column 'e' has duplicated value 'a' in SET
+Note 1291 Column 'e' has duplicated value 'a' in SET
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a set('') # # #
+b set('test1','test2','test3','test4','test5') # # #
+c set('01','02','03','04','05','06','07','08','09','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') # # #
+e set('a','A') # # #
+ALTER TABLE t1 ADD COLUMN f SET('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i') <CUSTOM_COL_OPTIONS> NOT NULL;
+ERROR HY000: Too many strings for column f and SET
+SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
+a b c e
+ test2,test3 01,23,34,44
+ test2,test4
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c SET('test1','test2','test3') <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c set('test1','test2','test3') NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+CREATE TABLE t1 (c SET('test1','test2','test3') <CUSTOM_COL_OPTIONS> NOT NULL,
+c2 SET('test1','test2','test3') <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT 'test2,test3'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c set('test1','test2','test3') NO NULL
+c2 set('test1','test2','test3') NO test2,test3
+ALTER TABLE t1 ADD COLUMN err SET('test1','test2','test3') <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT NULL;
+ERROR 42000: Invalid default value for 'err'
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+SELECT HEX(c), HEX(c2) FROM t1;
+HEX(c) HEX(c2)
+INSERT INTO t1 (c2) VALUES (NULL);
+ERROR 23000: Column 'c2' cannot be null
+INSERT INTO t1 (c) VALUES ('test2,test3');
+SELECT COUNT(c), COUNT(c2) FROM t1;
+COUNT(c) COUNT(c2)
+1 1
+DROP TABLE t1;
+#
+# TEXT columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (t TEXT <CUSTOM_COL_OPTIONS> NOT NULL,
+t0 TEXT(0) <CUSTOM_COL_OPTIONS> NOT NULL,
+t1 TEXT(1) <CUSTOM_COL_OPTIONS> NOT NULL,
+t300 TEXT(300) <CUSTOM_COL_OPTIONS> NOT NULL,
+tm TEXT(65535) <CUSTOM_COL_OPTIONS> NOT NULL,
+t70k TEXT(70000) <CUSTOM_COL_OPTIONS> NOT NULL,
+t17m TEXT(17000000) <CUSTOM_COL_OPTIONS> NOT NULL,
+tt TINYTEXT <CUSTOM_COL_OPTIONS> NOT NULL,
+m MEDIUMTEXT <CUSTOM_COL_OPTIONS> NOT NULL,
+l LONGTEXT <CUSTOM_COL_OPTIONS> NOT NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+t text # # #
+t0 text # # #
+t1 tinytext # # #
+t300 text # # #
+tm text # # #
+t70k mediumtext # # #
+t17m longtext # # #
+tt tinytext # # #
+m mediumtext # # #
+l longtext # # #
+INSERT INTO t1 VALUES
+('','','','','','','','','',''),
+('a','b','c','d','e','f','g','h','i','j'),
+('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
+( REPEAT('a',65535), REPEAT('b',65535), REPEAT('c',255), REPEAT('d',65535), REPEAT('e',65535), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',255), REPEAT('i',1048576), REPEAT('j',1048576) );
+SELECT LENGTH(t), LENGTH(t0), LENGTH(t1), LENGTH(t300), LENGTH(tm), LENGTH(t70k), LENGTH(t17m), LENGTH(tt), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m) LENGTH(tt) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+INSERT INTO t1 VALUES
+( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
+Warnings:
+Warning 1265 Data truncated for column 't' at row 1
+Warning 1265 Data truncated for column 't0' at row 1
+Warning 1265 Data truncated for column 't1' at row 1
+Warning 1265 Data truncated for column 't300' at row 1
+Warning 1265 Data truncated for column 'tm' at row 1
+Warning 1265 Data truncated for column 'tt' at row 1
+SELECT LENGTH(t), LENGTH(t0), LENGTH(t1), LENGTH(t300), LENGTH(tm), LENGTH(t70k), LENGTH(t17m), LENGTH(tt), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m) LENGTH(tt) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+ALTER TABLE t1 ADD COLUMN ttt TEXT(4294967296);
+ERROR 42000: Display width out of range for 'ttt' (max = 4294967295)
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TEXT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c text NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TINYTEXT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinytext NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c MEDIUMTEXT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c mediumtext NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c LONGTEXT <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c longtext NO NULL
+INSERT INTO t1 (c) VALUES (NULL);
+ERROR 23000: Column 'c' cannot be null
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/col_opt_not_null.test b/mysql-test/suite/storage_engine/col_opt_not_null.test
new file mode 100644
index 00000000000..2cd0e909536
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_opt_not_null.test
@@ -0,0 +1,260 @@
+#
+# NOT NULL column attribute
+#
+
+let $extra_col_opts = NOT NULL;
+
+--source have_engine.inc
+
+--echo #
+--echo # BINARY columns
+--echo #
+
+--source type_binary.inc
+--let $col_definition = BINARY $default_col_opts
+--let $col_default = 0
+--source col_not_null.inc
+
+--echo #
+--echo # VARBINARY columns
+--echo #
+
+--source type_varbinary.inc
+--let $col_definition = VARBINARY(64) $default_col_opts
+--let $col_default = 'test'
+--source col_not_null.inc
+
+--echo #
+--echo # BIT columns
+--echo #
+
+--source type_bit.inc
+--let $col_definition = BIT $default_col_opts
+--let $col_default = 1
+--source col_not_null.inc
+
+--echo #
+--echo # BLOB columns
+--echo #
+
+--source type_blob.inc
+
+--let $col_definition = BLOB $default_col_opts
+--source col_not_null.inc
+
+--let $col_definition = TINYBLOB $default_col_opts
+--source col_not_null.inc
+
+--let $col_definition = MEDIUMBLOB $default_col_opts
+--source col_not_null.inc
+
+--let $col_definition = LONGBLOB $default_col_opts
+--source col_not_null.inc
+
+--echo #
+--echo # BOOL columns
+--echo #
+
+--source type_bool.inc
+--let $col_definition = BOOL $default_col_opts
+--let $col_default = '0'
+--source col_not_null.inc
+
+--echo #
+--echo # CHAR columns
+--echo #
+
+--source type_char.inc
+--let $col_definition = CHAR $default_col_opts
+--let $col_default = '_'
+--source col_not_null.inc
+
+--echo #
+--echo # VARCHAR columns
+--echo #
+
+--source type_varchar.inc
+--let $col_definition = VARCHAR(64) $default_col_opts
+--let $col_default = 'test default'
+--source col_not_null.inc
+
+--echo #
+--echo # date and time columns
+--echo #
+
+--source type_date_time.inc
+
+--let $col_definition = DATE $default_col_opts
+--let $col_default = '2012-12-21'
+--source col_not_null.inc
+
+--let $col_definition = DATETIME $default_col_opts
+--let $col_default = '2012-12-21 12:21:12'
+--source col_not_null.inc
+
+# For TIMESTAMP the behavior is non-standard
+
+# $col_opts already contains NOT NULL part (it's set in have_engine.inc)
+
+let $create_definition =
+ c TIMESTAMP $col_opts,
+ c2 TIMESTAMP $col_opts DEFAULT '2012-02-21 12:21:12'
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = TIMESTAMP type or NOT NULL columns or DEFAULT
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --let $error_codes = ER_INVALID_DEFAULT
+ --let $alter_definition = ADD COLUMN err TIMESTAMP $col_opts DEFAULT NULL
+ --source alter_table.inc
+ if ($mysql_errname!=ER_INVALID_DEFAULT)
+ {
+ --let $functionality = ALTER or DEFAULT
+ --source unexpected_result.inc
+ }
+
+ INSERT INTO t1 (c) VALUES (NULL);
+ INSERT INTO t1 (c2) VALUES (NULL);
+ --replace_regex /2012-02-21 12:21:12/<DEFAULT_TIMESTAMP>/ /[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}/<TIMESTAMP>/
+ SELECT c, c2 FROM t1;
+
+ DROP TABLE t1;
+}
+
+--let $create_definition = c TIMESTAMP $col_opts
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = TIMESTAMP type
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (c) VALUES (NULL);
+ if ($mysql_errname)
+ {
+ --let $functionality = TIMESTAMP
+ --source unexpected_result.inc
+ }
+
+ --replace_regex /[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}/<TIMESTAMP>/
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+# End of TIMESTAMP exception
+
+
+--let $col_definition = TIME $default_col_opts
+--let $col_default = '12:21:12'
+--source col_not_null.inc
+
+--let $col_definition = YEAR $default_col_opts
+--let $col_default = '2012'
+--source col_not_null.inc
+
+--let $col_definition = YEAR(2) $default_col_opts
+--let $col_default = '12'
+--source col_not_null.inc
+
+
+--echo #
+--echo # ENUM columns
+--echo #
+
+--source type_enum.inc
+
+--let $col_definition = ENUM('test1','test2','test3') $default_col_opts
+--let $col_default = 'test2'
+--source col_not_null.inc
+
+
+--echo #
+--echo # Fixed point columns (NUMERIC, DECIMAL)
+--echo #
+
+--source type_fixed.inc
+
+--let $col_definition = DECIMAL $default_col_opts
+--let $col_default = 1.1
+--source col_not_null.inc
+
+--let $col_definition = NUMERIC $default_col_opts
+--let $col_default = 0
+--source col_not_null.inc
+
+--echo #
+--echo # Floating point columns (FLOAT, DOUBLE)
+--echo #
+
+--source type_float.inc
+
+--let $col_definition = FLOAT $default_col_opts
+--let $col_default = 1.1
+--source col_not_null.inc
+
+--let $col_definition = DOUBLE $default_col_opts
+--let $col_default = 0
+--source col_not_null.inc
+
+--echo #
+--echo # INT columns
+--echo #
+
+--source type_int.inc
+
+--let $col_definition = INT $default_col_opts
+--let $col_default = 2147483647
+--source col_not_null.inc
+
+--let $col_definition = TINYINT $default_col_opts
+--let $col_default = 127
+--source col_not_null.inc
+
+--let $col_definition = SMALLINT $default_col_opts
+--let $col_default = 0
+--source col_not_null.inc
+
+--let $col_definition = MEDIUMINT $default_col_opts
+--let $col_default = 1
+--source col_not_null.inc
+
+--let $col_definition = BIGINT $default_col_opts
+--let $col_default = 9223372036854775807
+--source col_not_null.inc
+
+--echo #
+--echo # SET columns
+--echo #
+
+--source type_set.inc
+--let $col_definition = SET('test1','test2','test3') $default_col_opts
+--let $col_default = 'test2,test3'
+--source col_not_null.inc
+
+--echo #
+--echo # TEXT columns
+--echo #
+
+--source type_text.inc
+
+--let $col_definition = TEXT $default_col_opts
+--source col_not_null.inc
+
+--let $col_definition = TINYTEXT $default_col_opts
+--source col_not_null.inc
+
+--let $col_definition = MEDIUMTEXT $default_col_opts
+--source col_not_null.inc
+
+--let $col_definition = LONGTEXT $default_col_opts
+--source col_not_null.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/col_opt_null.result b/mysql-test/suite/storage_engine/col_opt_null.result
new file mode 100644
index 00000000000..c6a46f8c18f
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_opt_null.result
@@ -0,0 +1,1991 @@
+#
+# BINARY columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b BINARY <CUSTOM_COL_OPTIONS> NULL,
+b0 BINARY(0) <CUSTOM_COL_OPTIONS> NULL,
+b1 BINARY(1) <CUSTOM_COL_OPTIONS> NULL,
+b20 BINARY(20) <CUSTOM_COL_OPTIONS> NULL,
+b255 BINARY(255) <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b binary(1) # # # #
+b0 binary(0) # # # #
+b1 binary(1) # # # #
+b20 binary(20) # # # #
+b255 binary(255) # # # #
+INSERT INTO t1 VALUES ('','','','','');
+INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
+HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255)
+00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
+INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b0' at row 1
+Warning 1265 Data truncated for column 'b1' at row 1
+Warning 1265 Data truncated for column 'b20' at row 1
+Warning 1265 Data truncated for column 'b255' at row 1
+INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b0' at row 1
+Warning 1265 Data truncated for column 'b1' at row 1
+Warning 1265 Data truncated for column 'b20' at row 1
+Warning 1265 Data truncated for column 'b255' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'b0' at row 2
+Warning 1265 Data truncated for column 'b1' at row 2
+Warning 1265 Data truncated for column 'b20' at row 2
+Warning 1265 Data truncated for column 'b255' at row 2
+Warning 1265 Data truncated for column 'b' at row 3
+Warning 1265 Data truncated for column 'b0' at row 3
+Warning 1265 Data truncated for column 'b1' at row 3
+Warning 1265 Data truncated for column 'b20' at row 3
+Warning 1265 Data truncated for column 'b255' at row 3
+SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
+HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255)
+00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+43 43 4372656174696E6720616E2061727469636C6520 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
+61 61 6161616161616161616161616161616161616161 787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878
+61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
+78 78 7878787878787878787878787878787878787878 787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878
+ALTER TABLE t1 ADD COLUMN b257 BINARY(257) <CUSTOM_COL_OPTIONS> NULL;
+ERROR 42000: Column length too big for column 'b257' (max = 255); use BLOB or TEXT instead
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b binary(1) # # # #
+b0 binary(0) # # # #
+b1 binary(1) # # # #
+b20 binary(20) # # # #
+b255 binary(255) # # # #
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c BINARY <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c binary(1) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c BINARY <CUSTOM_COL_OPTIONS> NULL,
+c1 BINARY <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 BINARY <CUSTOM_COL_OPTIONS> NULL DEFAULT 0
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c binary(1) YES NULL
+c1 binary(1) YES NULL
+c2 binary(1) YES 0
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# VARBINARY columns
+#
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (v0 VARBINARY(0) <CUSTOM_COL_OPTIONS> NULL,
+v1 VARBINARY(1) <CUSTOM_COL_OPTIONS> NULL,
+v64 VARBINARY(64) <CUSTOM_COL_OPTIONS> NULL,
+v65000 VARBINARY(65000) <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varbinary(0) # # #
+v1 varbinary(1) # # #
+v64 varbinary(64) # # #
+v65000 varbinary(65000) # # #
+CREATE TABLE t2 (v VARBINARY(65532) <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t2;
+Field Type Null Key Default Extra
+v varbinary(65532) # # #
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','','','');
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that an article doesn\'t already exist','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+ For developers who want to code on MariaDB or MySQL
+
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+
+ For MariaDB / MySQL end users
+
+ * MariaDB Crash Course by Ben Forta
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o Free to read in the Knowledgebase!
+
+ * MySQL (4th Edition) by Paul DuBois
+ o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+
+ * MySQL Cookbook by Paul DuBois
+ o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
+SELECT HEX(v0), HEX(v1), HEX(v64), HEX(v65000) FROM t1;
+HEX(v0) HEX(v1) HEX(v64) HEX(v65000)
+
+ 79 4F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C7265616479206578697374 486572652069732061206C697374206F66207265636F6D6D656E64656420626F6F6B73206F6E204D61726961444220616E64204D7953514C2E2057652776652070726F7669646564206C696E6B7320746F20416D617A6F6E2E636F6D206865726520666F7220636F6E76656E69656E63652C2062757420746865792063616E20626520666F756E64206174206D616E79206F7468657220626F6F6B73746F7265732C20626F7468206F6E6C696E6520616E64206F66662E0A0A2020496620796F752077616E7420746F206861766520796F7572206661766F72697465204D7953514C202F204D61726961444220626F6F6B206C697374656420686572652C20706C65617365206C65617665206120636F6D6D656E742E0A2020466F7220646576656C6F706572732077686F2077616E7420746F20636F6465206F6E204D617269614442206F72204D7953514C0A0A2020202020202A20556E6465727374616E64696E67204D7953514C20496E7465726E616C73206279205361736861205061636865762C20666F726D6572204D7953514C20646576656C6F706572206174204D7953514C2041422E0A2020202020202020202020206F205468697320697320746865206F6E6C7920626F6F6B207765206B6E6F772061626F75742074686174206465736372696265732074686520696E7465726E616C73206F66204D617269614442202F204D7953514C2E2041206D757374206861766520666F7220616E796F6E652077686F2077616E747320746F20756E6465727374616E6420616E6420646576656C6F70206F6E204D617269614442210A2020202020202020202020206F204E6F7420616C6C20746F706963732061726520636F766572656420616E6420736F6D652070617274732061726520736C696768746C79206F757464617465642C20627574207374696C6C20746865206265737420626F6F6B206F6E207468697320746F7069632E200A2020202020202A204D7953514C20352E3120506C7567696E20446576656C6F706D656E742062792053657267656920476F6C75626368696B20616E6420416E64726577204875746368696E67730A2020202020202020202020206F2041206D757374207265616420666F7220616E796F6E652077616E74696E6720746F207772697465206120706C7567696E20666F72204D6172696144422C207772697474656E20627920746865205365726765692077686F2064657369676E65642074686520706C7567696E20696E7465726661636520666F72204D7953514C20616E64204D61726961444221200A0A2020466F72204D617269614442202F204D7953514C20656E642075736572730A0A2020202020202A204D61726961444220437261736820436F757273652062792042656E20466F7274610A2020202020202020202020206F204669727374204D61726961444220626F6F6B210A2020202020202020202020206F20466F722070656F706C652077686F2077616E7420746F206C6561726E2053514C20616E642074686520626173696373206F66204D6172696144422E0A2020202020202020202020206F204E6F77207368697070696E672E20507572636861736520617420416D617A6F6E2E636F6D206F7220796F7572206661766F7269746520626F6F6B73656C6C65722E200A0A2020202020202A2053514C2D393920436F6D706C6574652C205265616C6C792062792050657465722047756C75747A616E20262054727564792050656C7A65722E0A2020202020202020202020206F2045766572797468696E6720796F752077616E74656420746F206B6E6F772061626F7574207468652053514C203939207374616E646172642E20457863656C6C656E74207265666572656E636520626F6F6B210A2020202020202020202020206F204672656520746F207265616420696E20746865204B6E6F776C656467656261736521200A0A2020202020202A204D7953514C20283474682045646974696F6E29206279205061756C204475426F69730A2020202020202020202020206F20546865202764656661756C742720626F6F6B20746F207265616420696620796F7520776F6E7420746F206C6561726E20746F20757365204D7953514C202F204D6172696144422E200A0A2020202020202A204D7953514C20436F6F6B626F6F6B206279205061756C204475426F69730A2020202020202020202020206F2041206C6F74206F66206578616D706C6573206F6620686F7720746F20757365204D7953514C2E204173207769746820616C6C206F66205061756C277320626F6F6B732C206974277320776F727468206974732077656967687420696E20676F6C6420616E64206576656E20656E6A6F7961626C652072656164696E6720666F7220737563682061202764727927207375626A6563742E200A0A2020202020202A204869676820506572666F726D616E6365204D7953514C2C205365636F6E642045646974696F6E2C204279204261726F6E20536368776172747A2C205065746572205A6169747365762C20566164696D20546B616368656E6B6F2C204A6572656D7920442E205A61776F646E792C2041726A656E204C656E747A2C20446572656B204A2E2042616C6C696E672C20657420616C2E0A2020202020202020202020206F20224869676820506572666F726D616E6365204D7953514C2069732074686520646566696E697469766520677569646520746F206275696C64696E6720666173742C2072656C6961626C652073797374656D732077697468204D7953514C2E205772697474656E206279206E6F74656420657870657274732077697468207965617273206F66207265616C2D776F726C6420657870657269656E6365206275696C64696E672076657279206C617267652073797374656D732C207468697320626F6F6B20636F7665727320657665727920617370656374206F66204D7953514C20706572666F726D616E636520696E2064657461696C2C20616E6420666F6375736573206F6E20726F627573746E6573732C2073656375726974792C20616E64206461746120696E746567726974792E204C6561726E20616476616E63656420746563686E697175657320696E20646570746820736F20796F752063616E206272696E67206F7574204D7953514C27732066756C6C20706F7765722E22202846726F6D2074686520626F6F6B206465736372697074696F6E206174204F275265696C6C7929200A0A2020202020202A204D7953514C2041646D696E20436F6F6B626F6F6B0A2020202020202020202020206F204120717569636B20737465702D62792D7374657020677569646520666F72204D7953514C20757365727320616E642064617461626173652061646D696E6973747261746F727320746F207461636B6C65207265616C2D776F726C64206368616C6C656E6765732077697468204D7953514C20636F6E66696775726174696F6E20616E642061646D696E697374726174696F6E200A0A2020202020202A204D7953514C20352E302043657274696669636174696F6E2053747564792047756964652C204279205061756C204475426F69732C2053746566616E2048696E7A2C204361727374656E20506564657273656E0A2020202020202020202020206F205468697320697320746865206F6666696369616C20677569646520746F20636F766572207468652070617373696E67206F66207468652074776F204D7953514C2043657274696669636174696F6E206578616D696E6174696F6E732E2049742069732076616C69642074696C6C2076657273696F6E20352E30206F6620746865207365727665722C20736F207768696C65206974206D697373657320616C6C2074686520666561747572657320617661696C61626C6520696E204D7953514C20352E3120616E6420677265617465722028696E636C7564696E67204D61726961444220352E3120616E642067726561746572292C2069742070726F7669646573206120676F6F6420626173696320756E6465727374616E64696E67206F66204D7953514C20666F722074686520656E642D757365722E20
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('y', 'yy', REPEAT('c',65), REPEAT('abcdefghi ',6501));
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 1
+Warning 1265 Data truncated for column 'v1' at row 1
+Warning 1265 Data truncated for column 'v64' at row 1
+Warning 1265 Data truncated for column 'v65000' at row 1
+INSERT INTO t1 (v0,v1,v64,v65000) SELECT v65000, v65000, v65000, CONCAT(v65000,v1) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 2
+Warning 1265 Data truncated for column 'v1' at row 2
+Warning 1265 Data truncated for column 'v64' at row 2
+Warning 1265 Data truncated for column 'v0' at row 3
+Warning 1265 Data truncated for column 'v1' at row 3
+Warning 1265 Data truncated for column 'v64' at row 3
+Warning 1265 Data truncated for column 'v65000' at row 3
+SELECT HEX(v0), HEX(v1), HEX(v64), LENGTH(HEX(v65000)) FROM t1;
+HEX(v0) HEX(v1) HEX(v64) LENGTH(HEX(v65000))
+ 0
+ 0
+ 48 486572652069732061206C697374206F66207265636F6D6D656E64656420626F6F6B73206F6E204D61726961444220616E64204D7953514C2E20576527766520 5932
+ 61 61626364656667686920616263646566676869206162636465666768692061626364656667686920616263646566676869206162636465666768692061626364 130000
+ 79 4F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C7265616479206578697374 5930
+ 79 63636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363 130000
+ALTER TABLE t1 ADD COLUMN v65536 VARBINARY(65536) <CUSTOM_COL_OPTIONS> NULL;
+Warnings:
+Note 1246 Converting column 'v65536' from VARBINARY to BLOB
+Note 1246 Converting column 'v65536' from VARBINARY to BLOB
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varbinary(0) # # #
+v1 varbinary(1) # # #
+v64 varbinary(64) # # #
+v65000 varbinary(65000) # # #
+v65536 mediumblob # # #
+DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c VARBINARY(64) <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c varbinary(64) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c VARBINARY(64) <CUSTOM_COL_OPTIONS> NULL,
+c1 VARBINARY(64) <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 VARBINARY(64) <CUSTOM_COL_OPTIONS> NULL DEFAULT 'test'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c varbinary(64) YES NULL
+c1 varbinary(64) YES NULL
+c2 varbinary(64) YES test
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# BIT columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a BIT <CUSTOM_COL_OPTIONS> NULL,
+b BIT(20) <CUSTOM_COL_OPTIONS> NULL,
+c BIT(64) <CUSTOM_COL_OPTIONS> NULL,
+d BIT(1) <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a bit(1) # # #
+b bit(20) # # #
+c bit(64) # # #
+d bit(1) # # #
+ALTER TABLE t1 DROP COLUMN d;
+ALTER TABLE t1 ADD COLUMN d BIT(0) <CUSTOM_COL_OPTIONS> NULL;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a bit(1) # # #
+b bit(20) # # #
+c bit(64) # # #
+d bit(1) # # #
+INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
+SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0;
+BIN(a) HEX(b) c+0
+0 FFFFF 18446744073709551615
+INSERT INTO t1 VALUES (1,0,-1,0);
+SELECT a+0, b+0, c+0 FROM t1 WHERE d<100;
+a+0 b+0 c+0
+0 1048575 18446744073709551615
+1 0 18446744073709551615
+INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0);
+SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2);
+a+0 b+0 c+0
+1 0 18446744073709551615
+1 102 255
+INSERT INTO t1 VALUES (0x10,0,0,1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT * FROM t1;
+a b c d
+INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0);
+Warnings:
+Warning 1264 Out of range value for column 'c' at row 1
+SELECT * FROM t1;
+a b c d
+DROP TABLE t1;
+CREATE TABLE t1 (a BIT(65) <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ERROR 42000: Display width out of range for 'a' (max = 64)
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c BIT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c bit(1) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c BIT <CUSTOM_COL_OPTIONS> NULL,
+c1 BIT <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 BIT <CUSTOM_COL_OPTIONS> NULL DEFAULT 1
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c bit(1) YES NULL
+c1 bit(1) YES NULL
+c2 bit(1) YES b'1'
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# BLOB columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b BLOB <CUSTOM_COL_OPTIONS> NULL,
+b0 BLOB(0) <CUSTOM_COL_OPTIONS> NULL,
+b1 BLOB(1) <CUSTOM_COL_OPTIONS> NULL,
+b300 BLOB(300) <CUSTOM_COL_OPTIONS> NULL,
+bm BLOB(65535) <CUSTOM_COL_OPTIONS> NULL,
+b70k BLOB(70000) <CUSTOM_COL_OPTIONS> NULL,
+b17m BLOB(17000000) <CUSTOM_COL_OPTIONS> NULL,
+t TINYBLOB <CUSTOM_COL_OPTIONS> NULL,
+m MEDIUMBLOB <CUSTOM_COL_OPTIONS> NULL,
+l LONGBLOB <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b blob # # #
+b0 blob # # #
+b1 tinyblob # # #
+b300 blob # # #
+bm blob # # #
+b70k mediumblob # # #
+b17m longblob # # #
+t tinyblob # # #
+m mediumblob # # #
+l longblob # # #
+INSERT INTO t1 VALUES
+('','','','','','','','','',''),
+('a','b','c','d','e','f','g','h','i','j'),
+('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
+( REPEAT('a',65535), REPEAT('b',65535), REPEAT('c',255), REPEAT('d',65535), REPEAT('e',65535), REPEAT('f',1048576), HEX(REPEAT('g',1048576)), REPEAT('h',255), REPEAT('i',1048576), HEX(REPEAT('j',1048576)) );
+SELECT LENGTH(b), LENGTH(b0), LENGTH(b1), LENGTH(b300), LENGTH(bm), LENGTH(b70k), LENGTH(b17m), LENGTH(t), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m) LENGTH(t) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152
+INSERT INTO t1 VALUES
+( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b0' at row 1
+Warning 1265 Data truncated for column 'b1' at row 1
+Warning 1265 Data truncated for column 'b300' at row 1
+Warning 1265 Data truncated for column 'bm' at row 1
+Warning 1265 Data truncated for column 't' at row 1
+SELECT LENGTH(b), LENGTH(b0), LENGTH(b1), LENGTH(b300), LENGTH(bm), LENGTH(b70k), LENGTH(b17m), LENGTH(t), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m) LENGTH(t) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152
+ALTER TABLE t1 ADD COLUMN bbb BLOB(4294967296);
+ERROR 42000: Display width out of range for 'bbb' (max = 4294967295)
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c BLOB <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c blob YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TINYBLOB <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinyblob YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c MEDIUMBLOB <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c mediumblob YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c LONGBLOB <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c longblob YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+#
+# BOOL columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b1 BOOL <CUSTOM_COL_OPTIONS> NULL,
+b2 BOOLEAN <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b1 tinyint(1) # # #
+b2 tinyint(1) # # #
+INSERT INTO t1 VALUES (1,TRUE);
+SELECT * FROM t1;
+b1 b2
+1 1
+INSERT INTO t1 VALUES (FALSE,0);
+SELECT * FROM t1;
+b1 b2
+0 0
+1 1
+INSERT INTO t1 VALUES (2,3);
+SELECT * FROM t1;
+b1 b2
+0 0
+1 1
+2 3
+INSERT INTO t1 VALUES (-1,-2);
+SELECT * FROM t1;
+b1 b2
+-1 -2
+0 0
+1 1
+2 3
+SELECT IF(b1,'true','false') AS a, IF(b2,'true','false') AS b FROM t1;
+a b
+false false
+true true
+true true
+true true
+SELECT * FROM t1 WHERE b1 = TRUE;
+b1 b2
+1 1
+SELECT * FROM t1 WHERE b2 = FALSE;
+b1 b2
+0 0
+INSERT INTO t1 VALUES ('a','b');
+Warnings:
+Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
+Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
+SELECT * FROM t1;
+b1 b2
+-1 -2
+0 0
+0 0
+1 1
+2 3
+INSERT INTO t1 VALUES (128,-129);
+Warnings:
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b2' at row 1
+SELECT * FROM t1;
+b1 b2
+-1 -2
+0 0
+0 0
+1 1
+127 -128
+2 3
+ALTER TABLE t1 ADD COLUMN b3 BOOLEAN UNSIGNED;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNSIGNED' at line 1
+ALTER TABLE t1 ADD COLUMN b3 BOOL ZEROFILL;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ZEROFILL' at line 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c BOOL <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinyint(1) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c BOOL <CUSTOM_COL_OPTIONS> NULL,
+c1 BOOL <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 BOOL <CUSTOM_COL_OPTIONS> NULL DEFAULT '0'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinyint(1) YES NULL
+c1 tinyint(1) YES NULL
+c2 tinyint(1) YES 0
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# CHAR columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS> NULL,
+c0 CHAR(0) <CUSTOM_COL_OPTIONS> NULL,
+c1 CHAR(1) <CUSTOM_COL_OPTIONS> NULL,
+c20 CHAR(20) <CUSTOM_COL_OPTIONS> NULL,
+c255 CHAR(255) <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c char(1) # # #
+c0 char(0) # # #
+c1 char(1) # # #
+c20 char(20) # # #
+c255 char(255) # # #
+INSERT INTO t1 VALUES ('','','','','');
+INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+SELECT * FROM t1;
+c c0 c1 c20 c255
+
+a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.
+INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'c0' at row 1
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c20' at row 1
+Warning 1265 Data truncated for column 'c255' at row 1
+INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 2
+Warning 1265 Data truncated for column 'c0' at row 2
+Warning 1265 Data truncated for column 'c1' at row 2
+Warning 1265 Data truncated for column 'c20' at row 2
+Warning 1265 Data truncated for column 'c' at row 3
+Warning 1265 Data truncated for column 'c0' at row 3
+Warning 1265 Data truncated for column 'c1' at row 3
+Warning 1265 Data truncated for column 'c20' at row 3
+Warning 1265 Data truncated for column 'c255' at row 3
+SELECT * FROM t1;
+c c0 c1 c20 c255
+
+
+C C Creating an article Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.b
+a a aaaaaaaaaaaaaaaaaaaa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.
+x x xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+SELECT DISTINCT c20, REPEAT('a',LENGTH(c20)), COUNT(*) FROM t1 GROUP BY c1, c20;
+c20 REPEAT('a',LENGTH(c20)) COUNT(*)
+ 2
+Creating an article aaaaaaaaaaaaaaaaaaa 1
+aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaa 1
+abcdefghi klmnopqrst aaaaaaaaaaaaaaaaaaaa 1
+xxxxxxxxxxxxxxxxxxxx aaaaaaaaaaaaaaaaaaaa 1
+ALTER TABLE t1 ADD COLUMN c257 CHAR(257) <CUSTOM_COL_OPTIONS> NULL;
+ERROR 42000: Column length too big for column 'c257' (max = 255); use BLOB or TEXT instead
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c char(1) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS> NULL,
+c1 CHAR <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 CHAR <CUSTOM_COL_OPTIONS> NULL DEFAULT '_'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c char(1) YES NULL
+c1 char(1) YES NULL
+c2 char(1) YES _
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# VARCHAR columns
+#
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (v0 VARCHAR(0) <CUSTOM_COL_OPTIONS> NULL,
+v1 VARCHAR(1) <CUSTOM_COL_OPTIONS> NULL,
+v64 VARCHAR(64) <CUSTOM_COL_OPTIONS> NULL,
+v65000 VARCHAR(65000) <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varchar(0) # # #
+v1 varchar(1) # # #
+v64 varchar(64) # # #
+v65000 varchar(65000) # # #
+CREATE TABLE t2 (v VARCHAR(65532) <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t2;
+Field Type Null Key Default Extra
+v varchar(65532) # # #
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','','','');
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that an article doesn\'t already exist','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+ For developers who want to code on MariaDB or MySQL
+
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+
+ For MariaDB / MySQL end users
+
+ * MariaDB Crash Course by Ben Forta
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o Free to read in the Knowledgebase!
+
+ * MySQL (4th Edition) by Paul DuBois
+ o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+
+ * MySQL Cookbook by Paul DuBois
+ o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
+SELECT * FROM t1;
+v0 v1 v64 v65000
+
+
+
+
+
+
+
+
+
+
+
+ y Once there, double check that an article doesn't already exist Here is a list of recommended books on MariaDB and MySQL. We've provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+ o "High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL's full power." (From the book description at O'Reilly)
+ o A lot of examples of how to use MySQL. As with all of Paul's books, it's worth its weight in gold and even enjoyable reading for such a 'dry' subject.
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Free to read in the Knowledgebase!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+ o The 'default' book to read if you wont to learn to use MySQL / MariaDB.
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ * MariaDB Crash Course by Ben Forta
+ * MySQL (4th Edition) by Paul DuBois
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ * MySQL Admin Cookbook
+ * MySQL Cookbook by Paul DuBois
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ For MariaDB / MySQL end users
+ For developers who want to code on MariaDB or MySQL
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('y', 'yy', REPEAT('c',65), REPEAT('abcdefghi ',6501));
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 1
+Warning 1265 Data truncated for column 'v1' at row 1
+Warning 1265 Data truncated for column 'v64' at row 1
+Warning 1265 Data truncated for column 'v65000' at row 1
+INSERT INTO t1 (v0,v1,v64,v65000) SELECT v65000, v65000, v65000, CONCAT(v65000,v1) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 2
+Warning 1265 Data truncated for column 'v1' at row 2
+Warning 1265 Data truncated for column 'v64' at row 2
+Warning 1265 Data truncated for column 'v0' at row 3
+Warning 1265 Data truncated for column 'v1' at row 3
+Warning 1265 Data truncated for column 'v64' at row 3
+Warning 1265 Data truncated for column 'v65000' at row 3
+SELECT v0, v1, v64, LENGTH(v65000) FROM t1;
+v0 v1 v64 LENGTH(v65000)
+ 0
+ 0
+ H Here is a list of recommended books on MariaDB and MySQL. We've 2966
+ a abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcd 65000
+ y Once there, double check that an article doesn't already exist 2965
+ y cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 65000
+ALTER TABLE t1 ADD COLUMN v65536 VARCHAR(65536) <CUSTOM_COL_OPTIONS> NULL;
+Warnings:
+Note 1246 Converting column 'v65536' from VARCHAR to TEXT
+Note 1246 Converting column 'v65536' from VARCHAR to TEXT
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varchar(0) # # #
+v1 varchar(1) # # #
+v64 varchar(64) # # #
+v65000 varchar(65000) # # #
+v65536 mediumtext # # #
+DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c VARCHAR(64) <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c varchar(64) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c VARCHAR(64) <CUSTOM_COL_OPTIONS> NULL,
+c1 VARCHAR(64) <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 VARCHAR(64) <CUSTOM_COL_OPTIONS> NULL DEFAULT 'test default'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c varchar(64) YES NULL
+c1 varchar(64) YES NULL
+c2 varchar(64) YES test default
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# date and time columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS> NULL,
+dt DATETIME <CUSTOM_COL_OPTIONS> NULL,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS> NULL,
+t TIME <CUSTOM_COL_OPTIONS> NULL,
+y YEAR <CUSTOM_COL_OPTIONS> NULL,
+y4 YEAR(4) <CUSTOM_COL_OPTIONS> NULL,
+y2 YEAR(2) <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+d date # # #
+dt datetime # # #
+ts timestamp # # #
+t time # # #
+y year(4) # # #
+y4 year(4) # # #
+y2 year(2) # # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 VALUES
+('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'),
+('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'),
+('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm));
+SELECT * FROM t1;
+d dt ts t y y4 y2
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
+1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00
+2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
+9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99
+INSERT INTO t1 VALUES
+('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' );
+Warnings:
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'dt' at row 1
+Warning 1265 Data truncated for column 'ts' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 'y' at row 1
+Warning 1264 Out of range value for column 'y4' at row 1
+Warning 1264 Out of range value for column 'y2' at row 1
+SELECT * FROM t1;
+d dt ts t y y4 y2
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
+1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00
+2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
+9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c DATE <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c date YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c DATE <CUSTOM_COL_OPTIONS> NULL,
+c1 DATE <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 DATE <CUSTOM_COL_OPTIONS> NULL DEFAULT '2012-12-21'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c date YES NULL
+c1 date YES NULL
+c2 date YES 2012-12-21
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c DATETIME <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c datetime YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c DATETIME <CUSTOM_COL_OPTIONS> NULL,
+c1 DATETIME <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 DATETIME <CUSTOM_COL_OPTIONS> NULL DEFAULT '2012-12-21 12:21:12'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c datetime YES NULL
+c1 datetime YES NULL
+c2 datetime YES 2012-12-21 12:21:12
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TIMESTAMP <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c timestamp YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c TIMESTAMP <CUSTOM_COL_OPTIONS> NULL,
+c1 TIMESTAMP <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 TIMESTAMP <CUSTOM_COL_OPTIONS> NULL DEFAULT '2012-12-21 12:21:12'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c timestamp YES NULL
+c1 timestamp YES NULL
+c2 timestamp YES 2012-12-21 12:21:12
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TIME <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c time YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c TIME <CUSTOM_COL_OPTIONS> NULL,
+c1 TIME <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 TIME <CUSTOM_COL_OPTIONS> NULL DEFAULT '12:21:12'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c time YES NULL
+c1 time YES NULL
+c2 time YES 12:21:12
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c YEAR <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c year(4) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c YEAR <CUSTOM_COL_OPTIONS> NULL,
+c1 YEAR <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 YEAR <CUSTOM_COL_OPTIONS> NULL DEFAULT '2012'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c year(4) YES NULL
+c1 year(4) YES NULL
+c2 year(4) YES 2012
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c YEAR(2) <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c year(2) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c YEAR(2) <CUSTOM_COL_OPTIONS> NULL,
+c1 YEAR(2) <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 YEAR(2) <CUSTOM_COL_OPTIONS> NULL DEFAULT '12'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c year(2) YES NULL
+c1 year(2) YES NULL
+c2 year(2) YES 12
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# ENUM columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a ENUM('') <CUSTOM_COL_OPTIONS> NULL,
+b ENUM('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS> NULL,
+c ENUM('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a enum('') # # #
+b enum('test1','test2','test3','test4','test5') # # #
+c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
+INSERT INTO t1 VALUES ('','test2','4'),('',5,2);
+SELECT * FROM t1;
+a b c
+ test2 4
+ test5 2
+INSERT INTO t1 VALUES (0,'test6',-1);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+SELECT * FROM t1;
+a b c
+
+ test2 4
+ test5 2
+ALTER TABLE t1 ADD COLUMN e ENUM('a','A') <CUSTOM_COL_OPTIONS> NULL;
+Warnings:
+Note 1291 Column 'e' has duplicated value 'a' in ENUM
+Note 1291 Column 'e' has duplicated value 'a' in ENUM
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a enum('') # # #
+b enum('test1','test2','test3','test4','test5') # # #
+c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
+e enum('a','A') # # #
+INSERT INTO t1 VALUES ('','test3','75','A');
+SELECT * FROM t1;
+a b c e
+ NULL
+ test2 4 NULL
+ test3 75 a
+ test5 2 NULL
+SELECT * FROM t1 WHERE b='test2' OR a != '';
+a b c e
+ test2 4 NULL
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c ENUM('test1','test2','test3') <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c enum('test1','test2','test3') YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c ENUM('test1','test2','test3') <CUSTOM_COL_OPTIONS> NULL,
+c1 ENUM('test1','test2','test3') <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 ENUM('test1','test2','test3') <CUSTOM_COL_OPTIONS> NULL DEFAULT 'test2'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c enum('test1','test2','test3') YES NULL
+c1 enum('test1','test2','test3') YES NULL
+c2 enum('test1','test2','test3') YES test2
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# Fixed point columns (NUMERIC, DECIMAL)
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (d DECIMAL <CUSTOM_COL_OPTIONS> NULL,
+d0 DECIMAL(0) <CUSTOM_COL_OPTIONS> NULL,
+d1_1 DECIMAL(1,1) <CUSTOM_COL_OPTIONS> NULL,
+d10_2 DECIMAL(10,2) <CUSTOM_COL_OPTIONS> NULL,
+d60_10 DECIMAL(60,10) <CUSTOM_COL_OPTIONS> NULL,
+n NUMERIC <CUSTOM_COL_OPTIONS> NULL,
+n0_0 NUMERIC(0,0) <CUSTOM_COL_OPTIONS> NULL,
+n1 NUMERIC(1) <CUSTOM_COL_OPTIONS> NULL,
+n20_4 NUMERIC(20,4) <CUSTOM_COL_OPTIONS> NULL,
+n65_4 NUMERIC(65,4) <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+d decimal(10,0) # # #
+d0 decimal(10,0) # # #
+d1_1 decimal(1,1) # # #
+d10_2 decimal(10,2) # # #
+d60_10 decimal(60,10) # # #
+n decimal(10,0) # # #
+n0_0 decimal(10,0) # # #
+n1 decimal(1,0) # # #
+n20_4 decimal(20,4) # # #
+n65_4 decimal(65,4) # # #
+INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+Warning 1264 Out of range value for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+Warnings:
+Note 1265 Data truncated for column 'd' at row 1
+Note 1265 Data truncated for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Note 1265 Data truncated for column 'd10_2' at row 1
+Note 1265 Data truncated for column 'd60_10' at row 1
+Note 1265 Data truncated for column 'n' at row 1
+Note 1265 Data truncated for column 'n0_0' at row 1
+Note 1265 Data truncated for column 'n1' at row 1
+Note 1265 Data truncated for column 'n20_4' at row 1
+Note 1265 Data truncated for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.00 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.0000 9999999999999999999999999999999999999999999999999999999999999.1111
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66);
+ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6);
+ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66);
+ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 30.
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c DECIMAL <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c decimal(10,0) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c DECIMAL <CUSTOM_COL_OPTIONS> NULL,
+c1 DECIMAL <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 DECIMAL <CUSTOM_COL_OPTIONS> NULL DEFAULT 1.1
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+Warnings:
+Note 1265 Data truncated for column 'c2' at row 1
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c decimal(10,0) YES NULL
+c1 decimal(10,0) YES NULL
+c2 decimal(10,0) YES 1
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c NUMERIC <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c decimal(10,0) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c NUMERIC <CUSTOM_COL_OPTIONS> NULL,
+c1 NUMERIC <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 NUMERIC <CUSTOM_COL_OPTIONS> NULL DEFAULT 0
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c decimal(10,0) YES NULL
+c1 decimal(10,0) YES NULL
+c2 decimal(10,0) YES 0
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# Floating point columns (FLOAT, DOUBLE)
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f FLOAT <CUSTOM_COL_OPTIONS> NULL,
+f0 FLOAT(0) <CUSTOM_COL_OPTIONS> NULL,
+r1_1 REAL(1,1) <CUSTOM_COL_OPTIONS> NULL,
+f23_0 FLOAT(23) <CUSTOM_COL_OPTIONS> NULL,
+f20_3 FLOAT(20,3) <CUSTOM_COL_OPTIONS> NULL,
+d DOUBLE <CUSTOM_COL_OPTIONS> NULL,
+d1_0 DOUBLE(1,0) <CUSTOM_COL_OPTIONS> NULL,
+d10_10 DOUBLE PRECISION (10,10) <CUSTOM_COL_OPTIONS> NULL,
+d53 DOUBLE(53,0) <CUSTOM_COL_OPTIONS> NULL,
+d53_10 DOUBLE(53,10) <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+f float # # #
+f0 float # # #
+r1_1 double(1,1) # # #
+f23_0 float # # #
+f20_3 float(20,3) # # #
+d double # # #
+d1_0 double(1,0) # # #
+d10_10 double(10,10) # # #
+d53 double(53,0) # # #
+d53_10 double(53,10) # # #
+INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+SELECT * FROM t1;
+f 12345.1
+d 11111111.111
+d10_10 0.0123456789
+d1_0 8
+d53 1234566789123456800
+d53_10 100000000000000000.0000000000
+f0 12345.1
+f20_3 56789.988
+f23_0 123457000
+r1_1 0.9
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (
+99999999999999999999999999999999999999,
+99999999999999999999999999999999999999.9999999999999999,
+0.9,
+99999999999999999999999999999999999999.9,
+99999999999999999.999,
+999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+9,
+0.9999999999,
+1999999999999999999999999999999999999999999999999999999,
+19999999999999999999999999999999999999999999.9999999999
+);
+Warnings:
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 12345.1
+d 0
+d 11111111.111
+d 1e81
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d1_0 0
+d1_0 8
+d1_0 9
+d53 0
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 0
+f 1e38
+f0 0
+f0 12345.1
+f0 1e38
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+SELECT * FROM t1;
+f 12345.1
+d -1e60
+d 0
+d 11111111.111
+d 1e81
+d10_10 -0.9999999999
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d1_0 -9
+d1_0 0
+d1_0 8
+d1_0 9
+d53 -1000000000000000000000000000000
+d53 0
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f -1e24
+f 0
+f 1e38
+f0 -100000000000
+f0 0
+f0 12345.1
+f0 1e38
+f20_3 -99999998430674940.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f23_0 -1000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+r1_1 -0.9
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+SELECT MAX(f), MAX(f0), MAX(r1_1), MAX(f23_0), MAX(f20_3), MAX(d), MAX(d1_0), MAX(d10_10), MAX(d53), MAX(d53_10) FROM t1;
+MAX(f) 9.999999680285692e37
+MAX(d) 1e81
+MAX(d10_10) 0.9999999999
+MAX(d1_0) 9
+MAX(d53) 100000000000000000000000000000000000000000000000000000
+MAX(d53_10) 10000000000000000000000000000000000000000000.0000000000
+MAX(f0) 9.999999680285692e37
+MAX(f20_3) 99999998430674940.000
+MAX(f23_0) 9.999999680285692e37
+MAX(r1_1) 0.9
+INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+Warnings:
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+SELECT * FROM t1;
+f 12345.1
+d -1e60
+d 0
+d 11111111.111
+d 1e43
+d 1e81
+d10_10 -0.9999999999
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d10_10 10000000000000000000000000000000000000000000.0000000000
+d1_0 -9
+d1_0 0
+d1_0 8
+d1_0 9
+d1_0 9
+d53 -1000000000000000000000000000000
+d53 0
+d53 10000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f -1e24
+f 0
+f 1e38
+f 3.40282e38
+f0 -100000000000
+f0 0
+f0 12345.1
+f0 1e38
+f0 3.40282e38
+f20_3 -99999998430674940.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f23_0 -1000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+f23_0 3.40282e38
+r1_1 -0.9
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+INSERT INTO t1 VALUES (
+999999999999999999999999999999999999999,
+999999999999999999999999999999999999999.9999999999999999,
+1.9,
+999999999999999999999999999999999999999.9,
+999999999999999999.999,
+9999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+99,
+1.9999999999,
+1999999999999999999999999999999999999999999999999999999,
+19999999999999999999999999999999999999999999.9999999999
+);
+Warnings:
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+Warning 1264 Out of range value for column 'd10_10' at row 1
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 12345.1
+d -1e60
+d 0
+d 11111111.111
+d 1e43
+d 1e65
+d 1e81
+d10_10 -0.9999999999
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d10_10 0.9999999999
+d10_10 10000000000000000000000000000000000000000000.0000000000
+d1_0 -9
+d1_0 0
+d1_0 8
+d1_0 9
+d1_0 9
+d1_0 9
+d53 -1000000000000000000000000000000
+d53 0
+d53 10000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f -1e24
+f 0
+f 1e38
+f 3.40282e38
+f 3.40282e38
+f0 -100000000000
+f0 0
+f0 12345.1
+f0 1e38
+f0 3.40282e38
+f0 3.40282e38
+f20_3 -99999998430674940.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f23_0 -1000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+f23_0 3.40282e38
+f23_0 3.40282e38
+r1_1 -0.9
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0);
+ERROR 42000: Display width out of range for 'd0_0' (max = 255)
+ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1);
+ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35);
+ERROR 42000: Too big scale 35 specified for 'n66_66'. Maximum is 30.
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c FLOAT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c float YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c FLOAT <CUSTOM_COL_OPTIONS> NULL,
+c1 FLOAT <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 FLOAT <CUSTOM_COL_OPTIONS> NULL DEFAULT 1.1
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c float YES NULL
+c1 float YES NULL
+c2 float YES 1.1
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c DOUBLE <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c double YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c DOUBLE <CUSTOM_COL_OPTIONS> NULL,
+c1 DOUBLE <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 DOUBLE <CUSTOM_COL_OPTIONS> NULL DEFAULT 0
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c double YES NULL
+c1 double YES NULL
+c2 double YES 0
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# INT columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT <CUSTOM_COL_OPTIONS> NULL,
+i0 INT(0) <CUSTOM_COL_OPTIONS> NULL,
+i1 INT(1) <CUSTOM_COL_OPTIONS> NULL,
+i20 INT(20) <CUSTOM_COL_OPTIONS> NULL,
+t TINYINT <CUSTOM_COL_OPTIONS> NULL,
+t0 TINYINT(0) <CUSTOM_COL_OPTIONS> NULL,
+t1 TINYINT(1) <CUSTOM_COL_OPTIONS> NULL,
+t20 TINYINT(20) <CUSTOM_COL_OPTIONS> NULL,
+s SMALLINT <CUSTOM_COL_OPTIONS> NULL,
+s0 SMALLINT(0) <CUSTOM_COL_OPTIONS> NULL,
+s1 SMALLINT(1) <CUSTOM_COL_OPTIONS> NULL,
+s20 SMALLINT(20) <CUSTOM_COL_OPTIONS> NULL,
+m MEDIUMINT <CUSTOM_COL_OPTIONS> NULL,
+m0 MEDIUMINT(0) <CUSTOM_COL_OPTIONS> NULL,
+m1 MEDIUMINT(1) <CUSTOM_COL_OPTIONS> NULL,
+m20 MEDIUMINT(20) <CUSTOM_COL_OPTIONS> NULL,
+b BIGINT <CUSTOM_COL_OPTIONS> NULL,
+b0 BIGINT(0) <CUSTOM_COL_OPTIONS> NULL,
+b1 BIGINT(1) <CUSTOM_COL_OPTIONS> NULL,
+b20 BIGINT(20) <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+i int(11) # # #
+i0 int(11) # # #
+i1 int(1) # # #
+i20 int(20) # # #
+t tinyint(4) # # #
+t0 tinyint(4) # # #
+t1 tinyint(1) # # #
+t20 tinyint(20) # # #
+s smallint(6) # # #
+s0 smallint(6) # # #
+s1 smallint(1) # # #
+s20 smallint(20) # # #
+m mediumint(9) # # #
+m0 mediumint(9) # # #
+m1 mediumint(1) # # #
+m20 mediumint(20) # # #
+b bigint(20) # # #
+b0 bigint(20) # # #
+b1 bigint(1) # # #
+b20 bigint(20) # # #
+INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'i' at row 2
+Warning 1264 Out of range value for column 'i0' at row 2
+Warning 1264 Out of range value for column 'i1' at row 2
+Warning 1264 Out of range value for column 'i20' at row 2
+Warning 1264 Out of range value for column 't' at row 2
+Warning 1264 Out of range value for column 't0' at row 2
+Warning 1264 Out of range value for column 't1' at row 2
+Warning 1264 Out of range value for column 't20' at row 2
+Warning 1264 Out of range value for column 's' at row 2
+Warning 1264 Out of range value for column 's0' at row 2
+Warning 1264 Out of range value for column 's1' at row 2
+Warning 1264 Out of range value for column 's20' at row 2
+Warning 1264 Out of range value for column 'm' at row 2
+Warning 1264 Out of range value for column 'm0' at row 2
+Warning 1264 Out of range value for column 'm1' at row 2
+Warning 1264 Out of range value for column 'm20' at row 2
+Warning 1264 Out of range value for column 'i' at row 3
+Warning 1264 Out of range value for column 'i0' at row 3
+Warning 1264 Out of range value for column 'i1' at row 3
+Warning 1264 Out of range value for column 'i20' at row 3
+Warning 1264 Out of range value for column 't' at row 3
+Warning 1264 Out of range value for column 't0' at row 3
+Warning 1264 Out of range value for column 't1' at row 3
+Warning 1264 Out of range value for column 't20' at row 3
+Warning 1264 Out of range value for column 's' at row 3
+Warning 1264 Out of range value for column 's0' at row 3
+Warning 1264 Out of range value for column 's1' at row 3
+Warning 1264 Out of range value for column 's20' at row 3
+Warning 1264 Out of range value for column 'm' at row 3
+Warning 1264 Out of range value for column 'm0' at row 3
+Warning 1264 Out of range value for column 'm1' at row 3
+Warning 1264 Out of range value for column 'm20' at row 3
+Warning 1264 Out of range value for column 'i' at row 4
+Warning 1264 Out of range value for column 'i0' at row 4
+Warning 1264 Out of range value for column 'i1' at row 4
+Warning 1264 Out of range value for column 'i20' at row 4
+Warning 1264 Out of range value for column 't' at row 4
+Warning 1264 Out of range value for column 't0' at row 4
+Warning 1264 Out of range value for column 't1' at row 4
+Warning 1264 Out of range value for column 't20' at row 4
+Warning 1264 Out of range value for column 's' at row 4
+Warning 1264 Out of range value for column 's0' at row 4
+Warning 1264 Out of range value for column 's1' at row 4
+Warning 1264 Out of range value for column 's20' at row 4
+Warning 1264 Out of range value for column 'm' at row 4
+Warning 1264 Out of range value for column 'm0' at row 4
+Warning 1264 Out of range value for column 'm1' at row 4
+Warning 1264 Out of range value for column 'm20' at row 4
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+ALTER TABLE t1 ADD COLUMN i257 INT(257);
+ERROR 42000: Display width out of range for 'i257' (max = 255)
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c INT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c int(11) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c INT <CUSTOM_COL_OPTIONS> NULL,
+c1 INT <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 INT <CUSTOM_COL_OPTIONS> NULL DEFAULT 2147483647
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c int(11) YES NULL
+c1 int(11) YES NULL
+c2 int(11) YES 2147483647
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TINYINT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinyint(4) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c TINYINT <CUSTOM_COL_OPTIONS> NULL,
+c1 TINYINT <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 TINYINT <CUSTOM_COL_OPTIONS> NULL DEFAULT 127
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinyint(4) YES NULL
+c1 tinyint(4) YES NULL
+c2 tinyint(4) YES 127
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c SMALLINT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c smallint(6) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c SMALLINT <CUSTOM_COL_OPTIONS> NULL,
+c1 SMALLINT <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 SMALLINT <CUSTOM_COL_OPTIONS> NULL DEFAULT 0
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c smallint(6) YES NULL
+c1 smallint(6) YES NULL
+c2 smallint(6) YES 0
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c MEDIUMINT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c mediumint(9) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c MEDIUMINT <CUSTOM_COL_OPTIONS> NULL,
+c1 MEDIUMINT <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 MEDIUMINT <CUSTOM_COL_OPTIONS> NULL DEFAULT 1
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c mediumint(9) YES NULL
+c1 mediumint(9) YES NULL
+c2 mediumint(9) YES 1
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c BIGINT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c bigint(20) YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c BIGINT <CUSTOM_COL_OPTIONS> NULL,
+c1 BIGINT <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 BIGINT <CUSTOM_COL_OPTIONS> NULL DEFAULT 9223372036854775807
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c bigint(20) YES NULL
+c1 bigint(20) YES NULL
+c2 bigint(20) YES 9223372036854775807
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# SET columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a SET('') <CUSTOM_COL_OPTIONS> NULL,
+b SET('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS> NULL,
+c SET('01','02','03','04','05','06','07','08','09','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') <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a set('') # # #
+b set('test1','test2','test3','test4','test5') # # #
+c set('01','02','03','04','05','06','07','08','09','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') # # #
+INSERT INTO t1 VALUES
+('','test2,test3','01,34,44,,23'),
+('',5,2),
+(',','test4,test2','');
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+SELECT * FROM t1;
+a b c
+ test1,test3 02
+ test2,test3 01,23,34,44
+ test2,test4
+INSERT INTO t1 VALUES (0,'test6',-1);
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+SELECT * FROM t1;
+a b c
+ 01,02,03,04,05,06,07,08,09,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
+ test1,test3 02
+ test2,test3 01,23,34,44
+ test2,test4
+ALTER TABLE t1 ADD COLUMN e SET('a','A') <CUSTOM_COL_OPTIONS> NULL;
+Warnings:
+Note 1291 Column 'e' has duplicated value 'a' in SET
+Note 1291 Column 'e' has duplicated value 'a' in SET
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a set('') # # #
+b set('test1','test2','test3','test4','test5') # # #
+c set('01','02','03','04','05','06','07','08','09','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') # # #
+e set('a','A') # # #
+ALTER TABLE t1 ADD COLUMN f SET('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i') <CUSTOM_COL_OPTIONS> NULL;
+ERROR HY000: Too many strings for column f and SET
+SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
+a b c e
+ test2,test3 01,23,34,44 NULL
+ test2,test4 NULL
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c SET('test1','test2','test3') <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c set('test1','test2','test3') YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+CREATE TABLE t1 (c SET('test1','test2','test3') <CUSTOM_COL_OPTIONS> NULL,
+c1 SET('test1','test2','test3') <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
+c2 SET('test1','test2','test3') <CUSTOM_COL_OPTIONS> NULL DEFAULT 'test2,test3'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c set('test1','test2','test3') YES NULL
+c1 set('test1','test2','test3') YES NULL
+c2 set('test1','test2','test3') YES test2,test3
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c2), COUNT(c1), COUNT(c), COUNT(*) FROM t1;
+COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
+1 0 0 1
+DROP TABLE t1;
+#
+# TEXT columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (t TEXT <CUSTOM_COL_OPTIONS> NULL,
+t0 TEXT(0) <CUSTOM_COL_OPTIONS> NULL,
+t1 TEXT(1) <CUSTOM_COL_OPTIONS> NULL,
+t300 TEXT(300) <CUSTOM_COL_OPTIONS> NULL,
+tm TEXT(65535) <CUSTOM_COL_OPTIONS> NULL,
+t70k TEXT(70000) <CUSTOM_COL_OPTIONS> NULL,
+t17m TEXT(17000000) <CUSTOM_COL_OPTIONS> NULL,
+tt TINYTEXT <CUSTOM_COL_OPTIONS> NULL,
+m MEDIUMTEXT <CUSTOM_COL_OPTIONS> NULL,
+l LONGTEXT <CUSTOM_COL_OPTIONS> NULL
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+t text # # #
+t0 text # # #
+t1 tinytext # # #
+t300 text # # #
+tm text # # #
+t70k mediumtext # # #
+t17m longtext # # #
+tt tinytext # # #
+m mediumtext # # #
+l longtext # # #
+INSERT INTO t1 VALUES
+('','','','','','','','','',''),
+('a','b','c','d','e','f','g','h','i','j'),
+('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
+( REPEAT('a',65535), REPEAT('b',65535), REPEAT('c',255), REPEAT('d',65535), REPEAT('e',65535), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',255), REPEAT('i',1048576), REPEAT('j',1048576) );
+SELECT LENGTH(t), LENGTH(t0), LENGTH(t1), LENGTH(t300), LENGTH(tm), LENGTH(t70k), LENGTH(t17m), LENGTH(tt), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m) LENGTH(tt) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+INSERT INTO t1 VALUES
+( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
+Warnings:
+Warning 1265 Data truncated for column 't' at row 1
+Warning 1265 Data truncated for column 't0' at row 1
+Warning 1265 Data truncated for column 't1' at row 1
+Warning 1265 Data truncated for column 't300' at row 1
+Warning 1265 Data truncated for column 'tm' at row 1
+Warning 1265 Data truncated for column 'tt' at row 1
+SELECT LENGTH(t), LENGTH(t0), LENGTH(t1), LENGTH(t300), LENGTH(tm), LENGTH(t70k), LENGTH(t17m), LENGTH(tt), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m) LENGTH(tt) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+ALTER TABLE t1 ADD COLUMN ttt TEXT(4294967296);
+ERROR 42000: Display width out of range for 'ttt' (max = 4294967295)
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TEXT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c text YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c TINYTEXT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c tinytext YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c MEDIUMTEXT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c mediumtext YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c LONGTEXT <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c longtext YES NULL
+INSERT INTO t1 (c) VALUES (NULL);
+SELECT COUNT(c), COUNT(*) FROM t1;
+COUNT(c) COUNT(*)
+0 1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/col_opt_null.test b/mysql-test/suite/storage_engine/col_opt_null.test
new file mode 100644
index 00000000000..29979d29dfd
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_opt_null.test
@@ -0,0 +1,208 @@
+#
+# NULL column attribute
+#
+
+let $extra_col_opts = NULL;
+
+--source have_engine.inc
+
+--echo #
+--echo # BINARY columns
+--echo #
+
+--source type_binary.inc
+--let $col_definition = BINARY $default_col_opts
+--let $col_default = 0
+--source col_null.inc
+
+--echo #
+--echo # VARBINARY columns
+--echo #
+
+--source type_varbinary.inc
+--let $col_definition = VARBINARY(64) $default_col_opts
+--let $col_default = 'test'
+--source col_null.inc
+
+--echo #
+--echo # BIT columns
+--echo #
+
+--source type_bit.inc
+--let $col_definition = BIT $default_col_opts
+--let $col_default = 1
+--source col_null.inc
+
+--echo #
+--echo # BLOB columns
+--echo #
+
+--source type_blob.inc
+
+--let $col_definition = BLOB $default_col_opts
+--source col_null.inc
+
+--let $col_definition = TINYBLOB $default_col_opts
+--source col_null.inc
+
+--let $col_definition = MEDIUMBLOB $default_col_opts
+--source col_null.inc
+
+--let $col_definition = LONGBLOB $default_col_opts
+--source col_null.inc
+
+--echo #
+--echo # BOOL columns
+--echo #
+
+--source type_bool.inc
+--let $col_definition = BOOL $default_col_opts
+--let $col_default = '0'
+--source col_null.inc
+
+
+--echo #
+--echo # CHAR columns
+--echo #
+
+--source type_char.inc
+--let $col_definition = CHAR $default_col_opts
+--let $col_default = '_'
+--source col_null.inc
+
+--echo #
+--echo # VARCHAR columns
+--echo #
+
+
+--source type_varchar.inc
+--let $col_definition = VARCHAR(64) $default_col_opts
+--let $col_default = 'test default'
+--source col_null.inc
+
+
+--echo #
+--echo # date and time columns
+--echo #
+
+--source type_date_time.inc
+
+--let $col_definition = DATE $default_col_opts
+--let $col_default = '2012-12-21'
+--source col_null.inc
+
+--let $col_definition = DATETIME $default_col_opts
+--let $col_default = '2012-12-21 12:21:12'
+--source col_null.inc
+
+--let $col_definition = TIMESTAMP $default_col_opts
+--let $col_default = '2012-12-21 12:21:12'
+--source col_null.inc
+
+--let $col_definition = TIME $default_col_opts
+--let $col_default = '12:21:12'
+--source col_null.inc
+
+--let $col_definition = YEAR $default_col_opts
+--let $col_default = '2012'
+--source col_null.inc
+
+--let $col_definition = YEAR(2) $default_col_opts
+--let $col_default = '12'
+--source col_null.inc
+
+
+--echo #
+--echo # ENUM columns
+--echo #
+
+--source type_enum.inc
+--let $col_definition = ENUM('test1','test2','test3') $default_col_opts
+--let $col_default = 'test2'
+--source col_null.inc
+
+--echo #
+--echo # Fixed point columns (NUMERIC, DECIMAL)
+--echo #
+
+--source type_fixed.inc
+
+--let $col_definition = DECIMAL $default_col_opts
+--let $col_default = 1.1
+--source col_null.inc
+
+--let $col_definition = NUMERIC $default_col_opts
+--let $col_default = 0
+--source col_null.inc
+
+--echo #
+--echo # Floating point columns (FLOAT, DOUBLE)
+--echo #
+
+--source type_float.inc
+
+--let $col_definition = FLOAT $default_col_opts
+--let $col_default = 1.1
+--source col_null.inc
+
+--let $col_definition = DOUBLE $default_col_opts
+--let $col_default = 0
+--source col_null.inc
+
+--echo #
+--echo # INT columns
+--echo #
+
+--source type_int.inc
+
+--let $col_definition = INT $default_col_opts
+--let $col_default = 2147483647
+--source col_null.inc
+
+--let $col_definition = TINYINT $default_col_opts
+--let $col_default = 127
+--source col_null.inc
+
+--let $col_definition = SMALLINT $default_col_opts
+--let $col_default = 0
+--source col_null.inc
+
+--let $col_definition = MEDIUMINT $default_col_opts
+--let $col_default = 1
+--source col_null.inc
+
+--let $col_definition = BIGINT $default_col_opts
+--let $col_default = 9223372036854775807
+--source col_null.inc
+
+--echo #
+--echo # SET columns
+--echo #
+
+--source type_set.inc
+--let $col_definition = SET('test1','test2','test3') $default_col_opts
+--let $col_default = 'test2,test3'
+--source col_null.inc
+
+
+--echo #
+--echo # TEXT columns
+--echo #
+
+--source type_text.inc
+
+--let $col_definition = TEXT $default_col_opts
+--source col_null.inc
+
+--let $col_definition = TINYTEXT $default_col_opts
+--source col_null.inc
+
+--let $col_definition = MEDIUMTEXT $default_col_opts
+--source col_null.inc
+
+--let $col_definition = LONGTEXT $default_col_opts
+--source col_null.inc
+
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/col_opt_unsigned.result b/mysql-test/suite/storage_engine/col_opt_unsigned.result
new file mode 100644
index 00000000000..a68aa48ee79
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_opt_unsigned.result
@@ -0,0 +1,697 @@
+#
+# Fixed point columns (NUMERIC, DECIMAL)
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (d DECIMAL UNSIGNED <CUSTOM_COL_OPTIONS>,
+d0 DECIMAL(0) UNSIGNED <CUSTOM_COL_OPTIONS>,
+d1_1 DECIMAL(1,1) UNSIGNED <CUSTOM_COL_OPTIONS>,
+d10_2 DECIMAL(10,2) UNSIGNED <CUSTOM_COL_OPTIONS>,
+d60_10 DECIMAL(60,10) UNSIGNED <CUSTOM_COL_OPTIONS>,
+n NUMERIC UNSIGNED <CUSTOM_COL_OPTIONS>,
+n0_0 NUMERIC(0,0) UNSIGNED <CUSTOM_COL_OPTIONS>,
+n1 NUMERIC(1) UNSIGNED <CUSTOM_COL_OPTIONS>,
+n20_4 NUMERIC(20,4) UNSIGNED <CUSTOM_COL_OPTIONS>,
+n65_4 NUMERIC(65,4) UNSIGNED <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+d decimal(10,0) unsigned # # #
+d0 decimal(10,0) unsigned # # #
+d1_1 decimal(1,1) unsigned # # #
+d10_2 decimal(10,2) unsigned # # #
+d60_10 decimal(60,10) unsigned # # #
+n decimal(10,0) unsigned # # #
+n0_0 decimal(10,0) unsigned # # #
+n1 decimal(1,0) unsigned # # #
+n20_4 decimal(20,4) unsigned # # #
+n65_4 decimal(65,4) unsigned # # #
+INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+Warning 1264 Out of range value for column 'n65_4' at row 1
+INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+Warning 1264 Out of range value for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+Warning 1264 Out of range value for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+Warnings:
+Note 1265 Data truncated for column 'd' at row 1
+Note 1265 Data truncated for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Note 1265 Data truncated for column 'd10_2' at row 1
+Note 1265 Data truncated for column 'd60_10' at row 1
+Note 1265 Data truncated for column 'n' at row 1
+Note 1265 Data truncated for column 'n0_0' at row 1
+Note 1265 Data truncated for column 'n1' at row 1
+Note 1265 Data truncated for column 'n20_4' at row 1
+Note 1265 Data truncated for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.00 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.0000 9999999999999999999999999999999999999999999999999999999999999.1111
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66);
+ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6);
+ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66);
+ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 30.
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL UNSIGNED <CUSTOM_COL_OPTIONS>,
+b NUMERIC UNSIGNED <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a decimal(10,0) unsigned # # # #
+b decimal(10,0) unsigned # # # #
+INSERT INTO t1 (a,b) VALUES (1.0,-1.0);
+Warnings:
+Warning 1264 Out of range value for column 'b' at row 1
+INSERT INTO t1 (a,b) VALUES (-100,100);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT * FROM t1;
+a b
+0 100
+1 0
+DROP TABLE t1;
+#
+# Floating point columns (FLOAT, DOUBLE)
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f FLOAT UNSIGNED <CUSTOM_COL_OPTIONS>,
+f0 FLOAT(0) UNSIGNED <CUSTOM_COL_OPTIONS>,
+r1_1 REAL(1,1) UNSIGNED <CUSTOM_COL_OPTIONS>,
+f23_0 FLOAT(23) UNSIGNED <CUSTOM_COL_OPTIONS>,
+f20_3 FLOAT(20,3) UNSIGNED <CUSTOM_COL_OPTIONS>,
+d DOUBLE UNSIGNED <CUSTOM_COL_OPTIONS>,
+d1_0 DOUBLE(1,0) UNSIGNED <CUSTOM_COL_OPTIONS>,
+d10_10 DOUBLE PRECISION (10,10) UNSIGNED <CUSTOM_COL_OPTIONS>,
+d53 DOUBLE(53,0) UNSIGNED <CUSTOM_COL_OPTIONS>,
+d53_10 DOUBLE(53,10) UNSIGNED <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+f float unsigned # # #
+f0 float unsigned # # #
+r1_1 double(1,1) unsigned # # #
+f23_0 float unsigned # # #
+f20_3 float(20,3) unsigned # # #
+d double unsigned # # #
+d1_0 double(1,0) unsigned # # #
+d10_10 double(10,10) unsigned # # #
+d53 double(53,0) unsigned # # #
+d53_10 double(53,10) unsigned # # #
+INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+SELECT * FROM t1;
+f 12345.1
+d 11111111.111
+d10_10 0.0123456789
+d1_0 8
+d53 1234566789123456800
+d53_10 100000000000000000.0000000000
+f0 12345.1
+f20_3 56789.988
+f23_0 123457000
+r1_1 0.9
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (
+99999999999999999999999999999999999999,
+99999999999999999999999999999999999999.9999999999999999,
+0.9,
+99999999999999999999999999999999999999.9,
+99999999999999999.999,
+999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+9,
+0.9999999999,
+1999999999999999999999999999999999999999999999999999999,
+19999999999999999999999999999999999999999999.9999999999
+);
+Warnings:
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 12345.1
+d 0
+d 11111111.111
+d 1e81
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d1_0 0
+d1_0 8
+d1_0 9
+d53 0
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 0
+f 1e38
+f0 0
+f0 12345.1
+f0 1e38
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+Warnings:
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+Warning 1264 Out of range value for column 'd10_10' at row 1
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 12345.1
+d 0
+d 0
+d 11111111.111
+d 1e81
+d10_10 0.0000000000
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d1_0 0
+d1_0 0
+d1_0 8
+d1_0 9
+d53 0
+d53 0
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 0.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 0
+f 0
+f 1e38
+f0 0
+f0 0
+f0 12345.1
+f0 1e38
+f20_3 0.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f23_0 0
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+r1_1 0.0
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+SELECT MAX(f), MAX(f0), MAX(r1_1), MAX(f23_0), MAX(f20_3), MAX(d), MAX(d1_0), MAX(d10_10), MAX(d53), MAX(d53_10) FROM t1;
+MAX(f) 9.999999680285692e37
+MAX(d) 1e81
+MAX(d10_10) 0.9999999999
+MAX(d1_0) 9
+MAX(d53) 100000000000000000000000000000000000000000000000000000
+MAX(d53_10) 10000000000000000000000000000000000000000000.0000000000
+MAX(f0) 9.999999680285692e37
+MAX(f20_3) 99999998430674940.000
+MAX(f23_0) 9.999999680285692e37
+MAX(r1_1) 0.9
+INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+Warnings:
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+SELECT * FROM t1;
+f 12345.1
+d 0
+d 0
+d 11111111.111
+d 1e43
+d 1e81
+d10_10 0.0000000000
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d10_10 10000000000000000000000000000000000000000000.0000000000
+d1_0 0
+d1_0 0
+d1_0 8
+d1_0 9
+d1_0 9
+d53 0
+d53 0
+d53 10000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 0.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 0
+f 0
+f 1e38
+f 3.40282e38
+f0 0
+f0 0
+f0 12345.1
+f0 1e38
+f0 3.40282e38
+f20_3 0.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f23_0 0
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+f23_0 3.40282e38
+r1_1 0.0
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+INSERT INTO t1 VALUES (
+999999999999999999999999999999999999999,
+999999999999999999999999999999999999999.9999999999999999,
+1.9,
+999999999999999999999999999999999999999.9,
+999999999999999999.999,
+9999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+99,
+1.9999999999,
+1999999999999999999999999999999999999999999999999999999,
+19999999999999999999999999999999999999999999.9999999999
+);
+Warnings:
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+Warning 1264 Out of range value for column 'd10_10' at row 1
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 12345.1
+d 0
+d 0
+d 11111111.111
+d 1e43
+d 1e65
+d 1e81
+d10_10 0.0000000000
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d10_10 0.9999999999
+d10_10 10000000000000000000000000000000000000000000.0000000000
+d1_0 0
+d1_0 0
+d1_0 8
+d1_0 9
+d1_0 9
+d1_0 9
+d53 0
+d53 0
+d53 10000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 0.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 0
+f 0
+f 1e38
+f 3.40282e38
+f 3.40282e38
+f0 0
+f0 0
+f0 12345.1
+f0 1e38
+f0 3.40282e38
+f0 3.40282e38
+f20_3 0.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f23_0 0
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+f23_0 3.40282e38
+f23_0 3.40282e38
+r1_1 0.0
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0);
+ERROR 42000: Display width out of range for 'd0_0' (max = 255)
+ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1);
+ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35);
+ERROR 42000: Too big scale 35 specified for 'n66_66'. Maximum is 30.
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE UNSIGNED <CUSTOM_COL_OPTIONS>,
+b FLOAT UNSIGNED <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a double unsigned # # # #
+b float unsigned # # # #
+INSERT INTO t1 (a,b) VALUES (1.0,-1.0);
+Warnings:
+Warning 1264 Out of range value for column 'b' at row 1
+INSERT INTO t1 (a,b) VALUES (-100,100);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT * FROM t1;
+a b
+0 100
+1 0
+DROP TABLE t1;
+#
+# INT columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT UNSIGNED <CUSTOM_COL_OPTIONS>,
+i0 INT(0) UNSIGNED <CUSTOM_COL_OPTIONS>,
+i1 INT(1) UNSIGNED <CUSTOM_COL_OPTIONS>,
+i20 INT(20) UNSIGNED <CUSTOM_COL_OPTIONS>,
+t TINYINT UNSIGNED <CUSTOM_COL_OPTIONS>,
+t0 TINYINT(0) UNSIGNED <CUSTOM_COL_OPTIONS>,
+t1 TINYINT(1) UNSIGNED <CUSTOM_COL_OPTIONS>,
+t20 TINYINT(20) UNSIGNED <CUSTOM_COL_OPTIONS>,
+s SMALLINT UNSIGNED <CUSTOM_COL_OPTIONS>,
+s0 SMALLINT(0) UNSIGNED <CUSTOM_COL_OPTIONS>,
+s1 SMALLINT(1) UNSIGNED <CUSTOM_COL_OPTIONS>,
+s20 SMALLINT(20) UNSIGNED <CUSTOM_COL_OPTIONS>,
+m MEDIUMINT UNSIGNED <CUSTOM_COL_OPTIONS>,
+m0 MEDIUMINT(0) UNSIGNED <CUSTOM_COL_OPTIONS>,
+m1 MEDIUMINT(1) UNSIGNED <CUSTOM_COL_OPTIONS>,
+m20 MEDIUMINT(20) UNSIGNED <CUSTOM_COL_OPTIONS>,
+b BIGINT UNSIGNED <CUSTOM_COL_OPTIONS>,
+b0 BIGINT(0) UNSIGNED <CUSTOM_COL_OPTIONS>,
+b1 BIGINT(1) UNSIGNED <CUSTOM_COL_OPTIONS>,
+b20 BIGINT(20) UNSIGNED <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+i int(10) unsigned # # #
+i0 int(10) unsigned # # #
+i1 int(1) unsigned # # #
+i20 int(20) unsigned # # #
+t tinyint(3) unsigned # # #
+t0 tinyint(3) unsigned # # #
+t1 tinyint(1) unsigned # # #
+t20 tinyint(20) unsigned # # #
+s smallint(5) unsigned # # #
+s0 smallint(5) unsigned # # #
+s1 smallint(1) unsigned # # #
+s20 smallint(20) unsigned # # #
+m mediumint(8) unsigned # # #
+m0 mediumint(8) unsigned # # #
+m1 mediumint(1) unsigned # # #
+m20 mediumint(20) unsigned # # #
+b bigint(20) unsigned # # #
+b0 bigint(20) unsigned # # #
+b1 bigint(1) unsigned # # #
+b20 bigint(20) unsigned # # #
+INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+4294967295 4294967295 4294967295 4294967295 255 255 255 255 65535 65535 65535 65535 16777215 16777215 16777215 16777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
+INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'i' at row 2
+Warning 1264 Out of range value for column 'i0' at row 2
+Warning 1264 Out of range value for column 'i1' at row 2
+Warning 1264 Out of range value for column 'i20' at row 2
+Warning 1264 Out of range value for column 't' at row 2
+Warning 1264 Out of range value for column 't0' at row 2
+Warning 1264 Out of range value for column 't1' at row 2
+Warning 1264 Out of range value for column 't20' at row 2
+Warning 1264 Out of range value for column 's' at row 2
+Warning 1264 Out of range value for column 's0' at row 2
+Warning 1264 Out of range value for column 's1' at row 2
+Warning 1264 Out of range value for column 's20' at row 2
+Warning 1264 Out of range value for column 'm' at row 2
+Warning 1264 Out of range value for column 'm0' at row 2
+Warning 1264 Out of range value for column 'm1' at row 2
+Warning 1264 Out of range value for column 'm20' at row 2
+Warning 1264 Out of range value for column 'i' at row 3
+Warning 1264 Out of range value for column 'i0' at row 3
+Warning 1264 Out of range value for column 'i1' at row 3
+Warning 1264 Out of range value for column 'i20' at row 3
+Warning 1264 Out of range value for column 't' at row 3
+Warning 1264 Out of range value for column 't0' at row 3
+Warning 1264 Out of range value for column 't1' at row 3
+Warning 1264 Out of range value for column 't20' at row 3
+Warning 1264 Out of range value for column 's' at row 3
+Warning 1264 Out of range value for column 's0' at row 3
+Warning 1264 Out of range value for column 's1' at row 3
+Warning 1264 Out of range value for column 's20' at row 3
+Warning 1264 Out of range value for column 'm' at row 3
+Warning 1264 Out of range value for column 'm0' at row 3
+Warning 1264 Out of range value for column 'm1' at row 3
+Warning 1264 Out of range value for column 'm20' at row 3
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+4294967295 4294967295 4294967295 4294967295 255 255 255 255 65535 65535 65535 65535 16777215 16777215 16777215 16777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
+4294967295 4294967295 4294967295 4294967295 255 255 255 255 65535 65535 65535 65535 16777215 16777215 16777215 16777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
+4294967295 4294967295 4294967295 4294967295 255 255 255 255 65535 65535 65535 65535 16777215 16777215 16777215 16777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
+4294967295 4294967295 4294967295 4294967295 255 255 255 255 65535 65535 65535 65535 16777215 16777215 16777215 16777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
+4294967295 4294967295 4294967295 4294967295 255 255 255 255 65535 65535 65535 65535 16777215 16777215 16777215 16777215 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+ALTER TABLE t1 ADD COLUMN i257 INT(257);
+ERROR 42000: Display width out of range for 'i257' (max = 255)
+DROP TABLE t1;
+CREATE TABLE t1 (t TINYINT UNSIGNED <CUSTOM_COL_OPTIONS>,
+s SMALLINT UNSIGNED <CUSTOM_COL_OPTIONS>,
+m MEDIUMINT UNSIGNED <CUSTOM_COL_OPTIONS>,
+i INT UNSIGNED <CUSTOM_COL_OPTIONS>,
+b BIGINT UNSIGNED <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+t tinyint(3) unsigned # # # #
+s smallint(5) unsigned # # # #
+m mediumint(8) unsigned # # # #
+i int(10) unsigned # # # #
+b bigint(20) unsigned # # # #
+INSERT INTO t1 (t,s,m,i,b) VALUES (255,65535,16777215,4294967295,18446744073709551615);
+INSERT INTO t1 (t,s,m,i,b) VALUES (-1,-1,-1,-1,-1);
+Warnings:
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+SELECT * FROM t1;
+t s m i b
+0 0 0 0 0
+255 65535 16777215 4294967295 18446744073709551615
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/col_opt_unsigned.test b/mysql-test/suite/storage_engine/col_opt_unsigned.test
new file mode 100644
index 00000000000..e9d4566de7f
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_opt_unsigned.test
@@ -0,0 +1,95 @@
+#
+# UNSIGNED column attribute
+#
+
+let $extra_type_opts = UNSIGNED;
+
+--source have_engine.inc
+
+--echo #
+--echo # Fixed point columns (NUMERIC, DECIMAL)
+--echo #
+
+--source type_fixed.inc
+let $create_definition =
+ a DECIMAL $col_opts,
+ b NUMERIC $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Fixed point types or UNSIGNED columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 # 6 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (a,b) VALUES (1.0,-1.0);
+ INSERT INTO t1 (a,b) VALUES (-100,100);
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+--echo #
+--echo # Floating point columns (FLOAT, DOUBLE)
+--echo #
+
+--source type_float.inc
+let $create_definition =
+ a DOUBLE $col_opts,
+ b FLOAT $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Floating point types or UNSIGNED columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 # 6 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (a,b) VALUES (1.0,-1.0);
+ INSERT INTO t1 (a,b) VALUES (-100,100);
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+--echo #
+--echo # INT columns
+--echo #
+
+--source type_int.inc
+let $create_definition =
+ t TINYINT $col_opts,
+ s SMALLINT $col_opts,
+ m MEDIUMINT $col_opts,
+ i INT $col_opts,
+ b BIGINT $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = INT types or UNSIGNED columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 # 6 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (t,s,m,i,b) VALUES (255,65535,16777215,4294967295,18446744073709551615);
+ INSERT INTO t1 (t,s,m,i,b) VALUES (-1,-1,-1,-1,-1);
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/col_opt_zerofill.result b/mysql-test/suite/storage_engine/col_opt_zerofill.result
new file mode 100644
index 00000000000..c2445c5bbc7
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_opt_zerofill.result
@@ -0,0 +1,679 @@
+#
+# Fixed point columns (NUMERIC, DECIMAL)
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (d DECIMAL ZEROFILL <CUSTOM_COL_OPTIONS>,
+d0 DECIMAL(0) ZEROFILL <CUSTOM_COL_OPTIONS>,
+d1_1 DECIMAL(1,1) ZEROFILL <CUSTOM_COL_OPTIONS>,
+d10_2 DECIMAL(10,2) ZEROFILL <CUSTOM_COL_OPTIONS>,
+d60_10 DECIMAL(60,10) ZEROFILL <CUSTOM_COL_OPTIONS>,
+n NUMERIC ZEROFILL <CUSTOM_COL_OPTIONS>,
+n0_0 NUMERIC(0,0) ZEROFILL <CUSTOM_COL_OPTIONS>,
+n1 NUMERIC(1) ZEROFILL <CUSTOM_COL_OPTIONS>,
+n20_4 NUMERIC(20,4) ZEROFILL <CUSTOM_COL_OPTIONS>,
+n65_4 NUMERIC(65,4) ZEROFILL <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+d decimal(10,0) unsigned zerofill # # #
+d0 decimal(10,0) unsigned zerofill # # #
+d1_1 decimal(1,1) unsigned zerofill # # #
+d10_2 decimal(10,2) unsigned zerofill # # #
+d60_10 decimal(60,10) unsigned zerofill # # #
+n decimal(10,0) unsigned zerofill # # #
+n0_0 decimal(10,0) unsigned zerofill # # #
+n1 decimal(1,0) unsigned zerofill # # #
+n20_4 decimal(20,4) unsigned zerofill # # #
+n65_4 decimal(65,4) unsigned zerofill # # #
+INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+Warning 1264 Out of range value for column 'n65_4' at row 1
+INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+Warning 1264 Out of range value for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+Warning 1264 Out of range value for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+Warnings:
+Note 1265 Data truncated for column 'd' at row 1
+Note 1265 Data truncated for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Note 1265 Data truncated for column 'd10_2' at row 1
+Note 1265 Data truncated for column 'd60_10' at row 1
+Note 1265 Data truncated for column 'n' at row 1
+Note 1265 Data truncated for column 'n0_0' at row 1
+Note 1265 Data truncated for column 'n1' at row 1
+Note 1265 Data truncated for column 'n20_4' at row 1
+Note 1265 Data truncated for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
+0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000
+9999999999 9999999999 0.9 99999999.00 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.0000 9999999999999999999999999999999999999999999999999999999999999.1111
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66);
+ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6);
+ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66);
+ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 30.
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL ZEROFILL <CUSTOM_COL_OPTIONS>,
+b NUMERIC ZEROFILL <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a decimal(10,0) unsigned zerofill # # # #
+b decimal(10,0) unsigned zerofill # # # #
+INSERT INTO t1 (a,b) VALUES (1.1,1234);
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+a b
+0000000001 0000001234
+DROP TABLE t1;
+#
+# Floating point columns (FLOAT, DOUBLE)
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f FLOAT ZEROFILL <CUSTOM_COL_OPTIONS>,
+f0 FLOAT(0) ZEROFILL <CUSTOM_COL_OPTIONS>,
+r1_1 REAL(1,1) ZEROFILL <CUSTOM_COL_OPTIONS>,
+f23_0 FLOAT(23) ZEROFILL <CUSTOM_COL_OPTIONS>,
+f20_3 FLOAT(20,3) ZEROFILL <CUSTOM_COL_OPTIONS>,
+d DOUBLE ZEROFILL <CUSTOM_COL_OPTIONS>,
+d1_0 DOUBLE(1,0) ZEROFILL <CUSTOM_COL_OPTIONS>,
+d10_10 DOUBLE PRECISION (10,10) ZEROFILL <CUSTOM_COL_OPTIONS>,
+d53 DOUBLE(53,0) ZEROFILL <CUSTOM_COL_OPTIONS>,
+d53_10 DOUBLE(53,10) ZEROFILL <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+f float unsigned zerofill # # #
+f0 float unsigned zerofill # # #
+r1_1 double(1,1) unsigned zerofill # # #
+f23_0 float unsigned zerofill # # #
+f20_3 float(20,3) unsigned zerofill # # #
+d double unsigned zerofill # # #
+d1_0 double(1,0) unsigned zerofill # # #
+d10_10 double(10,10) unsigned zerofill # # #
+d53 double(53,0) unsigned zerofill # # #
+d53_10 double(53,10) unsigned zerofill # # #
+INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+SELECT * FROM t1;
+f 0000012345.1
+d 000000000011111111.111
+d10_10 0.0123456789
+d1_0 8
+d53 00000000000000000000000000000000001234566789123456800
+d53_10 000000000000000000000000100000000000000000.0000000000
+f0 0000012345.1
+f20_3 0000000000056789.988
+f23_0 000123457000
+r1_1 0.9
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (
+99999999999999999999999999999999999999,
+99999999999999999999999999999999999999.9999999999999999,
+0.9,
+99999999999999999999999999999999999999.9,
+99999999999999999.999,
+999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+9,
+0.9999999999,
+1999999999999999999999999999999999999999999999999999999,
+19999999999999999999999999999999999999999999.9999999999
+);
+Warnings:
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 0000012345.1
+d 0000000000000000000000
+d 0000000000000000001e81
+d 000000000011111111.111
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d1_0 0
+d1_0 8
+d1_0 9
+d53 00000000000000000000000000000000000000000000000000000
+d53 00000000000000000000000000000000001234566789123456800
+d53 100000000000000000000000000000000000000000000000000000
+d53_10 000000000000000000000000000000000000000000.0000000000
+d53_10 000000000000000000000000100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 000000000000
+f 000000001e38
+f0 000000000000
+f0 000000001e38
+f0 0000012345.1
+f20_3 0000000000000000.000
+f20_3 0000000000056789.988
+f20_3 99999998430674940.000
+f23_0 000000000000
+f23_0 000000001e38
+f23_0 000123457000
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+Warnings:
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+Warning 1264 Out of range value for column 'd10_10' at row 1
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 0000012345.1
+d 0000000000000000000000
+d 0000000000000000000000
+d 0000000000000000001e81
+d 000000000011111111.111
+d10_10 0.0000000000
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d1_0 0
+d1_0 0
+d1_0 8
+d1_0 9
+d53 00000000000000000000000000000000000000000000000000000
+d53 00000000000000000000000000000000000000000000000000000
+d53 00000000000000000000000000000000001234566789123456800
+d53 100000000000000000000000000000000000000000000000000000
+d53_10 000000000000000000000000000000000000000000.0000000000
+d53_10 000000000000000000000000000000000000000000.0000000000
+d53_10 000000000000000000000000100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 000000000000
+f 000000000000
+f 000000001e38
+f0 000000000000
+f0 000000000000
+f0 000000001e38
+f0 0000012345.1
+f20_3 0000000000000000.000
+f20_3 0000000000000000.000
+f20_3 0000000000056789.988
+f20_3 99999998430674940.000
+f23_0 000000000000
+f23_0 000000000000
+f23_0 000000001e38
+f23_0 000123457000
+r1_1 0.0
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+SELECT MAX(f), MAX(f0), MAX(r1_1), MAX(f23_0), MAX(f20_3), MAX(d), MAX(d1_0), MAX(d10_10), MAX(d53), MAX(d53_10) FROM t1;
+MAX(f) 9.999999680285692e37
+MAX(d) 1e81
+MAX(d10_10) 0.9999999999
+MAX(d1_0) 9
+MAX(d53) 100000000000000000000000000000000000000000000000000000
+MAX(d53_10) 10000000000000000000000000000000000000000000.0000000000
+MAX(f0) 9.999999680285692e37
+MAX(f20_3) 99999998430674940.000
+MAX(f23_0) 9.999999680285692e37
+MAX(r1_1) 0.9
+INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+Warnings:
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+SELECT * FROM t1;
+f 0000012345.1
+d 0000000000000000000000
+d 0000000000000000000000
+d 0000000000000000001e43
+d 0000000000000000001e81
+d 000000000011111111.111
+d10_10 0.0000000000
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d10_10 10000000000000000000000000000000000000000000.0000000000
+d1_0 0
+d1_0 0
+d1_0 8
+d1_0 9
+d1_0 9
+d53 00000000000000000000000000000000000000000000000000000
+d53 00000000000000000000000000000000000000000000000000000
+d53 00000000000000000000000000000000001234566789123456800
+d53 00000000010000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53_10 000000000000000000000000000000000000000000.0000000000
+d53_10 000000000000000000000000000000000000000000.0000000000
+d53_10 000000000000000000000000100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 000000000000
+f 000000000000
+f 000000001e38
+f 003.40282e38
+f0 000000000000
+f0 000000000000
+f0 000000001e38
+f0 0000012345.1
+f0 003.40282e38
+f20_3 0000000000000000.000
+f20_3 0000000000000000.000
+f20_3 0000000000056789.988
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f23_0 000000000000
+f23_0 000000000000
+f23_0 000000001e38
+f23_0 000123457000
+f23_0 003.40282e38
+r1_1 0.0
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+INSERT INTO t1 VALUES (
+999999999999999999999999999999999999999,
+999999999999999999999999999999999999999.9999999999999999,
+1.9,
+999999999999999999999999999999999999999.9,
+999999999999999999.999,
+9999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+99,
+1.9999999999,
+1999999999999999999999999999999999999999999999999999999,
+19999999999999999999999999999999999999999999.9999999999
+);
+Warnings:
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+Warning 1264 Out of range value for column 'd10_10' at row 1
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 0000012345.1
+d 0000000000000000000000
+d 0000000000000000000000
+d 0000000000000000001e43
+d 0000000000000000001e65
+d 0000000000000000001e81
+d 000000000011111111.111
+d10_10 0.0000000000
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d10_10 0.9999999999
+d10_10 10000000000000000000000000000000000000000000.0000000000
+d1_0 0
+d1_0 0
+d1_0 8
+d1_0 9
+d1_0 9
+d1_0 9
+d53 00000000000000000000000000000000000000000000000000000
+d53 00000000000000000000000000000000000000000000000000000
+d53 00000000000000000000000000000000001234566789123456800
+d53 00000000010000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53_10 000000000000000000000000000000000000000000.0000000000
+d53_10 000000000000000000000000000000000000000000.0000000000
+d53_10 000000000000000000000000100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 000000000000
+f 000000000000
+f 000000001e38
+f 003.40282e38
+f 003.40282e38
+f0 000000000000
+f0 000000000000
+f0 000000001e38
+f0 0000012345.1
+f0 003.40282e38
+f0 003.40282e38
+f20_3 0000000000000000.000
+f20_3 0000000000000000.000
+f20_3 0000000000056789.988
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f23_0 000000000000
+f23_0 000000000000
+f23_0 000000001e38
+f23_0 000123457000
+f23_0 003.40282e38
+f23_0 003.40282e38
+r1_1 0.0
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0);
+ERROR 42000: Display width out of range for 'd0_0' (max = 255)
+ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1);
+ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35);
+ERROR 42000: Too big scale 35 specified for 'n66_66'. Maximum is 30.
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE ZEROFILL <CUSTOM_COL_OPTIONS>,
+b FLOAT ZEROFILL <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a double unsigned zerofill # # # #
+b float unsigned zerofill # # # #
+INSERT INTO t1 (a,b) VALUES (1,1234.5);
+SELECT * FROM t1;
+a b
+0000000000000000000001 0000001234.5
+DROP TABLE t1;
+#
+# INT columns
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT ZEROFILL <CUSTOM_COL_OPTIONS>,
+i0 INT(0) ZEROFILL <CUSTOM_COL_OPTIONS>,
+i1 INT(1) ZEROFILL <CUSTOM_COL_OPTIONS>,
+i20 INT(20) ZEROFILL <CUSTOM_COL_OPTIONS>,
+t TINYINT ZEROFILL <CUSTOM_COL_OPTIONS>,
+t0 TINYINT(0) ZEROFILL <CUSTOM_COL_OPTIONS>,
+t1 TINYINT(1) ZEROFILL <CUSTOM_COL_OPTIONS>,
+t20 TINYINT(20) ZEROFILL <CUSTOM_COL_OPTIONS>,
+s SMALLINT ZEROFILL <CUSTOM_COL_OPTIONS>,
+s0 SMALLINT(0) ZEROFILL <CUSTOM_COL_OPTIONS>,
+s1 SMALLINT(1) ZEROFILL <CUSTOM_COL_OPTIONS>,
+s20 SMALLINT(20) ZEROFILL <CUSTOM_COL_OPTIONS>,
+m MEDIUMINT ZEROFILL <CUSTOM_COL_OPTIONS>,
+m0 MEDIUMINT(0) ZEROFILL <CUSTOM_COL_OPTIONS>,
+m1 MEDIUMINT(1) ZEROFILL <CUSTOM_COL_OPTIONS>,
+m20 MEDIUMINT(20) ZEROFILL <CUSTOM_COL_OPTIONS>,
+b BIGINT ZEROFILL <CUSTOM_COL_OPTIONS>,
+b0 BIGINT(0) ZEROFILL <CUSTOM_COL_OPTIONS>,
+b1 BIGINT(1) ZEROFILL <CUSTOM_COL_OPTIONS>,
+b20 BIGINT(20) ZEROFILL <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+i int(10) unsigned zerofill # # #
+i0 int(10) unsigned zerofill # # #
+i1 int(1) unsigned zerofill # # #
+i20 int(20) unsigned zerofill # # #
+t tinyint(3) unsigned zerofill # # #
+t0 tinyint(3) unsigned zerofill # # #
+t1 tinyint(1) unsigned zerofill # # #
+t20 tinyint(20) unsigned zerofill # # #
+s smallint(5) unsigned zerofill # # #
+s0 smallint(5) unsigned zerofill # # #
+s1 smallint(1) unsigned zerofill # # #
+s20 smallint(20) unsigned zerofill # # #
+m mediumint(8) unsigned zerofill # # #
+m0 mediumint(8) unsigned zerofill # # #
+m1 mediumint(1) unsigned zerofill # # #
+m20 mediumint(20) unsigned zerofill # # #
+b bigint(20) unsigned zerofill # # #
+b0 bigint(20) unsigned zerofill # # #
+b1 bigint(1) unsigned zerofill # # #
+b20 bigint(20) unsigned zerofill # # #
+INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
+0000000001 0000000002 3 00000000000000000004 005 006 7 00000000000000000008 00009 00010 11 00000000000000000012 00000013 00000014 15 00000000000000000016 00000000000000000017 00000000000000000018 19 00000000000000000020
+2147483647 2147483647 2147483647 00000000002147483647 127 127 127 00000000000000000127 32767 32767 32767 00000000000000032767 08388607 08388607 8388607 00000000000008388607 09223372036854775807 09223372036854775807 9223372036854775807 09223372036854775807
+INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
+0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
+0000000001 0000000002 3 00000000000000000004 005 006 7 00000000000000000008 00009 00010 11 00000000000000000012 00000013 00000014 15 00000000000000000016 00000000000000000017 00000000000000000018 19 00000000000000000020
+2147483647 2147483647 2147483647 00000000002147483647 127 127 127 00000000000000000127 32767 32767 32767 00000000000000032767 08388607 08388607 8388607 00000000000008388607 09223372036854775807 09223372036854775807 9223372036854775807 09223372036854775807
+4294967295 4294967295 4294967295 00000000004294967295 255 255 255 00000000000000000255 65535 65535 65535 00000000000000065535 16777215 16777215 16777215 00000000000016777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
+INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'i' at row 2
+Warning 1264 Out of range value for column 'i0' at row 2
+Warning 1264 Out of range value for column 'i1' at row 2
+Warning 1264 Out of range value for column 'i20' at row 2
+Warning 1264 Out of range value for column 't' at row 2
+Warning 1264 Out of range value for column 't0' at row 2
+Warning 1264 Out of range value for column 't1' at row 2
+Warning 1264 Out of range value for column 't20' at row 2
+Warning 1264 Out of range value for column 's' at row 2
+Warning 1264 Out of range value for column 's0' at row 2
+Warning 1264 Out of range value for column 's1' at row 2
+Warning 1264 Out of range value for column 's20' at row 2
+Warning 1264 Out of range value for column 'm' at row 2
+Warning 1264 Out of range value for column 'm0' at row 2
+Warning 1264 Out of range value for column 'm1' at row 2
+Warning 1264 Out of range value for column 'm20' at row 2
+Warning 1264 Out of range value for column 'i' at row 3
+Warning 1264 Out of range value for column 'i0' at row 3
+Warning 1264 Out of range value for column 'i1' at row 3
+Warning 1264 Out of range value for column 'i20' at row 3
+Warning 1264 Out of range value for column 't' at row 3
+Warning 1264 Out of range value for column 't0' at row 3
+Warning 1264 Out of range value for column 't1' at row 3
+Warning 1264 Out of range value for column 't20' at row 3
+Warning 1264 Out of range value for column 's' at row 3
+Warning 1264 Out of range value for column 's0' at row 3
+Warning 1264 Out of range value for column 's1' at row 3
+Warning 1264 Out of range value for column 's20' at row 3
+Warning 1264 Out of range value for column 'm' at row 3
+Warning 1264 Out of range value for column 'm0' at row 3
+Warning 1264 Out of range value for column 'm1' at row 3
+Warning 1264 Out of range value for column 'm20' at row 3
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
+0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
+0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
+0000000001 0000000002 3 00000000000000000004 005 006 7 00000000000000000008 00009 00010 11 00000000000000000012 00000013 00000014 15 00000000000000000016 00000000000000000017 00000000000000000018 19 00000000000000000020
+2147483647 2147483647 2147483647 00000000002147483647 127 127 127 00000000000000000127 32767 32767 32767 00000000000000032767 08388607 08388607 8388607 00000000000008388607 09223372036854775807 09223372036854775807 9223372036854775807 09223372036854775807
+4294967295 4294967295 4294967295 00000000004294967295 255 255 255 00000000000000000255 65535 65535 65535 00000000000000065535 16777215 16777215 16777215 00000000000016777215 09223372036854775807 09223372036854775807 9223372036854775807 09223372036854775807
+4294967295 4294967295 4294967295 00000000004294967295 255 255 255 00000000000000000255 65535 65535 65535 00000000000000065535 16777215 16777215 16777215 00000000000016777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
+4294967295 4294967295 4294967295 00000000004294967295 255 255 255 00000000000000000255 65535 65535 65535 00000000000000065535 16777215 16777215 16777215 00000000000016777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
+4294967295 4294967295 4294967295 00000000004294967295 255 255 255 00000000000000000255 65535 65535 65535 00000000000000065535 16777215 16777215 16777215 00000000000016777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
+4294967295 4294967295 4294967295 00000000004294967295 255 255 255 00000000000000000255 65535 65535 65535 00000000000000065535 16777215 16777215 16777215 00000000000016777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
+ALTER TABLE t1 ADD COLUMN i257 INT(257);
+ERROR 42000: Display width out of range for 'i257' (max = 255)
+DROP TABLE t1;
+CREATE TABLE t1 (t TINYINT ZEROFILL <CUSTOM_COL_OPTIONS>,
+s SMALLINT ZEROFILL <CUSTOM_COL_OPTIONS>,
+m MEDIUMINT ZEROFILL <CUSTOM_COL_OPTIONS>,
+i INT ZEROFILL <CUSTOM_COL_OPTIONS>,
+b BIGINT ZEROFILL <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+t tinyint(3) unsigned zerofill # # # #
+s smallint(5) unsigned zerofill # # # #
+m mediumint(8) unsigned zerofill # # # #
+i int(10) unsigned zerofill # # # #
+b bigint(20) unsigned zerofill # # # #
+INSERT INTO t1 (t,s,m,i,b) VALUES (1,10,100,1000,0);
+SELECT * FROM t1;
+t s m i b
+001 00010 00000100 0000001000 00000000000000000000
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/col_opt_zerofill.test b/mysql-test/suite/storage_engine/col_opt_zerofill.test
new file mode 100644
index 00000000000..83b7dcf28c1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/col_opt_zerofill.test
@@ -0,0 +1,88 @@
+#
+# ZEROFILL column attribute
+#
+
+let $extra_type_opts = ZEROFILL;
+
+--source have_engine.inc
+
+--echo #
+--echo # Fixed point columns (NUMERIC, DECIMAL)
+--echo #
+
+--source type_fixed.inc
+let $create_definition =
+ a DECIMAL $col_opts,
+ b NUMERIC $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Fixed point types or ZEROFILL columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 # 6 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (a,b) VALUES (1.1,1234);
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+--echo #
+--echo # Floating point columns (FLOAT, DOUBLE)
+--echo #
+
+--source type_float.inc
+let $create_definition =
+ a DOUBLE $col_opts,
+ b FLOAT $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Floating point types or ZEROFILL columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 # 6 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (a,b) VALUES (1,1234.5);
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+--echo #
+--echo # INT columns
+--echo #
+
+--source type_int.inc
+let $create_definition =
+ t TINYINT $col_opts,
+ s SMALLINT $col_opts,
+ m MEDIUMINT $col_opts,
+ i INT $col_opts,
+ b BIGINT $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = INT types or UNSIGNED columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 # 6 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (t,s,m,i,b) VALUES (1,10,100,1000,0);
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/create_table.inc b/mysql-test/suite/storage_engine/create_table.inc
new file mode 100644
index 00000000000..9a1cba5100a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/create_table.inc
@@ -0,0 +1,174 @@
+##################################
+#
+# This include file will be used for all CREATE TABLE statements in the suite.
+# If you need to add additional steps or change the logic, copy the file
+# to storage/<engine>/mysql-test/storage_engine/ folder and modify it there.
+#
+##################
+#
+# Parameters:
+#
+# --let $create_definition = <column names, types, indexes) # optional, default a $int_col, b $char_col (based on defaults)
+# --let $table_name = <table name> # optional, default t1
+# --let $table_options = <table options> # optional, default based on define_engine.inc
+# --let $partition_options = <partitioning definition> # optional, default none
+# --let $as_select = <SELECT statement> # optional, default empty
+# --let $error_codes = <expected error codes, as in --error> # optional, default 0
+# --let $if_not_exists = [0|1] # optional, default 0 (1 adds IF NOT EXISTS clause)
+# --let $default_engine = [0|1] # optional, default 0 (with 1 will rely on default engine, no ENGINE=)
+# --let $temporary = [0|1] # optional, default 0 (1 adds TEMPORARY)
+# --let $disable_query_log = [0|1] # optional, default 0 (1 disables logging of CREATE)
+#
+# Usage examples:
+#
+# --source create_table.inc -- creates a default table
+#
+# --let $create_definition = a INT NOT NULL, b CHAR(1) PRIMARY KEY, INDEX(a)
+# --let $table_options = AUTO_INCREMENT = 100
+# --let $partition_options = PARTITION BY HASH(a) PARTITIONS 2
+# --let $as_select = SELECT 1, 'a'
+# --source create_table.inc
+#
+# Additionally, a test can define $extra_tbl_options. The difference with $table_options
+# is that its value is persistent and will be used until it is unset explicitly, or
+# until the test ends. The purpose of it is to allow one test to call another test,
+# when the called test does not know about specific options the calling test might require,
+# and thus cannot set them on per-create basis.
+
+--let $create_statement = CREATE
+
+if ($temporary)
+{
+ --let $create_statement = $create_statement TEMPORARY
+}
+
+--let $create_statement = $create_statement TABLE
+
+if ($if_not_exists)
+{
+ --let $create_statement = $create_statement IF NOT EXISTS
+}
+
+if (!$table_name)
+{
+ --let $table_name = t1
+}
+
+--let $create_statement = $create_statement $table_name
+
+if (!$create_definition)
+{
+ # If $create_definition is not defined, and AS SELECT is requested,
+ # we should not set $create_definition to the default value,
+ # because it might be inconsistent with the SELECT.
+ if (!$as_select)
+ {
+ --let $create_definition = a $int_col, b $char_col
+ }
+}
+
+if ($create_definition)
+{
+ --let $create_statement = $create_statement ($create_definition)
+}
+
+# If $default_engine is set, we will rely on the default storage engine
+
+if (!$default_engine)
+{
+ --let $create_statement = $create_statement ENGINE=$storage_engine
+}
+
+# Default table options from define_engine.inc
+--let $create_statement = $create_statement $default_tbl_opts
+
+# The calling script could request additional table options
+if ($table_options)
+{
+ --let $create_statement = $create_statement $table_options
+}
+
+# The difference between $extra_tbl_opts and $table_options
+# is that its $extra_tbl_opts is persistent -- it will not be unset at the end of this file,
+# and will be used until it is unset explicitly by the calling test,
+# or until the test ends. The purpose of it is to allow one test to call another test,
+# when the called test does not know about specific options the calling test might require,
+# and thus cannot set them on per-create basis.
+
+if ($extra_tbl_opts)
+{
+ --let $create_statement = $create_statement $extra_tbl_opts
+}
+
+if ($as_select)
+{
+ --let $create_statement = $create_statement AS $as_select
+}
+
+if ($partition_options)
+{
+ --let $create_statement = $create_statement $partition_options
+}
+
+# We now have the complete CREATE statement in $create_statement.
+# If your CREATE statement should be composed differently,
+# modify the logic above.
+
+#####################
+# Here you can add logic needed BEFORE the main table creation
+# (e.g. the table needs a base table, a reference table, etc.).
+# Surround it by --disable_query_log/--enable_query_log
+# if you don't want it to appear in the result output.
+#####################
+
+if ($disable_query_log)
+{
+ --disable_query_log
+}
+
+--source obfuscate.inc
+
+eval $create_statement;
+--source strict_check_errors.inc
+
+# Make sure you don't add any statements between the main CREATE (above)
+# and saving mysql_errno and mysql_errname (below)
+# They are saved in case you want to add more logic after the main CREATE,
+# because we need the result code of the table creation.
+# Also, do not change $create_statement after it is executed!
+
+--let $my_errno = $mysql_errno
+--let $my_errname = $mysql_errname
+
+
+if ($disable_query_log)
+{
+ --enable_query_log
+}
+
+#####################
+# Here you can add logic needed AFTER the main table creation,
+# e.g. triggers creation.
+# Surround it by --disable_query_log/--enable_query_log
+# if you don't want it to appear in the result output.
+#####################
+
+
+# Unset the parameters, we don't want them to be accidentally reused later
+--let $create_definition =
+--let $table_name = t1
+--let $table_options =
+--let $partition_options =
+--let $as_select = 0
+--let $error_codes =
+--let $if_not_exists = 0
+--let $default_engine = 0
+--let $temporary = 0
+--let $disable_query_log = 0
+
+# Restore the error codes of the main statement
+--let $mysql_errno = $my_errno
+--let $mysql_errname = $my_errname
+# Make sure you don't add any SQL statements after restoring
+# mysql_errno and mysql_errname (above)
+
diff --git a/mysql-test/suite/storage_engine/create_table.result b/mysql-test/suite/storage_engine/create_table.result
new file mode 100644
index 00000000000..87bf37046ba
--- /dev/null
+++ b/mysql-test/suite/storage_engine/create_table.result
@@ -0,0 +1,45 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+CREATE TABLE IF NOT EXISTS t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+Warnings:
+Note 1050 Table 't1' already exists
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+CREATE TEMPORARY TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TEMPORARY TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> AS SELECT 1 UNION SELECT 2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `1` bigint(20) NOT NULL DEFAULT '0'
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+1
+1
+2
+DROP TABLE t1;
+SET storage_engine = <STORAGE_ENGINE>;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+FLUSH LOGS;
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/storage_engine/create_table.test b/mysql-test/suite/storage_engine/create_table.test
new file mode 100644
index 00000000000..2f8971d8b27
--- /dev/null
+++ b/mysql-test/suite/storage_engine/create_table.test
@@ -0,0 +1,107 @@
+#
+# Basic CREATE TABLE statements
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+# Simple create table with minimal table options
+# which are defined in have_engine.inc
+# (default empty) plus ENGINE=
+
+--let $create_definition = a $int_col
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = CREATE TABLE
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --source mask_engine.inc
+ SHOW CREATE TABLE t1;
+
+ # IF NOT EXISTS
+ --let $if_not_exists = 1
+ --let $create_definition = a $int_col
+ --source create_table.inc
+}
+
+# CREATE .. LIKE
+
+CREATE TABLE t2 LIKE t1;
+if ($mysql_errname)
+{
+ --let $functionality = CREATE TABLE .. LIKE
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --source mask_engine.inc
+ SHOW CREATE TABLE t2;
+
+ eval
+ CREATE TEMPORARY TABLE t2 LIKE t1;
+ if ($mysql_errname)
+ {
+ --let $functionality = Temporary tables
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --source mask_engine.inc
+ SHOW CREATE TABLE t2;
+
+ DROP TEMPORARY TABLE t2;
+ }
+ DROP TABLE t2;
+}
+DROP TABLE IF EXISTS t1;
+
+# CREATE .. AS SELECT
+
+--let $as_select = SELECT 1 UNION SELECT 2
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = CREATE TABLE .. AS SELECT
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --source mask_engine.inc
+ SHOW CREATE TABLE t1;
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+# Use the engine as default
+
+--source mask_engine.inc
+eval SET storage_engine = $storage_engine;
+
+--let $tbl_opts = $default_tbl_opts
+--let $create_definition = a $int_col
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = CREATE TABLE or using the engine as default
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --source mask_engine.inc
+ SHOW CREATE TABLE t1;
+}
+
+# Just to add FLUSH LOGS into the mix while we are in the most common test
+FLUSH LOGS;
+
+DROP TABLE IF EXISTS t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/define_engine.inc b/mysql-test/suite/storage_engine/define_engine.inc
new file mode 100644
index 00000000000..33d1fc5c8bf
--- /dev/null
+++ b/mysql-test/suite/storage_engine/define_engine.inc
@@ -0,0 +1,45 @@
+###########################################
+#
+# This is a template of the include file define_engine.inc which
+# should be placed in storage/<engine>/mysql-test/storage_engine folder.
+#
+################################
+#
+# The name of the engine under test must be defined in $ENGINE variable.
+# You can set it either here (uncomment and edit) or in your environment.
+#
+# let $ENGINE =;
+#
+################################
+#
+# The following three variables define specific options for columns and tables.
+# Normally there should be none needed, but for some engines it can be different.
+# If the engine requires specific column option for all or indexed columns,
+# set them inside the comment, e.g. /*!NOT NULL*/.
+# Do the same for table options if needed, e.g. /*!INSERT_METHOD=LAST*/
+
+let $default_col_opts = /*!*/;
+let $default_col_indexed_opts = /*!*/;
+let $default_tbl_opts = /*!*/;
+
+# INDEX, UNIQUE INDEX, PRIMARY KEY, special index type - choose the fist that the engine allows,
+# or set it to /*!*/ if none is supported
+
+let $default_index = /*!INDEX*/;
+
+# If the engine does not support the following types, replace them with the closest possible
+
+let $default_int_type = INT(11);
+let $default_char_type = CHAR(8);
+
+################################
+
+--disable_query_log
+--disable_result_log
+
+# Here you can place your custom MTR code which needs to be executed before each test,
+# e.g. creation of an additional schema or table, etc.
+# The cleanup part should be defined in cleanup_engine.inc
+
+--enable_query_log
+--enable_result_log
diff --git a/mysql-test/suite/storage_engine/delete.result b/mysql-test/suite/storage_engine/delete.result
new file mode 100644
index 00000000000..1d84516c86a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/delete.result
@@ -0,0 +1,77 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (10000,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+DELETE FROM t1 WHERE b IN ('c');
+SELECT * FROM t1;
+a b
+1 a
+1 a
+10000 foobar
+10000 foobar
+2 b
+2 b
+4 d
+4 d
+5 e
+5 e
+DELETE FROM t1 WHERE a < 0 OR b = 'a';
+SELECT * FROM t1;
+a b
+10000 foobar
+10000 foobar
+2 b
+2 b
+4 d
+4 d
+5 e
+5 e
+DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
+SELECT * FROM t1;
+a b
+10000 foobar
+10000 foobar
+2 b
+2 b
+4 d
+5 e
+5 e
+CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t2 (c,d) SELECT b, a FROM t1;
+SELECT * FROM t2;
+c d
+b 2
+b 2
+d 4
+e 5
+e 5
+foobar 10000
+foobar 10000
+DELETE t2.* FROM t1, t2 WHERE c < b AND a + d != 1;
+SELECT * FROM t1;
+a b
+10000 foobar
+10000 foobar
+2 b
+2 b
+4 d
+5 e
+5 e
+SELECT * FROM t2;
+c d
+foobar 10000
+foobar 10000
+DELETE FROM t2, t1.* USING t2, t1 WHERE c = 'foobar' and b = c;
+SELECT * FROM t1;
+a b
+2 b
+2 b
+4 d
+5 e
+5 e
+SELECT * FROM t2;
+c d
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/delete.test b/mysql-test/suite/storage_engine/delete.test
new file mode 100644
index 00000000000..802093e2977
--- /dev/null
+++ b/mysql-test/suite/storage_engine/delete.test
@@ -0,0 +1,68 @@
+#
+# Basic DELETE statements.
+# DELETE LOW_PRIORITY is covered in delete_low_prio test
+# DELETE QUICK is covered in delete_quick test (syntax only)
+# DELETE IGNORE is covered in delete_ignore test
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+--let $create_definition = a $int_col, b $char_col
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (10000,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+
+# Single-table DELETE
+
+DELETE FROM t1 WHERE b IN ('c');
+if ($mysql_errname)
+{
+ --let $functionality = DELETE FROM
+ --source unexpected_result.inc
+}
+--sorted_result
+SELECT * FROM t1;
+
+DELETE FROM t1 WHERE a < 0 OR b = 'a';
+--sorted_result
+SELECT * FROM t1;
+
+# ORDER BY and LIMIT
+DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
+--sorted_result
+SELECT * FROM t1;
+
+# Multi-table DELETE
+
+--let $create_definition = c $char_col, d $int_col
+--let $table_name = t2
+--source create_table.inc
+INSERT INTO t2 (c,d) SELECT b, a FROM t1;
+--sorted_result
+SELECT * FROM t2;
+
+DELETE t2.* FROM t1, t2 WHERE c < b AND a + d != 1;
+--sorted_result
+SELECT * FROM t1;
+--sorted_result
+SELECT * FROM t2;
+
+DELETE FROM t2, t1.* USING t2, t1 WHERE c = 'foobar' and b = c;
+--sorted_result
+SELECT * FROM t1;
+--sorted_result
+SELECT * FROM t2;
+
+DELETE FROM t1;
+--sorted_result
+SELECT * FROM t1;
+
+# Cleanup
+DROP TABLE t1, t2;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/delete_ignore.result b/mysql-test/suite/storage_engine/delete_ignore.result
new file mode 100644
index 00000000000..a15c338ea04
--- /dev/null
+++ b/mysql-test/suite/storage_engine/delete_ignore.result
@@ -0,0 +1,59 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (10000,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t2 (c,d) SELECT b, a FROM t1;
+SELECT * FROM t1;
+a b
+1 a
+1 a
+10000 foobar
+10000 foobar
+2 b
+2 b
+3 c
+3 c
+4 d
+4 d
+5 e
+5 e
+SELECT * FROM t2;
+c d
+a 1
+a 1
+b 2
+b 2
+c 3
+c 3
+d 4
+d 4
+e 5
+e 5
+foobar 10000
+foobar 10000
+DELETE IGNORE FROM t1 WHERE b IS NOT NULL ORDER BY a LIMIT 1;
+SELECT * FROM t1;
+a b
+1 a
+10000 foobar
+10000 foobar
+2 b
+2 b
+3 c
+3 c
+4 d
+4 d
+5 e
+5 e
+DELETE IGNORE t1.*, t2.* FROM t1, t2 WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );
+Warnings:
+Warning 1242 Subquery returns more than 1 row
+SELECT * FROM t1;
+a b
+1 a
+SELECT * FROM t2;
+c d
+foobar 10000
+foobar 10000
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/delete_ignore.test b/mysql-test/suite/storage_engine/delete_ignore.test
new file mode 100644
index 00000000000..fa98ec92029
--- /dev/null
+++ b/mysql-test/suite/storage_engine/delete_ignore.test
@@ -0,0 +1,44 @@
+#
+# DELETE IGNORE
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+--let $create_definition = a $int_col, b $char_col
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (10000,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+
+--let $create_definition = c $char_col, d $int_col
+--let $table_name = t2
+--source create_table.inc
+INSERT INTO t2 (c,d) SELECT b, a FROM t1;
+--sorted_result
+SELECT * FROM t1;
+--sorted_result
+SELECT * FROM t2;
+
+DELETE IGNORE FROM t1 WHERE b IS NOT NULL ORDER BY a LIMIT 1;
+if ($mysql_errname)
+{
+ --let $functionality = DELETE IGNORE FROM ..
+ --source unexpected_result.inc
+}
+--sorted_result
+SELECT * FROM t1;
+
+DELETE IGNORE t1.*, t2.* FROM t1, t2 WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );
+--sorted_result
+SELECT * FROM t1;
+--sorted_result
+SELECT * FROM t2;
+
+# Cleanup
+DROP TABLE t1, t2;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/delete_low_prio.result b/mysql-test/suite/storage_engine/delete_low_prio.result
new file mode 100644
index 00000000000..be334612a2b
--- /dev/null
+++ b/mysql-test/suite/storage_engine/delete_low_prio.result
@@ -0,0 +1,59 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+SET LOW_PRIORITY_UPDATES = 0;
+SET lock_wait_timeout = 4;
+connect con1,localhost,root,,;
+SET lock_wait_timeout = 2;
+SELECT SLEEP(1) FROM t1;
+connection default;
+DELETE FROM t1;
+connect con2,localhost,root,,;
+SET lock_wait_timeout = 3;
+SELECT SLEEP(1) FROM t1;
+SLEEP(1)
+connection con1;
+SLEEP(1)
+0
+0
+connection default;
+SELECT * FROM t1;
+a b
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+connection con1;
+SELECT SLEEP(1) FROM t1;
+connection default;
+DELETE LOW_PRIORITY FROM t1;
+connection con2;
+SELECT SLEEP(1) FROM t1;
+SLEEP(1)
+0
+0
+connection con1;
+SLEEP(1)
+0
+0
+connection default;
+SELECT * FROM t1;
+a b
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+SET LOW_PRIORITY_UPDATES = 1;
+connection con1;
+SELECT SLEEP(1) FROM t1;
+connection default;
+DELETE FROM t1;
+connection con2;
+SELECT SLEEP(1) FROM t1;
+SLEEP(1)
+0
+0
+connection con1;
+SLEEP(1)
+0
+0
+connection default;
+SELECT * FROM t1;
+a b
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/delete_low_prio.test b/mysql-test/suite/storage_engine/delete_low_prio.test
new file mode 100644
index 00000000000..34677df5373
--- /dev/null
+++ b/mysql-test/suite/storage_engine/delete_low_prio.test
@@ -0,0 +1,162 @@
+#
+# DELETE LOW_PRIORITY
+#
+--source have_engine.inc
+
+--source include/count_sessions.inc
+
+--enable_connect_log
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definiiton = a $int_col, b $char_col
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+
+# We will have 3 connections:
+# con1 will start SELECT which should give us enough time;
+# default will run DELETE
+# con2 will then start another SELECT.
+# With LOW_PRIORITY_UPDATES = 0,
+# with standard DELETE we should see all rows in con1 resultset,
+# but no rows in con2 resultset.
+# With DELETE LOW_PRIORITY we should see all rows in both resultsets.
+# Then we will set LOW_PRIORITY_UPDATES to 1.
+# Then with standard DELETE we should see all rows in both resultsets.
+
+SET LOW_PRIORITY_UPDATES = 0;
+SET lock_wait_timeout = 4;
+
+# Normal DELETE with low_priority_updates=0
+
+--connect (con1,localhost,root,,)
+SET lock_wait_timeout = 2;
+--send
+SELECT SLEEP(1) FROM t1;
+
+--connection default
+let $show_statement = SHOW PROCESSLIST;
+let $field = State;
+let $condition = = 'User sleep';
+# We don't need to wait long,
+# if the feature works, threads
+# should show up in the processlist right away
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+
+--send
+DELETE FROM t1;
+
+--connect (con2,localhost,root,,)
+SET lock_wait_timeout = 3;
+
+let $field = Info;
+let $condition = = 'DELETE FROM t1';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+if (!$found)
+{
+ --let $mysql_errname = timeout in wait_show_condition.inc
+ --let $functionality = DELETE or table locking
+ --source unexpected_result.inc
+}
+if ($found)
+{
+ SELECT SLEEP(1) FROM t1;
+}
+
+--connection con1
+--reap
+
+--connection default
+--reap
+--sorted_result
+SELECT * FROM t1;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+
+
+# DELETE LOW_PRIORITY
+
+--connection con1
+--send
+SELECT SLEEP(1) FROM t1;
+
+--connection default
+let $field = State;
+let $condition = = 'User sleep';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+--send
+DELETE LOW_PRIORITY FROM t1;
+
+--connection con2
+let $field = Info;
+let $condition = = 'DELETE LOW_PRIORITY FROM t1';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+if (!$found)
+{
+ --let $mysql_errname = timeout in wait_show_condition.inc
+ --let $functionality = DELETE LOW_PRIORITY or table locking
+ --source unexpected_result.inc
+}
+if ($found)
+{
+ SELECT SLEEP(1) FROM t1;
+}
+
+--connection con1
+--reap
+
+--connection default
+--reap
+--sorted_result
+SELECT * FROM t1;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+
+SET LOW_PRIORITY_UPDATES = 1;
+
+# Normal DELETE with low_priority_updates=1
+
+--connection con1
+--send
+SELECT SLEEP(1) FROM t1;
+
+--connection default
+let $field = State;
+let $condition = = 'User sleep';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+--send
+DELETE FROM t1;
+
+--connection con2
+let $field = Info;
+let $condition = = 'DELETE FROM t1';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+if ($found)
+{
+ SELECT SLEEP(1) FROM t1;
+}
+
+--connection con1
+--reap
+
+--connection default
+--reap
+--sorted_result
+SELECT * FROM t1;
+
+--disconnect con1
+--disconnect con2
+
+# Cleanup
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/delete_quick.result b/mysql-test/suite/storage_engine/delete_quick.result
new file mode 100644
index 00000000000..30d4841b51f
--- /dev/null
+++ b/mysql-test/suite/storage_engine/delete_quick.result
@@ -0,0 +1,25 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX> (a), b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+DELETE QUICK FROM t1 WHERE a = 1 OR b > 'foo';
+SELECT * FROM t1;
+a b
+2 b
+3 c
+4 d
+5 e
+CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t2 SELECT b, a FROM t1;
+SELECT * FROM t2;
+c d
+b 2
+c 3
+d 4
+e 5
+DELETE QUICK FROM t2, t1.* USING t2, t1 WHERE c IS NULL OR a = d;
+SELECT * FROM t1;
+a b
+SELECT * FROM t2;
+c d
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/delete_quick.test b/mysql-test/suite/storage_engine/delete_quick.test
new file mode 100644
index 00000000000..3b37096de4f
--- /dev/null
+++ b/mysql-test/suite/storage_engine/delete_quick.test
@@ -0,0 +1,55 @@
+#
+# DELETE QUICK syntax.
+# For now we only check that the keyword is accepted,
+# without actually checking whether the feature works.
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+--let $create_definition = a $int_indexed_col, $default_index (a), b $char_col
+--source create_table.inc
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+ {
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+
+ DELETE QUICK FROM t1 WHERE a = 1 OR b > 'foo';
+ if ($mysql_errname)
+ {
+ --let $functionality = DELETE or DELETE QUICK
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --sorted_result
+ SELECT * FROM t1;
+
+ --let $create_definition = c $char_col, d $int_col
+ --let $table_name = t2
+ --source create_table.inc
+ INSERT INTO t2 SELECT b, a FROM t1;
+ --sorted_result
+ SELECT * FROM t2;
+
+ DELETE QUICK FROM t2, t1.* USING t2, t1 WHERE c IS NULL OR a = d;
+ --sorted_result
+ SELECT * FROM t1;
+ --sorted_result
+ SELECT * FROM t2;
+ DROP TABLE t2;
+ }
+ DROP TABLE t1;
+}
+
+# Cleanup
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/delete_with_keys.result b/mysql-test/suite/storage_engine/delete_with_keys.result
new file mode 100644
index 00000000000..6622cc1fb64
--- /dev/null
+++ b/mysql-test/suite/storage_engine/delete_with_keys.result
@@ -0,0 +1,38 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
+DELETE FROM t1 WHERE b > 'y';
+DELETE FROM t1 WHERE a=2;
+SELECT * FROM t1;
+a b
+1 a
+3 c
+4 d
+5 e
+6 x
+7 y
+DELETE FROM t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
+DELETE FROM t1 WHERE b > 'y';
+DELETE FROM t1 WHERE a=2;
+SELECT * FROM t1;
+a b
+1 a
+3 c
+4 d
+5 e
+6 x
+7 y
+DELETE FROM t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>, c <INT_COLUMN>, <CUSTOM_INDEX>(a), <CUSTOM_INDEX>(b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9);
+DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
+SELECT * FROM t1;
+a b c
+1 2 3
+4 5 6
+7 8 9
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/delete_with_keys.test b/mysql-test/suite/storage_engine/delete_with_keys.test
new file mode 100644
index 00000000000..274801b6d0e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/delete_with_keys.test
@@ -0,0 +1,74 @@
+#
+# DELETE statements for tables with keys
+#
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = a $int_col, b $char_indexed_col, $default_index (b)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Index on a CHAR column
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
+ DELETE FROM t1 WHERE b > 'y';
+ if ($mysql_errname)
+ {
+ --let $functionality = DELETE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ DELETE FROM t1 WHERE a=2;
+
+ --sorted_result
+ SELECT * FROM t1;
+ DELETE FROM t1;
+ }
+ DROP TABLE t1;
+}
+
+--let $create_definition = a $int_indexed_col PRIMARY KEY, b $char_col
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = PRIMARY KEY
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
+ DELETE FROM t1 WHERE b > 'y';
+ DELETE FROM t1 WHERE a=2;
+
+ --sorted_result
+ SELECT * FROM t1;
+ DELETE FROM t1;
+ DROP TABLE t1;
+}
+
+--let $create_definition = a $int_indexed_col, b $int_col, c $int_indexed_col, $default_index(a), $default_index(b)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = Multiple indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9);
+ DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/describe.result b/mysql-test/suite/storage_engine/describe.result
new file mode 100644
index 00000000000..61c3d6bafd1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/describe.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS t1, t2, t3;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHARACTER SET utf8;
+INSERT INTO t1 (a,b) VALUES (100,'foo'),(2, 'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHARACTER SET utf8;
+INSERT INTO t2 (a,b) VALUES (1, 'bar');
+CREATE TABLE t3 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHARACTER SET utf8;
+DESCRIBE t1;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+b char(8) YES NULL
+DESC t2 a;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+DESCRIBE t3 '%';
+Field Type Null Key Default Extra
+a int(11) YES NULL
+b char(8) YES NULL
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/suite/storage_engine/describe.test b/mysql-test/suite/storage_engine/describe.test
new file mode 100644
index 00000000000..9f792469e83
--- /dev/null
+++ b/mysql-test/suite/storage_engine/describe.test
@@ -0,0 +1,50 @@
+#
+# DESCRIBE statement
+#
+# Note: the output might well be different
+# (depending on default values for the engine).
+# Examine mismatch carefully and, if columns are shown
+# with correct options, add an rdiff.
+# If you create combinations (with different startup options),
+# you might have to add an rdiff for each of them.
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3;
+--enable_warnings
+
+--let $create_definition = a $int_col, b $char_col
+--let $table_options = CHARACTER SET utf8
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = CHARACTER SET
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (100,'foo'),(2, 'b');
+
+ --let $create_definition = a $int_col, b $char_col
+ --let $table_options = CHARACTER SET utf8
+ --let $table_name = t2
+ --source create_table.inc
+
+ INSERT INTO t2 (a,b) VALUES (1, 'bar');
+
+ --let $create_definition = a $int_col, b $char_col
+ --let $table_name = t3
+ --let $table_options = CHARACTER SET utf8
+ --source create_table.inc
+
+ DESCRIBE t1;
+ DESC t2 a;
+ DESCRIBE t3 '%';
+
+ DROP TABLE t1, t2, t3;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/disabled.def b/mysql-test/suite/storage_engine/disabled.def
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/disabled.def
diff --git a/mysql-test/suite/storage_engine/foreign_keys.result b/mysql-test/suite/storage_engine/foreign_keys.result
new file mode 100644
index 00000000000..5374e78d9b1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/foreign_keys.result
@@ -0,0 +1,71 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE t2 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+FOREIGN KEY (a) REFERENCES t1(a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL,
+ KEY `a` (`a`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b');
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'d');
+INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b');
+UPDATE t2 SET a=a+1;
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+UPDATE t1 SET a=3 WHERE a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+DELETE FROM t1 WHERE a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+DELETE FROM t2 WHERE a=2;
+SELECT * FROM t1;
+a b
+1 c
+2 d
+SELECT * FROM t2;
+a b
+1 a
+DROP TABLE t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+DROP TABLE t2;
+CREATE TABLE t2 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+FOREIGN KEY (a) REFERENCES t1(a)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL,
+ KEY `a` (`a`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d');
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE)
+INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'a');
+INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(4,'e'),(3,'a');
+UPDATE t1 SET a=a+1;
+SELECT * FROM t2;
+a b
+5 a
+5 a
+5 b
+5 c
+5 d
+5 e
+DELETE FROM t1 WHERE b='a' LIMIT 2;
+SELECT * FROM t2;
+a b
+TRUNCATE TABLE t1;
+ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`))
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/foreign_keys.test b/mysql-test/suite/storage_engine/foreign_keys.test
new file mode 100644
index 00000000000..643ca8bf6b1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/foreign_keys.test
@@ -0,0 +1,148 @@
+#
+# Simple foreign keys setup
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+
+let $create_definition =
+ a $int_indexed_col,
+ b $char_col,
+ $default_index (a)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ let $create_definition =
+ a $int_indexed_col,
+ b $char_col,
+ FOREIGN KEY (a) REFERENCES t1(a)
+ ;
+ --let $table_name = t2
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = Foreign keys
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --source mask_engine.inc
+ SHOW CREATE TABLE t2;
+
+ --let $error_codes = ER_NO_REFERENCED_ROW_2
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b');
+ --source check_errors.inc
+ if ($mysql_errname != ER_NO_REFERENCED_ROW_2)
+ {
+ --let $functionality = Foreign keys
+ --source unexpected_result.inc
+ }
+ INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'d');
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b');
+
+ --let $error_codes = ER_NO_REFERENCED_ROW_2
+ UPDATE t2 SET a=a+1;
+ --source check_errors.inc
+ if ($mysql_errname != ER_NO_REFERENCED_ROW_2)
+ {
+ --let $functionality = Foreign keys
+ --source unexpected_result.inc
+ }
+
+ --let $error_codes = ER_ROW_IS_REFERENCED_2
+ UPDATE t1 SET a=3 WHERE a=2;
+ --source check_errors.inc
+
+ --let $error_codes = ER_ROW_IS_REFERENCED_2
+ DELETE FROM t1 WHERE a=2;
+ --source check_errors.inc
+ if ($mysql_errname != ER_ROW_IS_REFERENCED_2)
+ {
+ --let $functionality = Foreign keys
+ --source unexpected_result.inc
+ }
+
+ DELETE FROM t2 WHERE a=2;
+
+ --sorted_result
+ SELECT * FROM t1;
+ SELECT * FROM t2;
+
+ --let $error_codes = ER_ROW_IS_REFERENCED
+ DROP TABLE t1;
+ --source check_errors.inc
+ if ($mysql_errname != ER_ROW_IS_REFERENCED)
+ {
+ --let $functionality = Foreign keys
+ --source unexpected_result.inc
+ }
+
+ DROP TABLE t2;
+ }
+
+ let $create_definition =
+ a $int_indexed_col,
+ b $char_col,
+ FOREIGN KEY (a) REFERENCES t1(a)
+ ON DELETE CASCADE ON UPDATE CASCADE
+ ;
+ --let $table_name = t2
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = Foreign keys or ON DELETE|UPDATE CASCADE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --source mask_engine.inc
+ SHOW CREATE TABLE t2;
+
+ --let $error_codes = ER_NO_REFERENCED_ROW_2
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d');
+ --source check_errors.inc
+ INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'a');
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(4,'e'),(3,'a');
+
+ UPDATE t1 SET a=a+1;
+ if ($mysql_errname)
+ {
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+ }
+ --sorted_result
+ SELECT * FROM t2;
+
+ DELETE FROM t1 WHERE b='a' LIMIT 2;
+ if ($mysql_errname)
+ {
+ --let $functionality = DELETE
+ --source unexpected_result.inc
+ }
+ --sorted_result
+ SELECT * FROM t2;
+
+ --let $error_codes = ER_TRUNCATE_ILLEGAL_FK
+ TRUNCATE TABLE t1;
+ --source check_errors.inc
+ if ($mysql_errname != ER_TRUNCATE_ILLEGAL_FK)
+ {
+ --let $functionality = Foreign keys
+ --source unexpected_result.inc
+ }
+
+ DROP TABLE t2;
+ }
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/fulltext_search.result b/mysql-test/suite/storage_engine/fulltext_search.result
new file mode 100644
index 00000000000..4363d0aba25
--- /dev/null
+++ b/mysql-test/suite/storage_engine/fulltext_search.result
@@ -0,0 +1,132 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (v0 VARCHAR(64) <CUSTOM_COL_OPTIONS>,
+v1 VARCHAR(16384) <CUSTOM_COL_OPTIONS>,
+v2 TEXT <CUSTOM_COL_OPTIONS>,
+FULLTEXT v1 (v1)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEXES IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT
+INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+For developers who want to code on MariaDB or MySQL
+* Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+* MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+For MariaDB / MySQL end users
+* MariaDB Crash Course by Ben Forta
+o First MariaDB book!
+o For people who want to learn SQL and the basics of MariaDB.
+o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+* SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+o Free to read in the Knowledgebase!
+* MySQL (4th Edition) by Paul DuBois
+o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+* MySQL Cookbook by Paul DuBois
+o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+* High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
+'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
+
+ 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
+ 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
+ 3. With MariaDB everyone has access to the latest code.
+ 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
+ 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
+The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
+ ), ('text2','test1','test2');
+SELECT v0 FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+v0
+INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
+SELECT v0, MATCH(v1) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+v0 rating
+INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
+SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
+v0 rating
+text4 1.3705332279205322
+SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
+v0
+text1
+SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
+v0
+SELECT v0, MATCH(v1) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('database' WITH QUERY EXPANSION);
+v0 rating
+text1 178.11756896972656
+DROP TABLE t1;
+CREATE TABLE t1 (v0 VARCHAR(64) <CUSTOM_COL_OPTIONS>,
+v1 VARCHAR(16384) <CUSTOM_COL_OPTIONS>,
+v2 TEXT <CUSTOM_COL_OPTIONS>,
+FULLTEXT v1 (v1),
+FULLTEXT v1_v2 (v1,v2)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEXES IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT
+t1 1 v1_v2 1 v1 # # NULL NULL YES FULLTEXT
+t1 1 v1_v2 2 v2 # # NULL NULL YES FULLTEXT
+INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+For developers who want to code on MariaDB or MySQL
+* Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+* MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+For MariaDB / MySQL end users
+* MariaDB Crash Course by Ben Forta
+o First MariaDB book!
+o For people who want to learn SQL and the basics of MariaDB.
+o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+* SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+o Free to read in the Knowledgebase!
+* MySQL (4th Edition) by Paul DuBois
+o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+* MySQL Cookbook by Paul DuBois
+o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+* High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
+'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
+
+ 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
+ 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
+ 3. With MariaDB everyone has access to the latest code.
+ 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
+ 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
+The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
+ ), ('text2','test1','test2');
+SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+v0
+INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
+SELECT v0, MATCH(v1,v2) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+v0 rating
+text1 0.2809644043445587
+INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
+SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
+v0 rating
+text4 1.3705332279205322
+SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
+v0
+text1
+SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
+v0
+SELECT v0, MATCH(v1,v2) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('database' WITH QUERY EXPANSION);
+v0 rating
+text1 190.56150817871094
+text4 1.1758291721343994
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/fulltext_search.test b/mysql-test/suite/storage_engine/fulltext_search.test
new file mode 100644
index 00000000000..47857a17241
--- /dev/null
+++ b/mysql-test/suite/storage_engine/fulltext_search.test
@@ -0,0 +1,187 @@
+#
+# Full-text indexes and search
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ v0 VARCHAR(64) $col_opts,
+ v1 VARCHAR(16384) $col_indexed_opts,
+ v2 TEXT $col_opts,
+ FULLTEXT v1 (v1)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = FULLTEXT indexes or VARCHAR|TEXT data types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 #
+ SHOW INDEXES IN t1;
+
+ INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+ For developers who want to code on MariaDB or MySQL
+
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+
+ For MariaDB / MySQL end users
+
+ * MariaDB Crash Course by Ben Forta
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o Free to read in the Knowledgebase!
+
+ * MySQL (4th Edition) by Paul DuBois
+ o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+
+ * MySQL Cookbook by Paul DuBois
+ o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
+
+ 'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
+
+ 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
+ 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
+ 3. With MariaDB everyone has access to the latest code.
+ 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
+ 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
+
+ The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
+ ), ('text2','test1','test2');
+
+ # 50% rule -- no result if the string is represented in at least 50% rows
+ SELECT v0 FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+
+ # Adding a row to start getting results
+ INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
+ SELECT v0, MATCH(v1) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+
+ INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
+ SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
+
+ # Boolean mode
+
+ SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
+ SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
+
+ # Query expansion
+
+ SELECT v0, MATCH(v1) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('database' WITH QUERY EXPANSION);
+ DROP TABLE t1;
+}
+
+
+let $create_definition =
+ v0 VARCHAR(64) $col_opts,
+ v1 VARCHAR(16384) $col_opts,
+ v2 TEXT $col_opts,
+ FULLTEXT v1 (v1),
+ FULLTEXT v1_v2 (v1,v2)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = FULLTEXT indexes or multiple keys or VARCHAR|TEXT data types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 #
+ SHOW INDEXES IN t1;
+
+ INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+ For developers who want to code on MariaDB or MySQL
+
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+
+ For MariaDB / MySQL end users
+
+ * MariaDB Crash Course by Ben Forta
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o Free to read in the Knowledgebase!
+
+ * MySQL (4th Edition) by Paul DuBois
+ o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+
+ * MySQL Cookbook by Paul DuBois
+ o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
+
+ 'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
+
+ 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
+ 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
+ 3. With MariaDB everyone has access to the latest code.
+ 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
+ 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
+
+ The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
+ ), ('text2','test1','test2');
+
+ # 50% rule -- no result if the string is represented in at least 50% rows
+ SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+
+ # Adding a row to start getting results
+ INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
+ SELECT v0, MATCH(v1,v2) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+
+ INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
+ SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
+
+ # Boolean mode
+
+ SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
+ SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
+
+ # Query expansion
+
+ SELECT v0, MATCH(v1,v2) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('database' WITH QUERY EXPANSION);
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/handler.result b/mysql-test/suite/storage_engine/handler.result
new file mode 100644
index 00000000000..be29b98cb78
--- /dev/null
+++ b/mysql-test/suite/storage_engine/handler.result
@@ -0,0 +1,77 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <CHAR_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES ('foobar',1000),('a',1),('bar',200),('foo',100);
+HANDLER t1 OPEN AS h1;
+HANDLER t1 READ FIRST;
+ERROR 42S02: Unknown table 't1' in HANDLER
+HANDLER h1 READ FIRST;
+a b
+foobar 1000
+HANDLER h1 READ NEXT;
+a b
+a 1
+HANDLER h1 READ FIRST WHERE a < 'foo';
+a b
+a 1
+HANDLER h1 READ NEXT;
+a b
+bar 200
+HANDLER h1 READ NEXT;
+a b
+foo 100
+HANDLER h1 READ NEXT;
+a b
+HANDLER h1 READ FIRST LIMIT 2;
+a b
+foobar 1000
+a 1
+HANDLER h1 READ NEXT;
+a b
+bar 200
+HANDLER h1 READ NEXT WHERE b>500 LIMIT 2;
+a b
+HANDLER t1 OPEN;
+HANDLER h1 READ FIRST WHERE b>500 LIMIT 5;
+a b
+foobar 1000
+HANDLER t1 READ NEXT;
+a b
+foobar 1000
+HANDLER h1 READ NEXT WHERE b<100;
+a b
+HANDLER t1 CLOSE;
+HANDLER h1 READ FIRST;
+a b
+foobar 1000
+HANDLER t1 CLOSE;
+ERROR 42S02: Unknown table 't1' in HANDLER
+DROP TABLE t1;
+HANDLER h1 CLOSE;
+ERROR 42S02: Unknown table 'h1' in HANDLER
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (b,a) VALUES ('a',1),('b',200),('f',100),('b',101),('c',2);
+HANDLER t1 OPEN AS h1;
+HANDLER h1 READ a = (100);
+a b
+100 f
+HANDLER h1 READ a <= (100) WHERE b < 'f';
+a b
+2 c
+HANDLER h1 READ a > (2) WHERE b IS NOT NULL LIMIT 2;
+a b
+100 f
+101 b
+HANDLER h1 READ a FIRST;
+a b
+1 a
+HANDLER h1 READ a LAST;
+a b
+200 b
+HANDLER h1 READ a PREV;
+a b
+101 b
+HANDLER h1 READ a NEXT;
+a b
+200 b
+HANDLER h1 CLOSE;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/handler.test b/mysql-test/suite/storage_engine/handler.test
new file mode 100644
index 00000000000..200ab649636
--- /dev/null
+++ b/mysql-test/suite/storage_engine/handler.test
@@ -0,0 +1,81 @@
+#
+# Basic HANDLER syntax
+#
+# HANDLER .. READ <index_name> is covered in handler_index test
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = a $char_col, b $int_col
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES ('foobar',1000),('a',1),('bar',200),('foo',100);
+
+HANDLER t1 OPEN AS h1;
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --let $error_codes = ER_UNKNOWN_TABLE
+ HANDLER t1 READ FIRST;
+ --source check_errors.inc
+ HANDLER h1 READ FIRST;
+ HANDLER h1 READ NEXT;
+ HANDLER h1 READ FIRST WHERE a < 'foo';
+ HANDLER h1 READ NEXT;
+ HANDLER h1 READ NEXT;
+ HANDLER h1 READ NEXT;
+ HANDLER h1 READ FIRST LIMIT 2;
+ HANDLER h1 READ NEXT;
+ HANDLER h1 READ NEXT WHERE b>500 LIMIT 2;
+ HANDLER t1 OPEN;
+ HANDLER h1 READ FIRST WHERE b>500 LIMIT 5;
+ HANDLER t1 READ NEXT;
+ HANDLER h1 READ NEXT WHERE b<100;
+ HANDLER t1 CLOSE;
+ HANDLER h1 READ FIRST;
+ --let $error_codes = ER_UNKNOWN_TABLE
+ HANDLER t1 CLOSE;
+ --source check_errors.inc
+}
+
+DROP TABLE t1;
+
+--let $error_codes = ER_UNKNOWN_TABLE
+HANDLER h1 CLOSE;
+--source check_errors.inc
+
+--let $continue = 1
+--source have_default_index.inc
+
+if ($have_default_index)
+{
+ --let $create_definition = a $int_indexed_col, b $char_col, $default_index (a)
+ --source create_table.inc
+ INSERT INTO t1 (b,a) VALUES ('a',1),('b',200),('f',100),('b',101),('c',2);
+ if ($mysql_errname)
+ {
+ --source unexpected_result.inc
+ }
+ HANDLER t1 OPEN AS h1;
+ if (!$mysql_errname)
+ {
+ HANDLER h1 READ a = (100);
+ HANDLER h1 READ a <= (100) WHERE b < 'f';
+ HANDLER h1 READ a > (2) WHERE b IS NOT NULL LIMIT 2;
+ HANDLER h1 READ a FIRST;
+ HANDLER h1 READ a LAST;
+ HANDLER h1 READ a PREV;
+ HANDLER h1 READ a NEXT;
+ HANDLER h1 CLOSE;
+ }
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/have_default_index.inc b/mysql-test/suite/storage_engine/have_default_index.inc
new file mode 100644
index 00000000000..fb5111c7180
--- /dev/null
+++ b/mysql-test/suite/storage_engine/have_default_index.inc
@@ -0,0 +1,20 @@
+#
+# This include file either just prints the message, or skips the rest of the test
+# Usage:
+# --let $continue = 1; # optional
+# --source have_default_index.inc
+#
+
+--let $have_default_index = 1
+if ($default_index == '/*!*/ /*Custom index*/')
+{
+ if (!$continue)
+ {
+ --source cleanup_engine.inc
+ --skip # Configuration does not allow indexes. Check \$default_index value
+ }
+ --echo # According to the configuration, the engine does not allow indexes. Check \$default_index value
+ --let $have_default_index = 0
+ --let $continue = 0
+}
+
diff --git a/mysql-test/suite/storage_engine/have_engine.inc b/mysql-test/suite/storage_engine/have_engine.inc
new file mode 100644
index 00000000000..5a6f05f42af
--- /dev/null
+++ b/mysql-test/suite/storage_engine/have_engine.inc
@@ -0,0 +1,127 @@
+###########################################
+#
+# This include file executes define_engine.inc which belongs to the storage engine
+# and then checks and sets test options and parameters.
+#
+# The name of the engine under test must be defined in $ENGINE variable.
+# You can define it either in define_engine.inc or in your environment.
+#
+################################
+#
+# The following three variables define specific options for columns and tables.
+# Normally there should be none needed, but for some engines it can be different.
+# If the engine requires specific column option for all or indexed columns,
+# set them inside the comment, e.g. /*!NOT NULL*/.
+# Do the same for table options if needed, e.g. /*!INSERT_METHOD=LAST*/
+
+let $default_col_opts = /*!*/;
+let $default_col_indexed_opts = /*!*/;
+let $default_tbl_opts = /*!*/;
+
+# INDEX, UNIQUE INDEX, PRIMARY KEY, special index type -- choose minimal that the engine allows,
+# or set it to /*!*/ if none is supported
+
+let $default_index = /*!INDEX*/;
+
+# If the engine does not support these types, replace them with the closest possible
+
+let $default_int_type = INT(11);
+let $default_char_type = CHAR(8);
+
+################################
+#
+# Here the actual work starts
+# define_engine.inc will set the ENGINE variable
+# and possibly redefine some of default_* variables
+
+--source define_engine.inc
+
+if (!$ENGINE)
+{
+ --skip ERROR: Storage engine under test is not defined, export ENGINE env variable or set it in define_engine.inc
+}
+
+# Check that the storage engine is loaded. Here we don't need to worry about the case,
+# as I_S is case-insensitive.
+
+if (!`SELECT engine FROM INFORMATION_SCHEMA.ENGINES WHERE engine = '$ENGINE' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
+{
+ --skip The test requires $ENGINE engine
+}
+
+# Further in tests we will use $storage_engine variable
+
+let $storage_engine = $ENGINE;
+
+# In case somebody removed comment tags in define_engine.inc
+if (!$default_col_opts)
+{
+ let $default_col_opts = /*!*/;
+}
+if (!$default_col_indexed_opts)
+{
+ let $default_col_indexed_opts = /*!*/;
+}
+if (!$default_tbl_opts)
+{
+ let $default_tbl_opts = /*!*/;
+}
+if (!$default_index)
+{
+ let $default_index = /*!*/;
+}
+
+# Adding a comment after default options helps later to mask the custom values in result output
+let $default_index = $default_index /*Custom index*/;
+let $default_col_opts = $default_col_opts /*Custom column options*/;
+let $default_col_indexed_opts = $default_col_indexed_opts /*Custom indexed column options*/;
+let $default_tbl_opts = $default_tbl_opts /*Custom table options*/;
+
+
+# Finally, set some variables which will make our life easier later.
+# For many tests, we need a simple INT or CHAR column, but with
+# (optional) column attributes which the engine might require.
+# Also, a test might be called by another test, and the calling test
+# might need additional attributes. So, here we are collecting them all together.
+# Example:
+# CSV engine requires all columns to be NOT NULL, so its define_engine.inc file will contain
+# let $default_col_opts = /*!NOT NULL*/;
+# Then, we have test1.test which calls have_engine.inc.
+# If it's executed directly, it will have $int_col = 'INT(11) NOT NULL' for CSV and 'INT(11)' for MyISAM.
+# Another test, test2.test might set $extra_type_opts = UNSIGNED and/or $extra_col_opts = NULL
+# and call test1.test.
+# If both are set, test1.test will be executed for MyISAM with 'INT(11) UNSIGNED NULL',
+# and for CSV INT(11) UNSIGNED NOT NULL NULL (and will fail because CSV does not support nullable columns)
+
+let $col_opts = $default_col_opts;
+let $col_indexed_opts = $default_col_indexed_opts;
+
+if ($extra_col_opts)
+{
+ let $col_opts = $col_opts $extra_col_opts;
+ let $col_indexed_opts = $col_indexed_opts $extra_col_opts;
+}
+
+if ($extra_type_opts)
+{
+ let $col_opts = $extra_type_opts $col_opts;
+ let $col_indexed_opts = $extra_type_opts $col_indexed_opts;
+}
+
+let $int_col = $default_int_type $col_opts;
+let $int_indexed_col = $default_int_type $col_indexed_opts;
+
+let $char_col = $default_char_type $col_opts;
+let $char_indexed_col = $default_char_type $col_indexed_opts;
+
+
+
+if (`SELECT @@global.log_bin = 'ON' AND @@global.binlog_format = 'STATEMENT'`)
+{
+ --disable_query_log
+ CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT');
+ --enable_query_log
+}
+
+--disable_abort_on_error
+
diff --git a/mysql-test/suite/storage_engine/index.inc b/mysql-test/suite/storage_engine/index.inc
new file mode 100644
index 00000000000..ac7632fb2b4
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index.inc
@@ -0,0 +1,194 @@
+#
+# Basic syntax related to indexes:
+# unique and non-unique keys,
+# single- and multi-column keys,
+# index option COMMENT.
+#
+# See other index* tests for operations
+# which are less likely to be supported
+#
+# PRIMARY KEY syntax is covered in index_primary test.
+# Index types BTREE|HASH -- in index_type_btree|hash tests.
+# SPATIAL -- in type_spatial_indexes test.
+# FULLTEXT -- in fulltext_search test.
+# KEY_BLOCK_SIZE -- in index_key_block_size test.
+#
+# Usage to call the test from another test:
+#
+# A calling test may define $index_type, in which case
+# USING clause will be added to the syntax.
+#
+
+let $using_index_type = ;
+if ($index_type)
+{
+ let $using_index_type = USING $index_type;
+}
+
+--source have_engine.inc
+
+--let $continue = 1
+--source have_default_index.inc
+
+if ($have_default_index)
+{
+
+ let $create_definition =
+ a $int_indexed_col,
+ b $char_col,
+ $default_index $using_index_type (a)
+ ;
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $create_statement
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ # Cardinality is not the exact science, so here and further
+ # we'll be masking it
+ --replace_column 6 # 7 # 10 #
+ SHOW KEYS IN t1;
+ DROP TABLE t1;
+ }
+
+ let $create_definition =
+ a $int_indexed_col,
+ b $char_indexed_col,
+ $default_index a_b $using_index_type (a,b) COMMENT 'a_b index'
+ ;
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = Multi-part indexes
+ --let $my_last_stmt = $create_statement
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_column 6 # 7 # 10 #
+ SHOW KEYS IN t1;
+ DROP TABLE t1;
+ }
+
+
+ let $create_definition =
+ a $int_indexed_col,
+ b $char_indexed_col,
+ $default_index $using_index_type (a),
+ $default_index $using_index_type (b)
+ ;
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = Multiple indexes
+ --let $my_last_stmt = $create_statement
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_column 6 # 7 # 10 #
+ SHOW KEYS IN t1;
+ DROP TABLE t1;
+ }
+
+ let $create_definition =
+ a $int_indexed_col,
+ b $char_col,
+ UNIQUE INDEX $using_index_type (a)
+ ;
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = Unique indexes
+ --let $my_last_stmt = $create_statement
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_column 6 # 7 # 10 #
+ SHOW KEYS IN t1;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ --source check_errors.inc
+
+ DROP TABLE t1;
+ }
+
+
+ #
+ # ALTER TABLE
+ #
+
+ --let $create_definition = a $int_indexed_col, b $char_col
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = Column options
+ --let $my_last_stmt = $create_statement
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ INSERT INTO t1 (a,b) VALUES (100,'z');
+
+ --let $alter_definition = ADD $default_index (a) $using_index_type COMMENT 'simple index on a'
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = ALTER TABLE .. ADD INDEX
+ --let $my_last_stmt = $alter_statement
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_column 6 # 7 # 10 #
+ SHOW INDEX FROM t1;
+ --let $alter_definition = DROP KEY a
+ --source alter_table.inc
+ }
+ DROP TABLE t1;
+ }
+
+ let $create_definition =
+ a $int_indexed_col,
+ b $char_col,
+ UNIQUE INDEX $using_index_type (a)
+ ;
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = Unique indexes
+ --let $my_last_stmt = $create_statement
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_column 6 # 7 # 10 #
+ SHOW KEYS IN t1;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ --source check_errors.inc
+
+ --let $alter_definition = DROP INDEX a
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $functionality = ALTER TABLE .. DROP INDEX
+ --let $my_last_stmt = $alter_statement
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ --let $alter_definition = ADD UNIQUE INDEX a(a) $using_index_type
+ --source alter_table.inc
+ }
+ DROP TABLE t1;
+ }
+}
+
diff --git a/mysql-test/suite/storage_engine/index.result b/mysql-test/suite/storage_engine/index.result
new file mode 100644
index 00000000000..baf9a4d4da2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index.result
@@ -0,0 +1,67 @@
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # BTREE
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> a_b (a,b) COMMENT 'a_b index'
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a_b 1 a # # NULL NULL # BTREE a_b index
+t1 1 a_b 2 b # # NULL NULL # BTREE a_b index
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> (a),
+<CUSTOM_INDEX> (b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # BTREE
+t1 1 b 1 b # # NULL NULL # BTREE
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+UNIQUE INDEX (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 a 1 a # # NULL NULL # BTREE
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+INSERT INTO t1 (a,b) VALUES (1,'c');
+ERROR 23000: Duplicate entry '1' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (100,'z');
+ALTER TABLE t1 ADD <CUSTOM_INDEX> (a) COMMENT 'simple index on a';
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # BTREE simple index on a
+ALTER TABLE t1 DROP KEY a;
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+UNIQUE INDEX (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 a 1 a # # NULL NULL # BTREE
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+INSERT INTO t1 (a,b) VALUES (1,'c');
+ERROR 23000: Duplicate entry '1' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+ALTER TABLE t1 DROP INDEX a;
+INSERT INTO t1 (a,b) VALUES (1,'c');
+ALTER TABLE t1 ADD UNIQUE INDEX a(a) ;
+ERROR 23000: Duplicate entry '1' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/index.test b/mysql-test/suite/storage_engine/index.test
new file mode 100644
index 00000000000..0dba3d1b299
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index.test
@@ -0,0 +1,23 @@
+#
+# Basic syntax related to indexes:
+# unique and non-unique keys,
+# single- and multi-column keys,
+# index option COMMENT.
+#
+# See other index* tests for operations
+# which are less likely to be supported
+#
+# PRIMARY KEY syntax is covered in index_primary test.
+# Index types BTREE|HASH -- in index_type_btree|hash tests.
+# SPATIAL -- in type_spatial_indexes test.
+# FULLTEXT -- in fulltext_search test.
+# KEY_BLOCK_SIZE -- in index_key_block_size test.
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--source index.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/index_enable_disable.result b/mysql-test/suite/storage_engine/index_enable_disable.result
new file mode 100644
index 00000000000..e7bb9cf3939
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index_enable_disable.result
@@ -0,0 +1,45 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a) VALUES (10);
+INSERT INTO t1 (a) VALUES
+(1),(2),(3),(4),(5),(6),(7),(8),(9),
+(21),(22),(23),(24),(25),(26),(27),(28),(29);
+EXPLAIN SELECT a FROM t1 ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL # Using index
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL YES BTREE
+ALTER TABLE t1 DISABLE KEYS;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL YES BTREE disabled
+EXPLAIN SELECT a FROM t1 ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using filesort
+INSERT INTO t1 (a) VALUES
+(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+ALTER TABLE t1 ENABLE KEYS;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL YES BTREE
+EXPLAIN SELECT a FROM t1 ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL # Using index
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, UNIQUE INDEX(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a) VALUES
+(1),(2),(3),(4),(5),(6),(7),(8),(9),
+(21),(22),(23),(24),(25),(26),(27),(28),(29);
+ALTER TABLE t1 DISABLE KEYS;
+INSERT INTO t1 (a) VALUES (29);
+ERROR 23000: Duplicate entry '29' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 a 1 a # # NULL NULL YES BTREE
+EXPLAIN SELECT a FROM t1 ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL # Using index
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/index_enable_disable.test b/mysql-test/suite/storage_engine/index_enable_disable.test
new file mode 100644
index 00000000000..4f0297ea2f0
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index_enable_disable.test
@@ -0,0 +1,88 @@
+#
+# ENABLE KEYS / DISABLE KEYS
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+
+--let $create_definition = a $int_indexed_col, $default_index(a)
+--source create_table.inc
+INSERT INTO t1 (a) VALUES (10);
+
+INSERT INTO t1 (a) VALUES
+ (1),(2),(3),(4),(5),(6),(7),(8),(9),
+ (21),(22),(23),(24),(25),(26),(27),(28),(29);
+# Plan should use the index.
+# Masking the `rows` column as the value might vary a bit
+--replace_column 9 #
+EXPLAIN SELECT a FROM t1 ORDER BY a;
+
+--replace_column 6 # 7 #
+SHOW INDEX IN t1;
+
+--let $alter_definition = DISABLE KEYS
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER .. DISABLE KEYS
+ --source unexpected_result.inc
+}
+
+# Now comment should say 'disabled'
+--replace_column 6 # 7 #
+SHOW INDEX IN t1;
+
+# And the plan should not use the index
+EXPLAIN SELECT a FROM t1 ORDER BY a;
+INSERT INTO t1 (a) VALUES
+ (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+
+# The index should be back active
+--let $alter_definition = ENABLE KEYS
+--source alter_table.inc
+--replace_column 6 # 7 #
+SHOW INDEX IN t1;
+--replace_column 9 #
+EXPLAIN SELECT a FROM t1 ORDER BY a;
+
+DROP TABLE t1;
+
+--let $create_definition = a $int_indexed_col, UNIQUE INDEX(a)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a) VALUES
+ (1),(2),(3),(4),(5),(6),(7),(8),(9),
+ (21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+ # For unique indexes DISABLE KEYS has no effect
+
+ --let $alter_definition = DISABLE KEYS
+ --source alter_table.inc
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a) VALUES (29);
+ --source check_errors.inc
+ --replace_column 6 # 7 #
+ SHOW INDEX IN t1;
+ --replace_column 9 #
+ EXPLAIN SELECT a FROM t1 ORDER BY a;
+
+ DROP TABLE t1;
+}
+
+# Cleanup
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/index_key_block_size.result b/mysql-test/suite/storage_engine/index_key_block_size.result
new file mode 100644
index 00000000000..0e00f02e922
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index_key_block_size.result
@@ -0,0 +1,43 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> (a) KEY_BLOCK_SIZE=8
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # #
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> ind1(b ASC) KEY_BLOCK_SIZE=0
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 ind1 1 b # # NULL NULL # #
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+UNIQUE INDEX ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value'
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 ind2 1 b # # 1 NULL # # big key_block_size value
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> a_b(a,b) KEY_BLOCK_SIZE=8192
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a_b 1 a # # NULL NULL # #
+t1 1 a_b 2 b # # NULL NULL # #
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (100,'z');
+ALTER TABLE t1 ADD <CUSTOM_INDEX>(a) KEY_BLOCK_SIZE 8192;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # #
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/index_key_block_size.test b/mysql-test/suite/storage_engine/index_key_block_size.test
new file mode 100644
index 00000000000..21304f0380e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index_key_block_size.test
@@ -0,0 +1,125 @@
+#
+# KEY_BLOCK_SIZE index option.
+#
+# The results are likely to be different
+# depending on the engine
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ a $int_indexed_col,
+ b $char_col,
+ $default_index (a) KEY_BLOCK_SIZE=8
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ # Cardinality is not the exact science, so here and further
+ # we'll be masking it
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW KEYS IN t1;
+
+ DROP TABLE t1;
+}
+
+
+let $create_definition =
+ a $int_col,
+ b $char_indexed_col,
+ $default_index ind1(b ASC) KEY_BLOCK_SIZE=0
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Indexes on CHAR columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ a $int_col,
+ b $char_indexed_col,
+ UNIQUE INDEX ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value'
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Unique keys on char columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ a $int_indexed_col,
+ b $char_indexed_col,
+ $default_index a_b(a,b) KEY_BLOCK_SIZE=8192
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+--replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ DROP TABLE t1;
+}
+
+#
+# ALTER TABLE
+#
+
+let $create_definition =
+ a $int_indexed_col,
+ b $char_col
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (100,'z');
+
+ --let $alter_definition = ADD $default_index(a) KEY_BLOCK_SIZE 8192
+ --source alter_table.inc
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX FROM t1;
+
+ DROP TABLE t1;
+}
+
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/index_primary.result b/mysql-test/suite/storage_engine/index_primary.result
new file mode 100644
index 00000000000..04b114f385e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index_primary.result
@@ -0,0 +1,53 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY,
+b <CHAR_COLUMN>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 a # # NULL NULL # #
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+INSERT INTO t1 (a,b) VALUES (1,'c');
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY,
+b <CHAR_COLUMN> PRIMARY KEY
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ERROR 42000: Multiple primary key defined
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+PRIMARY KEY (a,b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 a # # NULL NULL # #
+t1 0 PRIMARY 2 b # # NULL NULL # #
+INSERT INTO t1 (a,b) VALUES (1,'a'),(1,'b'),(2,'a'),(2,'b');
+INSERT INTO t1 (a,b) VALUES (1,'b');
+ERROR 23000: Duplicate entry '1-b' for key 'PRIMARY'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN> KEY,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> (b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 a # # NULL NULL # #
+t1 1 b 1 b # # NULL NULL # #
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN> PRIMARY KEY
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 b # # NULL NULL # #
+ALTER TABLE t1 DROP INDEX `PRIMARY`;
+ALTER TABLE t1 ADD CONSTRAINT PRIMARY KEY pk (a);
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 a # # NULL NULL # #
+ALTER TABLE t1 DROP PRIMARY KEY;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/index_primary.test b/mysql-test/suite/storage_engine/index_primary.test
new file mode 100644
index 00000000000..55671d99e46
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index_primary.test
@@ -0,0 +1,136 @@
+#
+# Basic syntax related to primary keys
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ a $int_indexed_col PRIMARY KEY,
+ b $char_col
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = PRIMARY KEY
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW KEYS IN t1;
+
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ --source check_errors.inc
+
+ DROP TABLE t1;
+}
+
+--let $error_codes = ER_MULTIPLE_PRI_KEY
+let $create_definition =
+ a $int_indexed_col PRIMARY KEY,
+ b $char_indexed_col PRIMARY KEY
+;
+--source create_table.inc
+if ($mysql_errname != ER_MULTIPLE_PRI_KEY)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = PRIMARY KEY
+ --source unexpected_result.inc
+}
+
+let $create_definition =
+ a $int_indexed_col,
+ b $char_indexed_col,
+ PRIMARY KEY (a,b)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(1,'b'),(2,'a'),(2,'b');
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (1,'b');
+ --source check_errors.inc
+ DROP TABLE t1;
+}
+
+
+--let $continue = 1
+--source have_default_index.inc
+if ($have_default_index)
+{
+ # KEY in a column definition means PK!
+ let $create_definition =
+ a $int_indexed_col KEY,
+ b $char_indexed_col,
+ $default_index (b)
+ ;
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Multiple keys or PK or keys on CHAR columns
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ DROP TABLE t1;
+ }
+}
+
+let $create_definition =
+ a $int_indexed_col,
+ b $char_indexed_col PRIMARY KEY
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ --let $alter_definition = DROP INDEX `PRIMARY`
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --let $alter_definition = ADD CONSTRAINT PRIMARY KEY pk (a)
+ --source alter_table.inc
+ --source mask_engine.inc
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW KEYS IN t1;
+ --let $alter_definition = DROP PRIMARY KEY
+ --source alter_table.inc
+ }
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/index_type_btree.result b/mysql-test/suite/storage_engine/index_type_btree.result
new file mode 100644
index 00000000000..e0b3ac546f2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index_type_btree.result
@@ -0,0 +1,67 @@
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> USING BTREE (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # BTREE
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> a_b USING BTREE (a,b) COMMENT 'a_b index'
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a_b 1 a # # NULL NULL # BTREE a_b index
+t1 1 a_b 2 b # # NULL NULL # BTREE a_b index
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> USING BTREE (a),
+<CUSTOM_INDEX> USING BTREE (b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # BTREE
+t1 1 b 1 b # # NULL NULL # BTREE
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+UNIQUE INDEX USING BTREE (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 a 1 a # # NULL NULL # BTREE
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+INSERT INTO t1 (a,b) VALUES (1,'c');
+ERROR 23000: Duplicate entry '1' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (100,'z');
+ALTER TABLE t1 ADD <CUSTOM_INDEX> (a) USING BTREE COMMENT 'simple index on a';
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # BTREE simple index on a
+ALTER TABLE t1 DROP KEY a;
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+UNIQUE INDEX USING BTREE (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 a 1 a # # NULL NULL # BTREE
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+INSERT INTO t1 (a,b) VALUES (1,'c');
+ERROR 23000: Duplicate entry '1' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+ALTER TABLE t1 DROP INDEX a;
+INSERT INTO t1 (a,b) VALUES (1,'c');
+ALTER TABLE t1 ADD UNIQUE INDEX a(a) USING BTREE;
+ERROR 23000: Duplicate entry '1' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/index_type_btree.test b/mysql-test/suite/storage_engine/index_type_btree.test
new file mode 100644
index 00000000000..c521221820e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index_type_btree.test
@@ -0,0 +1,12 @@
+#
+# Index type BTREE
+#
+
+--source have_engine.inc
+
+let $index_type = BTREE;
+
+--source index.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/index_type_hash.result b/mysql-test/suite/storage_engine/index_type_hash.result
new file mode 100644
index 00000000000..f26663418bf
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index_type_hash.result
@@ -0,0 +1,67 @@
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> USING HASH (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # HASH
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> a_b USING HASH (a,b) COMMENT 'a_b index'
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a_b 1 a # # NULL NULL # HASH a_b index
+t1 1 a_b 2 b # # NULL NULL # HASH a_b index
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+<CUSTOM_INDEX> USING HASH (a),
+<CUSTOM_INDEX> USING HASH (b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # HASH
+t1 1 b 1 b # # NULL NULL # HASH
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+UNIQUE INDEX USING HASH (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 a 1 a # # NULL NULL # HASH
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+INSERT INTO t1 (a,b) VALUES (1,'c');
+ERROR 23000: Duplicate entry '1' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (100,'z');
+ALTER TABLE t1 ADD <CUSTOM_INDEX> (a) USING HASH COMMENT 'simple index on a';
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # HASH simple index on a
+ALTER TABLE t1 DROP KEY a;
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>,
+b <CHAR_COLUMN>,
+UNIQUE INDEX USING HASH (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW KEYS IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 a 1 a # # NULL NULL # HASH
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+INSERT INTO t1 (a,b) VALUES (1,'c');
+ERROR 23000: Duplicate entry '1' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+ALTER TABLE t1 DROP INDEX a;
+INSERT INTO t1 (a,b) VALUES (1,'c');
+ALTER TABLE t1 ADD UNIQUE INDEX a(a) USING HASH;
+ERROR 23000: Duplicate entry '1' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/index_type_hash.test b/mysql-test/suite/storage_engine/index_type_hash.test
new file mode 100644
index 00000000000..c63f41c6344
--- /dev/null
+++ b/mysql-test/suite/storage_engine/index_type_hash.test
@@ -0,0 +1,12 @@
+#
+# Index type HASH
+#
+
+--source have_engine.inc
+
+let $index_type = HASH;
+
+--source index.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/insert.result b/mysql-test/suite/storage_engine/insert.result
new file mode 100644
index 00000000000..a07a6e8d9a4
--- /dev/null
+++ b/mysql-test/suite/storage_engine/insert.result
@@ -0,0 +1,149 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 VALUES (100,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+SELECT * FROM t1;
+a b
+1 a
+100 foobar
+2 b
+3 c
+4 d
+5 e
+INSERT t1 VALUE (10,'foo'),(11,'abc');
+SELECT * FROM t1;
+a b
+1 a
+10 foo
+100 foobar
+11 abc
+2 b
+3 c
+4 d
+5 e
+INSERT INTO t1 (b,a) VALUES ('test',0);
+SELECT * FROM t1;
+a b
+0 test
+1 a
+10 foo
+100 foobar
+11 abc
+2 b
+3 c
+4 d
+5 e
+INSERT INTO t1 VALUES (DEFAULT,DEFAULT);
+SELECT * FROM t1;
+a b
+0 test
+1 a
+10 foo
+100 foobar
+11 abc
+2 b
+3 c
+4 d
+5 e
+NULL NULL
+INSERT t1 (a) VALUE (10),(20);
+SELECT * FROM t1;
+a b
+0 test
+1 a
+10 NULL
+10 foo
+100 foobar
+11 abc
+2 b
+20 NULL
+3 c
+4 d
+5 e
+NULL NULL
+INSERT INTO t1 SET a = 11, b = 'f';
+SELECT * FROM t1;
+a b
+0 test
+1 a
+10 NULL
+10 foo
+100 foobar
+11 abc
+11 f
+2 b
+20 NULL
+3 c
+4 d
+5 e
+NULL NULL
+INSERT t1 SET b = DEFAULT;
+SELECT * FROM t1;
+a b
+0 test
+1 a
+10 NULL
+10 foo
+100 foobar
+11 abc
+11 f
+2 b
+20 NULL
+3 c
+4 d
+5 e
+NULL NULL
+NULL NULL
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t1 (a) SELECT a FROM t2 WHERE b = 'foo';
+SELECT * FROM t1;
+a b
+0 test
+1 a
+10 NULL
+10 NULL
+10 foo
+100 foobar
+11 abc
+11 f
+2 b
+20 NULL
+3 c
+4 d
+5 e
+NULL NULL
+NULL NULL
+INSERT t1 SELECT * FROM t1;
+SELECT * FROM t1;
+a b
+0 test
+0 test
+1 a
+1 a
+10 NULL
+10 NULL
+10 NULL
+10 NULL
+10 foo
+10 foo
+100 foobar
+100 foobar
+11 abc
+11 abc
+11 f
+11 f
+2 b
+2 b
+20 NULL
+20 NULL
+3 c
+3 c
+4 d
+4 d
+5 e
+5 e
+NULL NULL
+NULL NULL
+NULL NULL
+NULL NULL
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/insert.test b/mysql-test/suite/storage_engine/insert.test
new file mode 100644
index 00000000000..d9076219eb0
--- /dev/null
+++ b/mysql-test/suite/storage_engine/insert.test
@@ -0,0 +1,78 @@
+#
+# Basic INSERT statements
+#
+# LOW_PRIORITY|HIGH_PRIORITY are covered in insert_high_low_prio test
+# DELAYED is covered in insert_delayed test
+# IGNORE and ON DUPLICATE KEY UPDATE are covered in insert_with_keys test
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+--source create_table.inc
+
+# INSERT [INTO] .. VALUES|VALUE ..
+
+INSERT INTO t1 VALUES (100,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+if ($mysql_errname)
+{
+ --let $functionality = INSERT
+ --source unexpected_result.inc
+}
+--sorted_result
+SELECT * FROM t1;
+
+INSERT t1 VALUE (10,'foo'),(11,'abc');
+--sorted_result
+SELECT * FROM t1;
+
+INSERT INTO t1 (b,a) VALUES ('test',0);
+--sorted_result
+SELECT * FROM t1;
+
+INSERT INTO t1 VALUES (DEFAULT,DEFAULT);
+--sorted_result
+SELECT * FROM t1;
+
+INSERT t1 (a) VALUE (10),(20);
+--sorted_result
+SELECT * FROM t1;
+
+# INSERT [INTO] .. SET
+
+INSERT INTO t1 SET a = 11, b = 'f';
+--sorted_result
+SELECT * FROM t1;
+
+INSERT t1 SET b = DEFAULT;
+--sorted_result
+SELECT * FROM t1;
+
+
+# INSERT .. SELECT
+
+--let $table_name = t2
+--source create_table.inc
+INSERT INTO t2 SELECT * FROM t1;
+if ($mysql_errname)
+{
+ --let $functionality = INSERT .. SELECT
+ --source unexpected_result.inc
+}
+
+
+INSERT INTO t1 (a) SELECT a FROM t2 WHERE b = 'foo';
+--sorted_result
+SELECT * FROM t1;
+
+INSERT t1 SELECT * FROM t1;
+--sorted_result
+SELECT * FROM t1;
+
+# Cleanup
+DROP TABLE t1, t2;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/insert_delayed.result b/mysql-test/suite/storage_engine/insert_delayed.result
new file mode 100644
index 00000000000..98e149bdf96
--- /dev/null
+++ b/mysql-test/suite/storage_engine/insert_delayed.result
@@ -0,0 +1,25 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+LOCK TABLE t1 READ;
+connect con0,localhost,root,,;
+SET lock_wait_timeout = 1;
+INSERT DELAYED INTO t1 (a,b) VALUES (3,'c');
+INSERT DELAYED INTO t1 SET a=4, b='d';
+INSERT DELAYED INTO t1 SELECT 5, 'e';
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+disconnect con0;
+connection default;
+SELECT * FROM t1;
+a b
+1 f
+2 b
+UNLOCK TABLES;
+FLUSH TABLES;
+SELECT * FROM t1;
+a b
+1 f
+2 b
+3 c
+4 d
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/insert_delayed.test b/mysql-test/suite/storage_engine/insert_delayed.test
new file mode 100644
index 00000000000..7c3c4eec768
--- /dev/null
+++ b/mysql-test/suite/storage_engine/insert_delayed.test
@@ -0,0 +1,62 @@
+#
+# INSERT DELAYED
+#
+
+--source have_engine.inc
+
+if (`SELECT @@log_bin AND @@binlog_format IN ('statement','mixed')`)
+{
+ --source cleanup_engine.inc
+ --skip # INSERT DELAYED does not work with binlog format STATEMENT or MIXED
+}
+
+--source include/count_sessions.inc
+
+--enable_connect_log
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = a $int_col, b $char_col
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+
+LOCK TABLE t1 READ;
+if ($mysql_errname)
+{
+ --let $functionality = LOCK TABLE .. READ
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --connect (con0,localhost,root,,)
+ SET lock_wait_timeout = 1;
+ INSERT DELAYED INTO t1 (a,b) VALUES (3,'c');
+ if ($mysql_errname)
+ {
+ --let $functionality = INSERT DELAYED
+ --source unexpected_result.inc
+ }
+ INSERT DELAYED INTO t1 SET a=4, b='d';
+ # DELAYED is ignored with INSERT .. SELECT
+ --let $error_codes = ER_LOCK_WAIT_TIMEOUT
+ INSERT DELAYED INTO t1 SELECT 5, 'e';
+ --source check_errors.inc
+
+ --disconnect con0
+ --connection default
+ SELECT * FROM t1;
+}
+UNLOCK TABLES;
+FLUSH TABLES;
+SELECT * FROM t1;
+
+# Cleanup
+DROP TABLE t1;
+
+let $wait_timeout = 30;
+--source include/wait_until_count_sessions.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/insert_high_prio.result b/mysql-test/suite/storage_engine/insert_high_prio.result
new file mode 100644
index 00000000000..66378564ff7
--- /dev/null
+++ b/mysql-test/suite/storage_engine/insert_high_prio.result
@@ -0,0 +1,64 @@
+DROP TABLE IF EXISTS t1;
+SET @low_prio_updates = @@global.low_priority_updates;
+SET @concur_insert = @@global.concurrent_insert;
+SET GLOBAL concurrent_insert = NEVER;
+connect con0,localhost,root,,;
+SET lock_wait_timeout = 4;
+connect con1,localhost,root,,;
+SET lock_wait_timeout = 4;
+connect con2,localhost,root,,;
+SET lock_wait_timeout = 4;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+SET GLOBAL LOW_PRIORITY_UPDATES = 1;
+connection con1;
+SELECT SLEEP(1) FROM t1;
+connection con0;
+INSERT INTO t1 (a,b) VALUES (3,'z');
+connection con2;
+# Should return only 2 rows
+SELECT SLEEP(1) FROM t1;
+SLEEP(1)
+0
+0
+connection con1;
+SLEEP(1)
+0
+0
+connection con0;
+SELECT * FROM t1;
+a b
+1 f
+2 b
+3 z
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+connection con1;
+SELECT SLEEP(1) FROM t1;
+connection con0;
+INSERT HIGH_PRIORITY INTO t1 (a,b) VALUES (3,'z');
+connection con2;
+# Should return 3 rows
+SELECT SLEEP(1) FROM t1;
+SLEEP(1)
+0
+0
+0
+connection con1;
+SLEEP(1)
+0
+0
+connection con0;
+SELECT * FROM t1;
+a b
+1 f
+2 b
+3 z
+disconnect con1;
+disconnect con2;
+disconnect con0;
+connection default;
+SET GLOBAL low_priority_updates = @low_prio_updates;
+SET GLOBAL concurrent_insert = @concur_insert;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/insert_high_prio.test b/mysql-test/suite/storage_engine/insert_high_prio.test
new file mode 100644
index 00000000000..819e996d468
--- /dev/null
+++ b/mysql-test/suite/storage_engine/insert_high_prio.test
@@ -0,0 +1,143 @@
+#
+# INSERT HIGH_PRIOIRITY
+#
+--source have_engine.inc
+
+--source include/count_sessions.inc
+
+--enable_connect_log
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# We will be changing the GLOBAL value of low_priority_updates
+# due to bug#64892
+# (Session-level low_priority_updates does not work for INSERT)
+SET @low_prio_updates = @@global.low_priority_updates;
+
+# Concurrent insert might interfere
+# with HIGH|LOW_PRIORITY logic
+SET @concur_insert = @@global.concurrent_insert;
+SET GLOBAL concurrent_insert = NEVER;
+
+# We will have 3 connections:
+# con1 will start SELECT which should give us enough time;
+# con0 will run INSERT
+# con2 will then start another SELECT.
+# With standard INSERT and low_priority_updates=1
+# we should see only old rows in both resultsets,
+# while with INSERT HIGH_PRIORITY we should see new rows in con2 resultset.
+
+--connect (con0,localhost,root,,)
+SET lock_wait_timeout = 4;
+--connect (con1,localhost,root,,)
+SET lock_wait_timeout = 4;
+--connect (con2,localhost,root,,)
+SET lock_wait_timeout = 4;
+
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+
+# Normal INSERT with low_priority_updates=1
+# should work like INSERT LOW_PRIORITY
+
+SET GLOBAL LOW_PRIORITY_UPDATES = 1;
+
+--connection con1
+--send
+SELECT SLEEP(1) FROM t1;
+
+--connection con0
+let $show_statement = SHOW PROCESSLIST;
+let $field = State;
+let $condition = = 'User sleep';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+--send
+INSERT INTO t1 (a,b) VALUES (3,'z');
+
+--connection con2
+let $condition = = 'Waiting for table level lock';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+if (!$found)
+{
+ --let $mysql_errname = timeout in wait_show_condition.inc
+ --let $functionality = @@low_priority_updates or INSERT or table locking
+ --source unexpected_result.inc
+}
+if ($found)
+{
+ --echo # Should return only 2 rows
+ SELECT SLEEP(1) FROM t1;
+}
+
+--connection con1
+--reap
+
+--connection con0
+--reap
+--sorted_result
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+
+# INSERT HIGH_PRIORITY should override low_priority_updates=1
+
+--connection con1
+--send
+SELECT SLEEP(1) FROM t1;
+
+--connection con0
+let $condition = = 'User sleep';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+--send
+INSERT HIGH_PRIORITY INTO t1 (a,b) VALUES (3,'z');
+
+--connection con2
+let $condition = = 'Waiting for table level lock';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+if (!$found)
+{
+ --let $mysql_errname = timeout in wait_show_condition.inc
+ --let $functionality = @@low_priority_updates or INSERT HIGH_PRIORITY or table locking
+ --source unexpected_result.inc
+}
+if ($found)
+{
+ --echo # Should return 3 rows
+ SELECT SLEEP(1) FROM t1;
+}
+
+--connection con1
+--reap
+
+--connection con0
+--reap
+--sorted_result
+SELECT * FROM t1;
+
+--disconnect con1
+--disconnect con2
+--disconnect con0
+let $wait_timeout = 30;
+
+--connection default
+
+SET GLOBAL low_priority_updates = @low_prio_updates;
+SET GLOBAL concurrent_insert = @concur_insert;
+
+# Cleanup
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/insert_low_prio.result b/mysql-test/suite/storage_engine/insert_low_prio.result
new file mode 100644
index 00000000000..561b6296380
--- /dev/null
+++ b/mysql-test/suite/storage_engine/insert_low_prio.result
@@ -0,0 +1,39 @@
+DROP TABLE IF EXISTS t1;
+SET @low_prio_updates = @@global.low_priority_updates;
+SET @concur_insert = @@global.concurrent_insert;
+SET GLOBAL concurrent_insert = NEVER;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+connect con0,localhost,root,,;
+SET lock_wait_timeout = 4;
+connect con1,localhost,root,,;
+SET lock_wait_timeout = 4;
+connect con2,localhost,root,,;
+SET lock_wait_timeout = 4;
+connection con1;
+SELECT SLEEP(1) FROM t1;
+connection con0;
+INSERT LOW_PRIORITY INTO t1 (a,b) VALUES (3,'z');
+connection con2;
+# Should return only 2 rows
+SELECT SLEEP(1) FROM t1;
+SLEEP(1)
+0
+0
+connection con1;
+SLEEP(1)
+0
+0
+connection con0;
+SELECT * FROM t1;
+a b
+1 f
+2 b
+3 z
+disconnect con0;
+disconnect con1;
+disconnect con2;
+connection default;
+SET GLOBAL low_priority_updates = @low_prio_updates;
+SET GLOBAL concurrent_insert = @concur_insert;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/insert_low_prio.test b/mysql-test/suite/storage_engine/insert_low_prio.test
new file mode 100644
index 00000000000..30f47833162
--- /dev/null
+++ b/mysql-test/suite/storage_engine/insert_low_prio.test
@@ -0,0 +1,95 @@
+#
+# INSERT LOW_PRIORITY
+#
+--source have_engine.inc
+
+--source include/count_sessions.inc
+
+--enable_connect_log
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# We will be changing the GLOBAL value of low_priority_updates
+# due to bug#64892
+# (Session-level low_priority_updates does not work for INSERT)
+SET @low_prio_updates = @@global.low_priority_updates;
+
+# Concurrent insert might interfere
+# with HIGH|LOW_PRIORITY logic
+SET @concur_insert = @@global.concurrent_insert;
+SET GLOBAL concurrent_insert = NEVER;
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+
+# We will have 3 connections:
+# con1 will start SELECT which should give us enough time;
+# con0 will run INSERT
+# con2 will then start another SELECT.
+# With INSERT LOW_PRIORITY we should see only old rows in both resultsets.
+
+--connect (con0,localhost,root,,)
+SET lock_wait_timeout = 4;
+--connect (con1,localhost,root,,)
+SET lock_wait_timeout = 4;
+--connect (con2,localhost,root,,)
+SET lock_wait_timeout = 4;
+
+--connection con1
+
+--send
+SELECT SLEEP(1) FROM t1;
+
+--connection con0
+let $show_statement = SHOW PROCESSLIST;
+let $field = State;
+let $condition = = 'User sleep';
+# We don't need to wait long,
+# thread should show up in the processlist right away
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+--send
+INSERT LOW_PRIORITY INTO t1 (a,b) VALUES (3,'z');
+
+--connection con2
+
+let $condition = = 'Waiting for table level lock';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+if (!$found)
+{
+ --let $mysql_errname = timeout in wait_show_condition
+ --let $functionality = INSERT LOW_PRIORITY or table locking
+ --source unexpected_result.inc
+}
+if ($found)
+{
+ --echo # Should return only 2 rows
+ SELECT SLEEP(1) FROM t1;
+}
+
+--connection con1
+--reap
+
+--connection con0
+--reap
+--sorted_result
+SELECT * FROM t1;
+
+--disconnect con0
+--disconnect con1
+--disconnect con2
+--connection default
+
+SET GLOBAL low_priority_updates = @low_prio_updates;
+SET GLOBAL concurrent_insert = @concur_insert;
+
+# Cleanup
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/insert_with_keys.result b/mysql-test/suite/storage_engine/insert_with_keys.result
new file mode 100644
index 00000000000..175e7eeb2c7
--- /dev/null
+++ b/mysql-test/suite/storage_engine/insert_with_keys.result
@@ -0,0 +1,148 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX>(b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+INSERT INTO t1 (a,b) VALUES (100,'a'), (6,'f');
+INSERT INTO t1 (a,b) VALUES (30,'m'),(29,'n');
+INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+INSERT INTO t1 (a,b) VALUES (3,'a'),(0,'');
+SELECT * FROM t1;
+a b
+0
+1 a
+1 a
+100 a
+12345 z
+2 b
+29 n
+3 a
+3 c
+30 m
+4 d
+5 e
+6 f
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, UNIQUE INDEX(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+INSERT INTO t1 (a,b) VALUES (100,'a'), (6,'f');
+INSERT INTO t1 (a,b) VALUES (30,'m'),(29,'n');
+INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+ERROR 23000: Duplicate entry '1' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+INSERT INTO t1 (a,b) VALUES (3,'a'),(0,'');
+ERROR 23000: Duplicate entry '3' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+INSERT INTO t1 (a,b) VALUES (0,'');
+SELECT * FROM t1;
+a b
+0
+1 a
+100 a
+2 b
+29 n
+3 c
+30 m
+4 d
+5 e
+6 f
+INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'d') ON DUPLICATE KEY UPDATE a = a+10;
+SELECT * FROM t1;
+a b
+0
+1 a
+100 a
+12345 z
+13 c
+14 d
+2 b
+29 n
+30 m
+5 e
+6 f
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, UNIQUE INDEX(a,b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+INSERT INTO t1 (a,b) VALUES (100,'a'), (6,'f');
+INSERT INTO t1 (a,b) VALUES (30,'m'),(29,'n');
+INSERT INTO t1 (a,b) VALUES (100,'b'), (2,'c');
+INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+ERROR 23000: Duplicate entry '1-a' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+SELECT * FROM t1;
+a b
+1 a
+100 a
+100 b
+2 b
+2 c
+29 n
+3 c
+30 m
+4 d
+5 e
+6 f
+INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE a = a+VALUES(a);
+SELECT * FROM t1;
+a b
+100 a
+100 b
+2 a
+2 b
+2 c
+24690 z
+29 n
+3 c
+30 m
+4 d
+5 e
+6 f
+INSERT INTO t1 (a,b) VALUES (101,'x'),(101,'x');
+ERROR 23000: Duplicate entry '101-x' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+INSERT INTO t1 (a,b) VALUES (100,'a'), (6,'f');
+INSERT INTO t1 (a,b) VALUES (30,'m'),(29,'n');
+INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+INSERT INTO t1 (a,b) VALUES (3,'a'),(0,'');
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+INSERT INTO t1 (a,b) VALUES (0,'');
+SELECT * FROM t1;
+a b
+0
+1 a
+100 a
+2 b
+29 n
+3 c
+30 m
+4 d
+5 e
+6 f
+INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE b = CONCAT(b,b);
+SELECT * FROM t1;
+a b
+0
+1 aa
+100 a
+12345 zz
+2 b
+29 n
+3 c
+30 m
+4 d
+5 e
+6 f
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/insert_with_keys.test b/mysql-test/suite/storage_engine/insert_with_keys.test
new file mode 100644
index 00000000000..1959b55c707
--- /dev/null
+++ b/mysql-test/suite/storage_engine/insert_with_keys.test
@@ -0,0 +1,143 @@
+#
+# INSERT statements for tables with keys
+#
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = a $int_col, b $char_indexed_col, $default_index(b)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Indexes on CHAR columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+ INSERT INTO t1 (a,b) VALUES (100,'a'), (6,'f');
+ INSERT INTO t1 (a,b) VALUES (30,'m'),(29,'n');
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+ INSERT INTO t1 (a,b) VALUES (3,'a'),(0,'');
+ --sorted_result
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+--let $create_definition = a $int_indexed_col, b $char_col, UNIQUE INDEX(a)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Unique indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+ INSERT INTO t1 (a,b) VALUES (100,'a'), (6,'f');
+ INSERT INTO t1 (a,b) VALUES (30,'m'),(29,'n');
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+ --source check_errors.inc
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (3,'a'),(0,'');
+ --source check_errors.inc
+ INSERT INTO t1 (a,b) VALUES (0,'');
+ --sorted_result
+ SELECT * FROM t1;
+
+ INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+ if ($mysql_errname)
+ {
+ --source unexpected_result.inc
+ }
+ INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'d') ON DUPLICATE KEY UPDATE a = a+10;
+ if ($mysql_errname)
+ {
+ --source unexpected_result.inc
+ }
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+}
+
+--let $create_definition = a $int_indexed_col, b $char_indexed_col, UNIQUE INDEX(a,b)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Multi-part indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+ INSERT INTO t1 (a,b) VALUES (100,'a'), (6,'f');
+ INSERT INTO t1 (a,b) VALUES (30,'m'),(29,'n');
+ INSERT INTO t1 (a,b) VALUES (100,'b'), (2,'c');
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+ --source check_errors.inc
+ --sorted_result
+ SELECT * FROM t1;
+
+ INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE a = a+VALUES(a);
+ --sorted_result
+ SELECT * FROM t1;
+
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (101,'x'),(101,'x');
+ --source check_errors.inc
+ DROP TABLE t1;
+}
+
+--let $create_definition = a $int_indexed_col PRIMARY KEY, b $char_col
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Primary keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+ INSERT INTO t1 (a,b) VALUES (100,'a'), (6,'f');
+ INSERT INTO t1 (a,b) VALUES (30,'m'),(29,'n');
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+ --source check_errors.inc
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (3,'a'),(0,'');
+ --source check_errors.inc
+ INSERT INTO t1 (a,b) VALUES (0,'');
+ --sorted_result
+ SELECT * FROM t1;
+
+ INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
+ if ($mysql_errname)
+ {
+ --source unexpected_result.inc
+ }
+
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE b = CONCAT(b,b);
+ if ($mysql_errname)
+ {
+ --source unexpected_result.inc
+ }
+ --sorted_result
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/loaddata.result b/mysql-test/suite/storage_engine/loaddata.result
new file mode 100644
index 00000000000..85608cdc32a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/loaddata.result
@@ -0,0 +1,68 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+LOAD DATA INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1
+FIELDS TERMINATED BY ',';
+SELECT * FROM t1;
+a b
+1 foo
+2 bar
+3
+4 abc
+LOAD DATA LOCAL INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1
+CHARACTER SET utf8 COLUMNS TERMINATED BY ','
+ ESCAPED BY '/';
+SELECT * FROM t1;
+a b
+1 foo
+1 foo
+2 bar
+2 bar
+3
+3
+4 abc
+4 abc
+LOAD DATA INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1
+FIELDS TERMINATED BY ';'
+ OPTIONALLY ENCLOSED BY ''''
+ LINES STARTING BY 'prefix:'
+IGNORE 2 LINES
+(a,b);
+Warnings:
+Warning 1262 Row 2 was truncated; it contained more data than there were input columns
+SELECT * FROM t1;
+a b
+0
+1 foo
+1 foo
+100 foo
+2 bar
+2 bar
+3
+3
+4 abc
+4 abc
+7 test
+LOAD DATA LOCAL INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1
+FIELDS TERMINATED BY ';'
+ (a) SET b='loaded';
+Warnings:
+Warning 1262 Row 1 was truncated; it contained more data than there were input columns
+Warning 1262 Row 2 was truncated; it contained more data than there were input columns
+Warning 1262 Row 3 was truncated; it contained more data than there were input columns
+SELECT * FROM t1;
+a b
+0
+0 loaded
+1 foo
+1 foo
+100 foo
+102 loaded
+2 bar
+2 bar
+3
+3
+4 abc
+4 abc
+5 loaded
+7 test
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/loaddata.test b/mysql-test/suite/storage_engine/loaddata.test
new file mode 100644
index 00000000000..c413184af00
--- /dev/null
+++ b/mysql-test/suite/storage_engine/loaddata.test
@@ -0,0 +1,88 @@
+#
+# Basic LOAD DATA statements
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--source create_table.inc
+
+let $datadir = `SELECT @@datadir`;
+
+--write_file $datadir/se_loaddata.dat
+1,foo,
+2,bar,
+3,,
+4,abc,
+EOF
+
+--replace_result $datadir <DATADIR>
+eval
+LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
+ FIELDS TERMINATED BY ',';
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --sorted_result
+ SELECT * FROM t1;
+
+ --replace_result $datadir <DATADIR>
+ eval
+ LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
+ CHARACTER SET utf8 COLUMNS TERMINATED BY ','
+ ESCAPED BY '/';
+ --sorted_result
+ SELECT * FROM t1;
+
+ --remove_file $datadir/se_loaddata.dat
+ --write_file $datadir/se_loaddata.dat
+prefix:5;'foo';
+prefix:6;'';
+prefix:100;foo;
+prefix:7;'test';suffix
+101;abc;
+102;'z';
+prefix:0;;
+EOF
+
+ --replace_result $datadir <DATADIR>
+ eval
+ LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
+ FIELDS TERMINATED BY ';'
+ OPTIONALLY ENCLOSED BY ''''
+ LINES STARTING BY 'prefix:'
+ IGNORE 2 LINES
+ (a,b);
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ --remove_file $datadir/se_loaddata.dat
+ --write_file $datadir/se_loaddata.dat
+5;YYY;
+102;'zzz';
+0;'test';
+EOF
+
+ --replace_result $datadir <DATADIR>
+ eval
+ LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
+ FIELDS TERMINATED BY ';'
+ (a) SET b='loaded';
+
+ --sorted_result
+ SELECT * FROM t1;
+}
+
+# Cleanup
+--remove_file $datadir/se_loaddata.dat
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/lock.result b/mysql-test/suite/storage_engine/lock.result
new file mode 100644
index 00000000000..73573381110
--- /dev/null
+++ b/mysql-test/suite/storage_engine/lock.result
@@ -0,0 +1,111 @@
+connect con1,localhost,root,,;
+SET lock_wait_timeout=1;
+connection default;
+DROP TABLE IF EXISTS t1, t2, t3;
+CREATE TABLE t1 (id <INT_COLUMN>, id2 <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (id,id2) VALUES (1,1),(1,2),(1,3);
+LOCK TABLE t1 LOW_PRIORITY WRITE;
+SELECT id2,COUNT(DISTINCT id) FROM t1 GROUP BY id2;
+id2 COUNT(DISTINCT id)
+1 1
+2 1
+3 1
+UPDATE t1 SET id=-1 WHERE id=1;
+connection con1;
+SELECT * FROM t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+LOCK TABLE t1 READ;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection default;
+LOCK TABLE t1 READ;
+UPDATE t1 SET id=1 WHERE id=1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+connection con1;
+SELECT COUNT(DISTINCT id) FROM t1;
+COUNT(DISTINCT id)
+1
+UPDATE t1 SET id=2 WHERE id=2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+LOCK TABLE t1 WRITE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+LOCK TABLE t1 READ;
+UNLOCK TABLES;
+connection default;
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+CREATE TEMPORARY TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+DROP TABLE IF EXISTS t2;
+UNLOCK TABLES;
+CREATE TABLE t2 (id <INT_COLUMN>, id2 <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+LOCK TABLE t1 WRITE, t2 WRITE;
+INSERT INTO t2 SELECT * FROM t1;
+UPDATE t1 SET id=1 WHERE id=-1;
+DROP TABLE t1,t2;
+CREATE TABLE t1 (i1 <INT_COLUMN>, nr <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE t2 (nr <INT_COLUMN>, nm <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t2 (nr,nm) VALUES (1,3);
+INSERT INTO t2 (nr,nm) VALUES (2,4);
+lock tables t1 write, t2 read;
+INSERT INTO t1 (i1,nr) SELECT 1, nr FROM t2 WHERE nm=3;
+INSERT INTO t1 (i1,nr) SELECT 2, nr FROM t2 WHERE nm=4;
+UNLOCK TABLES;
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 (i1,nr) SELECT i1, nr FROM t1;
+ERROR HY000: Table 't1' was not locked with LOCK TABLES
+UNLOCK TABLES;
+LOCK TABLES t1 WRITE, t1 AS t1_alias READ;
+INSERT INTO t1 (i1,nr) SELECT i1, nr FROM t1 AS t1_alias;
+DROP TABLE t1,t2;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+UNLOCK TABLES;
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE t3 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE;
+DROP TABLE t2, t3, t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE t3 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE, t1 AS t4 READ;
+ALTER TABLE t2 ADD COLUMN c2 <INT_COLUMN>;
+DROP TABLE t1, t2, t3;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+LOCK TABLE t1 READ, t2 READ;
+FLUSH TABLE t1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+FLUSH TABLES;
+ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
+FLUSH TABLES t1, t2 WITH READ LOCK;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+UNLOCK TABLES;
+FLUSH TABLES t1, t2 WITH READ LOCK;
+connection con1;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection default;
+UNLOCK TABLES;
+FLUSH TABLES WITH READ LOCK;
+connection con1;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection default;
+UNLOCK TABLES;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT;
+DROP TABLE t1, t2;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+disconnect con1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+LOCK TABLE t1 WRITE, t2 WRITE;
+CREATE TEMPORARY TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+FLUSH TABLE t1;
+DROP TEMPORARY TABLE t1;
+SELECT * FROM t1;
+a b
+UNLOCK TABLES;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/lock.test b/mysql-test/suite/storage_engine/lock.test
new file mode 100644
index 00000000000..16872bdaa7d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/lock.test
@@ -0,0 +1,244 @@
+# Standard table locking:
+# LOCK TABLE .. READ
+# LOCK TABLE .. [LOW_PRIORITY] WRITE
+# UNLOCK TABLES
+#
+# and global locking:
+# FLUSH TABLES [..] WITH READ LOCK
+#
+#
+--source have_engine.inc
+
+--enable_connect_log
+
+# Save the initial number of concurrent sessions.
+--source include/count_sessions.inc
+
+connect (con1,localhost,root,,);
+SET lock_wait_timeout=1;
+
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3;
+--enable_warnings
+
+--let $create_definition = id $int_col, id2 $int_col
+--source create_table.inc
+
+INSERT INTO t1 (id,id2) VALUES (1,1),(1,2),(1,3);
+
+# LOW_PRIORITY has no effect, but is still syntactically correct
+LOCK TABLE t1 LOW_PRIORITY WRITE;
+SELECT id2,COUNT(DISTINCT id) FROM t1 GROUP BY id2;
+
+UPDATE t1 SET id=-1 WHERE id=1;
+if ($mysql_errname)
+{
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+}
+
+connection con1;
+# With WRITE lock held by connection 'default',
+# nobody else can access the table
+--let $error_codes = ER_LOCK_WAIT_TIMEOUT
+SELECT * FROM t1;
+--source check_errors.inc
+--let $error_codes = ER_LOCK_WAIT_TIMEOUT
+LOCK TABLE t1 READ;
+--source check_errors.inc
+
+connection default;
+LOCK TABLE t1 READ;
+--let $error_codes = ER_TABLE_NOT_LOCKED_FOR_WRITE
+UPDATE t1 SET id=1 WHERE id=1;
+--source check_errors.inc
+if ($mysql_errname != ER_TABLE_NOT_LOCKED_FOR_WRITE)
+{
+ --let $functonality = UPDATE or locking
+ --source unexpected_result.inc
+}
+
+connection con1;
+# With READ lock held by connection 'default',
+# it should be possible to read from the table
+# or acquire another READ lock,
+# but not update it or acquire WRITE lock
+SELECT COUNT(DISTINCT id) FROM t1;
+--let $error_codes = ER_LOCK_WAIT_TIMEOUT
+UPDATE t1 SET id=2 WHERE id=2;
+--source check_errors.inc
+--let $error_codes = ER_LOCK_WAIT_TIMEOUT
+LOCK TABLE t1 WRITE;
+--source check_errors.inc
+LOCK TABLE t1 READ;
+UNLOCK TABLES;
+
+
+--connection default
+
+--let $error_codes = ER_TABLE_NOT_LOCKED
+--let $table_name = t2
+--source create_table.inc
+
+--let $table_name = t2
+--let $temporary = 1
+--source create_table.inc
+
+DROP TABLE IF EXISTS t2;
+
+UNLOCK TABLES;
+
+--let $table_name = t2
+--let $create_definition = id $int_col, id2 $int_col
+--source create_table.inc
+LOCK TABLE t1 WRITE, t2 WRITE;
+INSERT INTO t2 SELECT * FROM t1;
+UPDATE t1 SET id=1 WHERE id=-1;
+if ($mysql_errname)
+{
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+}
+DROP TABLE t1,t2;
+
+#
+# INSERT ... SELECT with lock tables
+#
+
+--let $create_definition = i1 $int_col, nr $int_col
+--source create_table.inc
+
+--let $table_name = t2
+--let $create_definition = nr $int_col, nm $int_col
+--source create_table.inc
+
+INSERT INTO t2 (nr,nm) VALUES (1,3);
+INSERT INTO t2 (nr,nm) VALUES (2,4);
+
+lock tables t1 write, t2 read;
+INSERT INTO t1 (i1,nr) SELECT 1, nr FROM t2 WHERE nm=3;
+INSERT INTO t1 (i1,nr) SELECT 2, nr FROM t2 WHERE nm=4;
+UNLOCK TABLES;
+
+LOCK TABLES t1 WRITE;
+--let $error_codes = ER_TABLE_NOT_LOCKED
+INSERT INTO t1 (i1,nr) SELECT i1, nr FROM t1;
+--source check_errors.inc
+UNLOCK TABLES;
+LOCK TABLES t1 WRITE, t1 AS t1_alias READ;
+INSERT INTO t1 (i1,nr) SELECT i1, nr FROM t1 AS t1_alias;
+--let $error_codes = ER_TABLE_NOT_LOCKED
+DROP TABLE t1,t2;
+--source check_errors.inc
+UNLOCK TABLES;
+DROP TABLE t1,t2;
+
+#
+# Check that a dropped table is removed from a lock
+
+--source create_table.inc
+--let $table_name = t2
+--source create_table.inc
+--let $table_name = t3
+--source create_table.inc
+LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE;
+# This removes one table after the other from the lock.
+DROP TABLE t2, t3, t1;
+#
+# Check that a lock merge works
+--source create_table.inc
+--let $table_name = t2
+--source create_table.inc
+--let $table_name = t3
+--source create_table.inc
+LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE, t1 AS t4 READ;
+
+--let $alter_definition = ADD COLUMN c2 $int_col
+--let $table_name = t2
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+
+DROP TABLE t1, t2, t3;
+
+# FLUSH TABLES is not permitted when there is an active LOCK TABLES .. READ,
+# FLUSH TABLES .. WITH READ LOCK should be used instead
+# (and for other connections the table is locked)
+
+--source create_table.inc
+--let $table_name = t2
+--source create_table.inc
+
+LOCK TABLE t1 READ, t2 READ;
+--let $error_codes = ER_TABLE_NOT_LOCKED_FOR_WRITE
+FLUSH TABLE t1;
+--source check_errors.inc
+--let $error_codes = ER_TABLE_NOT_LOCKED_FOR_WRITE
+FLUSH TABLES;
+--source check_errors.inc
+--let $error_codes = ER_LOCK_OR_ACTIVE_TRANSACTION
+FLUSH TABLES t1, t2 WITH READ LOCK;
+--source check_errors.inc
+UNLOCK TABLES;
+
+FLUSH TABLES t1, t2 WITH READ LOCK;
+
+--connection con1
+--let $error_codes = ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+--source check_errors.inc
+
+--connection default
+UNLOCK TABLES;
+
+# Global lock
+
+FLUSH TABLES WITH READ LOCK;
+
+--connection con1
+--let $error_codes = ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+--source check_errors.inc
+
+--connection default
+UNLOCK TABLES;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT;
+--let $error_codes = ER_CANT_UPDATE_WITH_READLOCK
+DROP TABLE t1, t2;
+--source check_errors.inc
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+
+--disconnect con1
+
+#
+# Ensure that FLUSH TABLES doesn't substitute a base locked table
+# with a temporary one.
+#
+
+--source create_table.inc
+--let $table_name = t2
+--source create_table.inc
+LOCK TABLE t1 WRITE, t2 WRITE;
+
+--let $temporary = 1
+--source create_table.inc
+FLUSH TABLE t1;
+DROP TEMPORARY TABLE t1;
+SELECT * FROM t1;
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+
+# Check that all connections opened by test cases in this file are really
+# gone so execution of other tests won't be affected by their presence.
+--source include/wait_until_count_sessions.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/lock_concurrent.result b/mysql-test/suite/storage_engine/lock_concurrent.result
new file mode 100644
index 00000000000..65ab3e86fde
--- /dev/null
+++ b/mysql-test/suite/storage_engine/lock_concurrent.result
@@ -0,0 +1,12 @@
+SET lock_wait_timeout = 1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
+SET lock_wait_timeout = 1;
+LOCK TABLES t1 READ LOCAL;
+UNLOCK TABLES;
+UNLOCK TABLES;
+LOCK TABLES t1 READ LOCAL;
+LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
+UNLOCK TABLES;
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/lock_concurrent.test b/mysql-test/suite/storage_engine/lock_concurrent.test
new file mode 100644
index 00000000000..b75ccf0dd9f
--- /dev/null
+++ b/mysql-test/suite/storage_engine/lock_concurrent.test
@@ -0,0 +1,52 @@
+#
+# READ LOCAL / WRITE CONCURRENT locks.
+# This test is separate from the main lock.test
+# because the feature is likely to be unsupported.
+#
+
+--source have_engine.inc
+
+--source include/count_sessions.inc
+
+SET lock_wait_timeout = 1;
+
+--let $create_definition = a $int_col
+--source create_table.inc
+
+LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
+
+connect (con1,localhost,root,,);
+SET lock_wait_timeout = 1;
+
+# If this statement fails with ER_LOCK_WAIT_TIMEOUT,
+# most likely the engine does not support LOCK .. WRITE CONCURRENT
+LOCK TABLES t1 READ LOCAL;
+if ($mysql_errname)
+{
+ --let $functionality = LOCK .. WRITE CONCURRENT
+ --source unexpected_result.inc
+}
+
+UNLOCK TABLES;
+
+connection default;
+UNLOCK TABLES;
+
+connection con1;
+LOCK TABLES t1 READ LOCAL;
+
+connection default;
+LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
+UNLOCK TABLES;
+
+connection con1;
+UNLOCK TABLES;
+disconnect con1;
+
+connection default;
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/mask_engine.inc b/mysql-test/suite/storage_engine/mask_engine.inc
new file mode 100644
index 00000000000..3c00af39825
--- /dev/null
+++ b/mysql-test/suite/storage_engine/mask_engine.inc
@@ -0,0 +1,14 @@
+#
+# This include file just replaces the storage engine under test by the generic string <STORAGE_ENGINE>
+# in the next statement. More masks can be added by defining $add_regex, e.g.
+# let $add_regex = /$data_dir/<DATA_DIR>/ /$index_dir/<INDEX_DIR>/
+#
+
+--let $regex = /$storage_engine/<STORAGE_ENGINE>/i
+if ($add_regex)
+{
+ --let $regex = $regex $add_regex
+}
+--let $add_regex =
+--replace_regex $regex
+
diff --git a/mysql-test/suite/storage_engine/misc.result b/mysql-test/suite/storage_engine/misc.result
new file mode 100644
index 00000000000..591f172d796
--- /dev/null
+++ b/mysql-test/suite/storage_engine/misc.result
@@ -0,0 +1,79 @@
+INSERT INTO mysql.event (
+db,
+name,
+body,
+definer,
+interval_value,
+interval_field,
+originator,
+character_set_client,
+collation_connection,
+db_collation,
+body_utf8)
+values (
+database(),
+"ev1",
+"select 1",
+user(),
+100,
+"SECOND_MICROSECOND",
+1,
+'utf8',
+'utf8_general_ci',
+'utf8_general_ci',
+'select 1');
+SHOW EVENTS;
+ERROR 42000: This version of MariaDB doesn't yet support 'MICROSECOND'
+DROP EVENT ev1;
+SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME
+FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ORDER BY TABLE_NAME;
+TABLE_NAME COLUMN_NAME REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
+columns_priv Column_name NULL NULL
+columns_priv Db NULL NULL
+columns_priv Host NULL NULL
+columns_priv Table_name NULL NULL
+columns_priv User NULL NULL
+db Db NULL NULL
+db Host NULL NULL
+db User NULL NULL
+event db NULL NULL
+event name NULL NULL
+func name NULL NULL
+help_category help_category_id NULL NULL
+help_category name NULL NULL
+help_keyword help_keyword_id NULL NULL
+help_keyword name NULL NULL
+help_relation help_keyword_id NULL NULL
+help_relation help_topic_id NULL NULL
+help_topic help_topic_id NULL NULL
+help_topic name NULL NULL
+host Db NULL NULL
+host Host NULL NULL
+ndb_binlog_index epoch NULL NULL
+plugin name NULL NULL
+proc db NULL NULL
+proc name NULL NULL
+proc type NULL NULL
+procs_priv Db NULL NULL
+procs_priv Host NULL NULL
+procs_priv Routine_name NULL NULL
+procs_priv Routine_type NULL NULL
+procs_priv User NULL NULL
+proxies_priv Host NULL NULL
+proxies_priv Proxied_host NULL NULL
+proxies_priv Proxied_user NULL NULL
+proxies_priv User NULL NULL
+servers Server_name NULL NULL
+tables_priv Db NULL NULL
+tables_priv Host NULL NULL
+tables_priv Table_name NULL NULL
+tables_priv User NULL NULL
+time_zone Time_zone_id NULL NULL
+time_zone_leap_second Transition_time NULL NULL
+time_zone_name Name NULL NULL
+time_zone_transition Time_zone_id NULL NULL
+time_zone_transition Transition_time NULL NULL
+time_zone_transition_type Time_zone_id NULL NULL
+time_zone_transition_type Transition_type_id NULL NULL
+user Host NULL NULL
+user User NULL NULL
diff --git a/mysql-test/suite/storage_engine/misc.test b/mysql-test/suite/storage_engine/misc.test
new file mode 100644
index 00000000000..9357ea5767a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/misc.test
@@ -0,0 +1,47 @@
+#
+# Different statements not related to an engine,
+# but added to provide function coverage for handler.cc and handler.h.
+# The test can be disabled or removed later.
+#
+
+# hits get_error_message(int, String*)
+
+--source have_engine.inc
+
+INSERT INTO mysql.event (
+ db,
+ name,
+ body,
+ definer,
+ interval_value,
+ interval_field,
+ originator,
+ character_set_client,
+ collation_connection,
+ db_collation,
+ body_utf8)
+values (
+ database(),
+ "ev1",
+ "select 1",
+ user(),
+ 100,
+ "SECOND_MICROSECOND",
+ 1,
+ 'utf8',
+ 'utf8_general_ci',
+ 'utf8_general_ci',
+ 'select 1');
+
+--let $error_codes = ER_NOT_SUPPORTED_YET
+SHOW EVENTS;
+--source check_errors.inc
+DROP EVENT ev1;
+
+# hits get_foreign_key_list(THD*, List<st_foreign_key_info>*)
+--sorted_result
+SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME
+FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ORDER BY TABLE_NAME;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/my.cnf b/mysql-test/suite/storage_engine/my.cnf
new file mode 100644
index 00000000000..e83954c469d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/my.cnf
@@ -0,0 +1,7 @@
+!include include/default_my.cnf
+
+[server]
+sql-mode=NO_ENGINE_SUBSTITUTION
+binlog-format=row
+log-bin=master-bin
+
diff --git a/mysql-test/suite/storage_engine/obfuscate.inc b/mysql-test/suite/storage_engine/obfuscate.inc
new file mode 100644
index 00000000000..96c9e5a2956
--- /dev/null
+++ b/mysql-test/suite/storage_engine/obfuscate.inc
@@ -0,0 +1,4 @@
+let $storage_engine_search_string = ENGINE=$storage_engine;
+
+--replace_result ' ' ' ' ' ,' ',' ' )' ')' '( ' '(' $default_tbl_opts <CUSTOM_TABLE_OPTIONS> $int_indexed_col <INT_COLUMN> $char_indexed_col <CHAR_COLUMN> $int_col <INT_COLUMN> $char_col <CHAR_COLUMN> $default_col_indexed_opts <CUSTOM_COL_OPTIONS> $default_col_opts <CUSTOM_COL_OPTIONS> $storage_engine_search_string ENGINE=<STORAGE_ENGINE> $default_index <CUSTOM_INDEX>
+
diff --git a/mysql-test/suite/storage_engine/optimize_table.inc b/mysql-test/suite/storage_engine/optimize_table.inc
new file mode 100644
index 00000000000..acf80de3cea
--- /dev/null
+++ b/mysql-test/suite/storage_engine/optimize_table.inc
@@ -0,0 +1,42 @@
+#
+# OPTIMIZE TABLE statements
+#
+# Note: the output is likely to be different for the engine under test,
+# in which case rdiff will be needed. Or, the output might say that
+# the storage engine does not support OPTIMIZE.
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+--let $table_name = t2
+--source create_table.inc
+
+INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+OPTIMIZE TABLE t1;
+INSERT INTO t2 (a,b) VALUES (4,'d');
+OPTIMIZE NO_WRITE_TO_BINLOG TABLE t2;
+INSERT INTO t2 (a,b) VALUES (5,'e');
+INSERT INTO t1 (a,b) VALUES (6,'f');
+OPTIMIZE LOCAL TABLE t1, t2;
+OPTIMIZE TABLE t1, t2;
+
+DROP TABLE t1, t2;
+
+# OPTIMIZE on a table with index
+
+--let $continue = 1
+--source have_default_index.inc
+if ($have_default_index)
+{
+ --let $create_definition = a $int_indexed_col, b $char_col, $default_index (a)
+ --source create_table.inc
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(100,'b'),(2,'c'),(3,'d');
+ OPTIMIZE TABLE t1;
+ DROP TABLE t1;
+}
+
+
diff --git a/mysql-test/suite/storage_engine/optimize_table.result b/mysql-test/suite/storage_engine/optimize_table.result
new file mode 100644
index 00000000000..4bb0bd296bc
--- /dev/null
+++ b/mysql-test/suite/storage_engine/optimize_table.result
@@ -0,0 +1,29 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+INSERT INTO t2 (a,b) VALUES (4,'d');
+OPTIMIZE NO_WRITE_TO_BINLOG TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 optimize status OK
+INSERT INTO t2 (a,b) VALUES (5,'e');
+INSERT INTO t1 (a,b) VALUES (6,'f');
+OPTIMIZE LOCAL TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+test.t2 optimize status OK
+OPTIMIZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+test.t2 optimize status Table is already up to date
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(100,'b'),(2,'c'),(3,'d');
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/optimize_table.test b/mysql-test/suite/storage_engine/optimize_table.test
new file mode 100644
index 00000000000..a32a2c846a5
--- /dev/null
+++ b/mysql-test/suite/storage_engine/optimize_table.test
@@ -0,0 +1,14 @@
+#
+# OPTIMIZE TABLE statements
+#
+# Note: the output is likely to be different for the engine under test,
+# in which case rdiff will be needed. Or, the output might say that
+# the storage engine does not support OPTIMIZE.
+#
+
+--source have_engine.inc
+
+--source optimize_table.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/parts/alter_table.result b/mysql-test/suite/storage_engine/parts/alter_table.result
new file mode 100644
index 00000000000..d94fd3d5d14
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/alter_table.result
@@ -0,0 +1,42 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a) VALUES (1),(2),(2),(3),(4);
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p3 # # # # # # #
+ALTER TABLE t1 COALESCE PARTITION 1;
+EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 # # # # # # #
+ALTER TABLE t1 REORGANIZE PARTITION;
+EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 # # # # # # #
+ALTER TABLE t1 REBUILD PARTITION p0;
+EXPLAIN PARTiTIONS SELECT a FROM t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 # # # # # # #
+ALTER TABLE t1 REMOVE PARTITIONING;
+EXPLAIN PARTiTIONS SELECT a FROM t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 NULL # # # # # # #
+ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (101,102));
+ERROR HY000: Table has no partition for value 4
+ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3,4), PARTITION p1 VALUES IN (101,102));
+INSERT INTO t1 (a) VALUES (50);
+ERROR HY000: Table has no partition for value 50
+ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (50,51));
+INSERT INTO t1 (a) VALUES (50);
+ALTER TABLE t1 DROP PARTITION p1;
+ALTER TABLE t1 REORGANIZE PARTITION p0, p2 INTO (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4), PARTITION p2 VALUES IN (50,51), PARTITION p3 VALUES IN (101,102));
+EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 # # # # # # #
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+PARTITION abc VALUES IN (1,2,3),
+PARTITION def VALUES IN (100,101,102)
+);
+ALTER TABLE t1 DROP PARTITION abc;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/parts/alter_table.test b/mysql-test/suite/storage_engine/parts/alter_table.test
new file mode 100644
index 00000000000..48f1f3f7d96
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/alter_table.test
@@ -0,0 +1,107 @@
+#
+# Basic ALTER TABLE statements related to partitioning
+#
+
+--source include/have_partition.inc
+--source ../have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = a $int_col
+--let $partition_options = PARTITION BY HASH(a) PARTITIONS 2
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a) VALUES (1),(2),(2),(3),(4);
+
+ --let $alter_definition = ADD PARTITION PARTITIONS 2
+ --source ../alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source ../unexpected_result.inc
+ }
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
+
+ --let $alter_definition = COALESCE PARTITION 1
+ --source ../alter_table.inc
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
+
+ --let $alter_definition = REORGANIZE PARTITION
+ --source ../alter_table.inc
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
+
+ --let $alter_definition = REBUILD PARTITION p0
+ --source ../alter_table.inc
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTiTIONS SELECT a FROM t1;
+
+ --let $alter_definition = REMOVE PARTITIONING
+ --source ../alter_table.inc
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTiTIONS SELECT a FROM t1;
+
+ --let $error_codes = ER_NO_PARTITION_FOR_GIVEN_VALUE
+ --let $alter_definition = PARTITION BY LIST(a) ( PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (101,102) )
+ --source ../alter_table.inc
+ if ($mysql_errname != ER_NO_PARTITION_FOR_GIVEN_VALUE)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $my_functionality = ALTER TABLE or INSERT
+ --source ../unexpected_result.inc
+ }
+
+ --let $alter_definition = PARTITION BY LIST(a) ( PARTITION p0 VALUES IN (1,2,3,4), PARTITION p1 VALUES IN (101,102) )
+ --source ../alter_table.inc
+
+ --let $error_codes = ER_NO_PARTITION_FOR_GIVEN_VALUE
+ INSERT INTO t1 (a) VALUES (50);
+ --source ../check_errors.inc
+ --let $alter_definition = ADD PARTITION ( PARTITION p2 VALUES IN (50,51) )
+ --source ../alter_table.inc
+ INSERT INTO t1 (a) VALUES (50);
+
+ --let $alter_definition = DROP PARTITION p1
+ --source ../alter_table.inc
+ --let $alter_definition = REORGANIZE PARTITION p0, p2 INTO ( PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4), PARTITION p2 VALUES IN (50,51), PARTITION p3 VALUES IN (101,102) )
+ --source ../alter_table.inc
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
+ DROP TABLE t1;
+}
+
+
+--let $create_definition = a $int_col, b $int_col
+let $partition_options = PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+ PARTITION abc VALUES IN (1,2,3),
+ PARTITION def VALUES IN (100,101,102)
+);
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions or subpartitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --let $alter_definition = DROP PARTITION abc
+ --source ../alter_table.inc
+
+ DROP TABLE t1;
+}
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/parts/analyze_table.result b/mysql-test/suite/storage_engine/parts/analyze_table.result
new file mode 100644
index 00000000000..8cd210e4965
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/analyze_table.result
@@ -0,0 +1,47 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t2 (a,b) SELECT a,b FROM t1;
+INSERT INTO t1 (a,b) VALUES (3,'c');
+ALTER TABLE t1 ANALYZE PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+INSERT INTO t2 (a,b) VALUES (4,'d'), (1000,'e');
+ALTER TABLE t1 ANALYZE PARTITION LOCAL ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+INSERT INTO t1 (a,b) VALUES (5,'f'),(50,'g');
+ALTER TABLE t1 ANALYZE PARTITION NO_WRITE_TO_BINLOG p1,p0;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (3,'c');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+INSERT INTO t2 (a,b) VALUES (4,'d');
+ANALYZE NO_WRITE_TO_BINLOG TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+INSERT INTO t1 (a,b) VALUES (5,'e');
+INSERT INTO t2 (a,b) VALUES (6,'f');
+ANALYZE LOCAL TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a) VALUES (1),(2),(4),(7);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+INSERT INTO t1 (a) VALUES (8),(10),(11),(12);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/parts/analyze_table.test b/mysql-test/suite/storage_engine/parts/analyze_table.test
new file mode 100644
index 00000000000..2ff8fff1a03
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/analyze_table.test
@@ -0,0 +1,61 @@
+#
+# ANALYZE TABLE for partitioned tables and ANALYZE PARTITION
+#
+--source include/have_partition.inc
+--source ../have_engine.inc
+
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+--let $partition_options = PARTITION BY HASH(a) PARTITIONS 2
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+ let $partiton_options = PARTITION BY RANGE(a) (
+ PARTITION p0 VALUES LESS THAN (100),
+ PARTITION p1 VALUES LESS THAN MAXVALUE
+ );
+ --let $table_name = t2
+ --source ../create_table.inc
+
+ INSERT INTO t2 (a,b) SELECT a,b FROM t1;
+
+ INSERT INTO t1 (a,b) VALUES (3,'c');
+
+ --let $alter_definition = ANALYZE PARTITION p0
+ --source ../alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE .. ANALYZE PARTITION
+ --source unexpected_result.inc
+ }
+
+ INSERT INTO t2 (a,b) VALUES (4,'d'), (1000,'e');
+
+ --let $alter_definition = ANALYZE PARTITION LOCAL ALL
+ --source ../alter_table.inc
+
+ INSERT INTO t1 (a,b) VALUES (5,'f'),(50,'g');
+
+ --let $alter_definition = ANALYZE PARTITION NO_WRITE_TO_BINLOG p1,p0
+ --source ../alter_table.inc
+
+ DROP TABLE t1, t2;
+}
+
+let $extra_tbl_opts = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../analyze_table.inc
+let $extra_tbl_opts =;
+
+
+--source ../cleanup_engine.inc
diff --git a/mysql-test/suite/storage_engine/parts/check_table.result b/mysql-test/suite/storage_engine/parts/check_table.result
new file mode 100644
index 00000000000..6bd8d68e419
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/check_table.result
@@ -0,0 +1,104 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+PARTITION p0 VALUES LESS THAN (100),
+PARTITION p1 VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+ALTER TABLE t1 CHECK PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a,b) VALUES (3,'c');
+ALTER TABLE t1 CHECK PARTITION p0, p1 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t2 (a,b) VALUES (10000,'e');
+ALTER TABLE t2 CHECK PARTITION p0 QUICK;
+Table Op Msg_type Msg_text
+test.t2 check status OK
+INSERT INTO t1 (a,b) VALUES (6,'f');
+ALTER TABLE t1 CHECK PARTITION p1 FAST;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t2 (a,b) VALUES (8,'h');
+ALTER TABLE t2 CHECK PARTITION p1 MEDIUM;
+Table Op Msg_type Msg_text
+test.t2 check status OK
+INSERT INTO t1 (a,b) VALUES (9,'i');
+ALTER TABLE t1 CHECK PARTITION ALL EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a,b) VALUES (11,'k');
+ALTER TABLE t1 CHECK PARTITION p0 CHANGED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a,b) VALUES (3,'c');
+INSERT INTO t2 (a,b) VALUES (4,'d');
+CHECK TABLE t1, t2 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+test.t2 check status OK
+INSERT INTO t2 (a,b) VALUES (5,'e');
+CHECK TABLE t2 QUICK;
+Table Op Msg_type Msg_text
+test.t2 check status OK
+INSERT INTO t1 (a,b) VALUES (6,'f');
+CHECK TABLE t1 FAST;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a,b) VALUES (7,'g');
+INSERT INTO t2 (a,b) VALUES (8,'h');
+CHECK TABLE t2, t1 MEDIUM;
+Table Op Msg_type Msg_text
+test.t2 check status OK
+test.t1 check status OK
+INSERT INTO t1 (a,b) VALUES (9,'i');
+INSERT INTO t2 (a,b) VALUES (10,'j');
+CHECK TABLE t1, t2 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+test.t2 check status OK
+INSERT INTO t1 (a,b) VALUES (11,'k');
+CHECK TABLE t1 CHANGED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a) VALUES (1),(2),(5);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (6),(8),(12);
+CHECK TABLE t1 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (13),(15),(16);
+CHECK TABLE t1 QUICK;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (17),(120),(132);
+CHECK TABLE t1 FAST;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (801),(900),(7714);
+CHECK TABLE t1 MEDIUM;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (8760),(10023),(12000);
+CHECK TABLE t1 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 (a) VALUES (13345),(24456),(78302),(143028);
+CHECK TABLE t1 CHANGED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/parts/check_table.test b/mysql-test/suite/storage_engine/parts/check_table.test
new file mode 100644
index 00000000000..9a42620393f
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/check_table.test
@@ -0,0 +1,82 @@
+#
+# CHECK TABLE for partitioned tables and ANALYZE PARTITION
+#
+
+--source include/have_partition.inc
+--source ../have_engine.inc
+
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+--let $partition_options = PARTITION BY HASH(a) PARTITIONS 2
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+
+ let $partition_options = PARTITION BY RANGE(a) (
+ PARTITION p0 VALUES LESS THAN (100),
+ PARTITION p1 VALUES LESS THAN MAXVALUE
+ );
+ --let $table_name = t2
+ --source ../create_table.inc
+
+ INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+
+ let $alter_definition = CHECK PARTITION p0;
+ --source ../alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE .. CHECK PARTITION
+ --source ../unexpected_result.inc
+ }
+
+ INSERT INTO t1 (a,b) VALUES (3,'c');
+
+ let $alter_definition = CHECK PARTITION p0, p1 FOR UPGRADE;
+ --source ../alter_table.inc
+
+ INSERT INTO t2 (a,b) VALUES (10000,'e');
+
+ let $alter_definition = CHECK PARTITION p0 QUICK;
+ let $table_name = t2;
+ --source ../alter_table.inc
+
+ INSERT INTO t1 (a,b) VALUES (6,'f');
+
+ let $alter_definition = CHECK PARTITION p1 FAST;
+ --source ../alter_table.inc
+
+ INSERT INTO t2 (a,b) VALUES (8,'h');
+
+ let $alter_definition = CHECK PARTITION p1 MEDIUM;
+ let $table_name = t2;
+ --source ../alter_table.inc
+
+ INSERT INTO t1 (a,b) VALUES (9,'i');
+
+ let $alter_definition = CHECK PARTITION ALL EXTENDED;
+ --source ../alter_table.inc
+
+ INSERT INTO t1 (a,b) VALUES (11,'k');
+
+ let $alter_definition = CHECK PARTITION p0 CHANGED;
+ --source ../alter_table.inc
+
+ DROP TABLE t1, t2;
+}
+
+let $extra_tbl_opts = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../check_table.inc
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/parts/checksum_table.result b/mysql-test/suite/storage_engine/parts/checksum_table.result
new file mode 100644
index 00000000000..666cb7f25a9
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/checksum_table.result
@@ -0,0 +1,40 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=0 PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=0 PARTITION BY HASH(a) PARTITIONS 2;
+CHECKSUM TABLE t1;
+Table Checksum
+test.t1 4272806499
+CHECKSUM TABLE t2, t1;
+Table Checksum
+test.t2 0
+test.t1 4272806499
+CHECKSUM TABLE t1, t2 QUICK;
+Table Checksum
+test.t1 NULL
+test.t2 NULL
+CHECKSUM TABLE t1, t2 EXTENDED;
+Table Checksum
+test.t1 4272806499
+test.t2 0
+DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=1 PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=1 PARTITION BY HASH(a) PARTITIONS 2;
+CHECKSUM TABLE t1;
+Table Checksum
+test.t1 0
+CHECKSUM TABLE t2, t1;
+Table Checksum
+test.t2 0
+test.t1 0
+CHECKSUM TABLE t1, t2 QUICK;
+Table Checksum
+test.t1 0
+test.t2 0
+CHECKSUM TABLE t1, t2 EXTENDED;
+Table Checksum
+test.t1 4272806499
+test.t2 0
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/parts/checksum_table.test b/mysql-test/suite/storage_engine/parts/checksum_table.test
new file mode 100644
index 00000000000..eff70e3cadf
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/checksum_table.test
@@ -0,0 +1,13 @@
+#
+# CHECKSUM TABLE for partitioned tables
+#
+
+--source include/have_partition.inc
+--source ../have_engine.inc
+
+let $extra_tbl_opts = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../checksum_table.inc
+--source ../checksum_table_live.inc
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/parts/create_table.result b/mysql-test/suite/storage_engine/parts/create_table.result
new file mode 100644
index 00000000000..945ed2312c0
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/create_table.result
@@ -0,0 +1,91 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a) VALUES (1),(2),(3),(2);
+EXPLAIN PARTITIONS SELECT a FROM t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1 # # # # # # #
+EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 # # # # # # #
+DROP TABLE t1;
+CREATE TABLE t1 (a <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY KEY(a) PARTITIONS 2;
+INSERT INTO t1 (a) VALUES ('a'),('b'),('c');
+EXPLAIN PARTITIONS SELECT a FROM t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1 # # # # # # #
+EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 'b';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 # # # # # # #
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY KEY(a) PARTITIONS 2;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # #
+INSERT INTO t1 (a) VALUES (1),(2),(3),(5);
+EXPLAIN PARTITIONS SELECT a FROM t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1 # # # # # # #
+EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a IN (1,3);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 # # # # # # #
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY KEY() PARTITIONS 2;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 a # # NULL NULL # #
+INSERT INTO t1 (a) VALUES (1),(200),(3),(2);
+EXPLAIN PARTITIONS SELECT a FROM t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1 # # # # # # #
+EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 # # # # # # #
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+PARTITION p0 VALUES LESS THAN (10),
+PARTITION p1 VALUES LESS THAN (1000)
+);
+INSERT INTO t1 (a) VALUES (1),(2),(400);
+EXPLAIN PARTITIONS SELECT a FROM t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1 # # # # # # #
+EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 # # # # # # #
+INSERT INTO t1 (a) VALUES (10000);
+ERROR HY000: Table has no partition for value 10000
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) (
+PARTITION abc VALUES IN (1,2,3),
+PARTITION def VALUES IN (100,101,102)
+);
+INSERT INTO t1 (a) VALUES (1),(101),(1);
+EXPLAIN PARTITIONS SELECT a FROM t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 abc,def # # # # # # #
+EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL # # # # # # #
+INSERT INTO t1 (a) VALUES (50);
+ERROR HY000: Table has no partition for value 50
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+PARTITION abc VALUES IN (1,2,3),
+PARTITION def VALUES IN (100,101,102)
+);
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+INSERT INTO t1 (a,b) VALUES (1,1),(101,2),(1,3);
+EXPLAIN PARTITIONS SELECT a FROM t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 abc_abcsp0,def_defsp0 # # # # # # #
+EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL # # # # # # #
+SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, PARTITION_METHOD, SUBPARTITION_METHOD
+FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1';
+TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_METHOD SUBPARTITION_METHOD
+test t1 abc abcsp0 LIST HASH
+test t1 def defsp0 LIST HASH
+SELECT * FROM INFORMATION_SCHEMA.PARTITIONS;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/parts/create_table.test b/mysql-test/suite/storage_engine/parts/create_table.test
new file mode 100644
index 00000000000..69ab51f7281
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/create_table.test
@@ -0,0 +1,179 @@
+#
+# Basic CREATE TABLE .. PARTITION statements
+#
+
+--source include/have_partition.inc
+--source ../have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition = a $int_col;
+let $partition_options = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a) VALUES (1),(2),(3),(2);
+ # We are only interested in partition information
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1;
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2;
+
+ DROP TABLE t1;
+}
+
+let $create_definition = a $char_col;
+let $partition_options = PARTITION BY KEY(a) PARTITIONS 2;
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions or CHAR types
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a) VALUES ('a'),('b'),('c');
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1;
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 'b';
+ DROP TABLE t1;
+}
+
+--let $continue = 1
+--source ../have_default_index.inc
+if ($have_default_index)
+{
+ let $create_definition = a $int_indexed_col, $default_index (a);
+ let $partition_options = PARTITION BY KEY(a) PARTITIONS 2;
+ --source ../create_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions or indexes
+ --source ../unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --source ../mask_engine.inc
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ INSERT INTO t1 (a) VALUES (1),(2),(3),(5);
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1;
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a IN (1,3);
+ DROP TABLE t1;
+ }
+}
+
+let $create_definition = a $int_indexed_col PRIMARY KEY;
+let $partition_options = PARTITION BY KEY() PARTITIONS 2;
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = PK
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a) VALUES (1),(200),(3),(2);
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1;
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2;
+ DROP TABLE t1;
+}
+
+
+let $create_definition = a $int_col;
+let $partition_options = PARTITION BY RANGE(a) (
+ PARTITION p0 VALUES LESS THAN (10),
+ PARTITION p1 VALUES LESS THAN (1000)
+);
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a) VALUES (1),(2),(400);
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1;
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 2;
+
+ --let $error_codes = ER_NO_PARTITION_FOR_GIVEN_VALUE
+ INSERT INTO t1 (a) VALUES (10000);
+ --source ../check_errors.inc
+ DROP TABLE t1;
+
+ let $create_definition = a $int_col;
+ let $partition_options = PARTITION BY LIST(a) (
+ PARTITION abc VALUES IN (1,2,3),
+ PARTITION def VALUES IN (100,101,102)
+ );
+ --source ../create_table.inc
+
+ INSERT INTO t1 (a) VALUES (1),(101),(1);
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1;
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
+ --let $error_codes = ER_NO_PARTITION_FOR_GIVEN_VALUE
+ INSERT INTO t1 (a) VALUES (50);
+ --source ../check_errors.inc
+ DROP TABLE t1;
+}
+
+let $create_definition = a $int_col, b $int_col;
+let partition_options = PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+ PARTITION abc VALUES IN (1,2,3),
+ PARTITION def VALUES IN (100,101,102)
+);
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions or subpartitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a,b) VALUES (1,1),(101,2),(1,3);
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1;
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 #
+ EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
+
+ --sorted_result
+ SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, PARTITION_METHOD, SUBPARTITION_METHOD
+ FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1';
+ # This is just to hit some more handler functions while we are here
+ --disable_result_log
+ SELECT * FROM INFORMATION_SCHEMA.PARTITIONS;
+ --enable_result_log
+
+ DROP TABLE t1;
+}
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/parts/my.cnf b/mysql-test/suite/storage_engine/parts/my.cnf
new file mode 100644
index 00000000000..d61663106b2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/my.cnf
@@ -0,0 +1,9 @@
+!include include/default_my.cnf
+
+[server]
+sql-mode=NO_ENGINE_SUBSTITUTION
+binlog-format=row
+log-bin=master-bin
+partition
+
+
diff --git a/mysql-test/suite/storage_engine/parts/optimize_table.result b/mysql-test/suite/storage_engine/parts/optimize_table.result
new file mode 100644
index 00000000000..da165bc1520
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/optimize_table.result
@@ -0,0 +1,54 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+PARTITION p0 VALUES LESS THAN (100),
+PARTITION p1 VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+ALTER TABLE t1 OPTIMIZE PARTITION p1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+INSERT INTO t2 (a,b) VALUES (4,'d');
+ALTER TABLE t2 OPTIMIZE PARTITION p0 NO_WRITE_TO_BINLOG;
+Table Op Msg_type Msg_text
+test.t2 optimize status OK
+INSERT INTO t1 (a,b) VALUES (6,'f');
+ALTER TABLE t1 OPTIMIZE PARTITION ALL LOCAL;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+INSERT INTO t2 (a,b) VALUES (5,'e');
+ALTER TABLE t2 OPTIMIZE PARTITION p1,p0;
+Table Op Msg_type Msg_text
+test.t2 optimize status OK
+DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+INSERT INTO t2 (a,b) VALUES (4,'d');
+OPTIMIZE NO_WRITE_TO_BINLOG TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 optimize status OK
+INSERT INTO t2 (a,b) VALUES (5,'e');
+INSERT INTO t1 (a,b) VALUES (6,'f');
+OPTIMIZE LOCAL TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+test.t2 optimize status OK
+OPTIMIZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+test.t2 optimize status OK
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(100,'b'),(2,'c'),(3,'d');
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/parts/optimize_table.test b/mysql-test/suite/storage_engine/parts/optimize_table.test
new file mode 100644
index 00000000000..8c136933d60
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/optimize_table.test
@@ -0,0 +1,69 @@
+#
+# OPTIMIZE TABLE with partitions and OPTIMIZE PARTITIONS
+#
+
+--source include/have_partition.inc
+--source ../have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+let $partition_options = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+
+ let $table_name = t2;
+ let $partition_options = PARTITION BY RANGE(a) (
+ PARTITION p0 VALUES LESS THAN (100),
+ PARTITION p1 VALUES LESS THAN MAXVALUE
+ );
+ --source ../create_table.inc
+
+ INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+
+ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+
+ let $alter_definition = OPTIMIZE PARTITION p1;
+ --source ../alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE .. OPTIMIZE PARTITION
+ --source ../unexpected_result.inc
+ }
+
+ INSERT INTO t2 (a,b) VALUES (4,'d');
+
+ let $table_name = t2;
+ let $alter_definition = OPTIMIZE PARTITION p0 NO_WRITE_TO_BINLOG;
+ --source ../alter_table.inc
+
+ INSERT INTO t1 (a,b) VALUES (6,'f');
+
+ let $alter_definition = OPTIMIZE PARTITION ALL LOCAL;
+ --source ../alter_table.inc
+
+ INSERT INTO t2 (a,b) VALUES (5,'e');
+
+ let $table_name = t2;
+ let $alter_definition = OPTIMIZE PARTITION p1,p0;
+ --source ../alter_table.inc
+
+ DROP TABLE t1, t2;
+}
+
+let $extra_tbl_opts = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../optimize_table.inc
+
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/parts/repair_table.result b/mysql-test/suite/storage_engine/parts/repair_table.result
new file mode 100644
index 00000000000..b156df6d7dc
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/repair_table.result
@@ -0,0 +1,236 @@
+call mtr.add_suppression("Table '.*t1.*' is marked as crashed and should be repaired");
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+PARTITION p0 VALUES LESS THAN (100),
+PARTITION p1 VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+ALTER TABLE t1 REPAIR PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+INSERT INTO t1 VALUES (3,'c');
+ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+ALTER TABLE t2 REPAIR PARTITION LOCAL p1;
+Table Op Msg_type Msg_text
+test.t2 repair status OK
+INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ALTER TABLE t1 REPAIR PARTITION LOCAL ALL EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+INSERT INTO t1 VALUES (10,'j');
+ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+INSERT INTO t2 (a,b) VALUES (12,'l');
+ALTER TABLE t2 REPAIR PARTITION NO_WRITE_TO_BINLOG ALL QUICK EXTENDED USE_FRM;
+Table Op Msg_type Msg_text
+test.t2 repair status OK
+DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+INSERT INTO t1 (a,b) VALUES (3,'c');
+INSERT INTO t2 (a,b) VALUES (4,'d');
+REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+test.t2 repair status OK
+INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+REPAIR LOCAL TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 repair status OK
+INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+INSERT INTO t2 (a,b) VALUES (9,'i');
+REPAIR LOCAL TABLE t2, t1 EXTENDED;
+Table Op Msg_type Msg_text
+test.t2 repair status OK
+test.t1 repair status OK
+INSERT INTO t1 (a,b) VALUES (10,'j');
+INSERT INTO t2 (a,b) VALUES (11,'k');
+REPAIR TABLE t1, t2 QUICK USE_FRM;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+test.t2 repair status OK
+INSERT INTO t1 (a,b) VALUES (12,'l');
+INSERT INTO t2 (a,b) VALUES (13,'m');
+REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2 QUICK EXTENDED USE_FRM;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+test.t2 repair status OK
+FLUSH TABLE t1;
+INSERT INTO t1 (a,b) VALUES (14,'n');
+ERROR HY000: Failed to read from the .par file
+# Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+# If you got a difference in error message, just add it to rdiff file
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error Failed to read from the .par file
+test.t1 check Error Incorrect information in file: './test/t1.frm'
+test.t1 check error Corrupt
+SELECT * FROM t1;
+ERROR HY000: Failed to read from the .par file
+# Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+# If you got a difference in error message, just add it to rdiff file
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair Error Failed to read from the .par file
+test.t1 repair Error Incorrect information in file: './test/t1.frm'
+test.t1 repair error Corrupt
+DROP TABLE t1, t2;
+call mtr.add_suppression("Got an error from thread_id=.*");
+call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
+call mtr.add_suppression(" '\..test.t1'");
+call mtr.add_suppression("Couldn't repair table: test.t1");
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+REPAIR TABLE t1 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+INSERT INTO t1 (a,b) VALUES (10,'j');
+REPAIR TABLE t1 USE_FRM;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1.frm
+t1.par
+INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+# Statement ended with one of expected results (0,144).
+# If you got a difference in error message, just add it to rdiff file
+FLUSH TABLE t1;
+Restoring <DATADIR>/test/t1#P#p0.MYD
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check error Size of datafile is: 26 Should be: 39
+test.t1 check error Partition p0 returned error
+test.t1 check error Corrupt
+SELECT * FROM t1;
+a b
+8 h
+10 j
+7 g
+15 o
+Warnings:
+Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired
+Error 1194 Table 't1' is marked as crashed and should be repaired
+Error 1034 Number of rows changed from 3 to 2
+# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+# If you got a difference in error message, just add it to rdiff file
+INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+# Statement ended with one of expected results (0,144).
+# If you got a difference in error message, just add it to rdiff file
+FLUSH TABLE t1;
+Restoring <DATADIR>/test/t1#P#p0.MYI
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check warning Size of datafile is: 39 Should be: 26
+test.t1 check error Record-count is not ok; is 3 Should be: 2
+test.t1 check warning Found 3 key parts. Should be: 2
+test.t1 check error Partition p0 returned error
+test.t1 check error Corrupt
+SELECT * FROM t1;
+a b
+8 h
+10 j
+14 n
+7 g
+15 o
+15 o
+Warnings:
+Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired
+Error 1194 Table 't1' is marked as crashed and should be repaired
+Error 1034 Number of rows changed from 2 to 3
+# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+# If you got a difference in error message, just add it to rdiff file
+INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+# Statement ended with one of expected results (0,144).
+# If you got a difference in error message, just add it to rdiff file
+FLUSH TABLE t1;
+Restoring <DATADIR>/test/t1#P#p1.MYD
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check error Size of datafile is: 39 Should be: 52
+test.t1 check error Partition p1 returned error
+test.t1 check error Corrupt
+SELECT * FROM t1;
+a b
+8 h
+10 j
+14 n
+14 n
+7 g
+15 o
+15 o
+Warnings:
+Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired
+Error 1194 Table 't1' is marked as crashed and should be repaired
+Error 1034 Number of rows changed from 4 to 3
+# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+# If you got a difference in error message, just add it to rdiff file
+INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+# Statement ended with one of expected results (0,144).
+# If you got a difference in error message, just add it to rdiff file
+FLUSH TABLE t1;
+Restoring <DATADIR>/test/t1#P#p1.MYI
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check warning Size of datafile is: 52 Should be: 39
+test.t1 check error Record-count is not ok; is 4 Should be: 3
+test.t1 check warning Found 4 key parts. Should be: 3
+test.t1 check error Partition p1 returned error
+test.t1 check error Corrupt
+SELECT * FROM t1;
+a b
+8 h
+10 j
+14 n
+14 n
+14 n
+7 g
+15 o
+15 o
+15 o
+Warnings:
+Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired
+Error 1194 Table 't1' is marked as crashed and should be repaired
+Error 1034 Number of rows changed from 3 to 4
+# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+# If you got a difference in error message, just add it to rdiff file
+INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+# Statement ended with one of expected results (0,144).
+# If you got a difference in error message, just add it to rdiff file
+FLUSH TABLE t1;
+Restoring <DATADIR>/test/t1.par
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1;
+a b
+8 h
+10 j
+14 n
+14 n
+14 n
+14 n
+7 g
+15 o
+15 o
+15 o
+15 o
+# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/parts/repair_table.test b/mysql-test/suite/storage_engine/parts/repair_table.test
new file mode 100644
index 00000000000..f77b2ef8de4
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/repair_table.test
@@ -0,0 +1,78 @@
+#
+# REPAIR TABLE for partitioned tables and REPAIR PARTITION
+#
+
+--source include/have_partition.inc
+--source ../have_engine.inc
+
+call mtr.add_suppression("Table '.*t1.*' is marked as crashed and should be repaired");
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+let $partition_options = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+
+ let $table_name = t2;
+ let $partition_options = PARTITION BY RANGE(a) (
+ PARTITION p0 VALUES LESS THAN (100),
+ PARTITION p1 VALUES LESS THAN MAXVALUE
+ );
+ --source ../create_table.inc
+
+ INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+
+ let $alter_definition = REPAIR PARTITION p0;
+ --source ../alter_table.inc
+
+ INSERT INTO t1 VALUES (3,'c');
+
+ let $alter_definition = REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1;
+ --source ../alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source ../unexpected_result.inc
+ }
+
+ INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+
+ let $table_name = t2;
+ let $alter_definition = REPAIR PARTITION LOCAL p1;
+ --source ../alter_table.inc
+
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+
+ let $alter_definition = REPAIR PARTITION LOCAL ALL EXTENDED;
+ --source ../alter_table.inc
+
+ INSERT INTO t1 VALUES (10,'j');
+
+ let $alter_definition = REPAIR PARTITION p1 QUICK USE_FRM;
+ --source ../alter_table.inc
+
+ INSERT INTO t2 (a,b) VALUES (12,'l');
+
+ let $table_name = t2;
+ let $alter_definition = REPAIR PARTITION NO_WRITE_TO_BINLOG ALL QUICK EXTENDED USE_FRM;
+ --source ../alter_table.inc
+
+ DROP TABLE t1, t2;
+}
+
+let $extra_tbl_opts = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../repair_table.inc
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/parts/truncate_table.result b/mysql-test/suite/storage_engine/parts/truncate_table.result
new file mode 100644
index 00000000000..e46f4c97de5
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/truncate_table.result
@@ -0,0 +1,68 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+TRUNCATE TABLE t1;
+INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN> KEY AUTO_INCREMENT, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `c` char(8) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (a)
+PARTITIONS 2 */
+INSERT INTO t1 (c) VALUES ('a'),('b'),('c');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `c` char(8) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (a)
+PARTITIONS 2 */
+TRUNCATE TABLE t1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `c` char(8) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (a)
+PARTITIONS 2 */
+INSERT INTO t1 (c) VALUES ('d');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `c` char(8) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (a)
+PARTITIONS 2 */
+SELECT * FROM t1;
+a c
+1 d
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+ALTER TABLE t1 TRUNCATE PARTITION p0;
+SELECT * FROM t1;
+a b
+1 a
+101 g
+3 c
+EXPLAIN PARTITIONS SELECT * FROM t1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1 # # # # # #
+INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
+ALTER TABLE t1 TRUNCATE PARTITION ALL;
+SELECT * FROM t1;
+a b
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/parts/truncate_table.test b/mysql-test/suite/storage_engine/parts/truncate_table.test
new file mode 100644
index 00000000000..20f316d5297
--- /dev/null
+++ b/mysql-test/suite/storage_engine/parts/truncate_table.test
@@ -0,0 +1,111 @@
+#
+# TRUNCATE TABLE with partitions and TRUNCATE PARTITION
+#
+
+--source include/have_partition.inc
+--source ../have_engine.inc
+
+# A part of the standard TRUNCATE test
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+
+# Truncate partitioned table
+
+let $partition_options = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ TRUNCATE TABLE t1;
+ if ($mysql_errname)
+ {
+ --let $functionality = TRUNCATE TABLE
+ --source ../unexpected_result.inc
+ }
+
+ INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
+ TRUNCATE TABLE t1;
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+}
+
+
+# Truncate resets auto-increment value on the table
+
+let $create_definition = a $int_indexed_col KEY AUTO_INCREMENT, c $char_col;
+let $partition_options = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../create_table.inc
+
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions or PK or auto-increment
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --source ../mask_engine.inc
+ SHOW CREATE TABLE t1;
+ INSERT INTO t1 (c) VALUES ('a'),('b'),('c');
+ --source ../mask_engine.inc
+ SHOW CREATE TABLE t1;
+ TRUNCATE TABLE t1;
+ --source ../mask_engine.inc
+ SHOW CREATE TABLE t1;
+ INSERT INTO t1 (c) VALUES ('d');
+ --source ../mask_engine.inc
+ SHOW CREATE TABLE t1;
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+
+# Truncate partitions
+
+let $partition_options = PARTITION BY HASH(a) PARTITIONS 2;
+--source ../create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Partitions
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+
+ let $alter_definition = TRUNCATE PARTITION p0;
+ --source ../alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source ../unexpected_result.inc
+ }
+
+ --sorted_result
+ SELECT * FROM t1;
+ --replace_column 5 # 6 # 7 # 8 # 9 # 10 #
+ EXPLAIN PARTITIONS SELECT * FROM t1;
+
+ INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
+
+ let $alter_definition = TRUNCATE PARTITION ALL;
+ --source ../alter_table.inc
+
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+}
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/repair_table.inc b/mysql-test/suite/storage_engine/repair_table.inc
new file mode 100644
index 00000000000..83d2f02e20a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/repair_table.inc
@@ -0,0 +1,155 @@
+#
+# REPAIR TABLE statements
+#
+# Note: the output is likely to be different for the engine under test,
+# in which case rdiff will be needed. Or, the output might say that
+# the storage engine does not support REPAIR.
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+--let $table_name = t2
+--source create_table.inc
+
+REPAIR TABLE t1;
+if ($mysql_errname)
+{
+ --source unexpected_result.inc
+}
+INSERT INTO t1 (a,b) VALUES (3,'c');
+INSERT INTO t2 (a,b) VALUES (4,'d');
+REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2;
+INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+REPAIR LOCAL TABLE t2;
+INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+INSERT INTO t2 (a,b) VALUES (9,'i');
+REPAIR LOCAL TABLE t2, t1 EXTENDED;
+INSERT INTO t1 (a,b) VALUES (10,'j');
+INSERT INTO t2 (a,b) VALUES (11,'k');
+REPAIR TABLE t1, t2 QUICK USE_FRM;
+INSERT INTO t1 (a,b) VALUES (12,'l');
+INSERT INTO t2 (a,b) VALUES (13,'m');
+REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2 QUICK EXTENDED USE_FRM;
+FLUSH TABLE t1;
+
+let my_datadir = `SELECT @@datadir`;
+
+# Now we'll override all table files except for frm.
+# Some engines are more enduring to table files corruption
+# than others, so the result of the following INSERT and REPAIR
+# will be different for different engines
+
+--perl
+@files = glob "$ENV{my_datadir}/test/t1.*";
+foreach (@files)
+{
+ next if /.frm$/;
+ rename($_,"$_.save");
+ open(FILE,">$_") || print "Could not open $_\n" && exit;
+ print FILE "";
+ close(FILE);
+}
+EOF
+
+# We don't worry so much about the INSERT or SELECT result,
+# it's REPAIR that we are after.
+# The preceding INSERT, however, helps to trigger
+# a bit more internals
+--let $error_codes = 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY
+INSERT INTO t1 (a,b) VALUES (14,'n');
+--source check_errors.inc
+CHECK TABLE t1;
+--let $error_codes = 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY
+SELECT * FROM t1;
+--source check_errors.inc
+--enable_warnings
+REPAIR TABLE t1;
+
+--perl
+@files = glob "$ENV{my_datadir}/test/t1.*.save";
+foreach (@files)
+{
+ $nm = $_;
+ $nm =~ s/\.save$//;
+ rename($_,$nm);
+}
+EOF
+
+DROP TABLE t1, t2;
+
+--let $continue = 1
+--source have_default_index.inc
+
+if ($have_default_index)
+{
+ call mtr.add_suppression("Got an error from thread_id=.*");
+ call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
+ call mtr.add_suppression(" '\..test.t1'");
+ call mtr.add_suppression("Couldn't repair table: test.t1");
+
+ --let $create_definition = a $int_indexed_col, b $char_col, $default_index (a)
+ --source create_table.inc
+ REPAIR TABLE t1;
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ REPAIR TABLE t1 EXTENDED;
+ INSERT INTO t1 (a,b) VALUES (10,'j');
+ REPAIR TABLE t1 USE_FRM;
+
+ # We will take files one by one (except for frm file),
+ # save the file, update the table, then restore the file
+ # and check the table.
+ # Results here can be very different depending on the engine.
+
+ let $my_errno = 0;
+
+ --list_files $my_datadir/test
+
+ while (!$my_errno)
+ {
+ --error 0,1
+ --perl
+ use File::Copy;
+ @files = glob "$ENV{my_datadir}/test/t1*";
+ foreach (@files)
+ {
+ next if /.(?:frm|save|done)$/;
+ next if -e "$_.done";
+ copy($_,"$_.save");
+ exit 0;
+ }
+ # No more files
+ exit 1;
+ EOF
+ let $my_errno = $errno;
+ if (!$my_errno)
+ {
+ --let $error_codes = 0,144
+ INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+ --source check_errors.inc
+ FLUSH TABLE t1;
+ --replace_result $my_datadir <DATADIR>
+ --perl
+ use File::Copy;
+ @files = glob "$ENV{my_datadir}/test/t1*.save";
+ $nm = $files[0];
+ $nm =~ s/\.save$//;
+ print "Restoring $nm\n";
+ copy($files[0],"$nm.done");
+ rename($files[0],$nm);
+ EOF
+ CHECK TABLE t1;
+ --let $error_codes = 0,ER_NOT_KEYFILE,144
+ SELECT * FROM t1;
+ --source check_errors.inc
+ }
+ }
+ DROP TABLE t1;
+}
+
+--remove_files_wildcard $my_datadir/test t1*
+
+
diff --git a/mysql-test/suite/storage_engine/repair_table.result b/mysql-test/suite/storage_engine/repair_table.result
new file mode 100644
index 00000000000..f1af943fd7b
--- /dev/null
+++ b/mysql-test/suite/storage_engine/repair_table.result
@@ -0,0 +1,106 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+INSERT INTO t1 (a,b) VALUES (3,'c');
+INSERT INTO t2 (a,b) VALUES (4,'d');
+REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+test.t2 repair status OK
+INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+REPAIR LOCAL TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 repair status OK
+INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+INSERT INTO t2 (a,b) VALUES (9,'i');
+REPAIR LOCAL TABLE t2, t1 EXTENDED;
+Table Op Msg_type Msg_text
+test.t2 repair status OK
+test.t1 repair status OK
+INSERT INTO t1 (a,b) VALUES (10,'j');
+INSERT INTO t2 (a,b) VALUES (11,'k');
+REPAIR TABLE t1, t2 QUICK USE_FRM;
+Table Op Msg_type Msg_text
+test.t1 repair warning Number of rows changed from 0 to 6
+test.t1 repair status OK
+test.t2 repair warning Number of rows changed from 0 to 5
+test.t2 repair status OK
+INSERT INTO t1 (a,b) VALUES (12,'l');
+INSERT INTO t2 (a,b) VALUES (13,'m');
+REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2 QUICK EXTENDED USE_FRM;
+Table Op Msg_type Msg_text
+test.t1 repair warning Number of rows changed from 0 to 7
+test.t1 repair status OK
+test.t2 repair warning Number of rows changed from 0 to 6
+test.t2 repair status OK
+FLUSH TABLE t1;
+INSERT INTO t1 (a,b) VALUES (14,'n');
+ERROR HY000: Incorrect file format 't1'
+# Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+# If you got a difference in error message, just add it to rdiff file
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error Incorrect file format 't1'
+test.t1 check error Corrupt
+SELECT * FROM t1;
+ERROR HY000: Incorrect file format 't1'
+# Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+# If you got a difference in error message, just add it to rdiff file
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair Error Incorrect file format 't1'
+test.t1 repair error Corrupt
+DROP TABLE t1, t2;
+call mtr.add_suppression("Got an error from thread_id=.*");
+call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
+call mtr.add_suppression(" '\..test.t1'");
+call mtr.add_suppression("Couldn't repair table: test.t1");
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+REPAIR TABLE t1 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+INSERT INTO t1 (a,b) VALUES (10,'j');
+REPAIR TABLE t1 USE_FRM;
+Table Op Msg_type Msg_text
+test.t1 repair warning Number of rows changed from 0 to 3
+test.t1 repair status OK
+t1.MYD
+t1.MYI
+t1.frm
+INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+# Statement ended with one of expected results (0,144).
+# If you got a difference in error message, just add it to rdiff file
+FLUSH TABLE t1;
+Restoring <DATADIR>/test/t1.MYD
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check error Size of datafile is: 39 Should be: 65
+test.t1 check error Corrupt
+SELECT * FROM t1;
+ERROR HY000: Incorrect key file for table 't1'; try to repair it
+# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+# If you got a difference in error message, just add it to rdiff file
+INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
+# Statement ended with one of expected results (0,144).
+# If you got a difference in error message, just add it to rdiff file
+FLUSH TABLE t1;
+Restoring <DATADIR>/test/t1.MYI
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check warning Table is marked as crashed and last repair failed
+test.t1 check error Size of datafile is: 39 Should be: 65
+test.t1 check error Corrupt
+SELECT * FROM t1;
+ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
+# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/repair_table.test b/mysql-test/suite/storage_engine/repair_table.test
new file mode 100644
index 00000000000..5e3068b0970
--- /dev/null
+++ b/mysql-test/suite/storage_engine/repair_table.test
@@ -0,0 +1,14 @@
+#
+# REPAIR TABLE statements
+#
+# Note: the output is likely to be different for the engine under test,
+# in which case rdiff will be needed. Or, the output might say that
+# the storage engine does not support REPAIR.
+#
+
+--source have_engine.inc
+
+--source repair_table.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/replace.result b/mysql-test/suite/storage_engine/replace.result
new file mode 100644
index 00000000000..c8fbca8f534
--- /dev/null
+++ b/mysql-test/suite/storage_engine/replace.result
@@ -0,0 +1,47 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+SELECT * FROM t1;
+a b
+1 a
+2 b
+3 c
+4 d
+5 e
+REPLACE t1 (a,b) VALUE (10,'foo'),(10,'foo');
+SELECT * FROM t1;
+a b
+1 a
+10 foo
+10 foo
+2 b
+3 c
+4 d
+5 e
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, UNIQUE INDEX (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
+INSERT INTO t1 (a,b) VALUES (2,'d');
+ERROR 23000: Duplicate entry '2' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+REPLACE INTO t1 (a,b) VALUES (2,'d');
+SELECT * FROM t1;
+a b
+1 a
+2 d
+3 c
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, PRIMARY KEY (b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
+INSERT INTO t1 (a,b) VALUES (4,'b');
+ERROR 23000: Duplicate entry 'b' for key 'PRIMARY'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+REPLACE INTO t1 (a,b) VALUES (4,'b');
+SELECT * FROM t1;
+a b
+1 a
+3 c
+4 b
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/replace.test b/mysql-test/suite/storage_engine/replace.test
new file mode 100644
index 00000000000..368ed62a300
--- /dev/null
+++ b/mysql-test/suite/storage_engine/replace.test
@@ -0,0 +1,67 @@
+#
+# Basic REPLACE statements
+#
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--source create_table.inc
+
+# When there is no duplicate key, REPLACE should work as INSERT
+
+REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+--sorted_result
+SELECT * FROM t1;
+
+REPLACE t1 (a,b) VALUE (10,'foo'),(10,'foo');
+--sorted_result
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--let $create_definition = a $int_indexed_col, b $char_col, UNIQUE INDEX (a)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (2,'d');
+ --source check_errors.inc
+ REPLACE INTO t1 (a,b) VALUES (2,'d');
+ --sorted_result
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+}
+
+--let $create_definition = a $int_col, b $char_indexed_col, PRIMARY KEY (b)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Primary keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b) VALUES (4,'b');
+ --source check_errors.inc
+ REPLACE INTO t1 (a,b) VALUES (4,'b');
+ --sorted_result
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/se-innodb.out b/mysql-test/suite/storage_engine/se-innodb.out
new file mode 100644
index 00000000000..406e5066132
--- /dev/null
+++ b/mysql-test/suite/storage_engine/se-innodb.out
@@ -0,0 +1 @@
+Can't open perl script "./mtr": No such file or directory
diff --git a/mysql-test/suite/storage_engine/select.result b/mysql-test/suite/storage_engine/select.result
new file mode 100644
index 00000000000..d2331f4d869
--- /dev/null
+++ b/mysql-test/suite/storage_engine/select.result
@@ -0,0 +1,390 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (100,'foobar'),(1,'z'),(200,'bar');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+INSERT INTO t1 (a,b) SELECT a, b FROM t2;
+SELECT * FROM t1;
+a b
+1 z
+1 z
+100 foobar
+100 foobar
+200 bar
+200 bar
+SELECT DISTINCT a FROM t1;
+a
+1
+100
+200
+SELECT ALL b, a FROM t1;
+b a
+bar 200
+bar 200
+foobar 100
+foobar 100
+z 1
+z 1
+SELECT STRAIGHT_JOIN SQL_CACHE t1.* FROM t2, t1 WHERE t1.a <> t2.a;
+a b
+1 z
+1 z
+1 z
+1 z
+100 foobar
+100 foobar
+100 foobar
+100 foobar
+200 bar
+200 bar
+200 bar
+200 bar
+SELECT SQL_SMALL_RESULT SQL_NO_CACHE t1.a FROM t1, t2;
+a
+1
+1
+1
+1
+1
+1
+100
+100
+100
+100
+100
+100
+200
+200
+200
+200
+200
+200
+SELECT SQL_BIG_RESULT SQL_CALC_FOUND_ROWS DISTINCT(t2.a)
+FROM t1 t1_1, t2, t1 t1_2;
+a
+1
+100
+200
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+3
+SET GLOBAL query_cache_size = 1024*1024;
+SELECT SQL_CACHE * FROM t1, t2;
+a b a b
+1 z 1 z
+1 z 1 z
+1 z 100 foobar
+1 z 100 foobar
+1 z 200 bar
+1 z 200 bar
+100 foobar 1 z
+100 foobar 1 z
+100 foobar 100 foobar
+100 foobar 100 foobar
+100 foobar 200 bar
+100 foobar 200 bar
+200 bar 1 z
+200 bar 1 z
+200 bar 100 foobar
+200 bar 100 foobar
+200 bar 200 bar
+200 bar 200 bar
+SET GLOBAL query_cache_size = 0;
+SELECT a+10 AS field1, CONCAT(b,':',b) AS field2 FROM t1
+WHERE b > 'b' AND a IS NOT NULL
+GROUP BY 2 DESC, field1 ASC
+HAVING field1 < 1000
+ORDER BY field2, 1 DESC, field1*2
+LIMIT 5 OFFSET 1 ROWS EXAMINED 100000;
+field1 field2
+11 z:z
+110 foobar:foobar
+SELECT SUM(a), MAX(a), b FROM t1 GROUP BY b WITH ROLLUP;
+SUM(a) MAX(a) b
+2 1 z
+200 100 foobar
+400 200 bar
+602 200 NULL
+SELECT * FROM t2 WHERE a>0 PROCEDURE ANALYSE();
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+test.t2.a 1 200 1 3 0 0 100.3333 81.2418 ENUM('1','100','200') NOT NULL
+test.t2.b bar z 1 6 0 0 3.3333 NULL ENUM('bar','foobar','z') NOT NULL
+SELECT t1.a, t2.b FROM t2, t1 WHERE t1.a = t2.a ORDER BY t2.b, t1.a
+INTO OUTFILE '<DATADIR>/select.out'
+CHARACTER SET utf8
+FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '''';
+200,'bar'
+200,'bar'
+100,'foobar'
+100,'foobar'
+1,'z'
+1,'z'
+SELECT t1.a, t2.b FROM t2, t1 WHERE t1.a = t2.a ORDER BY t2.b, t1.a
+INTO DUMPFILE '<DATADIR>/select.dump';
+ERROR 42000: Result consisted of more than one row
+SELECT t1.*, t2.* FROM t1, t2 ORDER BY t2.b, t1.a, t2.a, t1.b LIMIT 1
+INTO DUMPFILE '<DATADIR>/select.dump';
+1z200bar
+SELECT MIN(a), MAX(a) FROM t1 INTO @min, @max;
+SELECT @min, @max;
+@min @max
+1 200
+SELECT t1_1.*, t2.* FROM t2, t1 AS t1_1, t1 AS t1_2
+WHERE t1_1.a = t1_2.a AND t2.a = t1_1.a;
+a b a b
+1 z 1 z
+1 z 1 z
+1 z 1 z
+1 z 1 z
+100 foobar 100 foobar
+100 foobar 100 foobar
+100 foobar 100 foobar
+100 foobar 100 foobar
+200 bar 200 bar
+200 bar 200 bar
+200 bar 200 bar
+200 bar 200 bar
+SELECT alias1.* FROM ( SELECT * FROM t1 ) alias1, t2 WHERE t2.a IN (100,200);
+a b
+1 z
+1 z
+1 z
+1 z
+100 foobar
+100 foobar
+100 foobar
+100 foobar
+200 bar
+200 bar
+200 bar
+200 bar
+SELECT t1.a FROM { OJ t1 LEFT OUTER JOIN t2 ON t1.a = t2.a+10 };
+a
+1
+1
+100
+100
+200
+200
+SELECT t1.* FROM t2 INNER JOIN t1;
+a b
+1 z
+1 z
+1 z
+1 z
+1 z
+1 z
+100 foobar
+100 foobar
+100 foobar
+100 foobar
+100 foobar
+100 foobar
+200 bar
+200 bar
+200 bar
+200 bar
+200 bar
+200 bar
+SELECT t1_2.* FROM t1 t1_1 CROSS JOIN t1 t1_2 ON t1_1.b = t1_2.b;
+a b
+1 z
+1 z
+1 z
+1 z
+100 foobar
+100 foobar
+100 foobar
+100 foobar
+200 bar
+200 bar
+200 bar
+200 bar
+SELECT t1.a, t2.b FROM t2 STRAIGHT_JOIN t1 WHERE t1.b > t2.b;
+a b
+1 bar
+1 bar
+1 foobar
+1 foobar
+100 bar
+100 bar
+SELECT t1.a, t2.b FROM t2 STRAIGHT_JOIN t1 ON t1.b > t2.b ORDER BY t1.a, t2.b;
+a b
+1 bar
+1 bar
+1 foobar
+1 foobar
+100 bar
+100 bar
+SELECT t2.* FROM t1 LEFT JOIN t2 USING (a) ORDER BY t2.a, t2.b LIMIT 1;
+a b
+1 z
+SELECT t2.* FROM t2 LEFT OUTER JOIN t1 ON t1.a = t2.a WHERE t1.a IS NOT NULL;
+a b
+1 z
+1 z
+100 foobar
+100 foobar
+200 bar
+200 bar
+SELECT SUM(t2.a) FROM t1 RIGHT JOIN t2 ON t2.b = t1.b;
+SUM(t2.a)
+602
+SELECT MIN(t2.a) FROM t1 RIGHT OUTER JOIN t2 USING (b,a);
+MIN(t2.a)
+1
+SELECT alias.b FROM t1 NATURAL JOIN ( SELECT * FROM t1 ) alias WHERE b > '';
+b
+bar
+bar
+bar
+bar
+foobar
+foobar
+foobar
+foobar
+z
+z
+z
+z
+SELECT t2.b FROM ( SELECT * FROM t1 ) alias NATURAL LEFT JOIN t2 WHERE b IS NOT NULL;
+b
+bar
+bar
+foobar
+foobar
+z
+z
+SELECT t1.*, t2.* FROM t1 NATURAL LEFT OUTER JOIN t2;
+a b a b
+1 z 1 z
+1 z 1 z
+100 foobar 100 foobar
+100 foobar 100 foobar
+200 bar 200 bar
+200 bar 200 bar
+SELECT t2_2.* FROM t2 t2_1 NATURAL RIGHT JOIN t2 t2_2 WHERE t2_1.a IN ( SELECT a FROM t1 );
+a b
+1 z
+100 foobar
+200 bar
+SELECT t1_2.b FROM t1 t1_1 NATURAL RIGHT OUTER JOIN t1 t1_2 INNER JOIN t2;
+b
+bar
+bar
+bar
+bar
+bar
+bar
+bar
+bar
+bar
+bar
+bar
+bar
+foobar
+foobar
+foobar
+foobar
+foobar
+foobar
+foobar
+foobar
+foobar
+foobar
+foobar
+foobar
+z
+z
+z
+z
+z
+z
+z
+z
+z
+z
+z
+z
+SELECT ( SELECT MIN(a) FROM ( SELECT * FROM t1 ) alias1 ) AS min_a FROM t2;
+min_a
+1
+1
+1
+SELECT * FROM t2 WHERE a = ( SELECT MIN(a) FROM t1 );
+a b
+1 z
+SELECT * FROM t2 WHERE b LIKE ( SELECT b FROM t1 ORDER BY b LIMIT 1 );
+a b
+200 bar
+SELECT t2.* FROM t1 t1_outer, t2 WHERE ( t1_outer.a, t2.b ) IN ( SELECT a, b FROM t2 WHERE a = t1_outer.a );
+a b
+1 z
+1 z
+100 foobar
+100 foobar
+200 bar
+200 bar
+SELECT * FROM t2 WHERE b = ANY ( SELECT b FROM t1 WHERE a > 1 );
+a b
+100 foobar
+200 bar
+SELECT * FROM t2 WHERE b > ALL ( SELECT b FROM t1 WHERE b < 'foo' );
+a b
+1 z
+100 foobar
+SELECT * FROM t1 WHERE ROW(a, b) = ( SELECT a, b FROM t2 ORDER BY a, b LIMIT 1 );
+a b
+1 z
+1 z
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE t2.b > t1.b );
+a b
+100 foobar
+100 foobar
+200 bar
+200 bar
+SELECT t1.* FROM t1, t2 ORDER BY ( SELECT b FROM t1 WHERE a IS NULL ORDER BY b LIMIT 1 ) DESC;
+a b
+1 z
+1 z
+1 z
+1 z
+1 z
+1 z
+100 foobar
+100 foobar
+100 foobar
+100 foobar
+100 foobar
+100 foobar
+200 bar
+200 bar
+200 bar
+200 bar
+200 bar
+200 bar
+SELECT a, b FROM t1 HAVING a IN ( SELECT a FROM t2 WHERE b = t1.b );
+a b
+1 z
+1 z
+100 foobar
+100 foobar
+200 bar
+200 bar
+SELECT * FROM t1 UNION SELECT * FROM t2 UNION DISTINCT SELECT * FROM t1;
+a b
+1 z
+100 foobar
+200 bar
+SELECT * FROM t1 UNION SELECT * FROM t2 UNION ALL SELECT * FROM t1;
+a b
+1 z
+1 z
+1 z
+100 foobar
+100 foobar
+100 foobar
+200 bar
+200 bar
+200 bar
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/select.test b/mysql-test/suite/storage_engine/select.test
new file mode 100644
index 00000000000..528fa64cfb2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/select.test
@@ -0,0 +1,210 @@
+#
+# Basic SELECT statements
+#
+# HIGH_PRIORITY is covered in select_high_prio test
+# FOR UPDATE - in trx/select_for_update test
+# LOCK IN SHARE MODE - in trx/select_lock_in_share_mode test
+# index hints - in type_*_indexes tests
+#
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (100,'foobar'),(1,'z'),(200,'bar');
+
+--let $table_name = t2
+--source create_table.inc
+INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+INSERT INTO t1 (a,b) SELECT a, b FROM t2;
+
+--sorted_result
+SELECT * FROM t1;
+
+# Modifiers
+
+--sorted_result
+SELECT DISTINCT a FROM t1;
+
+--sorted_result
+SELECT ALL b, a FROM t1;
+
+# Optimizer and cache directives should not have any visible effect here,
+# but we will add them for completness
+
+--sorted_result
+SELECT STRAIGHT_JOIN SQL_CACHE t1.* FROM t2, t1 WHERE t1.a <> t2.a;
+
+--sorted_result
+SELECT SQL_SMALL_RESULT SQL_NO_CACHE t1.a FROM t1, t2;
+
+--sorted_result
+SELECT SQL_BIG_RESULT SQL_CALC_FOUND_ROWS DISTINCT(t2.a)
+ FROM t1 t1_1, t2, t1 t1_2;
+SELECT FOUND_ROWS();
+
+let $query_cache = `SELECT @@query_cache_size`;
+SET GLOBAL query_cache_size = 1024*1024;
+--sorted_result
+SELECT SQL_CACHE * FROM t1, t2;
+eval SET GLOBAL query_cache_size = $query_cache;
+
+# Combination of main clauses
+
+--sorted_result
+SELECT a+10 AS field1, CONCAT(b,':',b) AS field2 FROM t1
+WHERE b > 'b' AND a IS NOT NULL
+GROUP BY 2 DESC, field1 ASC
+HAVING field1 < 1000
+ORDER BY field2, 1 DESC, field1*2
+LIMIT 5 OFFSET 1 ROWS EXAMINED 100000;
+
+# ROLLUP
+--sorted_result
+SELECT SUM(a), MAX(a), b FROM t1 GROUP BY b WITH ROLLUP;
+
+# Procedure
+
+--sorted_result
+SELECT * FROM t2 WHERE a>0 PROCEDURE ANALYSE();
+
+# SELECT INTO
+let $datadir = `SELECT @@datadir`;
+
+--replace_result $datadir <DATADIR>
+eval
+SELECT t1.a, t2.b FROM t2, t1 WHERE t1.a = t2.a ORDER BY t2.b, t1.a
+ INTO OUTFILE '$datadir/select.out'
+ CHARACTER SET utf8
+ FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '''';
+--cat_file $datadir/select.out
+--remove_file $datadir/select.out
+
+--replace_result $datadir <DATADIR>
+--let $error_codes = ER_TOO_MANY_ROWS
+eval
+SELECT t1.a, t2.b FROM t2, t1 WHERE t1.a = t2.a ORDER BY t2.b, t1.a
+ INTO DUMPFILE '$datadir/select.dump';
+--source check_errors.inc
+--remove_file $datadir/select.dump
+--replace_result $datadir <DATADIR>
+eval
+SELECT t1.*, t2.* FROM t1, t2 ORDER BY t2.b, t1.a, t2.a, t1.b LIMIT 1
+ INTO DUMPFILE '$datadir/select.dump';
+
+--cat_file $datadir/select.dump
+--echo
+--remove_file $datadir/select.dump
+
+SELECT MIN(a), MAX(a) FROM t1 INTO @min, @max;
+SELECT @min, @max;
+
+# Joins
+
+--sorted_result
+SELECT t1_1.*, t2.* FROM t2, t1 AS t1_1, t1 AS t1_2
+ WHERE t1_1.a = t1_2.a AND t2.a = t1_1.a;
+
+--sorted_result
+SELECT alias1.* FROM ( SELECT * FROM t1 ) alias1, t2 WHERE t2.a IN (100,200);
+
+--sorted_result
+SELECT t1.a FROM { OJ t1 LEFT OUTER JOIN t2 ON t1.a = t2.a+10 };
+
+--sorted_result
+SELECT t1.* FROM t2 INNER JOIN t1;
+
+--sorted_result
+SELECT t1_2.* FROM t1 t1_1 CROSS JOIN t1 t1_2 ON t1_1.b = t1_2.b;
+
+--sorted_result
+SELECT t1.a, t2.b FROM t2 STRAIGHT_JOIN t1 WHERE t1.b > t2.b;
+
+SELECT t1.a, t2.b FROM t2 STRAIGHT_JOIN t1 ON t1.b > t2.b ORDER BY t1.a, t2.b;
+
+SELECT t2.* FROM t1 LEFT JOIN t2 USING (a) ORDER BY t2.a, t2.b LIMIT 1;
+
+--sorted_result
+SELECT t2.* FROM t2 LEFT OUTER JOIN t1 ON t1.a = t2.a WHERE t1.a IS NOT NULL;
+
+SELECT SUM(t2.a) FROM t1 RIGHT JOIN t2 ON t2.b = t1.b;
+
+SELECT MIN(t2.a) FROM t1 RIGHT OUTER JOIN t2 USING (b,a);
+
+--sorted_result
+SELECT alias.b FROM t1 NATURAL JOIN ( SELECT * FROM t1 ) alias WHERE b > '';
+
+--sorted_result
+SELECT t2.b FROM ( SELECT * FROM t1 ) alias NATURAL LEFT JOIN t2 WHERE b IS NOT NULL;
+
+--sorted_result
+SELECT t1.*, t2.* FROM t1 NATURAL LEFT OUTER JOIN t2;
+
+--sorted_result
+SELECT t2_2.* FROM t2 t2_1 NATURAL RIGHT JOIN t2 t2_2 WHERE t2_1.a IN ( SELECT a FROM t1 );
+
+--sorted_result
+SELECT t1_2.b FROM t1 t1_1 NATURAL RIGHT OUTER JOIN t1 t1_2 INNER JOIN t2;
+
+# Subquery as scalar operand, subquery in the FROM clause
+
+--sorted_result
+SELECT ( SELECT MIN(a) FROM ( SELECT * FROM t1 ) alias1 ) AS min_a FROM t2;
+
+# Comparison using subqueries
+
+--sorted_result
+SELECT * FROM t2 WHERE a = ( SELECT MIN(a) FROM t1 );
+
+--sorted_result
+SELECT * FROM t2 WHERE b LIKE ( SELECT b FROM t1 ORDER BY b LIMIT 1 );
+
+# Subquery with IN, correlated subquery
+
+--sorted_result
+SELECT t2.* FROM t1 t1_outer, t2 WHERE ( t1_outer.a, t2.b ) IN ( SELECT a, b FROM t2 WHERE a = t1_outer.a );
+
+# Subquery with ANY, ALL
+
+--sorted_result
+SELECT * FROM t2 WHERE b = ANY ( SELECT b FROM t1 WHERE a > 1 );
+
+--sorted_result
+SELECT * FROM t2 WHERE b > ALL ( SELECT b FROM t1 WHERE b < 'foo' );
+
+# Row subqueries
+
+--sorted_result
+SELECT * FROM t1 WHERE ROW(a, b) = ( SELECT a, b FROM t2 ORDER BY a, b LIMIT 1 );
+
+# Subquery with EXISTS
+
+--sorted_result
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE t2.b > t1.b );
+
+# Subquery in ORDER BY
+
+--sorted_result
+SELECT t1.* FROM t1, t2 ORDER BY ( SELECT b FROM t1 WHERE a IS NULL ORDER BY b LIMIT 1 ) DESC;
+
+# Subquery in HAVING
+
+--sorted_result
+SELECT a, b FROM t1 HAVING a IN ( SELECT a FROM t2 WHERE b = t1.b );
+
+# Union
+
+--sorted_result
+SELECT * FROM t1 UNION SELECT * FROM t2 UNION DISTINCT SELECT * FROM t1;
+
+--sorted_result
+SELECT * FROM t1 UNION SELECT * FROM t2 UNION ALL SELECT * FROM t1;
+
+
+# Cleanup
+DROP TABLE t1, t2;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/select_high_prio.result b/mysql-test/suite/storage_engine/select_high_prio.result
new file mode 100644
index 00000000000..b3b70df3731
--- /dev/null
+++ b/mysql-test/suite/storage_engine/select_high_prio.result
@@ -0,0 +1,45 @@
+DROP TABLE IF EXISTS t1;
+connect con0,localhost,root,,;
+SET lock_wait_timeout = 4;
+connect con1,localhost,root,,;
+SET lock_wait_timeout = 4;
+connect con2,localhost,root,,;
+SET lock_wait_timeout = 4;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+connection con1;
+LOCK TABLE t1 READ;
+connection con0;
+UPDATE t1 SET b = CONCAT(b,b);
+connection con2;
+SELECT * FROM t1;
+connection con1;
+UNLOCK TABLES;
+connection con0;
+connection con2;
+# Should return the new data
+a b
+1 ff
+2 bb
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+connection con1;
+LOCK TABLE t1 READ;
+connection con0;
+UPDATE t1 SET b = CONCAT(b,b,b);
+connection con2;
+SET lock_wait_timeout = 1;
+# Should return old data
+SELECT HIGH_PRIORITY * FROM t1;
+a b
+1 f
+2 b
+connection con1;
+UNLOCK TABLES;
+connection con0;
+disconnect con1;
+disconnect con2;
+disconnect con0;
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/select_high_prio.test b/mysql-test/suite/storage_engine/select_high_prio.test
new file mode 100644
index 00000000000..385752e8d4e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/select_high_prio.test
@@ -0,0 +1,139 @@
+#
+# SELECT HIGH_PRIOIRITY
+#
+--source have_engine.inc
+
+--source include/count_sessions.inc
+
+--enable_connect_log
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# We will have 3 connections:
+# con1 will lock a table in READ mode
+# con0 will run UPDATE (and will wait on the lock)
+# con2 will start another SELECT
+# con1 will then unlock the table
+#
+# With standard SELECT we should see updated rows in the 2nd result set,
+# while with SELECT HIGH_PRIORITY we should still see only old rows in con2 resultset
+# (and it shouldn't wait till the table is unlocked and UPDATE is executed).
+
+--connect (con0,localhost,root,,)
+SET lock_wait_timeout = 4;
+--connect (con1,localhost,root,,)
+SET lock_wait_timeout = 4;
+--connect (con2,localhost,root,,)
+SET lock_wait_timeout = 4;
+
+
+# Part 1: Standard SELECT
+# should be executed after the UPDATE
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+
+--connection con1
+LOCK TABLE t1 READ;
+
+--connection con0
+--send
+UPDATE t1 SET b = CONCAT(b,b);
+
+--connection con2
+let $show_statement = SHOW PROCESSLIST;
+let $field = State;
+let $condition = LIKE 'Waiting for table%';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+--send
+SELECT * FROM t1;
+
+--connection con1
+let $show_statement = SHOW PROCESSLIST;
+let $field = Info;
+let $condition = = 'SELECT * FROM t1';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+if (!$found)
+{
+ --let $mysql_errname = timeout in wait_show_condition.inc
+ --let $functionality = Table locking or UPDATE
+ --source unexpected_result.inc
+}
+
+UNLOCK TABLES;
+
+--connection con0
+--reap
+if ($mysql_errname)
+{
+ --let $my_last_stmt = UPDATE t1 SET b = CONCAT(b,b)
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+}
+
+--connection con2
+--echo # Should return the new data
+--sorted_result
+--reap
+
+DROP TABLE t1;
+
+
+# Part 2: SELECT HIGH_PRIORITY
+# should be executed before the UPDATE
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
+
+--connection con1
+LOCK TABLE t1 READ;
+
+--connection con0
+--send
+UPDATE t1 SET b = CONCAT(b,b,b);
+
+--connection con2
+let $condition = LIKE 'Waiting for table%';
+let $field = State;
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+SET lock_wait_timeout = 1;
+--echo # Should return old data
+--sorted_result
+SELECT HIGH_PRIORITY * FROM t1;
+if ($mysql_errname)
+{
+ --let $functionality = SELECT HIGH_PRIORITY
+ --source unexpected_result.inc
+}
+
+--connection con1
+UNLOCK TABLES;
+
+--connection con0
+--reap
+if ($mysql_errname)
+{
+ --let $my_last_stmt = UPDATE t1 SET b = CONCAT(b,b,b)
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+}
+
+--disconnect con1
+--disconnect con2
+--disconnect con0
+let $wait_timeout = 30;
+
+--connection default
+
+# Cleanup
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/show_engine.result b/mysql-test/suite/storage_engine/show_engine.result
new file mode 100644
index 00000000000..ab8c6b8f428
--- /dev/null
+++ b/mysql-test/suite/storage_engine/show_engine.result
@@ -0,0 +1,11 @@
+# For most engines SHOW ENGINE .. STATUS produces an empty result,
+# so the default result file is empty; but returning a value here is not an error.
+# The Status column is masked, because it is likely to contain some
+# volatile data (timestamps, memory info, etc.)
+SHOW ENGINE <STORAGE_ENGINE> STATUS;
+Type Name Status
+<STORAGE_ENGINE> ### Engine status, can be long and changeable ###
+# For SHOW MUTEX even the number of lines is volatile, so the result logging is disabled,
+# the test only checks that the command does not produce any errors
+SHOW ENGINE <STORAGE_ENGINE> MUTEX;
+SHOW ENGINE ALL MUTEX;
diff --git a/mysql-test/suite/storage_engine/show_engine.test b/mysql-test/suite/storage_engine/show_engine.test
new file mode 100644
index 00000000000..dca0c6b35c7
--- /dev/null
+++ b/mysql-test/suite/storage_engine/show_engine.test
@@ -0,0 +1,31 @@
+#
+# SHOW ENGINE STATUS command
+#
+# The result might be empty, in which case the test will require rdiff,
+# as it is optimistically expects some output from the command
+#
+
+--source have_engine.inc
+
+--echo # For most engines SHOW ENGINE .. STATUS produces an empty result,
+--echo # so the default result file is empty; but returning a value here is not an error.
+--echo # The Status column is masked, because it is likely to contain some
+--echo # volatile data (timestamps, memory info, etc.)
+
+--source mask_engine.inc
+--replace_column 3 '### Engine status, can be long and changeable ###'
+eval
+SHOW ENGINE $storage_engine STATUS;
+
+--echo # For SHOW MUTEX even the number of lines is volatile, so the result logging is disabled,
+--echo # the test only checks that the command does not produce any errors
+--disable_result_log
+--source mask_engine.inc
+eval
+SHOW ENGINE $storage_engine MUTEX;
+--source mask_engine.inc
+SHOW ENGINE ALL MUTEX;
+--enable_result_log
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/show_table_status.result b/mysql-test/suite/storage_engine/show_table_status.result
new file mode 100644
index 00000000000..98de48f816b
--- /dev/null
+++ b/mysql-test/suite/storage_engine/show_table_status.result
@@ -0,0 +1,62 @@
+DROP TABLE IF EXISTS t1, t2, t3;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (100,'a'),(2,'foo');
+CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t2 (a,b) VALUES (1,'bar');
+CREATE TABLE t3 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHARACTER SET utf8;
+SHOW TABLE STATUS WHERE name IN ( 't1', 't2', 't3' );
+Name t1
+Engine <STORAGE_ENGINE>
+Version 10
+Row_format ###
+Rows 2
+Avg_row_length ###
+Data_length ###
+Max_data_length ###
+Index_length ###
+Data_free ###
+Auto_increment NULL
+Create_time ###
+Update_time ###
+Check_time NULL
+Collation latin1_swedish_ci
+Checksum NULL
+Create_options
+Comment
+Name t2
+Engine <STORAGE_ENGINE>
+Version 10
+Row_format ###
+Rows 1
+Avg_row_length ###
+Data_length ###
+Max_data_length ###
+Index_length ###
+Data_free ###
+Auto_increment NULL
+Create_time ###
+Update_time ###
+Check_time NULL
+Collation latin1_swedish_ci
+Checksum NULL
+Create_options
+Comment
+Name t3
+Engine <STORAGE_ENGINE>
+Version 10
+Row_format ###
+Rows 0
+Avg_row_length ###
+Data_length ###
+Max_data_length ###
+Index_length ###
+Data_free ###
+Auto_increment NULL
+Create_time ###
+Update_time ###
+Check_time NULL
+Collation utf8_general_ci
+Checksum NULL
+Create_options
+Comment
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/suite/storage_engine/show_table_status.test b/mysql-test/suite/storage_engine/show_table_status.test
new file mode 100644
index 00000000000..469d7e33a20
--- /dev/null
+++ b/mysql-test/suite/storage_engine/show_table_status.test
@@ -0,0 +1,30 @@
+#
+# SHOW TABLE STATUS statement
+#
+# Note: the output might be different if even with such tiny tables
+# the number of rows is approximate. In this case rdiff will be needed
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3;
+--enable_warnings
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (100,'a'),(2,'foo');
+
+--let $table_name = t2
+--source create_table.inc
+INSERT INTO t2 (a,b) VALUES (1,'bar');
+
+--let $table_name = t3
+--let $table_options = CHARACTER SET utf8
+--source create_table.inc
+
+--replace_column 2 <STORAGE_ENGINE> 4 ### 6 ### 7 ### 8 ### 9 ### 10 ### 12 ### 13 ###
+--query_vertical SHOW TABLE STATUS WHERE name IN ( 't1', 't2', 't3' )
+DROP TABLE t1, t2, t3;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/strict_check_errors.inc b/mysql-test/suite/storage_engine/strict_check_errors.inc
new file mode 100644
index 00000000000..f28fccb0169
--- /dev/null
+++ b/mysql-test/suite/storage_engine/strict_check_errors.inc
@@ -0,0 +1,23 @@
+#
+# Since we run tests in disable_abort_on_error mode, we cannot use --error command,
+# and need to check the result manually.
+# Usage in a test:
+# --let $error_codes = <comma-separated list> # optional, default ''
+# --let $mysql_errname = <error name> # optional, default current $mysql_errname (from the last SQL command)
+# --let $mysql_errno = <error code> # optional, default current $mysql_errno (from the last SQL command)
+#
+# The difference between strict_check_errors.inc and check_errors.inc is only
+# that they will produce different messages when there is a list of acceptable error codes (more than one),
+# and the statement finished with one of them.
+
+# If a list contained more than one error, it could be on one of two reasons:
+# first, we do not care which code it is, as long as it is one of the listed errors.
+# In this case we will suggest to add an rdiff file if the message differs.
+# Second, check_errors might be called from a generalized include file or test,
+# which runs with different parameters and thus might produce different results for the same statement.
+# Then, the message will be stricter, as the difference with the result file is actually a problem
+# which needs to be checked at least.
+
+--let $strict_check = 1
+--source check_errors.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_ai.result b/mysql-test/suite/storage_engine/tbl_opt_ai.result
new file mode 100644
index 00000000000..d83e446bede
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_ai.result
@@ -0,0 +1,14 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> AUTO_INCREMENT=10;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
+ALTER TABLE t1 AUTO_INCREMENT=100;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=100 DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_ai.test b/mysql-test/suite/storage_engine/tbl_opt_ai.test
new file mode 100644
index 00000000000..e0d26cd46b0
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_ai.test
@@ -0,0 +1,35 @@
+#
+# Check whether AUTO_INCREMENT option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = a $int_col
+--let $table_options = AUTO_INCREMENT=10
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = AUTO_INCREMENT=100
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_avg_row_length.result b/mysql-test/suite/storage_engine/tbl_opt_avg_row_length.result
new file mode 100644
index 00000000000..39debfcc8d1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_avg_row_length.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> AVG_ROW_LENGTH=300;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300
+ALTER TABLE t1 AVG_ROW_LENGTH=30000000;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_avg_row_length.test b/mysql-test/suite/storage_engine/tbl_opt_avg_row_length.test
new file mode 100644
index 00000000000..2ddde478511
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_avg_row_length.test
@@ -0,0 +1,35 @@
+#
+# Check whether AVG_ROW_LENGTH option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = AVG_ROW_LENGTH=300
+--source create_table.inc
+
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = AVG_ROW_LENGTH=30000000
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_checksum.result b/mysql-test/suite/storage_engine/tbl_opt_checksum.result
new file mode 100644
index 00000000000..3f86eb08df3
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_checksum.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1
+ALTER TABLE t1 CHECKSUM=0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_checksum.test b/mysql-test/suite/storage_engine/tbl_opt_checksum.test
new file mode 100644
index 00000000000..04d8cf9d9c6
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_checksum.test
@@ -0,0 +1,30 @@
+#
+# Check whether CHECKSUM option is supported
+# in CREATE and ALTER TABLE.
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = CHECKSUM=1
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = CHECKSUM=0
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_connection.result b/mysql-test/suite/storage_engine/tbl_opt_connection.result
new file mode 100644
index 00000000000..e382613f32c
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_connection.result
@@ -0,0 +1,24 @@
+DROP TABLE IF EXISTS t1;
+CREATE DATABASE test_remote;
+CREATE SERVER test_connection FOREIGN DATA WRAPPER mysql
+OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test_remote');
+CREATE SERVER test_connection2 FOREIGN DATA WRAPPER mysql
+OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test_remote');
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CONNECTION='test_connection';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection'
+ALTER TABLE t1 CONNECTION='test_connection2';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection2'
+DROP TABLE t1;
+DROP SERVER test_connection;
+DROP SERVER test_connection2;
+DROP DATABASE test_remote;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_connection.test b/mysql-test/suite/storage_engine/tbl_opt_connection.test
new file mode 100644
index 00000000000..df92df7e308
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_connection.test
@@ -0,0 +1,52 @@
+#
+# Check whether CONNECTION option is supported
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE DATABASE test_remote;
+CREATE SERVER test_connection FOREIGN DATA WRAPPER mysql
+OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test_remote');
+CREATE SERVER test_connection2 FOREIGN DATA WRAPPER mysql
+OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test_remote');
+
+--let $table_options = CONNECTION='test_connection'
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --source mask_engine.inc
+ SHOW CREATE TABLE t1;
+ --let $alter_definition = CONNECTION='test_connection2'
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+ --source mask_engine.inc
+ SHOW CREATE TABLE t1;
+
+ DROP TABLE t1;
+}
+
+DROP SERVER test_connection;
+DROP SERVER test_connection2;
+DROP DATABASE test_remote;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.result b/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.result
new file mode 100644
index 00000000000..b8c5e75c88c
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
+Warnings:
+Warning 1618 <INDEX DIRECTORY> option ignored
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.test b/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.test
new file mode 100644
index 00000000000..fa7a27eb8af
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.test
@@ -0,0 +1,51 @@
+#
+# Check whether DATA DIRECTORY and INDEX DIRECTORY
+# are supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the options
+# have any real effect on the table, only
+# that they are accepted
+#
+
+--source have_engine.inc
+
+--let $data_dir = $MYSQLTEST_VARDIR/storage_engine_data_dir/
+--let $index_dir = $MYSQLTEST_VARDIR/storage_engine_index_dir/
+--mkdir $data_dir
+--mkdir $index_dir
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = DATA DIRECTORY = '$data_dir' INDEX DIRECTORY = '$index_dir'
+# We cannot mask the folders name here, but we can switch off query logging
+--let $disable_query_log = 1
+--source create_table.inc
+
+--source mask_engine.inc
+--replace_result $data_dir <DATA_DIR> $index_dir <INDEX_DIR>
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = INDEX DIRECTORY = '$data_dir'
+--disable_query_log
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--enable_query_log
+--source mask_engine.inc
+--replace_result $data_dir <DATA_DIR> $index_dir <INDEX_DIR>
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
+--rmdir $data_dir
+--rmdir $index_dir
+
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_delay_key_write.result b/mysql-test/suite/storage_engine/tbl_opt_delay_key_write.result
new file mode 100644
index 00000000000..170f7b782a8
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_delay_key_write.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> DELAY_KEY_WRITE=1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
+ALTER TABLE t1 DELAY_KEY_WRITE=0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_delay_key_write.test b/mysql-test/suite/storage_engine/tbl_opt_delay_key_write.test
new file mode 100644
index 00000000000..724cd9e0566
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_delay_key_write.test
@@ -0,0 +1,35 @@
+#
+# Check whether DELAY_KEY_WRITE option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = DELAY_KEY_WRITE=1
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = DELAY_KEY_WRITE=0
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_insert_method.result b/mysql-test/suite/storage_engine/tbl_opt_insert_method.result
new file mode 100644
index 00000000000..e538c821c78
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_insert_method.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> INSERT_METHOD=FIRST;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST
+ALTER TABLE t1 INSERT_METHOD=NO;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_insert_method.test b/mysql-test/suite/storage_engine/tbl_opt_insert_method.test
new file mode 100644
index 00000000000..29378e7445b
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_insert_method.test
@@ -0,0 +1,35 @@
+#
+# Check whether INSERT_METHOD option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = INSERT_METHOD=FIRST
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = INSERT_METHOD=NO
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_key_block_size.result b/mysql-test/suite/storage_engine/tbl_opt_key_block_size.result
new file mode 100644
index 00000000000..f76fdb0caab
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_key_block_size.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> KEY_BLOCK_SIZE=8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8
+ALTER TABLE t1 KEY_BLOCK_SIZE=1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_key_block_size.test b/mysql-test/suite/storage_engine/tbl_opt_key_block_size.test
new file mode 100644
index 00000000000..9c9109a90af
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_key_block_size.test
@@ -0,0 +1,35 @@
+#
+# Check whether KEY_BLOCK_SIZE option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = KEY_BLOCK_SIZE=8
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = KEY_BLOCK_SIZE=1
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_max_rows.result b/mysql-test/suite/storage_engine/tbl_opt_max_rows.result
new file mode 100644
index 00000000000..977cf53acd6
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_max_rows.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> MAX_ROWS=10000000;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000
+ALTER TABLE t1 MAX_ROWS=30000000;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_max_rows.test b/mysql-test/suite/storage_engine/tbl_opt_max_rows.test
new file mode 100644
index 00000000000..cbf9ad934db
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_max_rows.test
@@ -0,0 +1,35 @@
+#
+# Check whether MAX_ROWS option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = MAX_ROWS=10000000
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = MAX_ROWS=30000000
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_min_rows.result b/mysql-test/suite/storage_engine/tbl_opt_min_rows.result
new file mode 100644
index 00000000000..0407d6b6425
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_min_rows.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> MIN_ROWS=1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1
+ALTER TABLE t1 MIN_ROWS=10000;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_min_rows.test b/mysql-test/suite/storage_engine/tbl_opt_min_rows.test
new file mode 100644
index 00000000000..75b6e7b14d1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_min_rows.test
@@ -0,0 +1,35 @@
+#
+# Check whether MIN_ROWS option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = MIN_ROWS=1
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = MIN_ROWS=10000
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_pack_keys.result b/mysql-test/suite/storage_engine/tbl_opt_pack_keys.result
new file mode 100644
index 00000000000..1f56c035442
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_pack_keys.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PACK_KEYS=1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1
+ALTER TABLE t1 PACK_KEYS=0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_pack_keys.test b/mysql-test/suite/storage_engine/tbl_opt_pack_keys.test
new file mode 100644
index 00000000000..f0d9387fe08
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_pack_keys.test
@@ -0,0 +1,35 @@
+#
+# Check whether PACK KEYS option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = PACK_KEYS=1
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = PACK_KEYS=0
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_password.result b/mysql-test/suite/storage_engine/tbl_opt_password.result
new file mode 100644
index 00000000000..43c409dac14
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_password.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PASSWORD='password';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ALTER TABLE t1 PASSWORD='new_password';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_password.test b/mysql-test/suite/storage_engine/tbl_opt_password.test
new file mode 100644
index 00000000000..471295e54e4
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_password.test
@@ -0,0 +1,40 @@
+#
+# Check whether PASSWORD option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+# This option is not supported by any known engines,
+# that's why the result file does not contain it;
+# but it's syntactically acceptable.
+#
+
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = PASSWORD='password'
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = PASSWORD='new_password'
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_row_format.result b/mysql-test/suite/storage_engine/tbl_opt_row_format.result
new file mode 100644
index 00000000000..5f1cf713bb6
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_row_format.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> ROW_FORMAT=FIXED;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
+ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_row_format.test b/mysql-test/suite/storage_engine/tbl_opt_row_format.test
new file mode 100644
index 00000000000..d6347551da0
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_row_format.test
@@ -0,0 +1,35 @@
+#
+# Check whether ROW_FORMAT option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = ROW_FORMAT=FIXED
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = ROW_FORMAT=DYNAMIC
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_opt_union.result b/mysql-test/suite/storage_engine/tbl_opt_union.result
new file mode 100644
index 00000000000..81521eff8a2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_union.result
@@ -0,0 +1,14 @@
+DROP TABLE IF EXISTS t1, child1, child2;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> UNION(child1);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`)
+ALTER TABLE t1 UNION = (child1,child2);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`,`child2`)
+DROP TABLE t1, child1, child2;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_union.test b/mysql-test/suite/storage_engine/tbl_opt_union.test
new file mode 100644
index 00000000000..fa134ab8344
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_union.test
@@ -0,0 +1,41 @@
+#
+# Check whether UNION option
+# is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only
+# that it's accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, child1, child2;
+--enable_warnings
+
+--disable_query_log
+eval CREATE TABLE child1 (a $int_col) ENGINE=MyISAM;
+eval CREATE TABLE child2 (a $int_col) ENGINE=MyISAM;
+--enable_query_log
+
+--let $table_options = UNION(child1)
+--let $create_definition = a $int_col
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+--let $alter_definition = UNION = (child1,child2)
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1, child1, child2;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_standard_opts.result b/mysql-test/suite/storage_engine/tbl_standard_opts.result
new file mode 100644
index 00000000000..b4b183aacb2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_standard_opts.result
@@ -0,0 +1,40 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> DEFAULT CHARACTER SET = utf8
+COLLATE = utf8_general_ci
+COMMENT = 'standard table options'
+;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='standard table options'
+ALTER TABLE t1 COMMENT = 'table altered';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='table altered'
+ALTER TABLE t1 ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8 COMMENT='table altered'
+ALTER TABLE t1 ENGINE=<STORAGE_ENGINE>;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='table altered'
+ALTER TABLE t1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COMMENT='table altered'
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_standard_opts.test b/mysql-test/suite/storage_engine/tbl_standard_opts.test
new file mode 100644
index 00000000000..7e723788cd7
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_standard_opts.test
@@ -0,0 +1,60 @@
+#
+# Standard options in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the options
+# have any real effect on the table, only
+# that they are accepted
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Create table with standard options
+
+let $table_options =
+ DEFAULT CHARACTER SET = utf8
+ COLLATE = utf8_general_ci
+ COMMENT = 'standard table options'
+;
+--source create_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+
+# Alter comment
+
+--let $alter_definition = COMMENT = 'table altered'
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+# Alter ENGINE value
+
+--let $alter_definition = ENGINE=MEMORY
+--source alter_table.inc
+SHOW CREATE TABLE t1;
+--let $alter_definition = ENGINE=$storage_engine
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+# Alter character set and collation
+
+--let $alter_definition = CHARACTER SET = latin1 COLLATE = latin1_swedish_ci
+--source alter_table.inc
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/tbl_temporary.result b/mysql-test/suite/storage_engine/tbl_temporary.result
new file mode 100644
index 00000000000..b81fa0a788b
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_temporary.result
@@ -0,0 +1,11 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c CHAR(1)) ENGINE=MyISAM;
+CREATE TEMPORARY TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+DROP TEMPORARY TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_temporary.test b/mysql-test/suite/storage_engine/tbl_temporary.test
new file mode 100644
index 00000000000..963238c37a5
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_temporary.test
@@ -0,0 +1,32 @@
+#
+# The test checks whether a temporary table
+# can be created with the engine under test.
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# This is a base table which we want to mask
+CREATE TABLE t1 (c CHAR(1)) ENGINE=MyISAM;
+
+--let $temporary = 1
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Temporary tables
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --source mask_engine.inc
+ SHOW CREATE TABLE t1;
+
+ DROP TEMPORARY TABLE t1;
+ DROP TABLE t1;
+}
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/truncate_table.result b/mysql-test/suite/storage_engine/truncate_table.result
new file mode 100644
index 00000000000..0a774c4b8dd
--- /dev/null
+++ b/mysql-test/suite/storage_engine/truncate_table.result
@@ -0,0 +1,41 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+TRUNCATE TABLE t1;
+INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN> KEY AUTO_INCREMENT, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+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 # # # # # # # # # 1 # # # # # # #
+INSERT INTO t1 (c) VALUES ('a'),('b'),('c');
+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 # # # # # # # # # 4 # # # # # # #
+TRUNCATE TABLE t1;
+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 # # # # # # # # # 1 # # # # # # #
+INSERT INTO t1 (c) VALUES ('d');
+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 # # # # # # # # # 2 # # # # # # #
+SELECT * FROM t1;
+a c
+1 d
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
+HANDLER t1 OPEN AS h1;
+HANDLER h1 READ FIRST;
+a b
+1 a
+TRUNCATE TABLE t1;
+HANDLER h1 READ NEXT;
+ERROR 42S02: Unknown table 'h1' in HANDLER
+HANDLER t1 OPEN AS h2;
+HANDLER h2 READ FIRST;
+a b
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/truncate_table.test b/mysql-test/suite/storage_engine/truncate_table.test
new file mode 100644
index 00000000000..c84fba143b7
--- /dev/null
+++ b/mysql-test/suite/storage_engine/truncate_table.test
@@ -0,0 +1,81 @@
+#
+# TRUNCATE TABLE
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--source create_table.inc
+TRUNCATE TABLE t1;
+if ($mysql_errname)
+{
+ --let $functionality = TRUNCATE TABLE
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
+ TRUNCATE TABLE t1;
+ SELECT * FROM t1;
+}
+DROP TABLE t1;
+
+
+# Truncate resets auto-increment value on the table
+
+--let $create_definition = a $int_indexed_col KEY AUTO_INCREMENT, c $char_col
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = PK or AUTO_INCREMENT
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
+ SHOW TABLE STATUS LIKE 't1';
+
+ INSERT INTO t1 (c) VALUES ('a'),('b'),('c');
+ --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
+ SHOW TABLE STATUS LIKE 't1';
+
+ TRUNCATE TABLE t1;
+ --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
+ SHOW TABLE STATUS LIKE 't1';
+
+ INSERT INTO t1 (c) VALUES ('d');
+ --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
+ SHOW TABLE STATUS LIKE 't1';
+
+ SELECT * FROM t1;
+ DROP TABLE t1;
+}
+
+# Truncate closes handlers
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
+HANDLER t1 OPEN AS h1;
+if ($mysql_errname)
+{
+ --let $functionality = HANDLER
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ HANDLER h1 READ FIRST;
+ TRUNCATE TABLE t1;
+ --let $error_codes = ER_UNKNOWN_TABLE
+ HANDLER h1 READ NEXT;
+ --source check_errors.inc
+ HANDLER t1 OPEN AS h2;
+ HANDLER h2 READ FIRST;
+}
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result b/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result
new file mode 100644
index 00000000000..a52f18fc623
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS t1;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection con2;
+INSERT INTO t1 (a) VALUES (1);
+connection con1;
+# If consistent read works on this isolation level (REPEATABLE READ), the following SELECT should not return the value we inserted (1)
+SELECT * FROM t1;
+a
+COMMIT;
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.test b/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.test
new file mode 100644
index 00000000000..e44e260e1d4
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.test
@@ -0,0 +1,9 @@
+--source ../have_engine.inc
+--source support_transactions.inc
+
+let $trx_isolation = REPEATABLE READ;
+
+--source consistent_snapshot.inc
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result b/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result
new file mode 100644
index 00000000000..8d75ea075a2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS t1;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection con2;
+INSERT INTO t1 (a) VALUES (1);
+connection con1;
+# If consistent read works on this isolation level (SERIALIZABLE), the following SELECT should not return the value we inserted (1)
+SELECT * FROM t1;
+a
+COMMIT;
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.test b/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.test
new file mode 100644
index 00000000000..9d516066927
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.test
@@ -0,0 +1,9 @@
+--source ../have_engine.inc
+--source support_transactions.inc
+
+let $trx_isolation = SERIALIZABLE;
+
+--source consistent_snapshot.inc
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc b/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc
new file mode 100644
index 00000000000..8dc9d6c4bb1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc
@@ -0,0 +1,50 @@
+#
+# TRANSACTION WITH CONSISTENT SNAPSHOT
+#
+
+--source ../have_engine.inc
+
+--enable_connect_log
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+
+let $create_definition = a $int_col;
+--source ../create_table.inc
+
+eval SET SESSION TRANSACTION ISOLATION LEVEL $trx_isolation;
+
+# While a consistent snapshot transaction is executed,
+# no external inserts should be visible to the transaction.
+# But it should only work this way for REPEATABLE-READ and SERIALIZABLE
+
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+
+connection con2;
+INSERT INTO t1 (a) VALUES (1);
+if ($mysql_errname)
+{
+ --echo # INSERT finished with error $mysql_errname
+}
+
+connection con1;
+--echo # If consistent read works on this isolation level ($trx_isolation), the following SELECT should not return the value we inserted (1)
+SELECT * FROM t1;
+COMMIT;
+
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/delete.result b/mysql-test/suite/storage_engine/trx/delete.result
new file mode 100644
index 00000000000..827877a7e30
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/delete.result
@@ -0,0 +1,72 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(10000,'foobar');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+BEGIN;
+DELETE FROM t1 WHERE b IN ('c');
+SELECT * FROM t1;
+a b
+1 a
+1 a
+10000 foobar
+10000 foobar
+2 b
+2 b
+4 d
+4 d
+5 e
+5 e
+6 f
+6 f
+7 g
+7 g
+8 h
+8 h
+DELETE FROM t1 WHERE a < 0 OR b = 'a';
+COMMIT;
+SELECT * FROM t1;
+a b
+10000 foobar
+10000 foobar
+2 b
+2 b
+4 d
+4 d
+5 e
+5 e
+6 f
+6 f
+7 g
+7 g
+8 h
+8 h
+BEGIN;
+DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
+SAVEPOINT spt1;
+DELETE FROM t1;
+RELEASE SAVEPOINT spt1;
+ROLLBACK;
+SELECT * FROM t1;
+a b
+10000 foobar
+10000 foobar
+2 b
+2 b
+4 d
+4 d
+5 e
+5 e
+6 f
+6 f
+7 g
+7 g
+8 h
+8 h
+BEGIN;
+DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
+SAVEPOINT spt1;
+DELETE FROM t1;
+INSERT INTO t1 (a,b) VALUES (1,'a');
+ROLLBACK TO SAVEPOINT spt1;
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/delete.test b/mysql-test/suite/storage_engine/trx/delete.test
new file mode 100644
index 00000000000..0898eebb49a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/delete.test
@@ -0,0 +1,51 @@
+#
+# Transactional DELETE
+#
+
+--source ../have_engine.inc
+--source support_transactions.inc
+--source support_savepoints.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--source ../create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(10000,'foobar');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+
+BEGIN;
+DELETE FROM t1 WHERE b IN ('c');
+if ($mysql_errname)
+{
+ --let $functionality = DELETE
+ --source ../unexpected_result.inc
+}
+--sorted_result
+SELECT * FROM t1;
+DELETE FROM t1 WHERE a < 0 OR b = 'a';
+COMMIT;
+--sorted_result
+SELECT * FROM t1;
+
+BEGIN;
+DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
+SAVEPOINT spt1;
+DELETE FROM t1;
+RELEASE SAVEPOINT spt1;
+ROLLBACK;
+--sorted_result
+SELECT * FROM t1;
+
+BEGIN;
+DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
+SAVEPOINT spt1;
+DELETE FROM t1;
+INSERT INTO t1 (a,b) VALUES (1,'a');
+ROLLBACK TO SAVEPOINT spt1;
+COMMIT;
+
+DROP TABLE t1;
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/insert.result b/mysql-test/suite/storage_engine/trx/insert.result
new file mode 100644
index 00000000000..986d63b2a07
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/insert.result
@@ -0,0 +1,55 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+BEGIN;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(100,'foo');
+INSERT t1 (a,b) VALUE (10,'foo'),(11,'abc');
+COMMIT;
+SELECT * FROM t1;
+a b
+1 a
+10 foo
+100 foo
+11 abc
+2 b
+3 c
+4 d
+5 e
+BEGIN;
+INSERT INTO t1 (b,a) VALUES ('test',0);
+SAVEPOINT spt1;
+INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT);
+RELEASE SAVEPOINT spt1;
+INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT);
+ROLLBACK;
+SELECT * FROM t1;
+a b
+1 a
+10 foo
+100 foo
+11 abc
+2 b
+3 c
+4 d
+5 e
+BEGIN;
+INSERT t1 (a) VALUE (10),(20);
+SAVEPOINT spt1;
+INSERT INTO t1 SET a = 11, b = 'f';
+INSERT t1 SET b = DEFAULT;
+ROLLBACK TO SAVEPOINT spt1;
+INSERT INTO t1 (b,a) VALUES ('test1',10);
+COMMIT;
+SELECT * FROM t1;
+a b
+1 a
+10 NULL
+10 foo
+10 test1
+100 foo
+11 abc
+2 b
+20 NULL
+3 c
+4 d
+5 e
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/insert.test b/mysql-test/suite/storage_engine/trx/insert.test
new file mode 100644
index 00000000000..c458f90b1bb
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/insert.test
@@ -0,0 +1,44 @@
+#
+# Transactional INSERT
+#
+--source ../have_engine.inc
+--source support_transactions.inc
+--source support_savepoints.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--source ../create_table.inc
+BEGIN;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(100,'foo');
+INSERT t1 (a,b) VALUE (10,'foo'),(11,'abc');
+COMMIT;
+--sorted_result
+SELECT * FROM t1;
+
+BEGIN;
+INSERT INTO t1 (b,a) VALUES ('test',0);
+SAVEPOINT spt1;
+INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT);
+RELEASE SAVEPOINT spt1;
+INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT);
+ROLLBACK;
+--sorted_result
+SELECT * FROM t1;
+
+BEGIN;
+INSERT t1 (a) VALUE (10),(20);
+SAVEPOINT spt1;
+INSERT INTO t1 SET a = 11, b = 'f';
+INSERT t1 SET b = DEFAULT;
+ROLLBACK TO SAVEPOINT spt1;
+INSERT INTO t1 (b,a) VALUES ('test1',10);
+COMMIT;
+--sorted_result
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/level_read_committed.result b/mysql-test/suite/storage_engine/trx/level_read_committed.result
new file mode 100644
index 00000000000..12c0c2f42a8
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/level_read_committed.result
@@ -0,0 +1,91 @@
+DROP TABLE IF EXISTS t1;
+connect con1,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+connect con2,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+connection con1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+START TRANSACTION;
+SELECT * FROM t1;
+a
+connection con2;
+BEGIN;
+INSERT INTO t1 (a) VALUES(1);
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+connection con1;
+SELECT * FROM t1;
+a
+connection con2;
+INSERT INTO t1 (a) VALUES (2);
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+connection con1;
+SELECT * FROM t1;
+a
+INSERT INTO t1 (a) SELECT a+100 FROM t1;
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+SELECT * FROM t1;
+a
+connection con2;
+SELECT * FROM t1;
+a
+1
+2
+COMMIT;
+SELECT * FROM t1;
+a
+1
+2
+connection con1;
+SELECT * FROM t1;
+a
+1
+2
+INSERT INTO t1 (a) SELECT a+200 FROM t1;
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+SELECT * FROM t1;
+a
+1
+2
+201
+202
+COMMIT;
+SELECT * FROM t1;
+a
+1
+2
+201
+202
+connection con2;
+SELECT * FROM t1;
+a
+1
+2
+201
+202
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection con2;
+INSERT INTO t1 (a) VALUES (1);
+connection con1;
+# If consistent read works on this isolation level (READ COMMITTED), the following SELECT should not return the value we inserted (1)
+SELECT * FROM t1;
+a
+1
+COMMIT;
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/level_read_committed.test b/mysql-test/suite/storage_engine/trx/level_read_committed.test
new file mode 100644
index 00000000000..77bd562c433
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/level_read_committed.test
@@ -0,0 +1,10 @@
+--source ../have_engine.inc
+--source support_transactions.inc
+
+let $trx_isolation = READ COMMITTED;
+
+--source transaction_isolation.inc
+--source consistent_snapshot.inc
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result b/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result
new file mode 100644
index 00000000000..2bf93768b00
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result
@@ -0,0 +1,116 @@
+DROP TABLE IF EXISTS t1;
+connect con1,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connect con2,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection con1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+START TRANSACTION;
+SELECT * FROM t1;
+a
+connection con2;
+BEGIN;
+INSERT INTO t1 (a) VALUES(1);
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+connection con1;
+SELECT * FROM t1;
+a
+1
+connection con2;
+INSERT INTO t1 (a) VALUES (2);
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+connection con1;
+SELECT * FROM t1;
+a
+1
+2
+INSERT INTO t1 (a) SELECT a+100 FROM t1;
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+SELECT * FROM t1;
+a
+1
+101
+102
+2
+connection con2;
+SELECT * FROM t1;
+a
+1
+101
+102
+2
+COMMIT;
+SELECT * FROM t1;
+a
+1
+101
+102
+2
+connection con1;
+SELECT * FROM t1;
+a
+1
+101
+102
+2
+INSERT INTO t1 (a) SELECT a+200 FROM t1;
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+SELECT * FROM t1;
+a
+1
+101
+102
+2
+201
+202
+301
+302
+COMMIT;
+SELECT * FROM t1;
+a
+1
+101
+102
+2
+201
+202
+301
+302
+connection con2;
+SELECT * FROM t1;
+a
+1
+101
+102
+2
+201
+202
+301
+302
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection con2;
+INSERT INTO t1 (a) VALUES (1);
+connection con1;
+# If consistent read works on this isolation level (READ UNCOMMITTED), the following SELECT should not return the value we inserted (1)
+SELECT * FROM t1;
+a
+1
+COMMIT;
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/level_read_uncommitted.test b/mysql-test/suite/storage_engine/trx/level_read_uncommitted.test
new file mode 100644
index 00000000000..48310fc22be
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/level_read_uncommitted.test
@@ -0,0 +1,9 @@
+--source ../have_engine.inc
+--source support_transactions.inc
+
+let $trx_isolation = READ UNCOMMITTED;
+--source transaction_isolation.inc
+--source consistent_snapshot.inc
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/level_repeatable_read.result b/mysql-test/suite/storage_engine/trx/level_repeatable_read.result
new file mode 100644
index 00000000000..82324c16801
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/level_repeatable_read.result
@@ -0,0 +1,69 @@
+DROP TABLE IF EXISTS t1;
+connect con1,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+connect con2,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+connection con1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+START TRANSACTION;
+SELECT * FROM t1;
+a
+connection con2;
+BEGIN;
+INSERT INTO t1 (a) VALUES(1);
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+connection con1;
+SELECT * FROM t1;
+a
+connection con2;
+INSERT INTO t1 (a) VALUES (2);
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+connection con1;
+SELECT * FROM t1;
+a
+INSERT INTO t1 (a) SELECT a+100 FROM t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
+# If it differs from the result file, it might indicate a problem.
+SELECT * FROM t1;
+a
+connection con2;
+SELECT * FROM t1;
+a
+1
+2
+COMMIT;
+SELECT * FROM t1;
+a
+1
+2
+connection con1;
+SELECT * FROM t1;
+a
+INSERT INTO t1 (a) SELECT a+200 FROM t1;
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+SELECT * FROM t1;
+a
+201
+202
+COMMIT;
+SELECT * FROM t1;
+a
+1
+2
+201
+202
+connection con2;
+SELECT * FROM t1;
+a
+1
+2
+201
+202
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/level_repeatable_read.test b/mysql-test/suite/storage_engine/trx/level_repeatable_read.test
new file mode 100644
index 00000000000..cb33d1093b5
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/level_repeatable_read.test
@@ -0,0 +1,8 @@
+--source ../have_engine.inc
+--source support_transactions.inc
+
+let $trx_isolation = REPEATABLE READ;
+--source transaction_isolation.inc
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/level_serializable.result b/mysql-test/suite/storage_engine/trx/level_serializable.result
new file mode 100644
index 00000000000..0f990dfbf77
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/level_serializable.result
@@ -0,0 +1,56 @@
+DROP TABLE IF EXISTS t1;
+connect con1,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+connect con2,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+connection con1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+START TRANSACTION;
+SELECT * FROM t1;
+a
+connection con2;
+BEGIN;
+INSERT INTO t1 (a) VALUES(1);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
+# If it differs from the result file, it might indicate a problem.
+connection con1;
+SELECT * FROM t1;
+a
+connection con2;
+INSERT INTO t1 (a) VALUES (2);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
+# If it differs from the result file, it might indicate a problem.
+connection con1;
+SELECT * FROM t1;
+a
+INSERT INTO t1 (a) SELECT a+100 FROM t1;
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+SELECT * FROM t1;
+a
+connection con2;
+SELECT * FROM t1;
+a
+COMMIT;
+SELECT * FROM t1;
+a
+connection con1;
+SELECT * FROM t1;
+a
+INSERT INTO t1 (a) SELECT a+200 FROM t1;
+# WARNING: Statement ended with errno 0, errname ''.
+# If it differs from the result file, it might indicate a problem.
+SELECT * FROM t1;
+a
+COMMIT;
+SELECT * FROM t1;
+a
+connection con2;
+SELECT * FROM t1;
+a
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/level_serializable.test b/mysql-test/suite/storage_engine/trx/level_serializable.test
new file mode 100644
index 00000000000..4372b48905d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/level_serializable.test
@@ -0,0 +1,8 @@
+--source ../have_engine.inc
+--source support_transactions.inc
+
+let $trx_isolation = SERIALIZABLE;
+--source transaction_isolation.inc
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/my.cnf b/mysql-test/suite/storage_engine/trx/my.cnf
new file mode 100644
index 00000000000..e83954c469d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/my.cnf
@@ -0,0 +1,7 @@
+!include include/default_my.cnf
+
+[server]
+sql-mode=NO_ENGINE_SUBSTITUTION
+binlog-format=row
+log-bin=master-bin
+
diff --git a/mysql-test/suite/storage_engine/trx/select_for_update.result b/mysql-test/suite/storage_engine/trx/select_for_update.result
new file mode 100644
index 00000000000..8b0de87de05
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/select_for_update.result
@@ -0,0 +1,35 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
+connect con1,localhost,root,,;
+BEGIN;
+SELECT * FROM t1 WHERE b='a' FOR UPDATE;
+a b
+1 a
+3 a
+connection default;
+SET lock_wait_timeout = 1;
+SELECT * FROM t1 WHERE b='a';
+a b
+1 a
+3 a
+SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UPDATE t1 SET b='c' WHERE b='a';
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection con1;
+COMMIT;
+SELECT * FROM t1;
+a b
+1 a
+2 b
+3 a
+disconnect con1;
+connection default;
+UPDATE t1 SET b='c' WHERE b='a';
+SELECT * FROM t1;
+a b
+1 c
+2 b
+3 c
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/select_for_update.test b/mysql-test/suite/storage_engine/trx/select_for_update.test
new file mode 100644
index 00000000000..93ccc1915df
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/select_for_update.test
@@ -0,0 +1,87 @@
+#
+# SELECT .. FOR UPDATE
+#
+# If the engine has its own lock timeouts,
+# it makes sense to set them to minimum to decrease
+# the duration of the test.
+
+--source ../have_engine.inc
+--source support_transactions.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--enable_connect_log
+
+--source include/count_sessions.inc
+
+--source ../create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
+
+--connect (con1,localhost,root,,)
+BEGIN;
+--sorted_result
+SELECT * FROM t1 WHERE b='a' FOR UPDATE;
+if ($mysql_errname)
+{
+ --let $functionality = SELECT .. FOR UPDATE
+ --source ../unexpected_result.inc
+}
+
+--connection default
+SET lock_wait_timeout = 1;
+
+# Should still be able to select
+
+--sorted_result
+SELECT * FROM t1 WHERE b='a';
+if ($mysql_errname)
+{
+ --let $functionality = SELECT .. FOR UPDATE or locking
+ --source ../unexpected_result.inc
+}
+
+# ... but not with LOCK IN SHARE MODE
+
+--sorted_result
+--let $error_codes = ER_LOCK_WAIT_TIMEOUT
+SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+--source ../check_errors.inc
+if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT)
+{
+ --let $functionality = SELECT .. FOR UPDATE or LOCK IN SHARE MODE
+ --source ../unexpected_result.inc
+}
+
+--let $error_codes = ER_LOCK_WAIT_TIMEOUT
+UPDATE t1 SET b='c' WHERE b='a';
+--source ../check_errors.inc
+if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT)
+{
+ --let $functionality = UPDATE or SELECT .. FOR UPDATE
+ --source ../unexpected_result.inc
+}
+
+--connection con1
+COMMIT;
+--sorted_result
+SELECT * FROM t1;
+
+--disconnect con1
+--connection default
+# Now it can be updated all right
+UPDATE t1 SET b='c' WHERE b='a';
+if ($mysql_errname)
+{
+ --let $functionality = UPDATE
+ --source ../unexpected_result.inc
+}
+--sorted_result
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result
new file mode 100644
index 00000000000..00610a03bd8
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result
@@ -0,0 +1,37 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
+connect con1,localhost,root,,;
+BEGIN;
+SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+a b
+1 a
+3 a
+connection default;
+SET lock_wait_timeout = 1;
+SELECT * FROM t1 WHERE b='a';
+a b
+1 a
+3 a
+SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+a b
+1 a
+3 a
+UPDATE t1 SET b='c' WHERE b='a';
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection con1;
+COMMIT;
+SELECT * FROM t1;
+a b
+1 a
+2 b
+3 a
+disconnect con1;
+connection default;
+UPDATE t1 SET b='c' WHERE b='a';
+SELECT * FROM t1;
+a b
+1 c
+2 b
+3 c
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test
new file mode 100644
index 00000000000..a50c86403e9
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test
@@ -0,0 +1,82 @@
+#
+# SELECT .. LOCK IN SHARE MODE
+#
+# If the engine has its own lock timeouts,
+# it makes sense to set them to minimum to decrease
+# the duration of the test.
+
+--source ../have_engine.inc
+--source support_transactions.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--enable_connect_log
+
+--source include/count_sessions.inc
+
+--source ../create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
+
+--connect (con1,localhost,root,,)
+BEGIN;
+--sorted_result
+SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+if ($mysql_errname)
+{
+ --let $functionality = LOCK IN SHARE MODE
+ --source ../unexpected_result.inc
+}
+
+--connection default
+SET lock_wait_timeout = 1;
+
+# Should still be able to select
+
+--sorted_result
+SELECT * FROM t1 WHERE b='a';
+if ($mysql_errname)
+{
+ --let $functionality = LOCK IN SHARE MODE
+ --source ../unexpected_result.inc
+}
+--sorted_result
+SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+if ($mysql_errname)
+{
+ --let $functionality = LOCK IN SHARE MODE
+ --source ../unexpected_result.inc
+}
+
+--let $error_codes = ER_LOCK_WAIT_TIMEOUT
+UPDATE t1 SET b='c' WHERE b='a';
+--source ../check_errors.inc
+if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT)
+{
+ --let $functionality = LOCK IN SHARE MODE or UPDATE
+ --source ../unexpected_result.inc
+}
+
+--connection con1
+COMMIT;
+--sorted_result
+SELECT * FROM t1;
+
+--disconnect con1
+--connection default
+# Now it can be updated all right
+UPDATE t1 SET b='c' WHERE b='a';
+if ($mysql_errname)
+{
+ --let $functionality = UPDATE
+ --source ../unexpected_result.inc
+}
+--sorted_result
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/support_savepoints.inc b/mysql-test/suite/storage_engine/trx/support_savepoints.inc
new file mode 100644
index 00000000000..36dbfce26b2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/support_savepoints.inc
@@ -0,0 +1,10 @@
+if (!`SELECT savepoints='YES' FROM INFORMATION_SCHEMA.ENGINES WHERE engine = '$storage_engine'`)
+{
+ --echo # -- WARNING ----------------------------------------------------------------
+ --echo # According to I_S.ENGINES, $storage_engine does not support savepoints.
+ --echo # If it is true, the test will most likely fail; you can
+ --echo # either create an rdiff file (recommended), or add the test to disabled.def.
+ --echo # If savepoints should be supported, check the data in Information Schema.
+ --echo # ---------------------------------------------------------------------------
+}
+
diff --git a/mysql-test/suite/storage_engine/trx/support_transactions.inc b/mysql-test/suite/storage_engine/trx/support_transactions.inc
new file mode 100644
index 00000000000..ff1224c5a3d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/support_transactions.inc
@@ -0,0 +1,10 @@
+if (!`SELECT transactions='YES' FROM INFORMATION_SCHEMA.ENGINES WHERE engine = '$storage_engine'`)
+{
+ --echo # -- WARNING ----------------------------------------------------------------
+ --echo # According to I_S.ENGINES, $storage_engine does not support transactions.
+ --echo # If it is true, the test will most likely fail; you can
+ --echo # either create an rdiff file, or add the test to disabled.def.
+ --echo # If transactions should be supported, check the data in Information Schema.
+ --echo # ---------------------------------------------------------------------------
+}
+
diff --git a/mysql-test/suite/storage_engine/trx/support_xa.inc b/mysql-test/suite/storage_engine/trx/support_xa.inc
new file mode 100644
index 00000000000..d51fc48aaa9
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/support_xa.inc
@@ -0,0 +1,12 @@
+--let $support_xa = 1
+if (!`SELECT xa='YES' FROM INFORMATION_SCHEMA.ENGINES WHERE engine = '$storage_engine'`)
+{
+ --echo # -- WARNING ----------------------------------------------------------------
+ --echo # According to I_S.ENGINES, $storage_engine does not support XA.
+ --echo # If it is true, the test will most likely fail; you can
+ --echo # either create an rdiff file, or add the test to disabled.def.
+ --echo # If XA should be supported, check the data in Information Schema.
+ --echo # ---------------------------------------------------------------------------
+ --let $support_xa = 0
+}
+
diff --git a/mysql-test/suite/storage_engine/trx/transaction_isolation.inc b/mysql-test/suite/storage_engine/trx/transaction_isolation.inc
new file mode 100644
index 00000000000..c81071d99b6
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/transaction_isolation.inc
@@ -0,0 +1,99 @@
+#
+# Basic check for transaction isolation.
+# The results should be different depending on the isolation level.
+# For some isolation levels, some statements will end with a timeout.
+# If the engine has its own timeout parameters, reduce them to minimum,
+# otherwise the test will take very long.
+# If the timeout value is greater than the testcase-timeout the test is run with,
+# it might fail due to the testcase timeout.
+#
+
+--source ../have_engine.inc
+
+--enable_connect_log
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+connect (con1,localhost,root,,);
+eval SET SESSION TRANSACTION ISOLATION LEVEL $trx_isolation;
+connect (con2,localhost,root,,);
+eval SET SESSION TRANSACTION ISOLATION LEVEL $trx_isolation;
+
+connection con1;
+
+let $create_definition = a $int_col;
+--source ../create_table.inc
+
+START TRANSACTION;
+--sorted_result
+SELECT * FROM t1; # First snapshot
+
+connection con2;
+
+BEGIN;
+--let $error_codes = 0,ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 (a) VALUES(1);
+--source ../strict_check_errors.inc
+
+connection con1;
+--sorted_result
+SELECT * FROM t1; # Second snapshot
+
+connection con2;
+--let $error_codes = 0,ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 (a) VALUES (2);
+--source ../strict_check_errors.inc
+
+connection con1;
+--sorted_result
+SELECT * FROM t1; # Third snapshot
+
+--let $error_codes = 0,ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 (a) SELECT a+100 FROM t1;
+--source ../strict_check_errors.inc
+
+--sorted_result
+SELECT * FROM t1;
+
+connection con2;
+--sorted_result
+SELECT * FROM t1; # Inside the transaction
+COMMIT;
+--sorted_result
+SELECT * FROM t1; # Outside the transaction
+
+connection con1;
+--sorted_result
+SELECT * FROM t1; # Inside the transaction
+
+# Note: INSERT .. SELECT might be tricky, for example for InnoDB
+# even with REPEATABLE-READ it works as if it is executed with READ COMMITTED.
+# The test will have a 'logical' result for repeatable read, even although
+# we currently don't have an engine which works this way.
+
+--let $error_codes = 0,ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 (a) SELECT a+200 FROM t1;
+--source ../strict_check_errors.inc
+
+--sorted_result
+SELECT * FROM t1;
+COMMIT;
+--sorted_result
+SELECT * FROM t1; # Outside the transaction
+
+connection con2;
+--sorted_result
+SELECT * FROM t1; # After both transactions have committed
+
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/update.result b/mysql-test/suite/storage_engine/trx/update.result
new file mode 100644
index 00000000000..e609bfcbc23
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/update.result
@@ -0,0 +1,48 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+BEGIN;
+UPDATE t1 SET a=a+100;
+UPDATE t1 SET a=a-50, b=DEFAULT WHERE a>100;
+COMMIT;
+SELECT * FROM t1;
+a b
+10050 NULL
+10050 NULL
+51 NULL
+51 NULL
+52 NULL
+52 NULL
+53 NULL
+53 NULL
+54 NULL
+54 NULL
+55 NULL
+55 NULL
+BEGIN;
+UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY a DESC, b ASC LIMIT 3;
+UPDATE t1 SET b = '';
+ROLLBACK;
+BEGIN;
+UPDATE t1 SET b = 'update2' WHERE a <= 100;
+SAVEPOINT spt1;
+UPDATE t1 SET b = '';
+ROLLBACK TO SAVEPOINT spt1;
+UPDATE t1 SET b = 'upd' WHERE a = 10050;
+COMMIT;
+SELECT * FROM t1;
+a b
+10050 upd
+10050 upd
+51 update2
+51 update2
+52 update2
+52 update2
+53 update2
+53 update2
+54 update2
+54 update2
+55 update2
+55 update2
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/update.test b/mysql-test/suite/storage_engine/trx/update.test
new file mode 100644
index 00000000000..df65e244528
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/update.test
@@ -0,0 +1,50 @@
+#
+# Transactional UPDATE
+#
+
+--source ../have_engine.inc
+--source support_transactions.inc
+--source support_savepoints.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--source ../create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+
+BEGIN;
+UPDATE t1 SET a=a+100;
+if ($mysql_errname)
+{
+ --let $functionality = UPDATE
+ --source ../unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ UPDATE t1 SET a=a-50, b=DEFAULT WHERE a>100;
+ COMMIT;
+ --sorted_result
+ SELECT * FROM t1;
+
+ BEGIN;
+ UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY a DESC, b ASC LIMIT 3;
+ UPDATE t1 SET b = '';
+ ROLLBACK;
+
+ BEGIN;
+ UPDATE t1 SET b = 'update2' WHERE a <= 100;
+ SAVEPOINT spt1;
+ UPDATE t1 SET b = '';
+ ROLLBACK TO SAVEPOINT spt1;
+ UPDATE t1 SET b = 'upd' WHERE a = 10050;
+ COMMIT;
+ --sorted_result
+ SELECT * FROM t1;
+}
+
+DROP TABLE t1;
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/xa.result b/mysql-test/suite/storage_engine/trx/xa.result
new file mode 100644
index 00000000000..3e2cb43a11c
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/xa.result
@@ -0,0 +1,96 @@
+DROP TABLE IF EXISTS t1;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+connection con2;
+XA START 'xa1';
+INSERT INTO t1 (a) VALUES (1);
+connection con1;
+SELECT * FROM t1;
+a
+connection con2;
+INSERT INTO t1 (a) VALUES (2);
+XA END 'xa1';
+connection con1;
+SELECT * FROM t1;
+a
+connection con2;
+XA PREPARE 'xa1';
+connection con1;
+SELECT * FROM t1;
+a
+connection con2;
+XA RECOVER;
+formatID gtrid_length bqual_length data
+1 3 0 xa1
+XA COMMIT 'xa1';
+connection con1;
+SELECT * FROM t1;
+a
+1
+2
+connection con2;
+XA START 'xa2';
+INSERT INTO t1 (a) VALUES (3);
+connection con1;
+SELECT * FROM t1;
+a
+1
+2
+connection con2;
+INSERT INTO t1 (a) VALUES (4);
+XA END 'xa2';
+connection con1;
+SELECT * FROM t1;
+a
+1
+2
+connection con2;
+XA COMMIT 'xa2' ONE PHASE;
+connection con1;
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+connection con2;
+XA START 'xa3';
+INSERT INTO t1 (a) VALUES (5);
+connection con1;
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+connection con2;
+INSERT INTO t1 (a) VALUES (6);
+XA END 'xa3';
+connection con1;
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+connection con2;
+XA PREPARE 'xa3';
+connection con1;
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+connection con2;
+XA ROLLBACK 'xa3';
+connection con1;
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/xa.test b/mysql-test/suite/storage_engine/trx/xa.test
new file mode 100644
index 00000000000..c64ba7cd27b
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/xa.test
@@ -0,0 +1,118 @@
+#
+# Basic XA transactions syntax
+#
+
+--source ../have_engine.inc
+--source support_xa.inc
+
+--enable_connect_log
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--connect (con1,localhost,root,,)
+--connect (con2,localhost,root,,)
+
+--connection con1
+--let $create_definition = a $int_col
+--source ../create_table.inc
+
+--connection con2
+
+# Two-phase COMMIT
+
+XA START 'xa1';
+INSERT INTO t1 (a) VALUES (1);
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+--connection con2
+INSERT INTO t1 (a) VALUES (2);
+XA END 'xa1';
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+--connection con2
+XA PREPARE 'xa1';
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+--connection con2
+XA RECOVER;
+XA COMMIT 'xa1';
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+# One-phase COMMIT
+
+--connection con2
+XA START 'xa2';
+INSERT INTO t1 (a) VALUES (3);
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+--connection con2
+INSERT INTO t1 (a) VALUES (4);
+XA END 'xa2';
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+--connection con2
+XA COMMIT 'xa2' ONE PHASE;
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+# Rollback
+
+--connection con2
+XA START 'xa3';
+INSERT INTO t1 (a) VALUES (5);
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+--connection con2
+INSERT INTO t1 (a) VALUES (6);
+XA END 'xa3';
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+--connection con2
+XA PREPARE 'xa3';
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+--connection con2
+XA ROLLBACK 'xa3';
+
+--connection con1
+--sorted_result
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/trx/xa_recovery.result b/mysql-test/suite/storage_engine/trx/xa_recovery.result
new file mode 100644
index 00000000000..e14e9a0bf1a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/xa_recovery.result
@@ -0,0 +1,29 @@
+call mtr.add_suppression("Found 2 prepared XA transactions");
+FLUSH TABLES;
+DROP TABLE IF EXISTS t1;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
+CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+XA START 'xa1';
+INSERT INTO t1 (a) VALUES (1),(2);
+XA END 'xa1';
+XA PREPARE 'xa1';
+connection con2;
+XA START 'xa2';
+INSERT INTO t1 (a) VALUES (3);
+INSERT INTO t1 (a) VALUES (4);
+XA END 'xa2';
+XA PREPARE 'xa2';
+connection default;
+XA RECOVER;
+formatID gtrid_length bqual_length data
+1 3 0 xa1
+1 3 0 xa2
+XA ROLLBACK 'xa1';
+XA COMMIT 'xa2';
+SELECT * FROM t1;
+a
+3
+4
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/xa_recovery.test b/mysql-test/suite/storage_engine/trx/xa_recovery.test
new file mode 100644
index 00000000000..d7ac2e782d1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/trx/xa_recovery.test
@@ -0,0 +1,71 @@
+#
+# Server restart with uncommitted XA transactions
+#
+
+--source ../have_engine.inc
+--source support_xa.inc
+
+# Before we start, we want to restart the server gracefully,
+# so GCOV information and everything else is properly stored
+
+--enable_reconnect
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+--shutdown_server 60
+--source include/wait_until_connected_again.inc
+
+
+call mtr.add_suppression("Found 2 prepared XA transactions");
+if (!$support_xa)
+{
+ --disable_query_log
+ call mtr.add_suppression("Table '.*t1' is marked as crashed and should be repaired");
+ call mtr.add_suppression("Checking table: '.*t1'");
+ --enable_query_log
+}
+
+--enable_connect_log
+
+# Close all unused tables to prevent unrelated corruption
+FLUSH TABLES;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--connect (con1,localhost,root,,)
+--connect (con2,localhost,root,,)
+
+--connection con1
+--let $create_definition = a $int_col
+--source ../create_table.inc
+
+XA START 'xa1';
+INSERT INTO t1 (a) VALUES (1),(2);
+XA END 'xa1';
+XA PREPARE 'xa1';
+
+--connection con2
+XA START 'xa2';
+INSERT INTO t1 (a) VALUES (3);
+INSERT INTO t1 (a) VALUES (4);
+XA END 'xa2';
+XA PREPARE 'xa2';
+
+--connection default
+--enable_reconnect
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+--shutdown_server 0
+--source include/wait_until_disconnected.inc
+--source include/wait_until_connected_again.inc
+XA RECOVER;
+XA ROLLBACK 'xa1';
+XA COMMIT 'xa2';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--source ../cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_binary.inc b/mysql-test/suite/storage_engine/type_binary.inc
new file mode 100644
index 00000000000..812a1cc9527
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_binary.inc
@@ -0,0 +1,52 @@
+#
+# BINARY column types
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ b BINARY $col_opts,
+ b0 BINARY(0) $col_opts,
+ b1 BINARY(1) $col_opts,
+ b20 BINARY(20) $col_opts,
+ b255 BINARY(255) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BINARY types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 # 6 #
+ SHOW COLUMNS IN t1;
+
+ # Valid values
+
+ INSERT INTO t1 VALUES ('','','','','');
+ INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+
+ --sorted_result
+ SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
+
+ # Invalid values
+
+ INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+ INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
+
+ --sorted_result
+ SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
+
+ --let $error_codes = ER_TOO_BIG_FIELDLENGTH
+ --let $alter_definition = ADD COLUMN b257 BINARY(257) $col_opts
+ --source alter_table.inc
+ --replace_column 3 # 4 # 5 # 6 #
+ SHOW COLUMNS IN t1;
+
+ DROP TABLE t1;
+}
+
diff --git a/mysql-test/suite/storage_engine/type_binary.result b/mysql-test/suite/storage_engine/type_binary.result
new file mode 100644
index 00000000000..455dbb57a7e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_binary.result
@@ -0,0 +1,62 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b BINARY <CUSTOM_COL_OPTIONS>,
+b0 BINARY(0) <CUSTOM_COL_OPTIONS>,
+b1 BINARY(1) <CUSTOM_COL_OPTIONS>,
+b20 BINARY(20) <CUSTOM_COL_OPTIONS>,
+b255 BINARY(255) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b binary(1) # # # #
+b0 binary(0) # # # #
+b1 binary(1) # # # #
+b20 binary(20) # # # #
+b255 binary(255) # # # #
+INSERT INTO t1 VALUES ('','','','','');
+INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
+HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255)
+00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
+INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b0' at row 1
+Warning 1265 Data truncated for column 'b1' at row 1
+Warning 1265 Data truncated for column 'b20' at row 1
+Warning 1265 Data truncated for column 'b255' at row 1
+INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b0' at row 1
+Warning 1265 Data truncated for column 'b1' at row 1
+Warning 1265 Data truncated for column 'b20' at row 1
+Warning 1265 Data truncated for column 'b255' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'b0' at row 2
+Warning 1265 Data truncated for column 'b1' at row 2
+Warning 1265 Data truncated for column 'b20' at row 2
+Warning 1265 Data truncated for column 'b255' at row 2
+Warning 1265 Data truncated for column 'b' at row 3
+Warning 1265 Data truncated for column 'b0' at row 3
+Warning 1265 Data truncated for column 'b1' at row 3
+Warning 1265 Data truncated for column 'b20' at row 3
+Warning 1265 Data truncated for column 'b255' at row 3
+SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
+HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255)
+00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+43 43 4372656174696E6720616E2061727469636C6520 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
+61 61 6161616161616161616161616161616161616161 787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878
+61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
+78 78 7878787878787878787878787878787878787878 787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878
+ALTER TABLE t1 ADD COLUMN b257 BINARY(257) <CUSTOM_COL_OPTIONS>;
+ERROR 42000: Column length too big for column 'b257' (max = 255); use BLOB or TEXT instead
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b binary(1) # # # #
+b0 binary(0) # # # #
+b1 binary(1) # # # #
+b20 binary(20) # # # #
+b255 binary(255) # # # #
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_binary.test b/mysql-test/suite/storage_engine/type_binary.test
new file mode 100644
index 00000000000..7820e3ab1d2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_binary.test
@@ -0,0 +1,10 @@
+#
+# BINARY column types
+#
+
+--source have_engine.inc
+
+--source type_binary.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_binary_indexes.result b/mysql-test/suite/storage_engine/type_binary_indexes.result
new file mode 100644
index 00000000000..6f828aed100
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_binary_indexes.result
@@ -0,0 +1,126 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b BINARY <CUSTOM_COL_OPTIONS>,
+b20 BINARY(20) <CUSTOM_COL_OPTIONS>,
+v16 VARBINARY(16) <CUSTOM_COL_OPTIONS>,
+v128 VARBINARY(128) <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> b20 (b20)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 b20 # # NULL NULL # #
+INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+SELECT HEX(b20) FROM t1 ORDER BY b20;
+HEX(b20)
+6368617231000000000000000000000000000000
+6368617232000000000000000000000000000000
+6368617233000000000000000000000000000000
+6368617234000000000000000000000000000000
+DROP TABLE t1;
+CREATE TABLE t1 (b BINARY <CUSTOM_COL_OPTIONS>,
+b20 BINARY(20) <CUSTOM_COL_OPTIONS> PRIMARY KEY,
+v16 VARBINARY(16) <CUSTOM_COL_OPTIONS>,
+v128 VARBINARY(128) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 b20 # # NULL NULL # #
+INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+EXPLAIN SELECT HEX(b20) FROM t1 ORDER BY b20;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT HEX(b20) FROM t1 ORDER BY b20;
+HEX(b20)
+6368617231000000000000000000000000000000
+6368617232000000000000000000000000000000
+6368617233000000000000000000000000000000
+6368617234000000000000000000000000000000
+EXPLAIN SELECT HEX(b20) FROM t1 IGNORE INDEX (PRIMARY) ORDER BY b20 DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # NULL # # # #
+SELECT HEX(b20) FROM t1 ORDER BY b20 DESC;
+HEX(b20)
+6368617234000000000000000000000000000000
+6368617233000000000000000000000000000000
+6368617232000000000000000000000000000000
+6368617231000000000000000000000000000000
+DROP TABLE t1;
+CREATE TABLE t1 (b BINARY <CUSTOM_COL_OPTIONS>,
+b20 BINARY(20) <CUSTOM_COL_OPTIONS>,
+v16 VARBINARY(16) <CUSTOM_COL_OPTIONS>,
+v128 VARBINARY(128) <CUSTOM_COL_OPTIONS>,
+UNIQUE INDEX b_v (b,v128)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 b_v 1 b # # NULL NULL # #
+t1 0 b_v 2 v128 # # NULL NULL # #
+INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+EXPLAIN SELECT HEX(b), HEX(v128) FROM t1 WHERE b != 'a' AND v128 > 'varchar';
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # b_v # # # #
+SELECT HEX(b), HEX(v128) FROM t1 WHERE b != 'a' AND v128 > 'varchar';
+HEX(b) HEX(v128)
+62 766172636861723162
+63 766172636861723362
+EXPLAIN SELECT HEX(b), HEX(v128) FROM t1 USE INDEX (b_v) WHERE b != 'a' AND v128 > 'varchar';
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # b_v # # # #
+SELECT HEX(b), HEX(v128) FROM t1 USE INDEX (b_v) WHERE b != 'a' AND v128 > 'varchar';
+HEX(b) HEX(v128)
+62 766172636861723162
+63 766172636861723362
+EXPLAIN SELECT HEX(v128), COUNT(*) FROM t1 GROUP BY HEX(v128);
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # b_v # # # #
+SELECT HEX(v128), COUNT(*) FROM t1 GROUP BY HEX(v128);
+HEX(v128) COUNT(*)
+766172636861723162 2
+766172636861723262 1
+766172636861723362 1
+DROP TABLE t1;
+CREATE TABLE t1 (b BINARY <CUSTOM_COL_OPTIONS>,
+b20 BINARY(20) <CUSTOM_COL_OPTIONS>,
+v16 VARBINARY(16) <CUSTOM_COL_OPTIONS>,
+v128 VARBINARY(128) <CUSTOM_COL_OPTIONS>,
+INDEX (v16(10))
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 v16 1 v16 # # 10 NULL # #
+INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b'),('d','char5','varchar4a','varchar3b'),('e','char6','varchar2a','varchar3b');
+INSERT INTO t1 SELECT * FROM t1;
+EXPLAIN SELECT HEX(SUBSTRING(v16,0,3)) FROM t1 WHERE v16 LIKE 'varchar%';
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # NULL # # # #
+SELECT HEX(SUBSTRING(v16,7,3)) FROM t1 WHERE v16 LIKE 'varchar%';
+HEX(SUBSTRING(v16,7,3))
+723161
+723161
+723161
+723161
+723261
+723261
+723261
+723261
+723361
+723361
+723461
+723461
+EXPLAIN SELECT HEX(SUBSTRING(v16,0,3)) FROM t1 FORCE INDEX (v16) WHERE v16 LIKE 'varchar%';
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # v16 # # # #
+SELECT HEX(SUBSTRING(v16,7,3)) FROM t1 FORCE INDEX (v16) WHERE v16 LIKE 'varchar%';
+HEX(SUBSTRING(v16,7,3))
+723161
+723161
+723161
+723161
+723261
+723261
+723261
+723261
+723361
+723361
+723461
+723461
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_binary_indexes.test b/mysql-test/suite/storage_engine/type_binary_indexes.test
new file mode 100644
index 00000000000..24b16aa5175
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_binary_indexes.test
@@ -0,0 +1,149 @@
+#
+# BINARY and VARBINARY columns with indexes
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Default index as set in define_engine.inc
+
+let $create_definition =
+ b BINARY $col_opts,
+ b20 BINARY(20) $col_indexed_opts,
+ v16 VARBINARY(16) $col_opts,
+ v128 VARBINARY(128) $col_opts,
+ $default_index b20 (b20)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BINARY or VARBINARY types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+
+ SELECT HEX(b20) FROM t1 ORDER BY b20;
+ DROP TABLE t1;
+}
+
+
+# PK, UNIQUE INDEX, INDEX
+
+let $create_definition =
+ b BINARY $col_opts,
+ b20 BINARY(20) $col_indexed_opts PRIMARY KEY,
+ v16 VARBINARY(16) $col_opts,
+ v128 VARBINARY(128) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BINARY or VARBINARY types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT HEX(b20) FROM t1 ORDER BY b20;
+ SELECT HEX(b20) FROM t1 ORDER BY b20;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT HEX(b20) FROM t1 IGNORE INDEX (PRIMARY) ORDER BY b20 DESC;
+ SELECT HEX(b20) FROM t1 ORDER BY b20 DESC;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ b BINARY $col_indexed_opts,
+ b20 BINARY(20) $col_opts,
+ v16 VARBINARY(16) $col_opts,
+ v128 VARBINARY(128) $col_indexed_opts,
+ UNIQUE INDEX b_v (b,v128)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BINARY or VARBINARY types or unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT HEX(b), HEX(v128) FROM t1 WHERE b != 'a' AND v128 > 'varchar';
+ --sorted_result
+ SELECT HEX(b), HEX(v128) FROM t1 WHERE b != 'a' AND v128 > 'varchar';
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT HEX(b), HEX(v128) FROM t1 USE INDEX (b_v) WHERE b != 'a' AND v128 > 'varchar';
+ --sorted_result
+ SELECT HEX(b), HEX(v128) FROM t1 USE INDEX (b_v) WHERE b != 'a' AND v128 > 'varchar';
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT HEX(v128), COUNT(*) FROM t1 GROUP BY HEX(v128);
+ --sorted_result
+ SELECT HEX(v128), COUNT(*) FROM t1 GROUP BY HEX(v128);
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ b BINARY $col_opts,
+ b20 BINARY(20) $col_opts,
+ v16 VARBINARY(16) $col_indexed_opts,
+ v128 VARBINARY(128) $col_opts,
+ INDEX (v16(10))
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BINARY or VARBINARY types or non-unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b'),('d','char5','varchar4a','varchar3b'),('e','char6','varchar2a','varchar3b');
+ INSERT INTO t1 SELECT * FROM t1;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT HEX(SUBSTRING(v16,0,3)) FROM t1 WHERE v16 LIKE 'varchar%';
+ --sorted_result
+ SELECT HEX(SUBSTRING(v16,7,3)) FROM t1 WHERE v16 LIKE 'varchar%';
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT HEX(SUBSTRING(v16,0,3)) FROM t1 FORCE INDEX (v16) WHERE v16 LIKE 'varchar%';
+ --sorted_result
+ SELECT HEX(SUBSTRING(v16,7,3)) FROM t1 FORCE INDEX (v16) WHERE v16 LIKE 'varchar%';
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_bit.inc b/mysql-test/suite/storage_engine/type_bit.inc
new file mode 100644
index 00000000000..1a232305e1c
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_bit.inc
@@ -0,0 +1,76 @@
+#
+# BIT column type
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Valid values
+
+let $create_definition =
+ a BIT $col_opts,
+ b BIT(20) $col_opts,
+ c BIT(64) $col_opts,
+ d BIT(1) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BIT types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ --let $alter_definition = DROP COLUMN d
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --let $alter_definition = ADD COLUMN d BIT(0) $col_opts
+ --source alter_table.inc
+
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+ }
+
+ INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
+ --sorted_result
+ SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0;
+
+ INSERT INTO t1 VALUES (1,0,-1,0);
+ --sorted_result
+ SELECT a+0, b+0, c+0 FROM t1 WHERE d<100;
+
+ INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0);
+ --sorted_result
+ SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2);
+
+ # Out of range values
+ # (should produce warnings)
+
+ INSERT INTO t1 VALUES (0x10,0,0,1);
+ --sorted_result
+ SELECT * FROM t1;
+
+ INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0);
+ --sorted_result
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+
+ --let $error_codes = ER_TOO_BIG_DISPLAYWIDTH
+ --let $create_definition = a BIT(65) $col_opts
+ --source create_table.inc
+}
+
+
diff --git a/mysql-test/suite/storage_engine/type_bit.result b/mysql-test/suite/storage_engine/type_bit.result
new file mode 100644
index 00000000000..69b9ac53d76
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_bit.result
@@ -0,0 +1,47 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a BIT <CUSTOM_COL_OPTIONS>,
+b BIT(20) <CUSTOM_COL_OPTIONS>,
+c BIT(64) <CUSTOM_COL_OPTIONS>,
+d BIT(1) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a bit(1) # # #
+b bit(20) # # #
+c bit(64) # # #
+d bit(1) # # #
+ALTER TABLE t1 DROP COLUMN d;
+ALTER TABLE t1 ADD COLUMN d BIT(0) <CUSTOM_COL_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a bit(1) # # #
+b bit(20) # # #
+c bit(64) # # #
+d bit(1) # # #
+INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
+SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0;
+BIN(a) HEX(b) c+0
+0 FFFFF 18446744073709551615
+INSERT INTO t1 VALUES (1,0,-1,0);
+SELECT a+0, b+0, c+0 FROM t1 WHERE d<100;
+a+0 b+0 c+0
+0 1048575 18446744073709551615
+1 0 18446744073709551615
+INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0);
+SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2);
+a+0 b+0 c+0
+1 0 18446744073709551615
+1 102 255
+INSERT INTO t1 VALUES (0x10,0,0,1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT * FROM t1;
+a b c d
+INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0);
+Warnings:
+Warning 1264 Out of range value for column 'c' at row 1
+SELECT * FROM t1;
+a b c d
+DROP TABLE t1;
+CREATE TABLE t1 (a BIT(65) <CUSTOM_COL_OPTIONS>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ERROR 42000: Display width out of range for 'a' (max = 64)
diff --git a/mysql-test/suite/storage_engine/type_bit.test b/mysql-test/suite/storage_engine/type_bit.test
new file mode 100644
index 00000000000..1670a633f57
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_bit.test
@@ -0,0 +1,10 @@
+#
+# BIT column type
+#
+
+--source have_engine.inc
+
+--source type_bit.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_bit_indexes.result b/mysql-test/suite/storage_engine/type_bit_indexes.result
new file mode 100644
index 00000000000..af8ddf7d6c9
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_bit_indexes.result
@@ -0,0 +1,132 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a BIT <CUSTOM_COL_OPTIONS>,
+b BIT(20) <CUSTOM_COL_OPTIONS>,
+c BIT(32) <CUSTOM_COL_OPTIONS>,
+d BIT(64) <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> b (b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 b # # NULL NULL # #
+INSERT INTO t1 (a,b,c,d) VALUES
+(0,0xFFFFF,0,1),(0,256,0xAAA,0x12345),(1,16,0,0xFFFFFFF),(0,11,12,13),
+(1,100,101,102),(0,12,13,14),(1,13,14,15),(0,101,201,202),(1,1000,1001,1002),
+(1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+SELECT b+0 FROM t1 ORDER BY b;
+b+0
+11
+12
+13
+16
+100
+101
+256
+1000
+65535
+1048575
+DROP TABLE t1;
+CREATE TABLE t1 (a BIT <CUSTOM_COL_OPTIONS>,
+b BIT(20) <CUSTOM_COL_OPTIONS> PRIMARY KEY,
+c BIT(32) <CUSTOM_COL_OPTIONS>,
+d BIT(64) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 b # # NULL NULL # #
+INSERT INTO t1 (a,b,c,d) VALUES
+(0,0xFFFFF,0,1),(0,256,0xAAA,0x12345),(1,16,0,0xFFFFFFF),(0,11,12,13),
+(1,100,101,102),(0,12,13,14),(1,13,14,15),(0,101,201,202),(1,1000,1001,1002),
+(1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+EXPLAIN SELECT b+0 FROM t1 ORDER BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT b+0 FROM t1 ORDER BY b;
+b+0
+11
+12
+13
+16
+100
+101
+256
+1000
+65535
+1048575
+DROP TABLE t1;
+CREATE TABLE t1 (a BIT <CUSTOM_COL_OPTIONS>,
+b BIT(20) <CUSTOM_COL_OPTIONS>,
+c BIT(32) <CUSTOM_COL_OPTIONS>,
+d BIT(64) <CUSTOM_COL_OPTIONS>,
+UNIQUE INDEX b_c (b,c)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 b_c 1 b # # NULL NULL # #
+t1 0 b_c 2 c # # NULL NULL # #
+INSERT INTO t1 (a,b,c,d) VALUES
+(0,0xFFFFF,0,1),(0,256,0xAAA,0x12345),(1,16,0,0xFFFFFFF),(0,11,12,13),
+(1,100,101,102),(0,12,13,14),(1,13,14,15),(0,101,201,202),(1,1000,1001,1002),
+(1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+EXPLAIN SELECT HEX(b+c) FROM t1 WHERE c > 1 OR HEX(b) < 0xFFFFFF;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # b_c # # # #
+SELECT HEX(b+c) FROM t1 WHERE c > 1 OR HEX(b) < 0xFFFFFF;
+HEX(b+c)
+10
+10000FFFE
+12E
+17
+19
+1B
+7D1
+BAA
+C9
+FFFFF
+DROP TABLE t1;
+CREATE TABLE t1 (a BIT <CUSTOM_COL_OPTIONS>,
+b BIT(20) <CUSTOM_COL_OPTIONS>,
+c BIT(32) <CUSTOM_COL_OPTIONS>,
+d BIT(64) <CUSTOM_COL_OPTIONS>,
+INDEX(a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # #
+INSERT INTO t1 (a,b,c,d) VALUES
+(0,0xFFFFF,0,1),(0,256,0xAAA,0x12345),(1,16,0,0xFFFFFFF),(0,11,12,13),
+(1,100,101,102),(0,12,13,14),(1,13,14,15),(0,101,201,202),(1,1000,1001,1002),
+(1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+EXPLAIN SELECT DISTINCT a+0 FROM t1 ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # a # # # #
+SELECT DISTINCT a+0 FROM t1 ORDER BY a;
+a+0
+0
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIT <CUSTOM_COL_OPTIONS>,
+b BIT(20) <CUSTOM_COL_OPTIONS>,
+c BIT(32) <CUSTOM_COL_OPTIONS>,
+d BIT(64) <CUSTOM_COL_OPTIONS>,
+UNIQUE INDEX (d)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 d 1 d # # NULL NULL # #
+INSERT INTO t1 (a,b,c,d) VALUES
+(0,0xFFFFF,0,1),(0,256,0xAAA,0x12345),(1,16,0,0xFFFFFFF),(0,11,12,13),
+(1,100,101,102),(0,12,13,14),(1,13,14,15),(0,101,201,202),(1,1000,1001,1002),
+(1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+EXPLAIN SELECT d FROM t1 WHERE d BETWEEN 1 AND 10000;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # d # # # #
+SELECT d+0 FROM t1 WHERE d BETWEEN 1 AND 10000;
+d+0
+1
+1002
+102
+13
+14
+15
+202
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_bit_indexes.test b/mysql-test/suite/storage_engine/type_bit_indexes.test
new file mode 100644
index 00000000000..df88d50b5d9
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_bit_indexes.test
@@ -0,0 +1,175 @@
+#
+# BIT columns with indexes
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+
+# Default index as set in define_engine.inc
+
+let $create_definition =
+ a BIT $col_opts,
+ b BIT(20) $col_indexed_opts,
+ c BIT(32) $col_opts,
+ d BIT(64) $col_opts,
+ $default_index b (b)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BIT types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a,b,c,d) VALUES
+ (0,0xFFFFF,0,1),(0,256,0xAAA,0x12345),(1,16,0,0xFFFFFFF),(0,11,12,13),
+ (1,100,101,102),(0,12,13,14),(1,13,14,15),(0,101,201,202),(1,1000,1001,1002),
+ (1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+
+ SELECT b+0 FROM t1 ORDER BY b;
+
+ DROP TABLE t1;
+}
+
+
+# PK, UNIQUE KEY, KEY
+
+
+let $create_definition =
+ a BIT $col_opts,
+ b BIT(20) $col_indexed_opts PRIMARY KEY,
+ c BIT(32) $col_opts,
+ d BIT(64) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BIT types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a,b,c,d) VALUES
+ (0,0xFFFFF,0,1),(0,256,0xAAA,0x12345),(1,16,0,0xFFFFFFF),(0,11,12,13),
+ (1,100,101,102),(0,12,13,14),(1,13,14,15),(0,101,201,202),(1,1000,1001,1002),
+ (1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT b+0 FROM t1 ORDER BY b;
+ SELECT b+0 FROM t1 ORDER BY b;
+
+ DROP TABLE t1;
+}
+
+
+let $create_definition =
+ a BIT $col_opts,
+ b BIT(20) $col_indexed_opts,
+ c BIT(32) $col_indexed_opts,
+ d BIT(64) $col_opts,
+UNIQUE INDEX b_c (b,c)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BIT types or unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a,b,c,d) VALUES
+ (0,0xFFFFF,0,1),(0,256,0xAAA,0x12345),(1,16,0,0xFFFFFFF),(0,11,12,13),
+ (1,100,101,102),(0,12,13,14),(1,13,14,15),(0,101,201,202),(1,1000,1001,1002),
+ (1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT HEX(b+c) FROM t1 WHERE c > 1 OR HEX(b) < 0xFFFFFF;
+ --sorted_result
+ SELECT HEX(b+c) FROM t1 WHERE c > 1 OR HEX(b) < 0xFFFFFF;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ a BIT $col_indexed_opts,
+ b BIT(20) $col_opts,
+ c BIT(32) $col_opts,
+ d BIT(64) $col_opts,
+INDEX(a)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BIT types or non-unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a,b,c,d) VALUES
+ (0,0xFFFFF,0,1),(0,256,0xAAA,0x12345),(1,16,0,0xFFFFFFF),(0,11,12,13),
+ (1,100,101,102),(0,12,13,14),(1,13,14,15),(0,101,201,202),(1,1000,1001,1002),
+ (1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT DISTINCT a+0 FROM t1 ORDER BY a;
+ SELECT DISTINCT a+0 FROM t1 ORDER BY a;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ a BIT $col_opts,
+ b BIT(20) $col_opts,
+ c BIT(32) $col_opts,
+ d BIT(64) $col_indexed_opts,
+UNIQUE INDEX (d)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BIT types or unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a,b,c,d) VALUES
+ (0,0xFFFFF,0,1),(0,256,0xAAA,0x12345),(1,16,0,0xFFFFFFF),(0,11,12,13),
+ (1,100,101,102),(0,12,13,14),(1,13,14,15),(0,101,201,202),(1,1000,1001,1002),
+ (1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT d FROM t1 WHERE d BETWEEN 1 AND 10000;
+ --sorted_result
+ SELECT d+0 FROM t1 WHERE d BETWEEN 1 AND 10000;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_blob.inc b/mysql-test/suite/storage_engine/type_blob.inc
new file mode 100644
index 00000000000..93a52fc9971
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_blob.inc
@@ -0,0 +1,65 @@
+#
+# BLOB column types
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ b BLOB $col_opts,
+ b0 BLOB(0) $col_opts,
+ b1 BLOB(1) $col_opts,
+ b300 BLOB(300) $col_opts,
+ bm BLOB(65535) $col_opts,
+ b70k BLOB(70000) $col_opts,
+ b17m BLOB(17000000) $col_opts,
+ t TINYBLOB $col_opts,
+ m MEDIUMBLOB $col_opts,
+ l LONGBLOB $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BLOB types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ # Valid values
+ # (cannot get MAX for all columns due to max_allowed_packet limitations)
+
+ INSERT INTO t1 VALUES
+ ('','','','','','','','','',''),
+ ('a','b','c','d','e','f','g','h','i','j'),
+ ('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
+ ( REPEAT('a',65535), REPEAT('b',65535), REPEAT('c',255), REPEAT('d',65535), REPEAT('e',65535), REPEAT('f',1048576), HEX(REPEAT('g',1048576)), REPEAT('h',255), REPEAT('i',1048576), HEX(REPEAT('j',1048576)) );
+
+ --sorted_result
+ SELECT LENGTH(b), LENGTH(b0), LENGTH(b1), LENGTH(b300), LENGTH(bm), LENGTH(b70k), LENGTH(b17m), LENGTH(t), LENGTH(m), LENGTH(l) FROM t1;
+
+ # Invalid values (produce warnings, except for mediumblob and longblob columns for which the values are within limits)
+
+ INSERT INTO t1 VALUES
+ ( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
+
+ --sorted_result
+ SELECT LENGTH(b), LENGTH(b0), LENGTH(b1), LENGTH(b300), LENGTH(bm), LENGTH(b70k), LENGTH(b17m), LENGTH(t), LENGTH(m), LENGTH(l) FROM t1;
+
+ --let $error_codes = ER_TOO_BIG_DISPLAYWIDTH
+ --let $alter_definition = ADD COLUMN bbb BLOB(4294967296)
+ --source alter_table.inc
+ if ($mysql_errname != ER_TOO_BIG_DISPLAYWIDTH)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+
+ DROP TABLE t1;
+}
+
diff --git a/mysql-test/suite/storage_engine/type_blob.result b/mysql-test/suite/storage_engine/type_blob.result
new file mode 100644
index 00000000000..a93391f749a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_blob.result
@@ -0,0 +1,54 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b BLOB <CUSTOM_COL_OPTIONS>,
+b0 BLOB(0) <CUSTOM_COL_OPTIONS>,
+b1 BLOB(1) <CUSTOM_COL_OPTIONS>,
+b300 BLOB(300) <CUSTOM_COL_OPTIONS>,
+bm BLOB(65535) <CUSTOM_COL_OPTIONS>,
+b70k BLOB(70000) <CUSTOM_COL_OPTIONS>,
+b17m BLOB(17000000) <CUSTOM_COL_OPTIONS>,
+t TINYBLOB <CUSTOM_COL_OPTIONS>,
+m MEDIUMBLOB <CUSTOM_COL_OPTIONS>,
+l LONGBLOB <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b blob # # #
+b0 blob # # #
+b1 tinyblob # # #
+b300 blob # # #
+bm blob # # #
+b70k mediumblob # # #
+b17m longblob # # #
+t tinyblob # # #
+m mediumblob # # #
+l longblob # # #
+INSERT INTO t1 VALUES
+('','','','','','','','','',''),
+('a','b','c','d','e','f','g','h','i','j'),
+('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
+( REPEAT('a',65535), REPEAT('b',65535), REPEAT('c',255), REPEAT('d',65535), REPEAT('e',65535), REPEAT('f',1048576), HEX(REPEAT('g',1048576)), REPEAT('h',255), REPEAT('i',1048576), HEX(REPEAT('j',1048576)) );
+SELECT LENGTH(b), LENGTH(b0), LENGTH(b1), LENGTH(b300), LENGTH(bm), LENGTH(b70k), LENGTH(b17m), LENGTH(t), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m) LENGTH(t) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152
+INSERT INTO t1 VALUES
+( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b0' at row 1
+Warning 1265 Data truncated for column 'b1' at row 1
+Warning 1265 Data truncated for column 'b300' at row 1
+Warning 1265 Data truncated for column 'bm' at row 1
+Warning 1265 Data truncated for column 't' at row 1
+SELECT LENGTH(b), LENGTH(b0), LENGTH(b1), LENGTH(b300), LENGTH(bm), LENGTH(b70k), LENGTH(b17m), LENGTH(t), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m) LENGTH(t) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152
+ALTER TABLE t1 ADD COLUMN bbb BLOB(4294967296);
+ERROR 42000: Display width out of range for 'bbb' (max = 4294967295)
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_blob.test b/mysql-test/suite/storage_engine/type_blob.test
new file mode 100644
index 00000000000..2f8ae88372e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_blob.test
@@ -0,0 +1,10 @@
+#
+# BLOB column types
+#
+
+--source have_engine.inc
+
+--source type_blob.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_blob_indexes.result b/mysql-test/suite/storage_engine/type_blob_indexes.result
new file mode 100644
index 00000000000..8e732e153b9
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_blob_indexes.result
@@ -0,0 +1,152 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b BLOB <CUSTOM_COL_OPTIONS>,
+t TINYBLOB <CUSTOM_COL_OPTIONS>,
+m MEDIUMBLOB <CUSTOM_COL_OPTIONS>,
+l LONGBLOB <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> b (b(32))
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 b # # 32 NULL # #
+INSERT INTO t1 (b,t,m,l) VALUES
+('','','',''),
+('a','b','c','d'),
+('b','d','c','b'),
+('test1','test2','test3','test4'),
+(REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+(HEX('abcd'),HEX('def'),HEX('a'),HEX('abc')),
+('abc','def','ghi','jkl'),
+('test2','test3','test4','test5'),
+('test3','test4','test5','test6'),
+(REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+(REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+SELECT SUBSTRING(b,16) AS f FROM t1 WHERE b IN ('test1','test2') ORDER BY f;
+f
+
+
+SELECT SUBSTRING(b,16) AS f FROM t1 USE INDEX () WHERE b IN ('test1','test2') ORDER BY f;
+f
+
+
+DROP TABLE t1;
+CREATE TABLE t1 (b BLOB <CUSTOM_COL_OPTIONS>,
+t TINYBLOB <CUSTOM_COL_OPTIONS>,
+m MEDIUMBLOB <CUSTOM_COL_OPTIONS>,
+l LONGBLOB <CUSTOM_COL_OPTIONS>,
+PRIMARY KEY b (b(32))
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 b # # 32 NULL # #
+INSERT INTO t1 (b,t,m,l) VALUES
+('','','',''),
+('a','b','c','d'),
+('b','d','c','b'),
+('test1','test2','test3','test4'),
+(REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+(HEX('abcd'),HEX('def'),HEX('a'),HEX('abc')),
+('abc','def','ghi','jkl'),
+('test2','test3','test4','test5'),
+('test3','test4','test5','test6'),
+(REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+(REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+EXPLAIN SELECT SUBSTRING(b,16) AS f FROM t1 WHERE b IN ('test1','test2') ORDER BY f;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT SUBSTRING(b,16) AS f FROM t1 WHERE b IN ('test1','test2') ORDER BY f;
+f
+
+
+EXPLAIN SELECT SUBSTRING(b,16) AS f FROM t1 USE INDEX () WHERE b IN ('test1','test2') ORDER BY f;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # NULL # # # #
+SELECT SUBSTRING(b,16) AS f FROM t1 USE INDEX () WHERE b IN ('test1','test2') ORDER BY f;
+f
+
+
+DROP TABLE t1;
+CREATE TABLE t1 (b BLOB <CUSTOM_COL_OPTIONS>,
+t TINYBLOB <CUSTOM_COL_OPTIONS>,
+m MEDIUMBLOB <CUSTOM_COL_OPTIONS>,
+l LONGBLOB <CUSTOM_COL_OPTIONS>,
+UNIQUE INDEX l_t (l(256),t(64))
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 l_t 1 l # # 256 NULL # #
+t1 0 l_t 2 t # # 64 NULL # #
+INSERT INTO t1 (b,t,m,l) VALUES
+('','','',''),
+('a','b','c','d'),
+('b','d','c','b'),
+('test1','test2','test3','test4'),
+(REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+(HEX('abcd'),HEX('def'),HEX('a'),HEX('abc')),
+('abc','def','ghi','jkl'),
+('test2','test3','test4','test5'),
+('test3','test4','test5','test6'),
+(REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+(REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+EXPLAIN SELECT SUBSTRING(t,64), SUBSTRING(l,256) FROM t1 WHERE t!=l AND l NOT IN ('test1') ORDER BY t, l DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # l_t # # # # #
+SELECT SUBSTRING(t,64), SUBSTRING(l,256) FROM t1 WHERE t!=l AND l NOT IN ('test1') ORDER BY t, l DESC;
+SUBSTRING(t,64) SUBSTRING(l,256)
+
+
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+
+
+fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+
+
+
+EXPLAIN SELECT SUBSTRING(t,64), SUBSTRING(l,256) FROM t1 FORCE INDEX (l_t) WHERE t!=l AND l NOT IN ('test1') ORDER BY t, l DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # l_t # # # # #
+SELECT SUBSTRING(t,64), SUBSTRING(l,256) FROM t1 FORCE INDEX (l_t) WHERE t!=l AND l NOT IN ('test1') ORDER BY t, l DESC;
+SUBSTRING(t,64) SUBSTRING(l,256)
+
+
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+
+
+fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+
+
+
+DROP TABLE t1;
+CREATE TABLE t1 (b BLOB <CUSTOM_COL_OPTIONS>,
+t TINYBLOB <CUSTOM_COL_OPTIONS>,
+m MEDIUMBLOB <CUSTOM_COL_OPTIONS>,
+l LONGBLOB <CUSTOM_COL_OPTIONS>,
+INDEX (m(128))
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 m 1 m # # 128 NULL # #
+INSERT INTO t1 (b,t,m,l) VALUES
+('','','',''),
+('a','b','c','d'),
+('b','d','c','b'),
+('test1','test2','test3','test4'),
+(REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+(HEX('abcd'),HEX('def'),HEX('a'),HEX('abc')),
+('abc','def','ghi','jkl'),
+('test2','test3','test4','test5'),
+('test3','test4','test5','test6'),
+(REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+(REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+EXPLAIN SELECT SUBSTRING(m,128) AS f FROM t1 WHERE m = 'test1' ORDER BY f DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # m # # # #
+SELECT SUBSTRING(m,128) AS f FROM t1 WHERE m = 'test1' ORDER BY f DESC;
+f
+EXPLAIN SELECT SUBSTRING(m,128) AS f FROM t1 IGNORE INDEX FOR ORDER BY (m) WHERE m = 'test1' ORDER BY f DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # m # # # #
+SELECT SUBSTRING(m,128) AS f FROM t1 IGNORE INDEX FOR ORDER BY (m) WHERE m = 'test1' ORDER BY f DESC;
+f
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_blob_indexes.test b/mysql-test/suite/storage_engine/type_blob_indexes.test
new file mode 100644
index 00000000000..7a3e09939bf
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_blob_indexes.test
@@ -0,0 +1,188 @@
+#
+# BLOB columns with indexes
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+
+# Default index as set in define_engine.inc
+
+let $create_definition =
+ b BLOB $col_indexed_opts,
+ t TINYBLOB $col_opts,
+ m MEDIUMBLOB $col_opts,
+ l LONGBLOB $col_opts,
+ $default_index b (b(32))
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BLOB types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (b,t,m,l) VALUES
+ ('','','',''),
+ ('a','b','c','d'),
+ ('b','d','c','b'),
+ ('test1','test2','test3','test4'),
+ (REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+ (HEX('abcd'),HEX('def'),HEX('a'),HEX('abc')),
+ ('abc','def','ghi','jkl'),
+ ('test2','test3','test4','test5'),
+ ('test3','test4','test5','test6'),
+ (REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+ (REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+
+ SELECT SUBSTRING(b,16) AS f FROM t1 WHERE b IN ('test1','test2') ORDER BY f;
+ SELECT SUBSTRING(b,16) AS f FROM t1 USE INDEX () WHERE b IN ('test1','test2') ORDER BY f;
+
+ DROP TABLE t1;
+}
+
+
+
+# PK, UNIQUE INDEX, INDEX
+
+let $create_definition =
+ b BLOB $col_indexed_opts,
+ t TINYBLOB $col_opts,
+ m MEDIUMBLOB $col_opts,
+ l LONGBLOB $col_opts,
+ PRIMARY KEY b (b(32))
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BLOB types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (b,t,m,l) VALUES
+ ('','','',''),
+ ('a','b','c','d'),
+ ('b','d','c','b'),
+ ('test1','test2','test3','test4'),
+ (REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+ (HEX('abcd'),HEX('def'),HEX('a'),HEX('abc')),
+ ('abc','def','ghi','jkl'),
+ ('test2','test3','test4','test5'),
+ ('test3','test4','test5','test6'),
+ (REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+ (REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(b,16) AS f FROM t1 WHERE b IN ('test1','test2') ORDER BY f;
+ SELECT SUBSTRING(b,16) AS f FROM t1 WHERE b IN ('test1','test2') ORDER BY f;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(b,16) AS f FROM t1 USE INDEX () WHERE b IN ('test1','test2') ORDER BY f;
+ SELECT SUBSTRING(b,16) AS f FROM t1 USE INDEX () WHERE b IN ('test1','test2') ORDER BY f;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ b BLOB $col_opts,
+ t TINYBLOB $col_indexed_opts,
+ m MEDIUMBLOB $col_opts,
+ l LONGBLOB $col_indexed_opts,
+ UNIQUE INDEX l_t (l(256),t(64))
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BLOB types or unique indexes or multi-part indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (b,t,m,l) VALUES
+ ('','','',''),
+ ('a','b','c','d'),
+ ('b','d','c','b'),
+ ('test1','test2','test3','test4'),
+ (REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+ (HEX('abcd'),HEX('def'),HEX('a'),HEX('abc')),
+ ('abc','def','ghi','jkl'),
+ ('test2','test3','test4','test5'),
+ ('test3','test4','test5','test6'),
+ (REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+ (REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+
+ # Here we are getting possible key l_t, but not the final key
+ --replace_column 1 # 2 # 3 # 4 # 6 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(t,64), SUBSTRING(l,256) FROM t1 WHERE t!=l AND l NOT IN ('test1') ORDER BY t, l DESC;
+ SELECT SUBSTRING(t,64), SUBSTRING(l,256) FROM t1 WHERE t!=l AND l NOT IN ('test1') ORDER BY t, l DESC;
+
+ --replace_column 1 # 2 # 3 # 4 # 6 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(t,64), SUBSTRING(l,256) FROM t1 FORCE INDEX (l_t) WHERE t!=l AND l NOT IN ('test1') ORDER BY t, l DESC;
+ SELECT SUBSTRING(t,64), SUBSTRING(l,256) FROM t1 FORCE INDEX (l_t) WHERE t!=l AND l NOT IN ('test1') ORDER BY t, l DESC;
+ DROP TABLE t1;
+
+}
+
+let $create_definition =
+ b BLOB $col_opts,
+ t TINYBLOB $col_opts,
+ m MEDIUMBLOB $col_indexed_opts,
+ l LONGBLOB $col_opts,
+ INDEX (m(128))
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BLOB types or non-unique indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (b,t,m,l) VALUES
+ ('','','',''),
+ ('a','b','c','d'),
+ ('b','d','c','b'),
+ ('test1','test2','test3','test4'),
+ (REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+ (HEX('abcd'),HEX('def'),HEX('a'),HEX('abc')),
+ ('abc','def','ghi','jkl'),
+ ('test2','test3','test4','test5'),
+ ('test3','test4','test5','test6'),
+ (REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+ (REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(m,128) AS f FROM t1 WHERE m = 'test1' ORDER BY f DESC;
+ SELECT SUBSTRING(m,128) AS f FROM t1 WHERE m = 'test1' ORDER BY f DESC;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(m,128) AS f FROM t1 IGNORE INDEX FOR ORDER BY (m) WHERE m = 'test1' ORDER BY f DESC;
+ SELECT SUBSTRING(m,128) AS f FROM t1 IGNORE INDEX FOR ORDER BY (m) WHERE m = 'test1' ORDER BY f DESC;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_bool.inc b/mysql-test/suite/storage_engine/type_bool.inc
new file mode 100644
index 00000000000..ae7d0043c49
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_bool.inc
@@ -0,0 +1,81 @@
+#
+# BOOLEAN column type
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ b1 BOOL $col_opts,
+ b2 BOOLEAN $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = BOOLEAN types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ # Valid values
+
+ INSERT INTO t1 VALUES (1,TRUE);
+ --sorted_result
+ SELECT * FROM t1;
+
+ INSERT INTO t1 VALUES (FALSE,0);
+ --sorted_result
+ SELECT * FROM t1;
+
+ INSERT INTO t1 VALUES (2,3);
+ --sorted_result
+ SELECT * FROM t1;
+
+ INSERT INTO t1 VALUES (-1,-2);
+ --sorted_result
+ SELECT * FROM t1;
+
+ --sorted_result
+ SELECT IF(b1,'true','false') AS a, IF(b2,'true','false') AS b FROM t1;
+
+ --sorted_result
+ SELECT * FROM t1 WHERE b1 = TRUE;
+
+ --sorted_result
+ SELECT * FROM t1 WHERE b2 = FALSE;
+
+ # Invalid values
+
+ INSERT INTO t1 VALUES ('a','b');
+ --sorted_result
+ SELECT * FROM t1;
+
+ INSERT INTO t1 VALUES (128,-129);
+ --sorted_result
+ SELECT * FROM t1;
+
+ # This is why we don't have zerofill and unsigned tests
+ # for boolean columns:
+ --let $error_codes = ER_PARSE_ERROR
+ --let $alter_definition = ADD COLUMN b3 BOOLEAN UNSIGNED
+ --source alter_table.inc
+ if ($mysql_errname != ER_PARSE_ERROR)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+ --let $error_codes = ER_PARSE_ERROR
+ --let $alter_definition = ADD COLUMN b3 BOOL ZEROFILL
+ --source alter_table.inc
+
+ DROP TABLE t1;
+}
+
+
diff --git a/mysql-test/suite/storage_engine/type_bool.result b/mysql-test/suite/storage_engine/type_bool.result
new file mode 100644
index 00000000000..89beaa11a16
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_bool.result
@@ -0,0 +1,70 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (b1 BOOL <CUSTOM_COL_OPTIONS>,
+b2 BOOLEAN <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+b1 tinyint(1) # # #
+b2 tinyint(1) # # #
+INSERT INTO t1 VALUES (1,TRUE);
+SELECT * FROM t1;
+b1 b2
+1 1
+INSERT INTO t1 VALUES (FALSE,0);
+SELECT * FROM t1;
+b1 b2
+0 0
+1 1
+INSERT INTO t1 VALUES (2,3);
+SELECT * FROM t1;
+b1 b2
+0 0
+1 1
+2 3
+INSERT INTO t1 VALUES (-1,-2);
+SELECT * FROM t1;
+b1 b2
+-1 -2
+0 0
+1 1
+2 3
+SELECT IF(b1,'true','false') AS a, IF(b2,'true','false') AS b FROM t1;
+a b
+false false
+true true
+true true
+true true
+SELECT * FROM t1 WHERE b1 = TRUE;
+b1 b2
+1 1
+SELECT * FROM t1 WHERE b2 = FALSE;
+b1 b2
+0 0
+INSERT INTO t1 VALUES ('a','b');
+Warnings:
+Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
+Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
+SELECT * FROM t1;
+b1 b2
+-1 -2
+0 0
+0 0
+1 1
+2 3
+INSERT INTO t1 VALUES (128,-129);
+Warnings:
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b2' at row 1
+SELECT * FROM t1;
+b1 b2
+-1 -2
+0 0
+0 0
+1 1
+127 -128
+2 3
+ALTER TABLE t1 ADD COLUMN b3 BOOLEAN UNSIGNED;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNSIGNED' at line 1
+ALTER TABLE t1 ADD COLUMN b3 BOOL ZEROFILL;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ZEROFILL' at line 1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_bool.test b/mysql-test/suite/storage_engine/type_bool.test
new file mode 100644
index 00000000000..40ef56769e9
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_bool.test
@@ -0,0 +1,10 @@
+#
+# BOOLEAN column type
+#
+
+--source have_engine.inc
+
+--source type_bool.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_char.inc b/mysql-test/suite/storage_engine/type_char.inc
new file mode 100644
index 00000000000..8484fc23b10
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_char.inc
@@ -0,0 +1,59 @@
+#
+# CHAR column types
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ c CHAR $col_opts,
+ c0 CHAR(0) $col_opts,
+ c1 CHAR(1) $col_opts,
+ c20 CHAR(20) $col_opts,
+ c255 CHAR(255) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = CHAR types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ # Valid values
+
+ INSERT INTO t1 VALUES ('','','','','');
+ INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Invalid values
+
+ INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+ INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ --sorted_result
+ SELECT DISTINCT c20, REPEAT('a',LENGTH(c20)), COUNT(*) FROM t1 GROUP BY c1, c20;
+
+ --let $error_codes = ER_TOO_BIG_FIELDLENGTH
+ --let $alter_definition = ADD COLUMN c257 CHAR(257) $col_opts
+ --source alter_table.inc
+ if ($mysql_errname != ER_TOO_BIG_FIELDLENGTH)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+ DROP TABLE t1;
+}
+
+
diff --git a/mysql-test/suite/storage_engine/type_char.result b/mysql-test/suite/storage_engine/type_char.result
new file mode 100644
index 00000000000..61d3cf2419d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_char.result
@@ -0,0 +1,56 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS>,
+c0 CHAR(0) <CUSTOM_COL_OPTIONS>,
+c1 CHAR(1) <CUSTOM_COL_OPTIONS>,
+c20 CHAR(20) <CUSTOM_COL_OPTIONS>,
+c255 CHAR(255) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+c char(1) # # #
+c0 char(0) # # #
+c1 char(1) # # #
+c20 char(20) # # #
+c255 char(255) # # #
+INSERT INTO t1 VALUES ('','','','','');
+INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+SELECT * FROM t1;
+c c0 c1 c20 c255
+
+a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.
+INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'c0' at row 1
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c20' at row 1
+Warning 1265 Data truncated for column 'c255' at row 1
+INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 2
+Warning 1265 Data truncated for column 'c0' at row 2
+Warning 1265 Data truncated for column 'c1' at row 2
+Warning 1265 Data truncated for column 'c20' at row 2
+Warning 1265 Data truncated for column 'c' at row 3
+Warning 1265 Data truncated for column 'c0' at row 3
+Warning 1265 Data truncated for column 'c1' at row 3
+Warning 1265 Data truncated for column 'c20' at row 3
+Warning 1265 Data truncated for column 'c255' at row 3
+SELECT * FROM t1;
+c c0 c1 c20 c255
+
+
+C C Creating an article Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.b
+a a aaaaaaaaaaaaaaaaaaaa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.
+x x xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+SELECT DISTINCT c20, REPEAT('a',LENGTH(c20)), COUNT(*) FROM t1 GROUP BY c1, c20;
+c20 REPEAT('a',LENGTH(c20)) COUNT(*)
+ 2
+Creating an article aaaaaaaaaaaaaaaaaaa 1
+aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaa 1
+abcdefghi klmnopqrst aaaaaaaaaaaaaaaaaaaa 1
+xxxxxxxxxxxxxxxxxxxx aaaaaaaaaaaaaaaaaaaa 1
+ALTER TABLE t1 ADD COLUMN c257 CHAR(257) <CUSTOM_COL_OPTIONS>;
+ERROR 42000: Column length too big for column 'c257' (max = 255); use BLOB or TEXT instead
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_char.test b/mysql-test/suite/storage_engine/type_char.test
new file mode 100644
index 00000000000..ef552f47060
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_char.test
@@ -0,0 +1,10 @@
+#
+# CHAR column types
+#
+
+--source have_engine.inc
+
+--source type_char.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_char_indexes.result b/mysql-test/suite/storage_engine/type_char_indexes.result
new file mode 100644
index 00000000000..f02fcef3ef0
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_char_indexes.result
@@ -0,0 +1,144 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS>,
+c20 CHAR(20) <CUSTOM_COL_OPTIONS>,
+v16 VARCHAR(16) <CUSTOM_COL_OPTIONS>,
+v128 VARCHAR(128) <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> c20 (c20)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 c20 # # NULL NULL # #
+INSERT INTO t1 (c,c20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+SELECT c20 FROM t1 ORDER BY c20;
+c20
+char1
+char2
+char3
+char4
+DROP TABLE t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS>,
+c20 CHAR(20) <CUSTOM_COL_OPTIONS>,
+v16 VARCHAR(16) <CUSTOM_COL_OPTIONS>,
+v128 VARCHAR(128) <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> v16 (v16)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 v16 # # NULL NULL # #
+INSERT INTO t1 (c,c20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char1','varchar3a','varchar1b'),('c','char4','varchar4a','varchar4b');
+SELECT v16 FROM t1 ORDER BY v16;
+v16
+varchar1a
+varchar2a
+varchar3a
+varchar4a
+DROP TABLE t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS>,
+c20 CHAR(20) <CUSTOM_COL_OPTIONS> PRIMARY KEY,
+v16 VARCHAR(16) <CUSTOM_COL_OPTIONS>,
+v128 VARCHAR(128) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 c20 # # NULL NULL # #
+INSERT INTO t1 (c,c20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+EXPLAIN SELECT c20 FROM t1 ORDER BY c20;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT c20 FROM t1 ORDER BY c20;
+c20
+char1
+char2
+char3
+char4
+EXPLAIN SELECT c20 FROM t1 FORCE INDEX FOR ORDER BY (PRIMARY) ORDER BY c20;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT c20 FROM t1 FORCE INDEX FOR ORDER BY (PRIMARY) ORDER BY c20;
+c20
+char1
+char2
+char3
+char4
+DROP TABLE t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS>,
+c20 CHAR(20) <CUSTOM_COL_OPTIONS>,
+v16 VARCHAR(16) <CUSTOM_COL_OPTIONS>,
+v128 VARCHAR(128) <CUSTOM_COL_OPTIONS>,
+UNIQUE INDEX c_v (c,v128)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 c_v 1 c # # NULL NULL # #
+t1 0 c_v 2 v128 # # NULL NULL # #
+INSERT INTO t1 (c,c20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+EXPLAIN SELECT c, v128 FROM t1 WHERE c != 'a' AND v128 > 'varchar';
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # c_v # # # #
+SELECT c, v128 FROM t1 WHERE c != 'a' AND v128 > 'varchar';
+c v128
+b varchar1b
+c varchar3b
+EXPLAIN SELECT v128, COUNT(*) FROM t1 GROUP BY v128;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # c_v # # # #
+SELECT v128, COUNT(*) FROM t1 GROUP BY v128;
+v128 COUNT(*)
+varchar1b 2
+varchar2b 1
+varchar3b 1
+EXPLAIN SELECT v128, COUNT(*) FROM t1 USE INDEX FOR GROUP BY (c_v) GROUP BY v128;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # c_v # # # #
+SELECT v128, COUNT(*) FROM t1 USE INDEX FOR GROUP BY (c_v) GROUP BY v128;
+v128 COUNT(*)
+varchar1b 2
+varchar2b 1
+varchar3b 1
+SET SESSION optimizer_switch = 'engine_condition_pushdown=on';
+EXPLAIN SELECT * FROM t1 WHERE c > 'a';
+id select_type table type possible_keys key key_len ref rows Extra
+# # # range c_v c_v # # # Using index condition
+SELECT * FROM t1 WHERE c > 'a';
+c c20 v16 v128
+b char3 varchar1a varchar1b
+c char4 varchar3a varchar3b
+SET SESSION optimizer_switch = @@global.optimizer_switch;
+DROP TABLE t1;
+CREATE TABLE t1 (c CHAR <CUSTOM_COL_OPTIONS>,
+c20 CHAR(20) <CUSTOM_COL_OPTIONS>,
+v16 VARCHAR(16) <CUSTOM_COL_OPTIONS>,
+v128 VARCHAR(128) <CUSTOM_COL_OPTIONS>,
+INDEX (v16)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 v16 1 v16 # # NULL NULL # #
+INSERT INTO t1 (c,c20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+EXPLAIN SELECT SUBSTRING(v16,0,3) FROM t1 WHERE v16 LIKE 'varchar%';
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # v16 # # # #
+SELECT SUBSTRING(v16,7,3) FROM t1 WHERE v16 LIKE 'varchar%';
+SUBSTRING(v16,7,3)
+r1a
+r1a
+r2a
+r3a
+EXPLAIN SELECT SUBSTRING(v16,0,3) FROM t1 IGNORE INDEX (v16) WHERE v16 LIKE 'varchar%';
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # NULL # # # #
+SELECT SUBSTRING(v16,7,3) FROM t1 IGNORE INDEX (v16) WHERE v16 LIKE 'varchar%';
+SUBSTRING(v16,7,3)
+r1a
+r1a
+r2a
+r3a
+EXPLAIN SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # range # v16 # # # #
+SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+c c20 v16 v128
+a char1 varchar1a varchar1b
+b char3 varchar1a varchar1b
+c char4 varchar3a varchar3b
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_char_indexes.test b/mysql-test/suite/storage_engine/type_char_indexes.test
new file mode 100644
index 00000000000..582800eabba
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_char_indexes.test
@@ -0,0 +1,186 @@
+#
+# CHAR and VARCHAR columns with indexes
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Default index as set in define_engine.inc
+
+let $create_definition =
+ c CHAR $col_opts,
+ c20 CHAR(20) $col_indexed_opts,
+ v16 VARCHAR(16) $col_opts,
+ v128 VARCHAR(128) $col_opts,
+ $default_index c20 (c20)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = CHAR or VARCHAR types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (c,c20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+
+ SELECT c20 FROM t1 ORDER BY c20;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ c CHAR $col_opts,
+ c20 CHAR(20) $col_opts,
+ v16 VARCHAR(16) $col_indexed_opts,
+ v128 VARCHAR(128) $col_opts,
+ $default_index v16 (v16)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = CHAR or VARCHAR types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (c,c20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char1','varchar3a','varchar1b'),('c','char4','varchar4a','varchar4b');
+
+ SELECT v16 FROM t1 ORDER BY v16;
+
+ DROP TABLE t1;
+}
+
+
+# PK, UNIQUE INDEX, INDEX
+
+let $create_definition =
+ c CHAR $col_opts,
+ c20 CHAR(20) $col_indexed_opts PRIMARY KEY,
+ v16 VARCHAR(16) $col_opts,
+ v128 VARCHAR(128) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = CHAR or VARCHAR types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (c,c20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT c20 FROM t1 ORDER BY c20;
+ SELECT c20 FROM t1 ORDER BY c20;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT c20 FROM t1 FORCE INDEX FOR ORDER BY (PRIMARY) ORDER BY c20;
+ SELECT c20 FROM t1 FORCE INDEX FOR ORDER BY (PRIMARY) ORDER BY c20;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ c CHAR $col_indexed_opts,
+ c20 CHAR(20) $col_opts,
+ v16 VARCHAR(16) $col_opts,
+ v128 VARCHAR(128) $col_indexed_opts,
+ UNIQUE INDEX c_v (c,v128)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = CHAR or VARCHAR types or unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (c,c20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT c, v128 FROM t1 WHERE c != 'a' AND v128 > 'varchar';
+ --sorted_result
+ SELECT c, v128 FROM t1 WHERE c != 'a' AND v128 > 'varchar';
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT v128, COUNT(*) FROM t1 GROUP BY v128;
+ --sorted_result
+ SELECT v128, COUNT(*) FROM t1 GROUP BY v128;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT v128, COUNT(*) FROM t1 USE INDEX FOR GROUP BY (c_v) GROUP BY v128;
+ --sorted_result
+ SELECT v128, COUNT(*) FROM t1 USE INDEX FOR GROUP BY (c_v) GROUP BY v128;
+
+ SET SESSION optimizer_switch = 'engine_condition_pushdown=on';
+ --replace_column 1 # 2 # 3 # 7 # 8 # 9 #
+ EXPLAIN SELECT * FROM t1 WHERE c > 'a';
+ --sorted_result
+ SELECT * FROM t1 WHERE c > 'a';
+ SET SESSION optimizer_switch = @@global.optimizer_switch;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ c CHAR $col_opts,
+ c20 CHAR(20) $col_opts,
+ v16 VARCHAR(16) $col_indexed_opts,
+ v128 VARCHAR(128) $col_opts,
+ INDEX (v16)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = CHAR or VARCHAR types or non-unique indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (c,c20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b');
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(v16,0,3) FROM t1 WHERE v16 LIKE 'varchar%';
+ --sorted_result
+ SELECT SUBSTRING(v16,7,3) FROM t1 WHERE v16 LIKE 'varchar%';
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(v16,0,3) FROM t1 IGNORE INDEX (v16) WHERE v16 LIKE 'varchar%';
+ --sorted_result
+ SELECT SUBSTRING(v16,7,3) FROM t1 IGNORE INDEX (v16) WHERE v16 LIKE 'varchar%';
+
+ --replace_column 1 # 2 # 3 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+ --sorted_result
+ SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_date_time.inc b/mysql-test/suite/storage_engine/type_date_time.inc
new file mode 100644
index 00000000000..d0b953984be
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_date_time.inc
@@ -0,0 +1,55 @@
+#
+# Date and time column types
+# (DATE, DATETIME, TIMESTAMP, TIME, YEAR)
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ d DATE $col_opts,
+ dt DATETIME $col_opts,
+ ts TIMESTAMP $col_opts,
+ t TIME $col_opts,
+ y YEAR $col_opts,
+ y4 YEAR(4) $col_opts,
+ y2 YEAR(2) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Date and time types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ SET @tm = '2012-04-09 05:27:00';
+
+ # Valid values
+ # '1970-01-01 00:00:01'
+ INSERT INTO t1 VALUES
+ ('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'),
+ ('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'),
+ ('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'),
+ (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm));
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Invalid values
+
+ INSERT INTO t1 VALUES
+ ('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' );
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+}
+
+
diff --git a/mysql-test/suite/storage_engine/type_date_time.result b/mysql-test/suite/storage_engine/type_date_time.result
new file mode 100644
index 00000000000..ba3a888562e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_date_time.result
@@ -0,0 +1,48 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS>,
+dt DATETIME <CUSTOM_COL_OPTIONS>,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS>,
+t TIME <CUSTOM_COL_OPTIONS>,
+y YEAR <CUSTOM_COL_OPTIONS>,
+y4 YEAR(4) <CUSTOM_COL_OPTIONS>,
+y2 YEAR(2) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+d date # # #
+dt datetime # # #
+ts timestamp # # # on update CURRENT_TIMESTAMP
+t time # # #
+y year(4) # # #
+y4 year(4) # # #
+y2 year(2) # # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 VALUES
+('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'),
+('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'),
+('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm));
+SELECT * FROM t1;
+d dt ts t y y4 y2
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
+1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00
+2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
+9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99
+INSERT INTO t1 VALUES
+('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' );
+Warnings:
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'dt' at row 1
+Warning 1265 Data truncated for column 'ts' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 'y' at row 1
+Warning 1264 Out of range value for column 'y4' at row 1
+Warning 1264 Out of range value for column 'y2' at row 1
+SELECT * FROM t1;
+d dt ts t y y4 y2
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
+1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00
+2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
+9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_date_time.test b/mysql-test/suite/storage_engine/type_date_time.test
new file mode 100644
index 00000000000..7f6c325ec3e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_date_time.test
@@ -0,0 +1,11 @@
+#
+# Date and time column types
+# (DATE, DATETIME, TIMESTAMP, TIME, YEAR)
+#
+
+--source have_engine.inc
+
+--source type_date_time.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_date_time_indexes.result b/mysql-test/suite/storage_engine/type_date_time_indexes.result
new file mode 100644
index 00000000000..f259aea2cc4
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_date_time_indexes.result
@@ -0,0 +1,278 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS>,
+dt DATETIME <CUSTOM_COL_OPTIONS>,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS>,
+t TIME <CUSTOM_COL_OPTIONS>,
+y YEAR <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> d (d)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 d # # NULL NULL # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+('2012-01-22', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+SELECT d FROM t1 ORDER BY d LIMIT 3;
+d
+2011-03-31
+2012-01-12
+2012-01-22
+DROP TABLE t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS>,
+dt DATETIME <CUSTOM_COL_OPTIONS>,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS>,
+t TIME <CUSTOM_COL_OPTIONS>,
+y YEAR <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> dt (dt)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 dt # # NULL NULL # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+SELECT dt FROM t1 ORDER BY dt LIMIT 3;
+dt
+2010-11-22 11:43:14
+2010-11-22 12:33:54
+2011-08-27 21:33:56
+DROP TABLE t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS>,
+dt DATETIME <CUSTOM_COL_OPTIONS>,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS>,
+t TIME <CUSTOM_COL_OPTIONS>,
+y YEAR <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> ts (ts)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 ts # # NULL NULL # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:25', '00:12:33', '2000'),
+('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+SELECT ts FROM t1 ORDER BY ts LIMIT 3;
+ts
+1997-01-31 11:54:01
+1999-03-30 19:11:08
+1999-04-30 19:11:08
+DROP TABLE t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS>,
+dt DATETIME <CUSTOM_COL_OPTIONS>,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS>,
+t TIME <CUSTOM_COL_OPTIONS>,
+y YEAR <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> t (t)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 t # # NULL NULL # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:25', '00:12:33', '2000'),
+('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+SELECT t FROM t1 ORDER BY t LIMIT 3;
+t
+00:12:32
+00:12:33
+05:27:00
+DROP TABLE t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS>,
+dt DATETIME <CUSTOM_COL_OPTIONS>,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS>,
+t TIME <CUSTOM_COL_OPTIONS>,
+y YEAR <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> y (y)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 y # # NULL NULL # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:25', '00:12:33', '2000'),
+('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+SELECT y FROM t1 ORDER BY y LIMIT 3;
+y
+1994
+1998
+1999
+DROP TABLE t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS>,
+dt DATETIME <CUSTOM_COL_OPTIONS> PRIMARY KEY,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS>,
+t TIME <CUSTOM_COL_OPTIONS>,
+y YEAR <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 dt # # NULL NULL # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+EXPLAIN SELECT dt FROM t1 ORDER BY dt LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT dt FROM t1 ORDER BY dt LIMIT 3;
+dt
+2010-11-22 11:43:14
+2010-11-22 12:33:54
+2011-08-27 21:33:56
+EXPLAIN SELECT dt FROM t1 FORCE INDEX FOR ORDER BY (PRIMARY) ORDER BY dt LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT dt FROM t1 FORCE INDEX FOR ORDER BY (PRIMARY) ORDER BY dt LIMIT 3;
+dt
+2010-11-22 11:43:14
+2010-11-22 12:33:54
+2011-08-27 21:33:56
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-11', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000');
+ERROR 23000: Duplicate entry '2010-11-22 12:33:54' for key 'PRIMARY'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS>,
+dt DATETIME <CUSTOM_COL_OPTIONS>,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS>,
+t TIME <CUSTOM_COL_OPTIONS>,
+y YEAR <CUSTOM_COL_OPTIONS>,
+INDEX (ts)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 ts 1 ts # # NULL NULL # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+EXPLAIN SELECT ts FROM t1 WHERE ts > NOW();
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # ts # # # #
+SELECT ts FROM t1 WHERE ts > NOW();
+ts
+EXPLAIN SELECT ts FROM t1 USE INDEX () WHERE ts > NOW();
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # NULL # # # #
+SELECT ts FROM t1 USE INDEX () WHERE ts > NOW();
+ts
+DROP TABLE t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS>,
+dt DATETIME <CUSTOM_COL_OPTIONS>,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS>,
+t TIME <CUSTOM_COL_OPTIONS>,
+y YEAR <CUSTOM_COL_OPTIONS>,
+UNIQUE INDEX d_t (d,t)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 d_t 1 d # # NULL NULL # #
+t1 0 d_t 2 t # # NULL NULL # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+EXPLAIN SELECT d, t FROM t1 WHERE CONCAT(d,' ',t) != CURRENT_DATE();
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # d_t # # # #
+SELECT d, t FROM t1 WHERE CONCAT(d,' ',t) != CURRENT_DATE();
+d t
+2011-03-31 22:04:10
+2012-01-12 00:12:32
+2012-01-12 00:12:33
+2012-03-13 12:10:00
+2012-03-31 12:00:00
+2012-04-09 05:27:00
+EXPLAIN SELECT d, t FROM t1 IGNORE INDEX (d_t) WHERE CONCAT(d,' ',t) != CURRENT_DATE();
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # NULL # # # #
+SELECT d, t FROM t1 IGNORE INDEX (d_t) WHERE CONCAT(d,' ',t) != CURRENT_DATE();
+d t
+2011-03-31 22:04:10
+2012-01-12 00:12:32
+2012-01-12 00:12:33
+2012-03-13 12:10:00
+2012-03-31 12:00:00
+2012-04-09 05:27:00
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-12', '2010-11-22 12:33:53', '2011-11-14 21:45:55', '00:12:33', '2000');
+ERROR 23000: Duplicate entry '2012-01-12-00:12:33' for key 'd_t'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (d DATE <CUSTOM_COL_OPTIONS>,
+dt DATETIME <CUSTOM_COL_OPTIONS>,
+ts TIMESTAMP <CUSTOM_COL_OPTIONS>,
+t TIME <CUSTOM_COL_OPTIONS>,
+y YEAR <CUSTOM_COL_OPTIONS>,
+INDEX (y,t)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 y 1 y # # NULL NULL # #
+t1 1 y 2 t # # NULL NULL # #
+SET @tm = '2012-04-09 05:27:00';
+INSERT INTO t1 (d,dt,ts,t,y) VALUES
+('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+EXPLAIN SELECT y, COUNT(*) FROM t1 GROUP BY y;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # y # # # #
+SELECT y, COUNT(*) FROM t1 GROUP BY y;
+y COUNT(*)
+1994 1
+1998 1
+1999 1
+2000 1
+2001 1
+2012 1
+EXPLAIN SELECT y, COUNT(*) FROM t1 USE INDEX FOR GROUP BY () GROUP BY y;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # y # # # #
+SELECT y, COUNT(*) FROM t1 USE INDEX FOR GROUP BY () GROUP BY y;
+y COUNT(*)
+1994 1
+1998 1
+1999 1
+2000 1
+2001 1
+2012 1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_date_time_indexes.test b/mysql-test/suite/storage_engine/type_date_time_indexes.test
new file mode 100644
index 00000000000..bb06432f079
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_date_time_indexes.test
@@ -0,0 +1,366 @@
+#
+# Date and time columns with indexes
+# (DATE, DATETIME, TIMESTAMP, TIME, YEAR)
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+
+# Default index as set in define_engine.inc
+
+let $create_definition =
+ d DATE $col_indexed_opts,
+ dt DATETIME $col_opts,
+ ts TIMESTAMP $col_opts,
+ t TIME $col_opts,
+ y YEAR $col_opts,
+ $default_index d (d)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Date and time types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ SET @tm = '2012-04-09 05:27:00';
+
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+ ('2012-01-22', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+ ('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+ ('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+ ('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+ (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+
+ SELECT d FROM t1 ORDER BY d LIMIT 3;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ d DATE $col_opts,
+ dt DATETIME $col_indexed_opts,
+ ts TIMESTAMP $col_opts,
+ t TIME $col_opts,
+ y YEAR $col_opts,
+ $default_index dt (dt)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Date and time types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ SET @tm = '2012-04-09 05:27:00';
+
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+ ('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+ ('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+ ('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+ ('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+ (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+
+ SELECT dt FROM t1 ORDER BY dt LIMIT 3;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ d DATE $col_opts,
+ dt DATETIME $col_opts,
+ ts TIMESTAMP $col_indexed_opts,
+ t TIME $col_opts,
+ y YEAR $col_opts,
+ $default_index ts (ts)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Date and time types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ SET @tm = '2012-04-09 05:27:00';
+
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:25', '00:12:33', '2000'),
+ ('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+ ('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+ ('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+ ('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+ (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+
+ SELECT ts FROM t1 ORDER BY ts LIMIT 3;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ d DATE $col_opts,
+ dt DATETIME $col_opts,
+ ts TIMESTAMP $col_opts,
+ t TIME $col_indexed_opts,
+ y YEAR $col_opts,
+ $default_index t (t)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Date and time types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ SET @tm = '2012-04-09 05:27:00';
+
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:25', '00:12:33', '2000'),
+ ('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+ ('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+ ('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+ ('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+ (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+
+ SELECT t FROM t1 ORDER BY t LIMIT 3;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ d DATE $col_opts,
+ dt DATETIME $col_opts,
+ ts TIMESTAMP $col_opts,
+ t TIME $col_opts,
+ y YEAR $col_indexed_opts,
+ $default_index y (y)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Date and time types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ SET @tm = '2012-04-09 05:27:00';
+
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:25', '00:12:33', '2000'),
+ ('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+ ('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+ ('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+ ('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+ (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+
+ SELECT y FROM t1 ORDER BY y LIMIT 3;
+
+ DROP TABLE t1;
+}
+
+
+# PK, UNIQUE INDEX, INDEX
+
+
+let $create_definition =
+ d DATE $col_opts,
+ dt DATETIME $col_indexed_opts PRIMARY KEY,
+ ts TIMESTAMP $col_opts,
+ t TIME $col_opts,
+ y YEAR $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Date and time types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ SET @tm = '2012-04-09 05:27:00';
+
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+ ('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+ ('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+ ('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+ ('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+ (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT dt FROM t1 ORDER BY dt LIMIT 3;
+ SELECT dt FROM t1 ORDER BY dt LIMIT 3;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT dt FROM t1 FORCE INDEX FOR ORDER BY (PRIMARY) ORDER BY dt LIMIT 3;
+ SELECT dt FROM t1 FORCE INDEX FOR ORDER BY (PRIMARY) ORDER BY dt LIMIT 3;
+
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-11', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000');
+ --source check_errors.inc
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ d DATE $col_opts,
+ dt DATETIME $col_opts,
+ ts TIMESTAMP $col_indexed_opts,
+ t TIME $col_opts,
+ y YEAR $col_opts,
+ INDEX (ts)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Date and time types or non-unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ SET @tm = '2012-04-09 05:27:00';
+
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+ ('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+ ('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+ ('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+ ('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+ (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT ts FROM t1 WHERE ts > NOW();
+ --sorted_result
+ SELECT ts FROM t1 WHERE ts > NOW();
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT ts FROM t1 USE INDEX () WHERE ts > NOW();
+ --sorted_result
+ SELECT ts FROM t1 USE INDEX () WHERE ts > NOW();
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ d DATE $col_indexed_opts,
+ dt DATETIME $col_opts,
+ ts TIMESTAMP $col_opts,
+ t TIME $col_indexed_opts,
+ y YEAR $col_opts,
+ UNIQUE INDEX d_t (d,t)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Date and time types or unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ SET @tm = '2012-04-09 05:27:00';
+
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+ ('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+ ('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+ ('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+ ('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+ (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT d, t FROM t1 WHERE CONCAT(d,' ',t) != CURRENT_DATE();
+ --sorted_result
+ SELECT d, t FROM t1 WHERE CONCAT(d,' ',t) != CURRENT_DATE();
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT d, t FROM t1 IGNORE INDEX (d_t) WHERE CONCAT(d,' ',t) != CURRENT_DATE();
+ --sorted_result
+ SELECT d, t FROM t1 IGNORE INDEX (d_t) WHERE CONCAT(d,' ',t) != CURRENT_DATE();
+
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-12', '2010-11-22 12:33:53', '2011-11-14 21:45:55', '00:12:33', '2000');
+ --source check_errors.inc
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ d DATE $col_opts,
+ dt DATETIME $col_opts,
+ ts TIMESTAMP $col_opts,
+ t TIME $col_indexed_opts,
+ y YEAR $col_indexed_opts,
+ INDEX (y,t)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Date and time types or non-unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+ SET @tm = '2012-04-09 05:27:00';
+
+ INSERT INTO t1 (d,dt,ts,t,y) VALUES
+ ('2012-01-12', '2010-11-22 12:33:54', '2011-11-14 21:45:55', '00:12:33', '2000'),
+ ('2012-01-12', '2010-11-22 11:43:14', '2011-11-14 21:45:55', '00:12:32', '2001'),
+ ('2012-03-31', '2011-08-28 21:33:56', '1999-04-30 19:11:08', '12:00:00', '1999'),
+ ('2012-03-13', '2011-08-27 21:33:56', '1999-03-30 19:11:08', '12:10:00', '1998'),
+ ('2011-03-31', '2011-08-28 20:33:56', '1997-01-31 11:54:01', '22:04:10', '1994'),
+ (DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm));
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT y, COUNT(*) FROM t1 GROUP BY y;
+ --sorted_result
+ SELECT y, COUNT(*) FROM t1 GROUP BY y;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT y, COUNT(*) FROM t1 USE INDEX FOR GROUP BY () GROUP BY y;
+ --sorted_result
+ SELECT y, COUNT(*) FROM t1 USE INDEX FOR GROUP BY () GROUP BY y;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_enum.inc b/mysql-test/suite/storage_engine/type_enum.inc
new file mode 100644
index 00000000000..6b9b83fc52e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_enum.inc
@@ -0,0 +1,69 @@
+#
+# ENUM column type
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Valid values.
+# We cannot test the maximum of 65,536 here,
+# because mysqltest has the standard limit of MAX_QUERY=256K;
+# but we can at least try 257
+
+let $create_definition =
+ a ENUM('') $col_opts,
+ b ENUM('test1','test2','test3','test4','test5') $col_opts,
+ c ENUM('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = ENUM type
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 VALUES ('','test2','4'),('',5,2);
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Out of range values
+ # (should produce warnings)
+
+ INSERT INTO t1 VALUES (0,'test6',-1);
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Non-unique values in enum
+ # (should produce a warning)
+ --let $alter_definition = ADD COLUMN e ENUM('a','A') $col_opts
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 VALUES ('','test3','75','A');
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Simple comparison
+
+ --sorted_result
+ SELECT * FROM t1 WHERE b='test2' OR a != '';
+
+ DROP TABLE t1;
+}
+
+
+
diff --git a/mysql-test/suite/storage_engine/type_enum.result b/mysql-test/suite/storage_engine/type_enum.result
new file mode 100644
index 00000000000..920aa5c7807
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_enum.result
@@ -0,0 +1,46 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a ENUM('') <CUSTOM_COL_OPTIONS>,
+b ENUM('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS>,
+c ENUM('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a enum('') # # #
+b enum('test1','test2','test3','test4','test5') # # #
+c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
+INSERT INTO t1 VALUES ('','test2','4'),('',5,2);
+SELECT * FROM t1;
+a b c
+ test2 4
+ test5 2
+INSERT INTO t1 VALUES (0,'test6',-1);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+SELECT * FROM t1;
+a b c
+
+ test2 4
+ test5 2
+ALTER TABLE t1 ADD COLUMN e ENUM('a','A') <CUSTOM_COL_OPTIONS>;
+Warnings:
+Note 1291 Column 'e' has duplicated value 'a' in ENUM
+Note 1291 Column 'e' has duplicated value 'a' in ENUM
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a enum('') # # #
+b enum('test1','test2','test3','test4','test5') # # #
+c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
+e enum('a','A') # # #
+INSERT INTO t1 VALUES ('','test3','75','A');
+SELECT * FROM t1;
+a b c e
+ NULL
+ test2 4 NULL
+ test3 75 a
+ test5 2 NULL
+SELECT * FROM t1 WHERE b='test2' OR a != '';
+a b c e
+ test2 4 NULL
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_enum.test b/mysql-test/suite/storage_engine/type_enum.test
new file mode 100644
index 00000000000..3476e8a0e9f
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_enum.test
@@ -0,0 +1,10 @@
+#
+# ENUM column type
+#
+
+--source have_engine.inc
+
+--source type_enum.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_enum_indexes.result b/mysql-test/suite/storage_engine/type_enum_indexes.result
new file mode 100644
index 00000000000..f8af1aed103
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_enum_indexes.result
@@ -0,0 +1,108 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a ENUM('N.America','S.America','Africa','Europe','Australia','Asia','Antarctica') <CUSTOM_COL_OPTIONS>,
+b ENUM('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS>,
+c ENUM('1a','1b','1d','1j','4a','4z','5a','5b','6v','6z') <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> a (a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b,c) VALUES
+('N.America','test1','5a'),('Europe','test1','5b'),('Europe','test2','6v'),
+('Africa','test3','4z'),('Africa','test4','1j'),('Antarctica','test4','1d');
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 a # # NULL NULL # #
+SELECT a FROM t1 WHERE b > 'test2' ORDER BY a;
+a
+Africa
+Africa
+Antarctica
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('N.America','S.America','Africa','Europe','Australia','Asia','Antarctica') <CUSTOM_COL_OPTIONS>,
+b ENUM('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS>,
+c ENUM('1a','1b','1d','1j','4a','4z','5a','5b','6v','6z') <CUSTOM_COL_OPTIONS>,
+UNIQUE KEY a_b (a,b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b,c) VALUES
+('N.America','test1','5a'),('Europe','test1','5b'),('Europe','test2','6v'),
+('Africa','test3','4z'),('Africa','test4','1j'),('Antarctica','test4','1d');
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 a_b 1 a # # NULL NULL # #
+t1 0 a_b 2 b # # NULL NULL # #
+EXPLAIN SELECT a FROM t1 WHERE b > 'test2' ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # a_b # # # #
+SELECT a FROM t1 WHERE b > 'test2' ORDER BY a;
+a
+Africa
+Africa
+Antarctica
+EXPLAIN SELECT a FROM t1 FORCE INDEX (a_b) WHERE b > 'test2' ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # a_b # # # #
+SELECT a FROM t1 FORCE INDEX (a_b) WHERE b > 'test2' ORDER BY a;
+a
+Africa
+Africa
+Antarctica
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('N.America','S.America','Africa','Europe','Australia','Asia','Antarctica') <CUSTOM_COL_OPTIONS>,
+b ENUM('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS>,
+c ENUM('1a','1b','1d','1j','4a','4z','5a','5b','6v','6z') <CUSTOM_COL_OPTIONS> PRIMARY KEY
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b,c) VALUES
+('N.America','test1','5a'),('Europe','test1','5b'),('Europe','test2','6v'),
+('Africa','test3','4z'),('Africa','test4','1j'),('Antarctica','test4','1d');
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 c # # NULL NULL # #
+EXPLAIN SELECT c FROM t1 WHERE c BETWEEN '1d' AND '6u';
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT c FROM t1 WHERE c BETWEEN '1d' AND '6u';
+c
+1d
+1j
+4z
+5a
+5b
+EXPLAIN SELECT c FROM t1 USE INDEX () WHERE c BETWEEN '1d' AND '6u';
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # NULL # # # #
+SELECT c FROM t1 USE INDEX () WHERE c BETWEEN '1d' AND '6u';
+c
+1d
+1j
+4z
+5a
+5b
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('N.America','S.America','Africa','Europe','Australia','Asia','Antarctica') <CUSTOM_COL_OPTIONS>,
+b ENUM('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS>,
+c ENUM('1a','1b','1d','1j','4a','4z','5a','5b','6v','6z') <CUSTOM_COL_OPTIONS>,
+INDEX(b)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b,c) VALUES
+('N.America','test1','5a'),('Europe','test1','5b'),('Europe','test2','6v'),
+('Africa','test3','4z'),('Africa','test4','1j'),('Antarctica','test4','1d');
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 b 1 b # # NULL NULL # #
+EXPLAIN SELECT DISTINCT b FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # b # # # #
+SELECT DISTINCT b FROM t1;
+b
+test1
+test2
+test3
+test4
+EXPLAIN SELECT DISTINCT b FROM t1 IGNORE INDEX (b);
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # NULL # # # #
+SELECT DISTINCT b FROM t1 IGNORE INDEX (b);
+b
+test1
+test2
+test3
+test4
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_enum_indexes.test b/mysql-test/suite/storage_engine/type_enum_indexes.test
new file mode 100644
index 00000000000..ba20197c3a9
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_enum_indexes.test
@@ -0,0 +1,146 @@
+#
+# ENUM columns with indexes
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Default index as set in define_engine.inc
+
+let $create_definition =
+ a ENUM('N.America','S.America','Africa','Europe','Australia','Asia','Antarctica') $col_indexed_opts,
+ b ENUM('test1','test2','test3','test4','test5') $col_opts,
+ c ENUM('1a','1b','1d','1j','4a','4z','5a','5b','6v','6z') $col_opts,
+ $default_index a (a)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = ENUM types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b,c) VALUES
+ ('N.America','test1','5a'),('Europe','test1','5b'),('Europe','test2','6v'),
+ ('Africa','test3','4z'),('Africa','test4','1j'),('Antarctica','test4','1d');
+
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ SELECT a FROM t1 WHERE b > 'test2' ORDER BY a;
+ DROP TABLE t1;
+}
+
+
+# PK, UNIQUE INDEX, INDEX
+
+let $create_definition =
+ a ENUM('N.America','S.America','Africa','Europe','Australia','Asia','Antarctica') $col_indexed_opts,
+ b ENUM('test1','test2','test3','test4','test5') $col_indexed_opts,
+ c ENUM('1a','1b','1d','1j','4a','4z','5a','5b','6v','6z') $col_opts,
+ UNIQUE KEY a_b (a,b)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = ENUM types or unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b,c) VALUES
+ ('N.America','test1','5a'),('Europe','test1','5b'),('Europe','test2','6v'),
+ ('Africa','test3','4z'),('Africa','test4','1j'),('Antarctica','test4','1d');
+
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT a FROM t1 WHERE b > 'test2' ORDER BY a;
+ SELECT a FROM t1 WHERE b > 'test2' ORDER BY a;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT a FROM t1 FORCE INDEX (a_b) WHERE b > 'test2' ORDER BY a;
+ SELECT a FROM t1 FORCE INDEX (a_b) WHERE b > 'test2' ORDER BY a;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ a ENUM('N.America','S.America','Africa','Europe','Australia','Asia','Antarctica') $col_opts,
+ b ENUM('test1','test2','test3','test4','test5') $col_opts,
+ c ENUM('1a','1b','1d','1j','4a','4z','5a','5b','6v','6z') $col_indexed_opts PRIMARY KEY
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = ENUM types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b,c) VALUES
+ ('N.America','test1','5a'),('Europe','test1','5b'),('Europe','test2','6v'),
+ ('Africa','test3','4z'),('Africa','test4','1j'),('Antarctica','test4','1d');
+
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT c FROM t1 WHERE c BETWEEN '1d' AND '6u';
+ --sorted_result
+ SELECT c FROM t1 WHERE c BETWEEN '1d' AND '6u';
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT c FROM t1 USE INDEX () WHERE c BETWEEN '1d' AND '6u';
+ --sorted_result
+ SELECT c FROM t1 USE INDEX () WHERE c BETWEEN '1d' AND '6u';
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ a ENUM('N.America','S.America','Africa','Europe','Australia','Asia','Antarctica') $col_opts,
+ b ENUM('test1','test2','test3','test4','test5') $col_indexed_opts,
+ c ENUM('1a','1b','1d','1j','4a','4z','5a','5b','6v','6z') $col_opts,
+ INDEX(b)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = ENUM types or non-unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b,c) VALUES
+ ('N.America','test1','5a'),('Europe','test1','5b'),('Europe','test2','6v'),
+ ('Africa','test3','4z'),('Africa','test4','1j'),('Antarctica','test4','1d');
+
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT DISTINCT b FROM t1;
+ --sorted_result
+ SELECT DISTINCT b FROM t1;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT DISTINCT b FROM t1 IGNORE INDEX (b);
+ --sorted_result
+ SELECT DISTINCT b FROM t1 IGNORE INDEX (b);
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_fixed.inc b/mysql-test/suite/storage_engine/type_fixed.inc
new file mode 100644
index 00000000000..6765fb575bc
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_fixed.inc
@@ -0,0 +1,89 @@
+#
+# Fixed point types
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ d DECIMAL $col_opts,
+ d0 DECIMAL(0) $col_opts,
+ d1_1 DECIMAL(1,1) $col_opts,
+ d10_2 DECIMAL(10,2) $col_opts,
+ d60_10 DECIMAL(60,10) $col_opts,
+ n NUMERIC $col_opts,
+ n0_0 NUMERIC(0,0) $col_opts,
+ n1 NUMERIC(1) $col_opts,
+ n20_4 NUMERIC(20,4) $col_opts,
+ n65_4 NUMERIC(65,4) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Fixed point types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ # Always valid values
+
+ INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+ INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+ INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Values which can be valid or not,
+ # depending on whether columns are SIGNED or UNSIGNED
+ # (if not valid should produce warnings)
+
+ INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+ INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ --sorted_result
+ SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+
+ # Invalid values
+
+ INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+ --sorted_result
+ SELECT * FROM t1;
+
+ INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+ --sorted_result
+ SELECT * FROM t1;
+
+ --let $error_codes = ER_TOO_BIG_PRECISION
+ --let $alter_definition = ADD COLUMN n66 NUMERIC(66)
+ --source alter_table.inc
+ if ($mysql_errname != ER_TOO_BIG_PRECISION)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+
+ --let $error_codes = ER_TOO_BIG_PRECISION
+ --let $alter_definition = ADD COLUMN n66_6 DECIMAL(66,6)
+ --source alter_table.inc
+ --let $error_codes = ER_TOO_BIG_SCALE
+ --let $alter_definition = ADD COLUMN n66_66 DECIMAL(66,66)
+ --source alter_table.inc
+
+ DROP TABLE t1;
+}
+
diff --git a/mysql-test/suite/storage_engine/type_fixed.result b/mysql-test/suite/storage_engine/type_fixed.result
new file mode 100644
index 00000000000..2c1566538db
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_fixed.result
@@ -0,0 +1,116 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (d DECIMAL <CUSTOM_COL_OPTIONS>,
+d0 DECIMAL(0) <CUSTOM_COL_OPTIONS>,
+d1_1 DECIMAL(1,1) <CUSTOM_COL_OPTIONS>,
+d10_2 DECIMAL(10,2) <CUSTOM_COL_OPTIONS>,
+d60_10 DECIMAL(60,10) <CUSTOM_COL_OPTIONS>,
+n NUMERIC <CUSTOM_COL_OPTIONS>,
+n0_0 NUMERIC(0,0) <CUSTOM_COL_OPTIONS>,
+n1 NUMERIC(1) <CUSTOM_COL_OPTIONS>,
+n20_4 NUMERIC(20,4) <CUSTOM_COL_OPTIONS>,
+n65_4 NUMERIC(65,4) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+d decimal(10,0) # # #
+d0 decimal(10,0) # # #
+d1_1 decimal(1,1) # # #
+d10_2 decimal(10,2) # # #
+d60_10 decimal(60,10) # # #
+n decimal(10,0) # # #
+n0_0 decimal(10,0) # # #
+n1 decimal(1,0) # # #
+n20_4 decimal(20,4) # # #
+n65_4 decimal(65,4) # # #
+INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Warning 1264 Out of range value for column 'd10_2' at row 1
+Warning 1264 Out of range value for column 'd60_10' at row 1
+Warning 1264 Out of range value for column 'n' at row 1
+Warning 1264 Out of range value for column 'n0_0' at row 1
+Warning 1264 Out of range value for column 'n1' at row 1
+Warning 1264 Out of range value for column 'n20_4' at row 1
+Warning 1264 Out of range value for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+Warnings:
+Note 1265 Data truncated for column 'd' at row 1
+Note 1265 Data truncated for column 'd0' at row 1
+Warning 1264 Out of range value for column 'd1_1' at row 1
+Note 1265 Data truncated for column 'd10_2' at row 1
+Note 1265 Data truncated for column 'd60_10' at row 1
+Note 1265 Data truncated for column 'n' at row 1
+Note 1265 Data truncated for column 'n0_0' at row 1
+Note 1265 Data truncated for column 'n1' at row 1
+Note 1265 Data truncated for column 'n20_4' at row 1
+Note 1265 Data truncated for column 'n65_4' at row 1
+SELECT * FROM t1;
+d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
+-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
+-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
+0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
+100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
+9999999999 9999999999 0.9 99999999.00 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.0000 9999999999999999999999999999999999999999999999999999999999999.1111
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
+ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66);
+ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6);
+ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66);
+ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 30.
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_fixed.test b/mysql-test/suite/storage_engine/type_fixed.test
new file mode 100644
index 00000000000..30b0f44d713
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_fixed.test
@@ -0,0 +1,10 @@
+#
+# Fixed point types
+#
+
+--source have_engine.inc
+
+--source type_fixed.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_fixed_indexes.result b/mysql-test/suite/storage_engine/type_fixed_indexes.result
new file mode 100644
index 00000000000..b1fe27cf735
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_fixed_indexes.result
@@ -0,0 +1,148 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (d1 DECIMAL(10,2) <CUSTOM_COL_OPTIONS>,
+d2 DECIMAL(60,10) <CUSTOM_COL_OPTIONS>,
+n1 NUMERIC <CUSTOM_COL_OPTIONS>,
+n2 NUMERIC(65,4) <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> d1 (d1)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 d1 # # NULL NULL # #
+INSERT INTO t1 (d1,d2,n1,n2) VALUES
+(10.22,60.12345,123456,14.3456),
+(10.0,60.12345,123456,14),
+(11.14,15,123456,13),
+(100,100,1,2),
+(0,0,0,0),
+(4540424564.23,3343303441.0,12,13),
+(15,17,23,100000);
+Warnings:
+Warning 1264 Out of range value for column 'd1' at row 6
+SELECT d1 FROM t1 ORDER BY d1 DESC;
+d1
+99999999.99
+100.00
+15.00
+11.14
+10.22
+10.00
+0.00
+DROP TABLE t1;
+CREATE TABLE t1 (d1 DECIMAL(10,2) <CUSTOM_COL_OPTIONS> PRIMARY KEY,
+d2 DECIMAL(60,10) <CUSTOM_COL_OPTIONS>,
+n1 NUMERIC <CUSTOM_COL_OPTIONS>,
+n2 NUMERIC(65,4) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 d1 # # NULL NULL # #
+INSERT INTO t1 (d1,d2,n1,n2) VALUES
+(10.22,60.12345,123456,14.3456),
+(10.0,60.12345,123456,14),
+(11.14,15,123456,13),
+(100,100,1,2),
+(0,0,0,0),
+(4540424564.23,3343303441.0,12,13),
+(15,17,23,100000);
+Warnings:
+Warning 1264 Out of range value for column 'd1' at row 6
+EXPLAIN SELECT d1 FROM t1 ORDER BY d1 DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT d1 FROM t1 ORDER BY d1 DESC;
+d1
+99999999.99
+100.00
+15.00
+11.14
+10.22
+10.00
+0.00
+EXPLAIN SELECT d1 FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) ORDER BY d1 DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT d1 FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) ORDER BY d1 DESC;
+d1
+99999999.99
+100.00
+15.00
+11.14
+10.22
+10.00
+0.00
+DROP TABLE t1;
+CREATE TABLE t1 (d1 DECIMAL(10,2) <CUSTOM_COL_OPTIONS>,
+d2 DECIMAL(60,10) <CUSTOM_COL_OPTIONS>,
+n1 NUMERIC <CUSTOM_COL_OPTIONS>,
+n2 NUMERIC(65,4) <CUSTOM_COL_OPTIONS>,
+UNIQUE INDEX n1_n2 (n1,n2)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 n1_n2 1 n1 # # NULL NULL # #
+t1 0 n1_n2 2 n2 # # NULL NULL # #
+INSERT INTO t1 (d1,d2,n1,n2) VALUES
+(10.22,60.12345,123456,14.3456),
+(10.0,60.12345,123456,14),
+(11.14,15,123456,13),
+(100,100,1,2),
+(0,0,0,0),
+(4540424564.23,3343303441.0,12,13),
+(15,17,23,100000);
+Warnings:
+Warning 1264 Out of range value for column 'd1' at row 6
+EXPLAIN SELECT DISTINCT n1+n2 FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # n1_n2 # # # #
+SELECT DISTINCT n1+n2 FROM t1;
+n1+n2
+0.0000
+100023.0000
+123469.0000
+123470.0000
+123470.3456
+25.0000
+3.0000
+DROP TABLE t1;
+CREATE TABLE t1 (d1 DECIMAL(10,2) <CUSTOM_COL_OPTIONS>,
+d2 DECIMAL(60,10) <CUSTOM_COL_OPTIONS>,
+n1 NUMERIC <CUSTOM_COL_OPTIONS>,
+n2 NUMERIC(65,4) <CUSTOM_COL_OPTIONS>,
+INDEX (d2)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 d2 1 d2 # # NULL NULL # #
+INSERT INTO t1 (d1,d2,n1,n2) VALUES
+(10.22,60.12345,123456,14.3456),
+(10.0,60.12345,123456,14),
+(11.14,15,123456,13),
+(100,100,1,2),
+(0,0,0,0),
+(4540424564.23,3343303441.0,12,13),
+(15,17,23,100000);
+Warnings:
+Warning 1264 Out of range value for column 'd1' at row 6
+EXPLAIN SELECT d2, COUNT(*) FROM t1 GROUP BY d2;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # d2 # # # #
+SELECT d2, COUNT(*) FROM t1 GROUP BY d2;
+d2 COUNT(*)
+0.0000000000 1
+100.0000000000 1
+15.0000000000 1
+17.0000000000 1
+3343303441.0000000000 1
+60.1234500000 2
+EXPLAIN SELECT d2, COUNT(*) FROM t1 IGNORE INDEX FOR GROUP BY (d2) GROUP BY d2;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # d2 # # # #
+SELECT d2, COUNT(*) FROM t1 IGNORE INDEX FOR GROUP BY (d2) GROUP BY d2;
+d2 COUNT(*)
+0.0000000000 1
+100.0000000000 1
+15.0000000000 1
+17.0000000000 1
+3343303441.0000000000 1
+60.1234500000 2
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_fixed_indexes.test b/mysql-test/suite/storage_engine/type_fixed_indexes.test
new file mode 100644
index 00000000000..0d3e825c1b0
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_fixed_indexes.test
@@ -0,0 +1,167 @@
+#
+# Fixed point columns with indexes
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+
+# Default index as set in define_engine.inc
+
+let $create_definition =
+ d1 DECIMAL(10,2) $col_indexed_opts,
+ d2 DECIMAL(60,10) $col_opts,
+ n1 NUMERIC $col_opts,
+ n2 NUMERIC(65,4) $col_opts,
+ $default_index d1 (d1)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Fixed point types or indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (d1,d2,n1,n2) VALUES
+ (10.22,60.12345,123456,14.3456),
+ (10.0,60.12345,123456,14),
+ (11.14,15,123456,13),
+ (100,100,1,2),
+ (0,0,0,0),
+ (4540424564.23,3343303441.0,12,13),
+ (15,17,23,100000);
+
+ SELECT d1 FROM t1 ORDER BY d1 DESC;
+
+ DROP TABLE t1;
+}
+
+
+# PK, UNIQUE INDEX, INDEX
+
+let $create_definition =
+ d1 DECIMAL(10,2) $col_indexed_opts PRIMARY KEY,
+ d2 DECIMAL(60,10) $col_opts,
+ n1 NUMERIC $col_opts,
+ n2 NUMERIC(65,4) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Fixed point types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (d1,d2,n1,n2) VALUES
+ (10.22,60.12345,123456,14.3456),
+ (10.0,60.12345,123456,14),
+ (11.14,15,123456,13),
+ (100,100,1,2),
+ (0,0,0,0),
+ (4540424564.23,3343303441.0,12,13),
+ (15,17,23,100000);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT d1 FROM t1 ORDER BY d1 DESC;
+ SELECT d1 FROM t1 ORDER BY d1 DESC;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT d1 FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) ORDER BY d1 DESC;
+ SELECT d1 FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) ORDER BY d1 DESC;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ d1 DECIMAL(10,2) $col_opts,
+ d2 DECIMAL(60,10) $col_opts,
+ n1 NUMERIC $col_indexed_opts,
+ n2 NUMERIC(65,4) $col_indexed_opts,
+ UNIQUE INDEX n1_n2 (n1,n2)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Fixed point types or unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (d1,d2,n1,n2) VALUES
+ (10.22,60.12345,123456,14.3456),
+ (10.0,60.12345,123456,14),
+ (11.14,15,123456,13),
+ (100,100,1,2),
+ (0,0,0,0),
+ (4540424564.23,3343303441.0,12,13),
+ (15,17,23,100000);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT DISTINCT n1+n2 FROM t1;
+ --sorted_result
+ SELECT DISTINCT n1+n2 FROM t1;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ d1 DECIMAL(10,2) $col_opts,
+ d2 DECIMAL(60,10) $col_indexed_opts,
+ n1 NUMERIC $col_opts,
+ n2 NUMERIC(65,4) $col_opts,
+ INDEX (d2)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Fixed point types or non-unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (d1,d2,n1,n2) VALUES
+ (10.22,60.12345,123456,14.3456),
+ (10.0,60.12345,123456,14),
+ (11.14,15,123456,13),
+ (100,100,1,2),
+ (0,0,0,0),
+ (4540424564.23,3343303441.0,12,13),
+ (15,17,23,100000);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT d2, COUNT(*) FROM t1 GROUP BY d2;
+ --sorted_result
+ SELECT d2, COUNT(*) FROM t1 GROUP BY d2;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT d2, COUNT(*) FROM t1 IGNORE INDEX FOR GROUP BY (d2) GROUP BY d2;
+ --sorted_result
+ SELECT d2, COUNT(*) FROM t1 IGNORE INDEX FOR GROUP BY (d2) GROUP BY d2;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_float.inc b/mysql-test/suite/storage_engine/type_float.inc
new file mode 100644
index 00000000000..7e355f01e0d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_float.inc
@@ -0,0 +1,111 @@
+#
+# Float types
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ f FLOAT $col_opts,
+ f0 FLOAT(0) $col_opts,
+ r1_1 REAL(1,1) $col_opts,
+ f23_0 FLOAT(23) $col_opts,
+ f20_3 FLOAT(20,3) $col_opts,
+ d DOUBLE $col_opts,
+ d1_0 DOUBLE(1,0) $col_opts,
+ d10_10 DOUBLE PRECISION (10,10) $col_opts,
+ d53 DOUBLE(53,0) $col_opts,
+ d53_10 DOUBLE(53,10) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Float point types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ # Always valid values
+
+ INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+
+ --sorted_result
+ --query_vertical SELECT * FROM t1
+
+ INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+ INSERT INTO t1 VALUES (
+ 99999999999999999999999999999999999999,
+ 99999999999999999999999999999999999999.9999999999999999,
+ 0.9,
+ 99999999999999999999999999999999999999.9,
+ 99999999999999999.999,
+ 999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+ 9,
+ 0.9999999999,
+ 1999999999999999999999999999999999999999999999999999999,
+ 19999999999999999999999999999999999999999999.9999999999
+ );
+
+ --sorted_result
+ --query_vertical SELECT * FROM t1
+
+ # Values which can be valid or not,
+ # depending on whether columns are SIGNED or UNSIGNED
+ # (if not valid should produce warnings)
+
+ INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+
+ --sorted_result
+ --query_vertical SELECT * FROM t1
+
+ --sorted_result
+ --query_vertical SELECT MAX(f), MAX(f0), MAX(r1_1), MAX(f23_0), MAX(f20_3), MAX(d), MAX(d1_0), MAX(d10_10), MAX(d53), MAX(d53_10) FROM t1
+
+ # Invalid values
+
+ INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+
+ --sorted_result
+ --query_vertical SELECT * FROM t1
+
+ INSERT INTO t1 VALUES (
+ 999999999999999999999999999999999999999,
+ 999999999999999999999999999999999999999.9999999999999999,
+ 1.9,
+ 999999999999999999999999999999999999999.9,
+ 999999999999999999.999,
+ 9999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+ 99,
+ 1.9999999999,
+ 1999999999999999999999999999999999999999999999999999999,
+ 19999999999999999999999999999999999999999999.9999999999
+ );
+
+ --sorted_result
+ --query_vertical SELECT * FROM t1
+
+ --let $error_codes = ER_TOO_BIG_DISPLAYWIDTH
+ --let $alter_definition = ADD COLUMN d0_0 DOUBLE(0,0)
+ --source alter_table.inc
+ if ($mysql_errname != ER_TOO_BIG_DISPLAYWIDTH)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+
+ --let $error_codes = ER_TOO_BIG_PRECISION
+ --let $alter_definition = ADD COLUMN n66_6 DECIMAL(256,1)
+ --source alter_table.inc
+ --let $error_codes = ER_TOO_BIG_SCALE
+ --let $alter_definition = ADD COLUMN n66_66 DECIMAL(40,35)
+ --source alter_table.inc
+
+ DROP TABLE t1;
+}
+
diff --git a/mysql-test/suite/storage_engine/type_float.result b/mysql-test/suite/storage_engine/type_float.result
new file mode 100644
index 00000000000..1f863505430
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_float.result
@@ -0,0 +1,286 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f FLOAT <CUSTOM_COL_OPTIONS>,
+f0 FLOAT(0) <CUSTOM_COL_OPTIONS>,
+r1_1 REAL(1,1) <CUSTOM_COL_OPTIONS>,
+f23_0 FLOAT(23) <CUSTOM_COL_OPTIONS>,
+f20_3 FLOAT(20,3) <CUSTOM_COL_OPTIONS>,
+d DOUBLE <CUSTOM_COL_OPTIONS>,
+d1_0 DOUBLE(1,0) <CUSTOM_COL_OPTIONS>,
+d10_10 DOUBLE PRECISION (10,10) <CUSTOM_COL_OPTIONS>,
+d53 DOUBLE(53,0) <CUSTOM_COL_OPTIONS>,
+d53_10 DOUBLE(53,10) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+f float # # #
+f0 float # # #
+r1_1 double(1,1) # # #
+f23_0 float # # #
+f20_3 float(20,3) # # #
+d double # # #
+d1_0 double(1,0) # # #
+d10_10 double(10,10) # # #
+d53 double(53,0) # # #
+d53_10 double(53,10) # # #
+INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+SELECT * FROM t1;
+f 12345.1
+d 11111111.111
+d10_10 0.0123456789
+d1_0 8
+d53 1234566789123456800
+d53_10 100000000000000000.0000000000
+f0 12345.1
+f20_3 56789.988
+f23_0 123457000
+r1_1 0.9
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (
+99999999999999999999999999999999999999,
+99999999999999999999999999999999999999.9999999999999999,
+0.9,
+99999999999999999999999999999999999999.9,
+99999999999999999.999,
+999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+9,
+0.9999999999,
+1999999999999999999999999999999999999999999999999999999,
+19999999999999999999999999999999999999999999.9999999999
+);
+Warnings:
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 12345.1
+d 0
+d 11111111.111
+d 1e81
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d1_0 0
+d1_0 8
+d1_0 9
+d53 0
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f 0
+f 1e38
+f0 0
+f0 12345.1
+f0 1e38
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+SELECT * FROM t1;
+f 12345.1
+d -1e60
+d 0
+d 11111111.111
+d 1e81
+d10_10 -0.9999999999
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d1_0 -9
+d1_0 0
+d1_0 8
+d1_0 9
+d53 -1000000000000000000000000000000
+d53 0
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f -1e24
+f 0
+f 1e38
+f0 -100000000000
+f0 0
+f0 12345.1
+f0 1e38
+f20_3 -99999998430674940.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f23_0 -1000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+r1_1 -0.9
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+SELECT MAX(f), MAX(f0), MAX(r1_1), MAX(f23_0), MAX(f20_3), MAX(d), MAX(d1_0), MAX(d10_10), MAX(d53), MAX(d53_10) FROM t1;
+MAX(f) 9.999999680285692e37
+MAX(d) 1e81
+MAX(d10_10) 0.9999999999
+MAX(d1_0) 9
+MAX(d53) 100000000000000000000000000000000000000000000000000000
+MAX(d53_10) 10000000000000000000000000000000000000000000.0000000000
+MAX(f0) 9.999999680285692e37
+MAX(f20_3) 99999998430674940.000
+MAX(f23_0) 9.999999680285692e37
+MAX(r1_1) 0.9
+INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+Warnings:
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+SELECT * FROM t1;
+f 12345.1
+d -1e60
+d 0
+d 11111111.111
+d 1e43
+d 1e81
+d10_10 -0.9999999999
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d10_10 10000000000000000000000000000000000000000000.0000000000
+d1_0 -9
+d1_0 0
+d1_0 8
+d1_0 9
+d1_0 9
+d53 -1000000000000000000000000000000
+d53 0
+d53 10000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f -1e24
+f 0
+f 1e38
+f 3.40282e38
+f0 -100000000000
+f0 0
+f0 12345.1
+f0 1e38
+f0 3.40282e38
+f20_3 -99999998430674940.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f23_0 -1000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+f23_0 3.40282e38
+r1_1 -0.9
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+INSERT INTO t1 VALUES (
+999999999999999999999999999999999999999,
+999999999999999999999999999999999999999.9999999999999999,
+1.9,
+999999999999999999999999999999999999999.9,
+999999999999999999.999,
+9999999999999999999999999999999999999999999999999999999999999999999999999999999999,
+99,
+1.9999999999,
+1999999999999999999999999999999999999999999999999999999,
+19999999999999999999999999999999999999999999.9999999999
+);
+Warnings:
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f0' at row 1
+Warning 1264 Out of range value for column 'r1_1' at row 1
+Warning 1264 Out of range value for column 'f23_0' at row 1
+Warning 1264 Out of range value for column 'f20_3' at row 1
+Warning 1264 Out of range value for column 'd1_0' at row 1
+Warning 1264 Out of range value for column 'd10_10' at row 1
+Warning 1264 Out of range value for column 'd53' at row 1
+Warning 1264 Out of range value for column 'd53_10' at row 1
+SELECT * FROM t1;
+f 12345.1
+d -1e60
+d 0
+d 11111111.111
+d 1e43
+d 1e65
+d 1e81
+d10_10 -0.9999999999
+d10_10 0.0000000000
+d10_10 0.0123456789
+d10_10 0.9999999999
+d10_10 0.9999999999
+d10_10 10000000000000000000000000000000000000000000.0000000000
+d1_0 -9
+d1_0 0
+d1_0 8
+d1_0 9
+d1_0 9
+d1_0 9
+d53 -1000000000000000000000000000000
+d53 0
+d53 10000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 100000000000000000000000000000000000000000000000000000
+d53 1234566789123456800
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+d53_10 0.0000000000
+d53_10 100000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+d53_10 10000000000000000000000000000000000000000000.0000000000
+f -1e24
+f 0
+f 1e38
+f 3.40282e38
+f 3.40282e38
+f0 -100000000000
+f0 0
+f0 12345.1
+f0 1e38
+f0 3.40282e38
+f0 3.40282e38
+f20_3 -99999998430674940.000
+f20_3 0.000
+f20_3 56789.988
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f20_3 99999998430674940.000
+f23_0 -1000
+f23_0 0
+f23_0 123457000
+f23_0 1e38
+f23_0 3.40282e38
+f23_0 3.40282e38
+r1_1 -0.9
+r1_1 0.0
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+r1_1 0.9
+ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0);
+ERROR 42000: Display width out of range for 'd0_0' (max = 255)
+ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1);
+ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65.
+ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35);
+ERROR 42000: Too big scale 35 specified for 'n66_66'. Maximum is 30.
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_float.test b/mysql-test/suite/storage_engine/type_float.test
new file mode 100644
index 00000000000..eb197542962
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_float.test
@@ -0,0 +1,10 @@
+#
+# Float types
+#
+
+--source have_engine.inc
+
+--source type_float.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_float_indexes.result b/mysql-test/suite/storage_engine/type_float_indexes.result
new file mode 100644
index 00000000000..905c9da40da
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_float_indexes.result
@@ -0,0 +1,146 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f FLOAT <CUSTOM_COL_OPTIONS>,
+r REAL(20,3) <CUSTOM_COL_OPTIONS>,
+d DOUBLE <CUSTOM_COL_OPTIONS>,
+dp DOUBLE PRECISION (64,10) <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> f (f)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 f # # NULL NULL # #
+INSERT INTO t1 (f,r,d,dp) VALUES
+(1.2345,1422.22,1.2345,1234567.89),
+(0,0,0,0),
+(-1,-1,-1,-1),
+(17.5843,4953453454.44,29229114.0,1111111.23),
+(4644,1422.22,466664.999,0.5);
+SELECT f FROM t1 ORDER BY f;
+f
+-1
+0
+1.2345
+17.5843
+4644
+DROP TABLE t1;
+CREATE TABLE t1 (f FLOAT <CUSTOM_COL_OPTIONS> PRIMARY KEY,
+r REAL(20,3) <CUSTOM_COL_OPTIONS>,
+d DOUBLE <CUSTOM_COL_OPTIONS>,
+dp DOUBLE PRECISION (64,10) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 f # # NULL NULL # #
+INSERT INTO t1 (f,r,d,dp) VALUES
+(1.2345,1422.22,1.2345,1234567.89),
+(0,0,0,0),
+(-1,-1,-1,-1),
+(17.5843,4953453454.44,29229114.0,1111111.23),
+(4644,1422.22,466664.999,0.5);
+EXPLAIN SELECT f FROM t1 ORDER BY f;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT f FROM t1 ORDER BY f;
+f
+-1
+0
+1.2345
+17.5843
+4644
+EXPLAIN SELECT f FROM t1 IGNORE INDEX (PRIMARY) ORDER BY f;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # NULL # # # #
+SELECT f FROM t1 IGNORE INDEX (PRIMARY) ORDER BY f;
+f
+-1
+0
+1.2345
+17.5843
+4644
+ALTER TABLE t1 DROP PRIMARY KEY;
+ALTER TABLE t1 ADD UNIQUE KEY(d);
+EXPLAIN SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # d # # # #
+SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d;
+d
+1.2345
+466664.999
+29229114
+DROP TABLE t1;
+CREATE TABLE t1 (f FLOAT <CUSTOM_COL_OPTIONS>,
+r REAL(20,3) <CUSTOM_COL_OPTIONS>,
+d DOUBLE <CUSTOM_COL_OPTIONS>,
+dp DOUBLE PRECISION (64,10) <CUSTOM_COL_OPTIONS>,
+UNIQUE KEY r_dp (r,dp)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 r_dp 1 r # # NULL NULL # #
+t1 0 r_dp 2 dp # # NULL NULL # #
+INSERT INTO t1 (f,r,d,dp) VALUES
+(1.2345,1422.22,1.2345,1234567.89),
+(0,0,0,0),
+(-1,-1,-1,-1),
+(17.5843,4953453454.44,29229114.0,1111111.23),
+(4644,1422.22,466664.999,0.5);
+EXPLAIN SELECT r, dp FROM t1 WHERE r > 0 or dp > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # r_dp # # # #
+SELECT r, dp FROM t1 WHERE r > 0 or dp > 0;
+r dp
+1422.220 0.5000000000
+1422.220 1234567.8900000000
+4953453454.440 1111111.2300000000
+DROP TABLE t1;
+CREATE TABLE t1 (f FLOAT <CUSTOM_COL_OPTIONS>,
+r REAL(20,3) <CUSTOM_COL_OPTIONS>,
+d DOUBLE <CUSTOM_COL_OPTIONS>,
+dp DOUBLE PRECISION (64,10) <CUSTOM_COL_OPTIONS>,
+UNIQUE KEY(d)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 d 1 d # # NULL NULL # #
+INSERT INTO t1 (f,r,d,dp) VALUES
+(1.2345,1422.22,1.2345,1234567.89),
+(0,0,0,0),
+(-1,-1,-1,-1),
+(17.5843,4953453454.44,29229114.0,1111111.23),
+(4644,1422.22,466664.999,0.5);
+EXPLAIN SELECT DISTINCT d FROM t1 ORDER BY d;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # d # # # #
+SELECT DISTINCT d FROM t1 ORDER BY d;
+d
+-1
+0
+1.2345
+466664.999
+29229114
+DROP TABLE t1;
+CREATE TABLE t1 (f FLOAT <CUSTOM_COL_OPTIONS>,
+r REAL(20,3) <CUSTOM_COL_OPTIONS>,
+d DOUBLE <CUSTOM_COL_OPTIONS>,
+dp DOUBLE PRECISION (64,10) <CUSTOM_COL_OPTIONS>,
+KEY(d)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 d 1 d # # NULL NULL # #
+INSERT INTO t1 (f,r,d,dp) VALUES
+(1.2345,1422.22,1.2345,1234567.89),
+(0,0,0,0),
+(-1,-1,-1,-1),
+(17.5843,4953453454.44,29229114.0,1111111.23),
+(4644,1422.22,466664.999,0.5);
+EXPLAIN SELECT DISTINCT d FROM t1 ORDER BY d;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # d # # # #
+SELECT DISTINCT d FROM t1 ORDER BY d;
+d
+-1
+0
+1.2345
+466664.999
+29229114
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_float_indexes.test b/mysql-test/suite/storage_engine/type_float_indexes.test
new file mode 100644
index 00000000000..0f1afc600a1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_float_indexes.test
@@ -0,0 +1,203 @@
+#
+# Float type columns with indexes
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Default index as set in define_engine.inc
+
+let $create_definition =
+ f FLOAT $col_indexed_opts,
+ r REAL(20,3) $col_opts,
+ d DOUBLE $col_opts,
+ dp DOUBLE PRECISION (64,10) $col_opts,
+ $default_index f (f)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Float point types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (f,r,d,dp) VALUES
+ (1.2345,1422.22,1.2345,1234567.89),
+ (0,0,0,0),
+ (-1,-1,-1,-1),
+ (17.5843,4953453454.44,29229114.0,1111111.23),
+ (4644,1422.22,466664.999,0.5);
+
+ SELECT f FROM t1 ORDER BY f;
+
+ DROP TABLE t1;
+}
+
+
+# PK, UNIQUE INDEX, INDEX
+
+let $create_definition =
+ f FLOAT $col_indexed_opts PRIMARY KEY,
+ r REAL(20,3) $col_opts,
+ d DOUBLE $col_opts,
+ dp DOUBLE PRECISION (64,10) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Float point types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (f,r,d,dp) VALUES
+ (1.2345,1422.22,1.2345,1234567.89),
+ (0,0,0,0),
+ (-1,-1,-1,-1),
+ (17.5843,4953453454.44,29229114.0,1111111.23),
+ (4644,1422.22,466664.999,0.5);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT f FROM t1 ORDER BY f;
+ SELECT f FROM t1 ORDER BY f;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT f FROM t1 IGNORE INDEX (PRIMARY) ORDER BY f;
+ SELECT f FROM t1 IGNORE INDEX (PRIMARY) ORDER BY f;
+
+
+ --let $alter_definition = DROP PRIMARY KEY
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --let $alter_definition = ADD UNIQUE KEY(d)
+ --source alter_table.inc
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d;
+ SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d;
+ }
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ f FLOAT $col_opts,
+ r REAL(20,3) $col_indexed_opts,
+ d DOUBLE $col_opts,
+ dp DOUBLE PRECISION (64,10) $col_indexed_opts,
+ UNIQUE KEY r_dp (r,dp)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Float point types or unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (f,r,d,dp) VALUES
+ (1.2345,1422.22,1.2345,1234567.89),
+ (0,0,0,0),
+ (-1,-1,-1,-1),
+ (17.5843,4953453454.44,29229114.0,1111111.23),
+ (4644,1422.22,466664.999,0.5);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT r, dp FROM t1 WHERE r > 0 or dp > 0;
+ --sorted_result
+ SELECT r, dp FROM t1 WHERE r > 0 or dp > 0;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ f FLOAT $col_opts,
+ r REAL(20,3) $col_opts,
+ d DOUBLE $col_indexed_opts,
+ dp DOUBLE PRECISION (64,10) $col_opts,
+ UNIQUE KEY(d)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Float point types or unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (f,r,d,dp) VALUES
+ (1.2345,1422.22,1.2345,1234567.89),
+ (0,0,0,0),
+ (-1,-1,-1,-1),
+ (17.5843,4953453454.44,29229114.0,1111111.23),
+ (4644,1422.22,466664.999,0.5);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT DISTINCT d FROM t1 ORDER BY d;
+ SELECT DISTINCT d FROM t1 ORDER BY d;
+
+ DROP TABLE t1;
+}
+
+
+let $create_definition =
+ f FLOAT $col_opts,
+ r REAL(20,3) $col_opts,
+ d DOUBLE $col_indexed_opts,
+ dp DOUBLE PRECISION (64,10) $col_opts,
+ KEY(d)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Float point types or non-unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (f,r,d,dp) VALUES
+ (1.2345,1422.22,1.2345,1234567.89),
+ (0,0,0,0),
+ (-1,-1,-1,-1),
+ (17.5843,4953453454.44,29229114.0,1111111.23),
+ (4644,1422.22,466664.999,0.5);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT DISTINCT d FROM t1 ORDER BY d;
+ SELECT DISTINCT d FROM t1 ORDER BY d;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_int.inc b/mysql-test/suite/storage_engine/type_int.inc
new file mode 100644
index 00000000000..5aaea78fcd5
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_int.inc
@@ -0,0 +1,84 @@
+#
+# INT column types
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ i INT $col_opts,
+ i0 INT(0) $col_opts,
+ i1 INT(1) $col_opts,
+ i20 INT(20) $col_opts,
+ t TINYINT $col_opts,
+ t0 TINYINT(0) $col_opts,
+ t1 TINYINT(1) $col_opts,
+ t20 TINYINT(20) $col_opts,
+ s SMALLINT $col_opts,
+ s0 SMALLINT(0) $col_opts,
+ s1 SMALLINT(1) $col_opts,
+ s20 SMALLINT(20) $col_opts,
+ m MEDIUMINT $col_opts,
+ m0 MEDIUMINT(0) $col_opts,
+ m1 MEDIUMINT(1) $col_opts,
+ m20 MEDIUMINT(20) $col_opts,
+ b BIGINT $col_opts,
+ b0 BIGINT(0) $col_opts,
+ b1 BIGINT(1) $col_opts,
+ b20 BIGINT(20) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = INT types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ # Always valid values
+
+ INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+ INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+ INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Values which can be valid or not,
+ # depending on whether columns are SIGNED or UNSIGNED
+ # (if not valid should produce warnings)
+
+ INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+ INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Invalid values
+
+ INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+
+ INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+
+ INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ --let $error_codes = ER_TOO_BIG_DISPLAYWIDTH
+ --let $alter_definition = ADD COLUMN i257 INT(257)
+ --source alter_table.inc
+ if ($mysql_errname != ER_TOO_BIG_DISPLAYWIDTH)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+
+ DROP TABLE t1;
+}
+
diff --git a/mysql-test/suite/storage_engine/type_int.result b/mysql-test/suite/storage_engine/type_int.result
new file mode 100644
index 00000000000..47f4ebad93a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_int.result
@@ -0,0 +1,209 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT <CUSTOM_COL_OPTIONS>,
+i0 INT(0) <CUSTOM_COL_OPTIONS>,
+i1 INT(1) <CUSTOM_COL_OPTIONS>,
+i20 INT(20) <CUSTOM_COL_OPTIONS>,
+t TINYINT <CUSTOM_COL_OPTIONS>,
+t0 TINYINT(0) <CUSTOM_COL_OPTIONS>,
+t1 TINYINT(1) <CUSTOM_COL_OPTIONS>,
+t20 TINYINT(20) <CUSTOM_COL_OPTIONS>,
+s SMALLINT <CUSTOM_COL_OPTIONS>,
+s0 SMALLINT(0) <CUSTOM_COL_OPTIONS>,
+s1 SMALLINT(1) <CUSTOM_COL_OPTIONS>,
+s20 SMALLINT(20) <CUSTOM_COL_OPTIONS>,
+m MEDIUMINT <CUSTOM_COL_OPTIONS>,
+m0 MEDIUMINT(0) <CUSTOM_COL_OPTIONS>,
+m1 MEDIUMINT(1) <CUSTOM_COL_OPTIONS>,
+m20 MEDIUMINT(20) <CUSTOM_COL_OPTIONS>,
+b BIGINT <CUSTOM_COL_OPTIONS>,
+b0 BIGINT(0) <CUSTOM_COL_OPTIONS>,
+b1 BIGINT(1) <CUSTOM_COL_OPTIONS>,
+b20 BIGINT(20) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+i int(11) # # #
+i0 int(11) # # #
+i1 int(1) # # #
+i20 int(20) # # #
+t tinyint(4) # # #
+t0 tinyint(4) # # #
+t1 tinyint(1) # # #
+t20 tinyint(20) # # #
+s smallint(6) # # #
+s0 smallint(6) # # #
+s1 smallint(1) # # #
+s20 smallint(20) # # #
+m mediumint(9) # # #
+m0 mediumint(9) # # #
+m1 mediumint(1) # # #
+m20 mediumint(20) # # #
+b bigint(20) # # #
+b0 bigint(20) # # #
+b1 bigint(1) # # #
+b20 bigint(20) # # #
+INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b0' at row 1
+Warning 1264 Out of range value for column 'b1' at row 1
+Warning 1264 Out of range value for column 'b20' at row 1
+INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+Warnings:
+Warning 1264 Out of range value for column 'i' at row 1
+Warning 1264 Out of range value for column 'i0' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i20' at row 1
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't0' at row 1
+Warning 1264 Out of range value for column 't1' at row 1
+Warning 1264 Out of range value for column 't20' at row 1
+Warning 1264 Out of range value for column 's' at row 1
+Warning 1264 Out of range value for column 's0' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
+Warning 1264 Out of range value for column 's20' at row 1
+Warning 1264 Out of range value for column 'm' at row 1
+Warning 1264 Out of range value for column 'm0' at row 1
+Warning 1264 Out of range value for column 'm1' at row 1
+Warning 1264 Out of range value for column 'm20' at row 1
+Warning 1264 Out of range value for column 'i' at row 2
+Warning 1264 Out of range value for column 'i0' at row 2
+Warning 1264 Out of range value for column 'i1' at row 2
+Warning 1264 Out of range value for column 'i20' at row 2
+Warning 1264 Out of range value for column 't' at row 2
+Warning 1264 Out of range value for column 't0' at row 2
+Warning 1264 Out of range value for column 't1' at row 2
+Warning 1264 Out of range value for column 't20' at row 2
+Warning 1264 Out of range value for column 's' at row 2
+Warning 1264 Out of range value for column 's0' at row 2
+Warning 1264 Out of range value for column 's1' at row 2
+Warning 1264 Out of range value for column 's20' at row 2
+Warning 1264 Out of range value for column 'm' at row 2
+Warning 1264 Out of range value for column 'm0' at row 2
+Warning 1264 Out of range value for column 'm1' at row 2
+Warning 1264 Out of range value for column 'm20' at row 2
+Warning 1264 Out of range value for column 'i' at row 3
+Warning 1264 Out of range value for column 'i0' at row 3
+Warning 1264 Out of range value for column 'i1' at row 3
+Warning 1264 Out of range value for column 'i20' at row 3
+Warning 1264 Out of range value for column 't' at row 3
+Warning 1264 Out of range value for column 't0' at row 3
+Warning 1264 Out of range value for column 't1' at row 3
+Warning 1264 Out of range value for column 't20' at row 3
+Warning 1264 Out of range value for column 's' at row 3
+Warning 1264 Out of range value for column 's0' at row 3
+Warning 1264 Out of range value for column 's1' at row 3
+Warning 1264 Out of range value for column 's20' at row 3
+Warning 1264 Out of range value for column 'm' at row 3
+Warning 1264 Out of range value for column 'm0' at row 3
+Warning 1264 Out of range value for column 'm1' at row 3
+Warning 1264 Out of range value for column 'm20' at row 3
+Warning 1264 Out of range value for column 'i' at row 4
+Warning 1264 Out of range value for column 'i0' at row 4
+Warning 1264 Out of range value for column 'i1' at row 4
+Warning 1264 Out of range value for column 'i20' at row 4
+Warning 1264 Out of range value for column 't' at row 4
+Warning 1264 Out of range value for column 't0' at row 4
+Warning 1264 Out of range value for column 't1' at row 4
+Warning 1264 Out of range value for column 't20' at row 4
+Warning 1264 Out of range value for column 's' at row 4
+Warning 1264 Out of range value for column 's0' at row 4
+Warning 1264 Out of range value for column 's1' at row 4
+Warning 1264 Out of range value for column 's20' at row 4
+Warning 1264 Out of range value for column 'm' at row 4
+Warning 1264 Out of range value for column 'm0' at row 4
+Warning 1264 Out of range value for column 'm1' at row 4
+Warning 1264 Out of range value for column 'm20' at row 4
+SELECT * FROM t1;
+i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
+ALTER TABLE t1 ADD COLUMN i257 INT(257);
+ERROR 42000: Display width out of range for 'i257' (max = 255)
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_int.test b/mysql-test/suite/storage_engine/type_int.test
new file mode 100644
index 00000000000..1e1ca36854b
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_int.test
@@ -0,0 +1,10 @@
+#
+# INT column types
+#
+
+--source have_engine.inc
+
+--source type_int.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_int_indexes.result b/mysql-test/suite/storage_engine/type_int_indexes.result
new file mode 100644
index 00000000000..aa82d6b9c4e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_int_indexes.result
@@ -0,0 +1,133 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT <CUSTOM_COL_OPTIONS>,
+t TINYINT <CUSTOM_COL_OPTIONS>,
+s SMALLINT <CUSTOM_COL_OPTIONS>,
+m MEDIUMINT <CUSTOM_COL_OPTIONS>,
+b BIGINT <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> i (i)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 i # # NULL NULL # #
+INSERT INTO t1 (i,t,s,m,b) VALUES (1,2,3,4,5),(1000,100,10000,1000000,1000000000000000000),(5,100,10000,1000000,100000000000000000),(2,3,4,5,6),(3,4,5,6,7),(101,102,103,104,105),(10001,103,10002,10003,10004),(10,11,12,13,14),(11,12,13,14,15),(12,13,14,15,16);
+SELECT i FROM t1 ORDER BY i;
+i
+1
+2
+3
+5
+10
+11
+12
+101
+1000
+10001
+DROP TABLE t1;
+CREATE TABLE t1 (i INT <CUSTOM_COL_OPTIONS> PRIMARY KEY,
+t TINYINT <CUSTOM_COL_OPTIONS>,
+s SMALLINT <CUSTOM_COL_OPTIONS>,
+m MEDIUMINT <CUSTOM_COL_OPTIONS>,
+b BIGINT <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (i,t,s,m,b) VALUES (1,2,3,4,5),(1000,100,10000,1000000,1000000000000000000),(5,100,10000,1000000,100000000000000000),(2,3,4,5,6),(3,4,5,6,7),(101,102,103,104,105),(10001,103,10002,10003,10004),(10,11,12,13,14),(11,12,13,14,15),(12,13,14,15,16);
+EXPLAIN SELECT i FROM t1 ORDER BY i;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # Using index
+SELECT i FROM t1 ORDER BY i;
+i
+1
+2
+3
+5
+10
+11
+12
+101
+1000
+10001
+ALTER TABLE t1 DROP PRIMARY KEY;
+ALTER TABLE t1 ADD PRIMARY KEY (i,t);
+INSERT INTO t1 (i,t,s,m,b) VALUES (1,3,2,4,5);
+EXPLAIN SELECT i, t FROM t1 ORDER BY i, t;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # Using index
+SELECT i, t FROM t1 ORDER BY i, t;
+i t
+1 2
+1 3
+2 3
+3 4
+5 100
+10 11
+11 12
+12 13
+101 102
+1000 100
+10001 103
+DROP TABLE t1;
+CREATE TABLE t1 (i INT <CUSTOM_COL_OPTIONS>,
+t TINYINT <CUSTOM_COL_OPTIONS>,
+s SMALLINT <CUSTOM_COL_OPTIONS>,
+m MEDIUMINT <CUSTOM_COL_OPTIONS>,
+b BIGINT <CUSTOM_COL_OPTIONS>,
+INDEX s_m (s,m)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (i,t,s,m,b) VALUES (1,2,3,4,5),(1000,100,10000,1000000,1000000000000000000),(5,100,10000,1000000,100000000000000000),(2,3,4,5,6),(3,4,5,6,7),(101,102,103,104,105),(10001,103,10002,10003,10004),(10,11,12,13,14),(11,12,13,14,15),(12,13,14,15,16);
+EXPLAIN SELECT s, m FROM t1 WHERE s != 10 AND m != 1;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # s_m # # # Using where; Using index
+SELECT s, m FROM t1 WHERE s != 10 AND m != 1;
+s m
+10000 1000000
+10000 1000000
+10002 10003
+103 104
+12 13
+13 14
+14 15
+3 4
+4 5
+5 6
+DROP TABLE t1;
+CREATE TABLE t1 (i INT <CUSTOM_COL_OPTIONS>,
+t TINYINT <CUSTOM_COL_OPTIONS>,
+s SMALLINT <CUSTOM_COL_OPTIONS>,
+m MEDIUMINT <CUSTOM_COL_OPTIONS>,
+b BIGINT <CUSTOM_COL_OPTIONS>,
+UNIQUE KEY b_t (b,t)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (i,t,s,m,b) VALUES (1,2,3,4,5),(1000,100,10000,1000000,1000000000000000000),(5,100,10000,1000000,100000000000000000),(2,3,4,5,6),(3,4,5,6,7),(101,102,103,104,105),(10001,103,10002,10003,10004),(10,11,12,13,14),(11,12,13,14,15),(12,13,14,15,16);
+SELECT b+t FROM t1 WHERE (b,t) IN ( SELECT b, t FROM t1 WHERE i>1 ) ORDER BY b+t;
+b+t
+9
+11
+25
+27
+29
+207
+10107
+100000000000000100
+1000000000000000100
+SELECT b+t FROM t1 FORCE INDEX (b_t) WHERE (b,t) IN ( SELECT b, t FROM t1 WHERE i>1 ) ORDER BY b+t;
+b+t
+9
+11
+25
+27
+29
+207
+10107
+100000000000000100
+1000000000000000100
+SELECT b+t FROM t1 IGNORE INDEX (b_t) WHERE (b,t) IN ( SELECT b, t FROM t1 WHERE i>1 ) ORDER BY b+t;
+b+t
+9
+11
+25
+27
+29
+207
+10107
+100000000000000100
+1000000000000000100
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_int_indexes.test b/mysql-test/suite/storage_engine/type_int_indexes.test
new file mode 100644
index 00000000000..f8270c91ae3
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_int_indexes.test
@@ -0,0 +1,146 @@
+#
+# INT column types with indexes
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+
+# Default index as set in define_engine.inc
+
+let $create_definition =
+ i INT $col_indexed_opts,
+ t TINYINT $col_opts,
+ s SMALLINT $col_opts,
+ m MEDIUMINT $col_opts,
+ b BIGINT $col_opts,
+ $default_index i (i)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = INT types or indexes on them
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (i,t,s,m,b) VALUES (1,2,3,4,5),(1000,100,10000,1000000,1000000000000000000),(5,100,10000,1000000,100000000000000000),(2,3,4,5,6),(3,4,5,6,7),(101,102,103,104,105),(10001,103,10002,10003,10004),(10,11,12,13,14),(11,12,13,14,15),(12,13,14,15,16);
+
+ SELECT i FROM t1 ORDER BY i;
+
+ DROP TABLE t1;
+}
+
+
+# PK, UNIQUE INDEX, INDEX
+
+let $create_definition =
+ i INT $col_indexed_opts PRIMARY KEY,
+ t TINYINT $col_opts,
+ s SMALLINT $col_opts,
+ m MEDIUMINT $col_opts,
+ b BIGINT $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = INT types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (i,t,s,m,b) VALUES (1,2,3,4,5),(1000,100,10000,1000000,1000000000000000000),(5,100,10000,1000000,100000000000000000),(2,3,4,5,6),(3,4,5,6,7),(101,102,103,104,105),(10001,103,10002,10003,10004),(10,11,12,13,14),(11,12,13,14,15),(12,13,14,15,16);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 #
+ EXPLAIN SELECT i FROM t1 ORDER BY i;
+ SELECT i FROM t1 ORDER BY i;
+
+ --let $alter_definition = DROP PRIMARY KEY
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --let $alter_definition = ADD PRIMARY KEY (i,t)
+ --source alter_table.inc
+
+ INSERT INTO t1 (i,t,s,m,b) VALUES (1,3,2,4,5);
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 #
+ EXPLAIN SELECT i, t FROM t1 ORDER BY i, t;
+ SELECT i, t FROM t1 ORDER BY i, t;
+ }
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ i INT $col_opts,
+ t TINYINT $col_opts,
+ s SMALLINT $col_indexed_opts,
+ m MEDIUMINT $col_indexed_opts,
+ b BIGINT $col_opts,
+ INDEX s_m (s,m)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = INT types or non-unique indexes or multi-part indexes
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (i,t,s,m,b) VALUES (1,2,3,4,5),(1000,100,10000,1000000,1000000000000000000),(5,100,10000,1000000,100000000000000000),(2,3,4,5,6),(3,4,5,6,7),(101,102,103,104,105),(10001,103,10002,10003,10004),(10,11,12,13,14),(11,12,13,14,15),(12,13,14,15,16);
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 #
+ EXPLAIN SELECT s, m FROM t1 WHERE s != 10 AND m != 1;
+ --sorted_result
+ SELECT s, m FROM t1 WHERE s != 10 AND m != 1;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ i INT $col_opts,
+ t TINYINT $col_indexed_opts,
+ s SMALLINT $col_opts,
+ m MEDIUMINT $col_opts,
+ b BIGINT $col_indexed_opts,
+ UNIQUE KEY b_t (b,t)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = INT types or unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (i,t,s,m,b) VALUES (1,2,3,4,5),(1000,100,10000,1000000,1000000000000000000),(5,100,10000,1000000,100000000000000000),(2,3,4,5,6),(3,4,5,6,7),(101,102,103,104,105),(10001,103,10002,10003,10004),(10,11,12,13,14),(11,12,13,14,15),(12,13,14,15,16);
+
+ # This query should use the index b_t, we just don't want to run EXPLAIN
+ # (to avoid mismatches due to different subquery-related plans)
+ SELECT b+t FROM t1 WHERE (b,t) IN ( SELECT b, t FROM t1 WHERE i>1 ) ORDER BY b+t;
+ SELECT b+t FROM t1 FORCE INDEX (b_t) WHERE (b,t) IN ( SELECT b, t FROM t1 WHERE i>1 ) ORDER BY b+t;
+ SELECT b+t FROM t1 IGNORE INDEX (b_t) WHERE (b,t) IN ( SELECT b, t FROM t1 WHERE i>1 ) ORDER BY b+t;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_set.inc b/mysql-test/suite/storage_engine/type_set.inc
new file mode 100644
index 00000000000..b4844b00ec7
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_set.inc
@@ -0,0 +1,69 @@
+#
+# SET column type
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Valid values.
+
+let $create_definition =
+ a SET('') $col_opts,
+ b SET('test1','test2','test3','test4','test5') $col_opts,
+ c SET('01','02','03','04','05','06','07','08','09','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') $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = SET types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 VALUES
+ ('','test2,test3','01,34,44,,23'),
+ ('',5,2),
+ (',','test4,test2','');
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Out of range values
+ # (should produce warnings)
+
+ INSERT INTO t1 VALUES (0,'test6',-1);
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Non-unique values in set
+ # (should produce a warning)
+ --let $alter_definition = ADD COLUMN e SET('a','A') $col_opts
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ --let $error_codes = ER_TOO_BIG_SET
+ --let $alter_definition = ADD COLUMN f SET('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i') $col_opts
+ --source alter_table.inc
+ }
+
+ # Simple comparison
+
+ --sorted_result
+ SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
+
+ DROP TABLE t1;
+}
+
diff --git a/mysql-test/suite/storage_engine/type_set.result b/mysql-test/suite/storage_engine/type_set.result
new file mode 100644
index 00000000000..210b07748bc
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_set.result
@@ -0,0 +1,48 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a SET('') <CUSTOM_COL_OPTIONS>,
+b SET('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS>,
+c SET('01','02','03','04','05','06','07','08','09','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') <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a set('') # # #
+b set('test1','test2','test3','test4','test5') # # #
+c set('01','02','03','04','05','06','07','08','09','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') # # #
+INSERT INTO t1 VALUES
+('','test2,test3','01,34,44,,23'),
+('',5,2),
+(',','test4,test2','');
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+SELECT * FROM t1;
+a b c
+ test1,test3 02
+ test2,test3 01,23,34,44
+ test2,test4
+INSERT INTO t1 VALUES (0,'test6',-1);
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+SELECT * FROM t1;
+a b c
+ 01,02,03,04,05,06,07,08,09,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
+ test1,test3 02
+ test2,test3 01,23,34,44
+ test2,test4
+ALTER TABLE t1 ADD COLUMN e SET('a','A') <CUSTOM_COL_OPTIONS>;
+Warnings:
+Note 1291 Column 'e' has duplicated value 'a' in SET
+Note 1291 Column 'e' has duplicated value 'a' in SET
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a set('') # # #
+b set('test1','test2','test3','test4','test5') # # #
+c set('01','02','03','04','05','06','07','08','09','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') # # #
+e set('a','A') # # #
+ALTER TABLE t1 ADD COLUMN f SET('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i') <CUSTOM_COL_OPTIONS>;
+ERROR HY000: Too many strings for column f and SET
+SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
+a b c e
+ test2,test3 01,23,34,44 NULL
+ test2,test4 NULL
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_set.test b/mysql-test/suite/storage_engine/type_set.test
new file mode 100644
index 00000000000..7313ccaf7fe
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_set.test
@@ -0,0 +1,10 @@
+#
+# SET column type
+#
+
+--source have_engine.inc
+
+--source type_set.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_set_indexes.result b/mysql-test/suite/storage_engine/type_set_indexes.result
new file mode 100644
index 00000000000..871202d7b97
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_set_indexes.result
@@ -0,0 +1,137 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a SET('N.America','S.America','Africa','Antarctica','Australia','Europe','Asia') <CUSTOM_COL_OPTIONS>,
+b SET('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS>,
+c SET('01','22','23','33','34','39','40','44','50','63','64') <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> c (c)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 c # # NULL NULL # #
+INSERT INTO t1 (a,b,c) VALUES
+('','test2,test3','01,34,44,23'),
+('',5,2),
+('N.America,Asia','test4,test2',''),
+('Africa,Europe,Asia','test2,test3','01'),
+('Antarctica','test3','34,44'),
+('Asia','test5','50'),
+('Europe,S.America','test1,','39');
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 7
+SELECT c FROM t1 ORDER BY c;
+c
+
+01
+22
+39
+34,44
+01,23,34,44
+50
+DROP TABLE t1;
+CREATE TABLE t1 (a SET('N.America','S.America','Africa','Antarctica','Australia','Europe','Asia') <CUSTOM_COL_OPTIONS>,
+b SET('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS>,
+c SET('01','22','23','33','34','39','40','44','50','63','64') <CUSTOM_COL_OPTIONS> PRIMARY KEY
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 c # # NULL NULL # #
+INSERT INTO t1 (a,b,c) VALUES
+('','test2,test3','01,34,44,23'),
+('',5,2),
+('N.America,Asia','test4,test2',''),
+('Africa,Europe,Asia','test2,test3','01'),
+('Antarctica','test3','34,44'),
+('Asia','test5','50'),
+('Europe,S.America','test1,','39');
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 7
+EXPLAIN SELECT c FROM t1 ORDER BY c;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT c FROM t1 ORDER BY c;
+c
+
+01
+22
+39
+34,44
+01,23,34,44
+50
+EXPLAIN SELECT c FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) ORDER BY c;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT c FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) ORDER BY c;
+c
+
+01
+22
+39
+34,44
+01,23,34,44
+50
+INSERT INTO t1 (a,b,c) VALUES ('Antarctica','test3','02');
+ERROR 23000: Duplicate entry '22' for key 'PRIMARY'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+INSERT INTO t1 (a,b,c) VALUES ('','test1','34,44');
+ERROR 23000: Duplicate entry '34,44' for key 'PRIMARY'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (a SET('N.America','S.America','Africa','Antarctica','Australia','Europe','Asia') <CUSTOM_COL_OPTIONS>,
+b SET('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS>,
+c SET('01','22','23','33','34','39','40','44','50','63','64') <CUSTOM_COL_OPTIONS>,
+INDEX(a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 a 1 a # # NULL NULL # #
+INSERT INTO t1 (a,b,c) VALUES
+('','test2,test3','01,34,44,23'),
+('',5,2),
+('N.America,Asia','test4,test2',''),
+('Africa,Europe,Asia','test2,test3','01'),
+('Antarctica','test3','34,44'),
+('Asia','test5','50'),
+('Europe,S.America','test1,','39');
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 7
+EXPLAIN SELECT a FROM t1 WHERE FIND_IN_SET('Europe',a) > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # a # # # #
+SELECT a FROM t1 WHERE FIND_IN_SET('Europe',a) > 0;
+a
+Africa,Europe,Asia
+S.America,Europe
+DROP TABLE t1;
+CREATE TABLE t1 (a SET('N.America','S.America','Africa','Antarctica','Australia','Europe','Asia') <CUSTOM_COL_OPTIONS>,
+b SET('test1','test2','test3','test4','test5') <CUSTOM_COL_OPTIONS>,
+c SET('01','22','23','33','34','39','40','44','50','63','64') <CUSTOM_COL_OPTIONS>,
+UNIQUE INDEX b_a (b,a)
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 b_a 1 b # # NULL NULL # #
+t1 0 b_a 2 a # # NULL NULL # #
+INSERT INTO t1 (a,b,c) VALUES
+('','test2,test3','01,34,44,23'),
+('',5,2),
+('N.America,Asia','test4,test2',''),
+('Africa,Europe,Asia','test2,test3','01'),
+('Antarctica','test3','34,44'),
+('Asia','test5','50'),
+('Europe,S.America','test1,','39');
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 7
+EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY b DESC, a;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # b_a # # # #
+SELECT DISTINCT a, b FROM t1 ORDER BY b DESC, a;
+a b
+ test1,test3
+ test2,test3
+Africa,Europe,Asia test2,test3
+Antarctica test3
+Asia test5
+N.America,Asia test2,test4
+S.America,Europe test1
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_set_indexes.test b/mysql-test/suite/storage_engine/type_set_indexes.test
new file mode 100644
index 00000000000..3223c957cea
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_set_indexes.test
@@ -0,0 +1,167 @@
+#
+# SET columns with indexes
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Default index as configured in define_engine.inc
+
+let $create_definition =
+ a SET('N.America','S.America','Africa','Antarctica','Australia','Europe','Asia') $col_opts,
+ b SET('test1','test2','test3','test4','test5') $col_opts,
+ c SET('01','22','23','33','34','39','40','44','50','63','64') $col_indexed_opts,
+ $default_index c (c)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = SET types or indexes on them
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a,b,c) VALUES
+ ('','test2,test3','01,34,44,23'),
+ ('',5,2),
+ ('N.America,Asia','test4,test2',''),
+ ('Africa,Europe,Asia','test2,test3','01'),
+ ('Antarctica','test3','34,44'),
+ ('Asia','test5','50'),
+ ('Europe,S.America','test1,','39');
+
+ SELECT c FROM t1 ORDER BY c;
+
+ DROP TABLE t1;
+}
+
+
+# PK, UNIQUE INDEX, INDEX
+
+
+let $create_definition =
+ a SET('N.America','S.America','Africa','Antarctica','Australia','Europe','Asia') $col_opts,
+ b SET('test1','test2','test3','test4','test5') $col_opts,
+ c SET('01','22','23','33','34','39','40','44','50','63','64') $col_indexed_opts PRIMARY KEY
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = SET types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a,b,c) VALUES
+ ('','test2,test3','01,34,44,23'),
+ ('',5,2),
+ ('N.America,Asia','test4,test2',''),
+ ('Africa,Europe,Asia','test2,test3','01'),
+ ('Antarctica','test3','34,44'),
+ ('Asia','test5','50'),
+ ('Europe,S.America','test1,','39');
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT c FROM t1 ORDER BY c;
+ SELECT c FROM t1 ORDER BY c;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT c FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) ORDER BY c;
+ SELECT c FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) ORDER BY c;
+
+
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b,c) VALUES ('Antarctica','test3','02');
+ --source check_errors.inc
+
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ INSERT INTO t1 (a,b,c) VALUES ('','test1','34,44');
+ --source check_errors.inc
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ a SET('N.America','S.America','Africa','Antarctica','Australia','Europe','Asia') $col_indexed_opts,
+ b SET('test1','test2','test3','test4','test5') $col_opts,
+ c SET('01','22','23','33','34','39','40','44','50','63','64') $col_opts,
+ INDEX(a)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = SET types or non-unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a,b,c) VALUES
+ ('','test2,test3','01,34,44,23'),
+ ('',5,2),
+ ('N.America,Asia','test4,test2',''),
+ ('Africa,Europe,Asia','test2,test3','01'),
+ ('Antarctica','test3','34,44'),
+ ('Asia','test5','50'),
+ ('Europe,S.America','test1,','39');
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT a FROM t1 WHERE FIND_IN_SET('Europe',a) > 0;
+ --sorted_result
+ SELECT a FROM t1 WHERE FIND_IN_SET('Europe',a) > 0;
+
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ a SET('N.America','S.America','Africa','Antarctica','Australia','Europe','Asia') $col_indexed_opts,
+ b SET('test1','test2','test3','test4','test5') $col_indexed_opts,
+ c SET('01','22','23','33','34','39','40','44','50','63','64') $col_opts,
+ UNIQUE INDEX b_a (b,a)
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = SET types or unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (a,b,c) VALUES
+ ('','test2,test3','01,34,44,23'),
+ ('',5,2),
+ ('N.America,Asia','test4,test2',''),
+ ('Africa,Europe,Asia','test2,test3','01'),
+ ('Antarctica','test3','34,44'),
+ ('Asia','test5','50'),
+ ('Europe,S.America','test1,','39');
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY b DESC, a;
+ --sorted_result
+ SELECT DISTINCT a, b FROM t1 ORDER BY b DESC, a;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_spatial.inc b/mysql-test/suite/storage_engine/type_spatial.inc
new file mode 100644
index 00000000000..5195f779bcc
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_spatial.inc
@@ -0,0 +1,738 @@
+#
+# Spatial objects
+#
+
+#
+# A calling test can initialize $index variable,
+# which can be SPATIAL, or INDEX, or UNIQUE INDEX;
+# Logic for creating tables with spatial and non-spatial indexes is different
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+--enable_warnings
+
+--disable_warnings
+DROP DATABASE IF EXISTS gis_ogs;
+--enable_warnings
+
+CREATE DATABASE gis_ogs;
+
+
+if ($index=='')
+{
+ --let $table_name = gis_point
+ --let $create_definition = fid $int_col, g POINT
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Geometry types
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --let $table_name = gis_line
+ --let $create_definition = fid $int_col, g LINESTRING
+ --source create_table.inc
+ --let $table_name = gis_polygon
+ --let $create_definition = fid $int_col, g POLYGON
+ --source create_table.inc
+ --let $table_name = gis_multi_point
+ --let $create_definition = fid $int_col, g MULTIPOINT
+ --source create_table.inc
+ --let $table_name = gis_multi_line
+ --let $create_definition = fid $int_col, g MULTILINESTRING
+ --source create_table.inc
+ --let $table_name = gis_multi_polygon
+ --let $create_definition = fid $int_col, g MULTIPOLYGON
+ --source create_table.inc
+ --let $table_name = gis_geometrycollection
+ --let $create_definition = fid $int_col, g GEOMETRYCOLLECTION
+ --source create_table.inc
+ --let $table_name = gis_geometry
+ --let $create_definition = fid $int_col, g GEOMETRY
+ --source create_table.inc
+
+ USE gis_ogs;
+
+ --let $table_name = lakes
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ shore POLYGON;
+ --source create_table.inc
+
+ --let $table_name = road_segments
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ aliases CHAR(64) $col_opts,
+ num_lanes INT $col_opts,
+ centerline LINESTRING;
+ --source create_table.inc
+
+ --let $table_name = divided_routes
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ num_lanes INT $col_opts,
+ centerlines MULTILINESTRING;
+ --source create_table.inc
+
+ --let $table_name = forests
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ boundary MULTIPOLYGON;
+ --source create_table.inc
+
+ --let $table_name = bridges
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ position POINT;
+ --source create_table.inc
+
+ --let $table_name = streams
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ centerline LINESTRING;
+ --source create_table.inc
+
+ --let $table_name = buildings
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ position POINT,
+ footprint POLYGON;
+ --source create_table.inc
+
+ --let $table_name = ponds
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ type CHAR(64) $col_opts,
+ shores MULTIPOLYGON;
+ --source create_table.inc
+
+ --let $table_name = named_places
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ boundary POLYGON;
+ --source create_table.inc
+
+ --let $table_name = map_neatlines
+ let $create_definition =
+ fid INT $col_opts,
+ neatline POLYGON;
+ --source create_table.inc
+ }
+}
+
+if ($index == 'SPATIAL')
+{
+ --let $table_name = gis_point
+ --let $create_definition = fid $int_col, g POINT NOT NULL, SPATIAL INDEX(g)
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Geometry types or spatial indexes
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --let $table_name = gis_line
+ --let $create_definition = fid $int_col, g LINESTRING NOT NULL, SPATIAL INDEX(g)
+ --source create_table.inc
+ --let $table_name = gis_polygon
+ --let $create_definition = fid $int_col, g POLYGON NOT NULL, SPATIAL INDEX(g)
+ --source create_table.inc
+ --let $table_name = gis_multi_point
+ --let $create_definition = fid $int_col, g MULTIPOINT NOT NULL, SPATIAL INDEX(g)
+ --source create_table.inc
+ --let $table_name = gis_multi_line
+ --let $create_definition = fid $int_col, g MULTILINESTRING NOT NULL, SPATIAL INDEX(g)
+ --source create_table.inc
+ --let $table_name = gis_multi_polygon
+ --let $create_definition = fid $int_col, g MULTIPOLYGON NOT NULL, SPATIAL INDEX(g)
+ --source create_table.inc
+ --let $table_name = gis_geometrycollection
+ --let $create_definition = fid $int_col, g GEOMETRYCOLLECTION NOT NULL, SPATIAL INDEX(g)
+ --source create_table.inc
+ --let $table_name = gis_geometry
+ --let $create_definition = fid $int_col, g GEOMETRY NOT NULL
+ --source create_table.inc
+
+ USE gis_ogs;
+
+ --let $table_name = lakes
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ shore POLYGON NOT NULL, SPATIAL INDEX s(shore);
+ --source create_table.inc
+
+ --let $table_name = road_segments
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ aliases CHAR(64) $col_opts,
+ num_lanes INT $col_opts,
+ centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline);
+ --source create_table.inc
+
+ --let $table_name = divided_routes
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ num_lanes INT $col_opts,
+ centerlines MULTILINESTRING NOT NULL, SPATIAL INDEX c(centerlines);
+ --source create_table.inc
+
+ --let $table_name = forests
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ boundary MULTIPOLYGON NOT NULL, SPATIAL INDEX b(boundary);
+ --source create_table.inc
+
+ --let $table_name = bridges
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ position POINT NOT NULL, SPATIAL INDEX p(position);
+ --source create_table.inc
+
+ --let $table_name = streams
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline);
+ --source create_table.inc
+
+ --let $table_name = buildings
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ position POINT NOT NULL,
+ footprint POLYGON NOT NULL, SPATIAL INDEX p(position), SPATIAL INDEX f(footprint);
+ --source create_table.inc
+
+ --let $table_name = ponds
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ type CHAR(64) $col_opts,
+ shores MULTIPOLYGON NOT NULL, SPATIAL INDEX s(shores);
+ --source create_table.inc
+
+ --let $table_name = named_places
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ boundary POLYGON NOT NULL, SPATIAL INDEX b(boundary);
+ --source create_table.inc
+
+ --let $table_name = map_neatlines
+ let $create_definition =
+ fid INT $col_opts,
+ neatline POLYGON NOT NULL, SPATIAL INDEX n(neatline);
+ --source create_table.inc
+ }
+ let $index =;
+}
+
+if ($index)
+{
+ --let $table_name = gis_point
+ --let $create_definition = fid $int_col, g POINT, $index g(g(128))
+ --source create_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Geometry types or indexes on them
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --let $table_name = gis_line
+ --let $create_definition = fid $int_col, g LINESTRING, $index g(g(256))
+ --source create_table.inc
+ --let $table_name = gis_polygon
+ --let $create_definition = fid $int_col, g POLYGON, $index g(g(512))
+ --source create_table.inc
+ --let $table_name = gis_multi_point
+ --let $create_definition = fid $int_col, g MULTIPOINT, $index g(g(128))
+ --source create_table.inc
+ --let $table_name = gis_multi_line
+ --let $create_definition = fid $int_col, g MULTILINESTRING, $index g(g(256))
+ --source create_table.inc
+ --let $table_name = gis_multi_polygon
+ --let $create_definition = fid $int_col, g MULTIPOLYGON
+ --source create_table.inc
+ --let $table_name = gis_geometrycollection
+ --let $create_definition = fid $int_col, g GEOMETRYCOLLECTION
+ --source create_table.inc
+ --let $table_name = gis_geometry
+ --let $create_definition = fid $int_col, g GEOMETRY
+ --source create_table.inc
+
+ USE gis_ogs;
+
+ --let $table_name = lakes
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ shore POLYGON $spatial_col_opts, $index s(shore(64));
+ --source create_table.inc
+
+ --let $table_name = road_segments
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ aliases CHAR(64) $col_opts,
+ num_lanes INT $col_opts,
+ centerline LINESTRING $spatial_col_opts, $index c(centerline(128));
+ --source create_table.inc
+
+ --let $table_name = divided_routes
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ num_lanes INT $col_opts,
+ centerlines MULTILINESTRING $spatial_col_opts, $index c(centerlines(512));
+ --source create_table.inc
+
+ --let $table_name = forests
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ boundary MULTIPOLYGON $spatial_col_opts, $index b(boundary(128));
+ --source create_table.inc
+
+ --let $table_name = bridges
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ position POINT $spatial_col_opts, $index p(`position`(64));
+ --source create_table.inc
+
+ --let $table_name = streams
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ centerline LINESTRING $spatial_col_opts, $index c(centerline(256));
+ --source create_table.inc
+
+ --let $table_name = buildings
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ position POINT $spatial_col_opts,
+ footprint POLYGON $spatial_col_opts, $index p(`position`(64)), $index f(footprint(128));
+ --source create_table.inc
+
+ --let $table_name = ponds
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ type CHAR(64) $col_opts,
+ shores MULTIPOLYGON $spatial_col_opts, $index s(shores(256));
+ --source create_table.inc
+
+ --let $table_name = named_places
+ let $create_definition =
+ fid INT $col_opts,
+ name CHAR(64) $col_opts,
+ boundary POLYGON $spatial_col_opts, $index b(boundary(512));
+ --source create_table.inc
+
+ --let $table_name = map_neatlines
+ let $create_definition =
+ fid INT $col_opts,
+ neatline POLYGON $spatial_col_opts, $index n(neatline(700));
+ --source create_table.inc
+ }
+}
+
+if (!$mysql_errname)
+{
+ USE test;
+
+ SHOW FIELDS FROM gis_point;
+ SHOW FIELDS FROM gis_line;
+ SHOW FIELDS FROM gis_polygon;
+ SHOW FIELDS FROM gis_multi_point;
+ SHOW FIELDS FROM gis_multi_line;
+ SHOW FIELDS FROM gis_multi_polygon;
+ SHOW FIELDS FROM gis_geometrycollection;
+ SHOW FIELDS FROM gis_geometry;
+
+ INSERT INTO gis_point VALUES
+ (101, PointFromText('POINT(10 10)')),
+ (102, PointFromText('POINT(20 10)')),
+ (103, PointFromText('POINT(20 20)')),
+ (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+
+ INSERT INTO gis_line VALUES
+ (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+ (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+ (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+
+ INSERT INTO gis_polygon VALUES
+ (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+ (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+ (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+
+ INSERT INTO gis_multi_point VALUES
+ (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+ (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+ (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+
+ INSERT INTO gis_multi_line VALUES
+ (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+ (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+ (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+
+ INSERT INTO gis_multi_polygon VALUES
+ (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+ (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+ (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+
+ INSERT INTO gis_geometrycollection VALUES
+ (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+ (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+ (122, GeomFromText('GeometryCollection()')),
+ (123, GeomFromText('GeometryCollection EMPTY'));
+
+ INSERT into gis_geometry SELECT * FROM gis_point;
+ INSERT into gis_geometry SELECT * FROM gis_line;
+ INSERT into gis_geometry SELECT * FROM gis_polygon;
+ INSERT into gis_geometry SELECT * FROM gis_multi_point;
+ INSERT into gis_geometry SELECT * FROM gis_multi_line;
+ INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+ INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+
+ SELECT fid, AsText(g) FROM gis_point;
+ SELECT fid, AsText(g) FROM gis_line;
+ SELECT fid, AsText(g) FROM gis_polygon;
+ SELECT fid, AsText(g) FROM gis_multi_point;
+ SELECT fid, AsText(g) FROM gis_multi_line;
+ SELECT fid, AsText(g) FROM gis_multi_polygon;
+ SELECT fid, AsText(g) FROM gis_geometrycollection;
+ SELECT fid, AsText(g) FROM gis_geometry;
+
+ SELECT fid, Dimension(g) FROM gis_geometry;
+ SELECT fid, GeometryType(g) FROM gis_geometry;
+ SELECT fid, IsEmpty(g) FROM gis_geometry;
+ SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+
+ SELECT fid, X(g) FROM gis_point;
+ SELECT fid, Y(g) FROM gis_point;
+
+ SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+ SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+ SELECT fid, GLength(g) FROM gis_line;
+ SELECT fid, NumPoints(g) FROM gis_line;
+ SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+ SELECT fid, IsClosed(g) FROM gis_line;
+
+ SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+ SELECT fid, Area(g) FROM gis_polygon;
+ SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+ SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+ SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+
+ SELECT fid, IsClosed(g) FROM gis_multi_line;
+
+ SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+ SELECT fid, Area(g) FROM gis_multi_polygon;
+
+ SELECT fid, NumGeometries(g) from gis_multi_point;
+ SELECT fid, NumGeometries(g) from gis_multi_line;
+ SELECT fid, NumGeometries(g) from gis_multi_polygon;
+ SELECT fid, NumGeometries(g) from gis_geometrycollection;
+
+ SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+ SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+ SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+ SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+ SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+
+ SELECT g1.fid as first, g2.fid as second,
+ Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+ Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+ FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+
+ DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+
+
+ USE gis_ogs;
+
+ --echo # Lakes
+ INSERT INTO lakes VALUES (
+ 101, 'BLUE LAKE',
+ PolyFromText(
+ 'POLYGON(
+ (52 18,66 23,73 9,48 6,52 18),
+ (59 18,67 18,67 13,59 13,59 18)
+ )',
+ 101));
+
+ --echo # Road Segments
+
+ INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+ LineFromText(
+ 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+
+ INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+ LineFromText(
+ 'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+
+ INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+ LineFromText(
+ 'LINESTRING( 70 38, 72 48 )' ,101));
+
+ INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+ LineFromText(
+ 'LINESTRING( 70 38, 84 42 )' ,101));
+
+ INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+ 1,
+ LineFromText(
+ 'LINESTRING( 28 26, 28 0 )',101));
+
+ --echo # DividedRoutes
+
+ INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+ MLineFromText(
+ 'MULTILINESTRING((10 48,10 21,10 0),
+ (16 0,16 23,16 48))', 101));
+
+ --echo # Forests
+
+ INSERT INTO forests VALUES(109, 'Green Forest',
+ MPolyFromText(
+ 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+ (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+ 101));
+
+ --echo # Bridges
+
+ INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+ 'POINT( 44 31 )', 101));
+
+ --echo # Streams
+
+ INSERT INTO streams VALUES(111, 'Cam Stream',
+ LineFromText(
+ 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+
+ INSERT INTO streams VALUES(112, NULL,
+ LineFromText(
+ 'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+
+ --echo # Buildings
+
+ INSERT INTO buildings VALUES(113, '123 Main Street',
+ PointFromText(
+ 'POINT( 52 30 )', 101),
+ PolyFromText(
+ 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+
+ INSERT INTO buildings VALUES(114, '215 Main Street',
+ PointFromText(
+ 'POINT( 64 33 )', 101),
+ PolyFromText(
+ 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+
+
+ --echo # Ponds
+
+ INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+ MPolyFromText(
+ 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+ ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+
+ --echo # Named Places
+
+ INSERT INTO named_places VALUES(117, 'Ashton',
+ PolyFromText(
+ 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+
+ INSERT INTO named_places VALUES(118, 'Goose Island',
+ PolyFromText(
+ 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+
+ --echo # Map Neatlines
+
+ INSERT INTO map_neatlines VALUES(115,
+ PolyFromText(
+ 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+
+ SELECT Dimension(shore)
+ FROM lakes
+ WHERE name = 'Blue Lake';
+
+ SELECT GeometryType(centerlines)
+ FROM divided_routes
+ WHERE name = 'Route 75';
+
+ SELECT AsText(boundary)
+ FROM named_places
+ WHERE name = 'Goose Island';
+
+ SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+ FROM named_places
+ WHERE name = 'Goose Island';
+
+ SELECT SRID(boundary)
+ FROM named_places
+ WHERE name = 'Goose Island';
+
+ SELECT IsEmpty(centerline)
+ FROM road_segments
+ WHERE name = 'Route 5'
+ AND aliases = 'Main Street';
+
+ SELECT AsText(Envelope(boundary))
+ FROM named_places
+ WHERE name = 'Goose Island';
+
+ SELECT X(position)
+ FROM bridges
+ WHERE name = 'Cam Bridge';
+
+ SELECT Y(position)
+ FROM bridges
+ WHERE name = 'Cam Bridge';
+
+ SELECT AsText(StartPoint(centerline))
+ FROM road_segments
+ WHERE fid = 102;
+
+ SELECT AsText(EndPoint(centerline))
+ FROM road_segments
+ WHERE fid = 102;
+
+ SELECT GLength(centerline)
+ FROM road_segments
+ WHERE fid = 106;
+
+ SELECT NumPoints(centerline)
+ FROM road_segments
+ WHERE fid = 102;
+
+ SELECT AsText(PointN(centerline, 1))
+ FROM road_segments
+ WHERE fid = 102;
+
+ SELECT AsText(Centroid(boundary))
+ FROM named_places
+ WHERE name = 'Goose Island';
+
+ SELECT Area(boundary)
+ FROM named_places
+ WHERE name = 'Goose Island';
+
+ SELECT AsText(ExteriorRing(shore))
+ FROM lakes
+ WHERE name = 'Blue Lake';
+
+ SELECT NumInteriorRings(shore)
+ FROM lakes
+ WHERE name = 'Blue Lake';
+
+ SELECT AsText(InteriorRingN(shore, 1))
+ FROM lakes
+ WHERE name = 'Blue Lake';
+
+ SELECT NumGeometries(centerlines)
+ FROM divided_routes
+ WHERE name = 'Route 75';
+
+ SELECT AsText(GeometryN(centerlines, 2))
+ FROM divided_routes
+ WHERE name = 'Route 75';
+
+ SELECT IsClosed(centerlines)
+ FROM divided_routes
+ WHERE name = 'Route 75';
+
+ SELECT GLength(centerlines)
+ FROM divided_routes
+ WHERE name = 'Route 75';
+
+ SELECT AsText(Centroid(shores))
+ FROM ponds
+ WHERE fid = 120;
+
+ SELECT Area(shores)
+ FROM ponds
+ WHERE fid = 120;
+
+ SELECT ST_Equals(boundary,
+ PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+ FROM named_places
+ WHERE name = 'Goose Island';
+
+ SELECT ST_Disjoint(centerlines, boundary)
+ FROM divided_routes, named_places
+ WHERE divided_routes.name = 'Route 75'
+ AND named_places.name = 'Ashton';
+
+ SELECT ST_Touches(centerline, shore)
+ FROM streams, lakes
+ WHERE streams.name = 'Cam Stream'
+ AND lakes.name = 'Blue Lake';
+
+ SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+ FROM road_segments, divided_routes
+ WHERE road_segments.fid = 102
+ AND divided_routes.name = 'Route 75';
+
+ SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+ FROM road_segments, divided_routes
+ WHERE road_segments.fid = 102
+ AND divided_routes.name = 'Route 75';
+
+ SELECT ST_Contains(forests.boundary, named_places.boundary)
+ FROM forests, named_places
+ WHERE forests.name = 'Green Forest'
+ AND named_places.name = 'Ashton';
+
+ SELECT ST_Distance(position, boundary)
+ FROM bridges, named_places
+ WHERE bridges.name = 'Cam Bridge'
+ AND named_places.name = 'Ashton';
+
+ SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+ FROM named_places, forests
+ WHERE named_places.name = 'Ashton'
+ AND forests.name = 'Green Forest';
+
+ SELECT AsText(ST_Union(shore, boundary))
+ FROM lakes, named_places
+ WHERE lakes.name = 'Blue Lake'
+ AND named_places.name = 'Goose Island';
+
+ SELECT AsText(ST_SymDifference(shore, boundary))
+ FROM lakes, named_places
+ WHERE lakes.name = 'Blue Lake'
+ AND named_places.name = 'Ashton';
+
+ SELECT count(*)
+ FROM buildings, bridges
+ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+
+}
+
+DROP DATABASE gis_ogs;
+USE test;
+
+
diff --git a/mysql-test/suite/storage_engine/type_spatial.result b/mysql-test/suite/storage_engine/type_spatial.result
new file mode 100644
index 00000000000..c6b856ab8b0
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_spatial.result
@@ -0,0 +1,700 @@
+DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+DROP DATABASE IF EXISTS gis_ogs;
+CREATE DATABASE gis_ogs;
+CREATE TABLE gis_point (fid <INT_COLUMN>, g POINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+USE gis_ogs;
+CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+shore POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
+num_lanes INT <CUSTOM_COL_OPTIONS>,
+centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+num_lanes INT <CUSTOM_COL_OPTIONS>,
+centerlines MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+boundary MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+position POINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+position POINT,
+footprint POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+type CHAR(64) <CUSTOM_COL_OPTIONS>,
+shores MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+boundary POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
+neatline POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+USE test;
+SHOW FIELDS FROM gis_point;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g point YES NULL
+SHOW FIELDS FROM gis_line;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g linestring YES NULL
+SHOW FIELDS FROM gis_polygon;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g polygon YES NULL
+SHOW FIELDS FROM gis_multi_point;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g multipoint YES NULL
+SHOW FIELDS FROM gis_multi_line;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g multilinestring YES NULL
+SHOW FIELDS FROM gis_multi_polygon;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g multipolygon YES NULL
+SHOW FIELDS FROM gis_geometrycollection;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g geometrycollection YES NULL
+SHOW FIELDS FROM gis_geometry;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g geometry YES NULL
+INSERT INTO gis_point VALUES
+(101, PointFromText('POINT(10 10)')),
+(102, PointFromText('POINT(20 10)')),
+(103, PointFromText('POINT(20 20)')),
+(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+INSERT INTO gis_line VALUES
+(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+INSERT INTO gis_polygon VALUES
+(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+INSERT INTO gis_multi_point VALUES
+(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+INSERT INTO gis_multi_line VALUES
+(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+INSERT INTO gis_multi_polygon VALUES
+(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+INSERT INTO gis_geometrycollection VALUES
+(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+(122, GeomFromText('GeometryCollection()')),
+(123, GeomFromText('GeometryCollection EMPTY'));
+INSERT into gis_geometry SELECT * FROM gis_point;
+INSERT into gis_geometry SELECT * FROM gis_line;
+INSERT into gis_geometry SELECT * FROM gis_polygon;
+INSERT into gis_geometry SELECT * FROM gis_multi_point;
+INSERT into gis_geometry SELECT * FROM gis_multi_line;
+INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+SELECT fid, AsText(g) FROM gis_point;
+fid AsText(g)
+101 POINT(10 10)
+102 POINT(20 10)
+103 POINT(20 20)
+104 POINT(10 20)
+SELECT fid, AsText(g) FROM gis_line;
+fid AsText(g)
+105 LINESTRING(0 0,0 10,10 0)
+106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+107 LINESTRING(10 10,40 10)
+SELECT fid, AsText(g) FROM gis_polygon;
+fid AsText(g)
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+110 POLYGON((0 0,30 0,30 30,0 0))
+SELECT fid, AsText(g) FROM gis_multi_point;
+fid AsText(g)
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
+SELECT fid, AsText(g) FROM gis_multi_line;
+fid AsText(g)
+114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+115 MULTILINESTRING((10 48,10 21,10 0))
+116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+SELECT fid, AsText(g) FROM gis_multi_polygon;
+fid AsText(g)
+117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+SELECT fid, AsText(g) FROM gis_geometrycollection;
+fid AsText(g)
+120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+122 GEOMETRYCOLLECTION EMPTY
+123 GEOMETRYCOLLECTION EMPTY
+SELECT fid, AsText(g) FROM gis_geometry;
+fid AsText(g)
+101 POINT(10 10)
+102 POINT(20 10)
+103 POINT(20 20)
+104 POINT(10 20)
+105 LINESTRING(0 0,0 10,10 0)
+106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+107 LINESTRING(10 10,40 10)
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+110 POLYGON((0 0,30 0,30 30,0 0))
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
+114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+115 MULTILINESTRING((10 48,10 21,10 0))
+116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+122 GEOMETRYCOLLECTION EMPTY
+123 GEOMETRYCOLLECTION EMPTY
+SELECT fid, Dimension(g) FROM gis_geometry;
+fid Dimension(g)
+101 0
+102 0
+103 0
+104 0
+105 1
+106 1
+107 1
+108 2
+109 2
+110 2
+111 0
+112 0
+113 0
+114 1
+115 1
+116 1
+117 2
+118 2
+119 2
+120 1
+121 1
+122 0
+123 0
+SELECT fid, GeometryType(g) FROM gis_geometry;
+fid GeometryType(g)
+101 POINT
+102 POINT
+103 POINT
+104 POINT
+105 LINESTRING
+106 LINESTRING
+107 LINESTRING
+108 POLYGON
+109 POLYGON
+110 POLYGON
+111 MULTIPOINT
+112 MULTIPOINT
+113 MULTIPOINT
+114 MULTILINESTRING
+115 MULTILINESTRING
+116 MULTILINESTRING
+117 MULTIPOLYGON
+118 MULTIPOLYGON
+119 MULTIPOLYGON
+120 GEOMETRYCOLLECTION
+121 GEOMETRYCOLLECTION
+122 GEOMETRYCOLLECTION
+123 GEOMETRYCOLLECTION
+SELECT fid, IsEmpty(g) FROM gis_geometry;
+fid IsEmpty(g)
+101 0
+102 0
+103 0
+104 0
+105 0
+106 0
+107 0
+108 0
+109 0
+110 0
+111 0
+112 0
+113 0
+114 0
+115 0
+116 0
+117 0
+118 0
+119 0
+120 0
+121 0
+122 0
+123 0
+SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+fid AsText(Envelope(g))
+101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+122 GEOMETRYCOLLECTION EMPTY
+123 GEOMETRYCOLLECTION EMPTY
+SELECT fid, X(g) FROM gis_point;
+fid X(g)
+101 10
+102 20
+103 20
+104 10
+SELECT fid, Y(g) FROM gis_point;
+fid Y(g)
+101 10
+102 10
+103 20
+104 20
+SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+fid AsText(StartPoint(g))
+105 POINT(0 0)
+106 POINT(10 10)
+107 POINT(10 10)
+SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+fid AsText(EndPoint(g))
+105 POINT(10 0)
+106 POINT(10 10)
+107 POINT(40 10)
+SELECT fid, GLength(g) FROM gis_line;
+fid GLength(g)
+105 24.14213562373095
+106 40
+107 30
+SELECT fid, NumPoints(g) FROM gis_line;
+fid NumPoints(g)
+105 3
+106 5
+107 2
+SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+fid AsText(PointN(g, 2))
+105 POINT(0 10)
+106 POINT(20 10)
+107 POINT(40 10)
+SELECT fid, IsClosed(g) FROM gis_line;
+fid IsClosed(g)
+105 0
+106 1
+107 0
+SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+fid AsText(Centroid(g))
+108 POINT(15 15)
+109 POINT(25.416666666666668 25.416666666666668)
+110 POINT(20 10)
+SELECT fid, Area(g) FROM gis_polygon;
+fid Area(g)
+108 100
+109 2400
+110 450
+SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+fid AsText(ExteriorRing(g))
+108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+110 LINESTRING(0 0,30 0,30 30,0 0)
+SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+fid NumInteriorRings(g)
+108 0
+109 1
+110 0
+SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+fid AsText(InteriorRingN(g, 1))
+108 NULL
+109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+110 NULL
+SELECT fid, IsClosed(g) FROM gis_multi_line;
+fid IsClosed(g)
+114 0
+115 0
+116 0
+SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+fid AsText(Centroid(g))
+117 POINT(55.58852775304245 17.426536064113982)
+118 POINT(55.58852775304245 17.426536064113982)
+119 POINT(2 2)
+SELECT fid, Area(g) FROM gis_multi_polygon;
+fid Area(g)
+117 1684.5
+118 1684.5
+119 4.5
+SELECT fid, NumGeometries(g) from gis_multi_point;
+fid NumGeometries(g)
+111 4
+112 4
+113 2
+SELECT fid, NumGeometries(g) from gis_multi_line;
+fid NumGeometries(g)
+114 2
+115 1
+116 2
+SELECT fid, NumGeometries(g) from gis_multi_polygon;
+fid NumGeometries(g)
+117 2
+118 2
+119 1
+SELECT fid, NumGeometries(g) from gis_geometrycollection;
+fid NumGeometries(g)
+120 2
+121 2
+122 0
+123 0
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+fid AsText(GeometryN(g, 2))
+111 POINT(10 10)
+112 POINT(11 11)
+113 POINT(4 10)
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+fid AsText(GeometryN(g, 2))
+114 LINESTRING(16 0,16 23,16 48)
+115 NULL
+116 LINESTRING(2 5,5 8,21 7)
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+fid AsText(GeometryN(g, 2))
+117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+119 NULL
+SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+fid AsText(GeometryN(g, 2))
+120 LINESTRING(0 0,10 10)
+121 LINESTRING(3 6,7 9)
+122 NULL
+123 NULL
+SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+fid AsText(GeometryN(g, 1))
+120 POINT(0 0)
+121 POINT(44 6)
+122 NULL
+123 NULL
+SELECT g1.fid as first, g2.fid as second,
+Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+first second w c o e d t i r
+120 120 1 1 0 1 0 1 1 0
+120 121 0 0 1 0 0 0 1 0
+120 122 0 1 NULL 0 NULL 0 NULL 0
+120 123 0 1 NULL 0 NULL 0 NULL 0
+121 120 0 0 1 0 0 0 1 0
+121 121 1 1 0 1 0 1 1 0
+121 122 0 1 NULL 0 NULL 0 NULL 0
+121 123 0 1 NULL 0 NULL 0 NULL 0
+122 120 1 0 NULL 0 NULL 0 NULL 0
+122 121 1 0 NULL 0 NULL 0 NULL 0
+122 122 1 1 NULL 1 NULL 0 NULL 0
+122 123 1 1 NULL 1 NULL 0 NULL 0
+123 120 1 0 NULL 0 NULL 0 NULL 0
+123 121 1 0 NULL 0 NULL 0 NULL 0
+123 122 1 1 NULL 1 NULL 0 NULL 0
+123 123 1 1 NULL 1 NULL 0 NULL 0
+DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+USE gis_ogs;
+# Lakes
+INSERT INTO lakes VALUES (
+101, 'BLUE LAKE',
+PolyFromText(
+'POLYGON(
+ (52 18,66 23,73 9,48 6,52 18),
+ (59 18,67 18,67 13,59 13,59 18)
+ )',
+101));
+# Road Segments
+INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+LineFromText(
+'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+LineFromText(
+'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+LineFromText(
+'LINESTRING( 70 38, 72 48 )' ,101));
+INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+LineFromText(
+'LINESTRING( 70 38, 84 42 )' ,101));
+INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+1,
+LineFromText(
+'LINESTRING( 28 26, 28 0 )',101));
+# DividedRoutes
+INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+MLineFromText(
+'MULTILINESTRING((10 48,10 21,10 0),
+ (16 0,16 23,16 48))', 101));
+# Forests
+INSERT INTO forests VALUES(109, 'Green Forest',
+MPolyFromText(
+'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+ (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+101));
+# Bridges
+INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+'POINT( 44 31 )', 101));
+# Streams
+INSERT INTO streams VALUES(111, 'Cam Stream',
+LineFromText(
+'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+INSERT INTO streams VALUES(112, NULL,
+LineFromText(
+'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+# Buildings
+INSERT INTO buildings VALUES(113, '123 Main Street',
+PointFromText(
+'POINT( 52 30 )', 101),
+PolyFromText(
+'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+INSERT INTO buildings VALUES(114, '215 Main Street',
+PointFromText(
+'POINT( 64 33 )', 101),
+PolyFromText(
+'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+# Ponds
+INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+MPolyFromText(
+'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+ ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+# Named Places
+INSERT INTO named_places VALUES(117, 'Ashton',
+PolyFromText(
+'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+INSERT INTO named_places VALUES(118, 'Goose Island',
+PolyFromText(
+'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+# Map Neatlines
+INSERT INTO map_neatlines VALUES(115,
+PolyFromText(
+'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+SELECT Dimension(shore)
+FROM lakes
+WHERE name = 'Blue Lake';
+Dimension(shore)
+2
+SELECT GeometryType(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+GeometryType(centerlines)
+MULTILINESTRING
+SELECT AsText(boundary)
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(boundary)
+POLYGON((67 13,67 18,59 18,59 13,67 13))
+SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(PolyFromWKB(AsBinary(boundary),101))
+POLYGON((67 13,67 18,59 18,59 13,67 13))
+SELECT SRID(boundary)
+FROM named_places
+WHERE name = 'Goose Island';
+SRID(boundary)
+101
+SELECT IsEmpty(centerline)
+FROM road_segments
+WHERE name = 'Route 5'
+AND aliases = 'Main Street';
+IsEmpty(centerline)
+0
+SELECT AsText(Envelope(boundary))
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(Envelope(boundary))
+POLYGON((59 13,67 13,67 18,59 18,59 13))
+SELECT X(position)
+FROM bridges
+WHERE name = 'Cam Bridge';
+X(position)
+44
+SELECT Y(position)
+FROM bridges
+WHERE name = 'Cam Bridge';
+Y(position)
+31
+SELECT AsText(StartPoint(centerline))
+FROM road_segments
+WHERE fid = 102;
+AsText(StartPoint(centerline))
+POINT(0 18)
+SELECT AsText(EndPoint(centerline))
+FROM road_segments
+WHERE fid = 102;
+AsText(EndPoint(centerline))
+POINT(44 31)
+SELECT GLength(centerline)
+FROM road_segments
+WHERE fid = 106;
+GLength(centerline)
+26
+SELECT NumPoints(centerline)
+FROM road_segments
+WHERE fid = 102;
+NumPoints(centerline)
+5
+SELECT AsText(PointN(centerline, 1))
+FROM road_segments
+WHERE fid = 102;
+AsText(PointN(centerline, 1))
+POINT(0 18)
+SELECT AsText(Centroid(boundary))
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(Centroid(boundary))
+POINT(63 15.5)
+SELECT Area(boundary)
+FROM named_places
+WHERE name = 'Goose Island';
+Area(boundary)
+40
+SELECT AsText(ExteriorRing(shore))
+FROM lakes
+WHERE name = 'Blue Lake';
+AsText(ExteriorRing(shore))
+LINESTRING(52 18,66 23,73 9,48 6,52 18)
+SELECT NumInteriorRings(shore)
+FROM lakes
+WHERE name = 'Blue Lake';
+NumInteriorRings(shore)
+1
+SELECT AsText(InteriorRingN(shore, 1))
+FROM lakes
+WHERE name = 'Blue Lake';
+AsText(InteriorRingN(shore, 1))
+LINESTRING(59 18,67 18,67 13,59 13,59 18)
+SELECT NumGeometries(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+NumGeometries(centerlines)
+2
+SELECT AsText(GeometryN(centerlines, 2))
+FROM divided_routes
+WHERE name = 'Route 75';
+AsText(GeometryN(centerlines, 2))
+LINESTRING(16 0,16 23,16 48)
+SELECT IsClosed(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+IsClosed(centerlines)
+0
+SELECT GLength(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+GLength(centerlines)
+96
+SELECT AsText(Centroid(shores))
+FROM ponds
+WHERE fid = 120;
+AsText(Centroid(shores))
+POINT(25 42)
+SELECT Area(shores)
+FROM ponds
+WHERE fid = 120;
+Area(shores)
+8
+SELECT ST_Equals(boundary,
+PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+FROM named_places
+WHERE name = 'Goose Island';
+ST_Equals(boundary,
+PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+1
+SELECT ST_Disjoint(centerlines, boundary)
+FROM divided_routes, named_places
+WHERE divided_routes.name = 'Route 75'
+AND named_places.name = 'Ashton';
+ST_Disjoint(centerlines, boundary)
+1
+SELECT ST_Touches(centerline, shore)
+FROM streams, lakes
+WHERE streams.name = 'Cam Stream'
+AND lakes.name = 'Blue Lake';
+ST_Touches(centerline, shore)
+1
+SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+FROM road_segments, divided_routes
+WHERE road_segments.fid = 102
+AND divided_routes.name = 'Route 75';
+Crosses(road_segments.centerline, divided_routes.centerlines)
+1
+SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+FROM road_segments, divided_routes
+WHERE road_segments.fid = 102
+AND divided_routes.name = 'Route 75';
+ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+1
+SELECT ST_Contains(forests.boundary, named_places.boundary)
+FROM forests, named_places
+WHERE forests.name = 'Green Forest'
+AND named_places.name = 'Ashton';
+ST_Contains(forests.boundary, named_places.boundary)
+0
+SELECT ST_Distance(position, boundary)
+FROM bridges, named_places
+WHERE bridges.name = 'Cam Bridge'
+AND named_places.name = 'Ashton';
+ST_Distance(position, boundary)
+12
+SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+FROM named_places, forests
+WHERE named_places.name = 'Ashton'
+AND forests.name = 'Green Forest';
+AsText(ST_Difference(named_places.boundary, forests.boundary))
+POLYGON((56 34,62 48,84 48,84 42,56 34))
+SELECT AsText(ST_Union(shore, boundary))
+FROM lakes, named_places
+WHERE lakes.name = 'Blue Lake'
+AND named_places.name = 'Goose Island';
+AsText(ST_Union(shore, boundary))
+POLYGON((48 6,52 18,66 23,73 9,48 6))
+SELECT AsText(ST_SymDifference(shore, boundary))
+FROM lakes, named_places
+WHERE lakes.name = 'Blue Lake'
+AND named_places.name = 'Ashton';
+AsText(ST_SymDifference(shore, boundary))
+MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
+SELECT count(*)
+FROM buildings, bridges
+WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+count(*)
+1
+DROP DATABASE gis_ogs;
+USE test;
diff --git a/mysql-test/suite/storage_engine/type_spatial.test b/mysql-test/suite/storage_engine/type_spatial.test
new file mode 100644
index 00000000000..e71805c5516
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_spatial.test
@@ -0,0 +1,10 @@
+#
+# Spatial objects
+#
+
+--source have_engine.inc
+
+--source type_spatial.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_spatial_indexes.result b/mysql-test/suite/storage_engine/type_spatial_indexes.result
new file mode 100644
index 00000000000..a3c2a4d4e75
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_spatial_indexes.result
@@ -0,0 +1,1400 @@
+DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+DROP DATABASE IF EXISTS gis_ogs;
+CREATE DATABASE gis_ogs;
+CREATE TABLE gis_point (fid <INT_COLUMN>, g POINT, <CUSTOM_INDEX> g(g(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON, <CUSTOM_INDEX> g(g(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT, <CUSTOM_INDEX> g(g(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+USE gis_ogs;
+CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+shore POLYGON, <CUSTOM_INDEX> s(shore(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
+num_lanes INT <CUSTOM_COL_OPTIONS>,
+centerline LINESTRING, <CUSTOM_INDEX> c(centerline(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+num_lanes INT <CUSTOM_COL_OPTIONS>,
+centerlines MULTILINESTRING, <CUSTOM_INDEX> c(centerlines(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+boundary MULTIPOLYGON, <CUSTOM_INDEX> b(boundary(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+position POINT, <CUSTOM_INDEX> p(`position`(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+centerline LINESTRING, <CUSTOM_INDEX> c(centerline(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+position POINT,
+footprint POLYGON, <CUSTOM_INDEX> p(`position`(64)), <CUSTOM_INDEX> f(footprint(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+type CHAR(64) <CUSTOM_COL_OPTIONS>,
+shores MULTIPOLYGON, <CUSTOM_INDEX> s(shores(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+boundary POLYGON, <CUSTOM_INDEX> b(boundary(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
+neatline POLYGON, <CUSTOM_INDEX> n(neatline(700))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+USE test;
+SHOW FIELDS FROM gis_point;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g point YES MUL NULL
+SHOW FIELDS FROM gis_line;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g linestring YES MUL NULL
+SHOW FIELDS FROM gis_polygon;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g polygon YES MUL NULL
+SHOW FIELDS FROM gis_multi_point;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g multipoint YES MUL NULL
+SHOW FIELDS FROM gis_multi_line;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g multilinestring YES MUL NULL
+SHOW FIELDS FROM gis_multi_polygon;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g multipolygon YES NULL
+SHOW FIELDS FROM gis_geometrycollection;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g geometrycollection YES NULL
+SHOW FIELDS FROM gis_geometry;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g geometry YES NULL
+INSERT INTO gis_point VALUES
+(101, PointFromText('POINT(10 10)')),
+(102, PointFromText('POINT(20 10)')),
+(103, PointFromText('POINT(20 20)')),
+(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+INSERT INTO gis_line VALUES
+(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+INSERT INTO gis_polygon VALUES
+(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+INSERT INTO gis_multi_point VALUES
+(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+INSERT INTO gis_multi_line VALUES
+(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+INSERT INTO gis_multi_polygon VALUES
+(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+INSERT INTO gis_geometrycollection VALUES
+(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+(122, GeomFromText('GeometryCollection()')),
+(123, GeomFromText('GeometryCollection EMPTY'));
+INSERT into gis_geometry SELECT * FROM gis_point;
+INSERT into gis_geometry SELECT * FROM gis_line;
+INSERT into gis_geometry SELECT * FROM gis_polygon;
+INSERT into gis_geometry SELECT * FROM gis_multi_point;
+INSERT into gis_geometry SELECT * FROM gis_multi_line;
+INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+SELECT fid, AsText(g) FROM gis_point;
+fid AsText(g)
+101 POINT(10 10)
+102 POINT(20 10)
+103 POINT(20 20)
+104 POINT(10 20)
+SELECT fid, AsText(g) FROM gis_line;
+fid AsText(g)
+105 LINESTRING(0 0,0 10,10 0)
+106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+107 LINESTRING(10 10,40 10)
+SELECT fid, AsText(g) FROM gis_polygon;
+fid AsText(g)
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+110 POLYGON((0 0,30 0,30 30,0 0))
+SELECT fid, AsText(g) FROM gis_multi_point;
+fid AsText(g)
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
+SELECT fid, AsText(g) FROM gis_multi_line;
+fid AsText(g)
+114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+115 MULTILINESTRING((10 48,10 21,10 0))
+116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+SELECT fid, AsText(g) FROM gis_multi_polygon;
+fid AsText(g)
+117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+SELECT fid, AsText(g) FROM gis_geometrycollection;
+fid AsText(g)
+120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+122 GEOMETRYCOLLECTION EMPTY
+123 GEOMETRYCOLLECTION EMPTY
+SELECT fid, AsText(g) FROM gis_geometry;
+fid AsText(g)
+101 POINT(10 10)
+102 POINT(20 10)
+103 POINT(20 20)
+104 POINT(10 20)
+105 LINESTRING(0 0,0 10,10 0)
+106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+107 LINESTRING(10 10,40 10)
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+110 POLYGON((0 0,30 0,30 30,0 0))
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
+114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+115 MULTILINESTRING((10 48,10 21,10 0))
+116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+122 GEOMETRYCOLLECTION EMPTY
+123 GEOMETRYCOLLECTION EMPTY
+SELECT fid, Dimension(g) FROM gis_geometry;
+fid Dimension(g)
+101 0
+102 0
+103 0
+104 0
+105 1
+106 1
+107 1
+108 2
+109 2
+110 2
+111 0
+112 0
+113 0
+114 1
+115 1
+116 1
+117 2
+118 2
+119 2
+120 1
+121 1
+122 0
+123 0
+SELECT fid, GeometryType(g) FROM gis_geometry;
+fid GeometryType(g)
+101 POINT
+102 POINT
+103 POINT
+104 POINT
+105 LINESTRING
+106 LINESTRING
+107 LINESTRING
+108 POLYGON
+109 POLYGON
+110 POLYGON
+111 MULTIPOINT
+112 MULTIPOINT
+113 MULTIPOINT
+114 MULTILINESTRING
+115 MULTILINESTRING
+116 MULTILINESTRING
+117 MULTIPOLYGON
+118 MULTIPOLYGON
+119 MULTIPOLYGON
+120 GEOMETRYCOLLECTION
+121 GEOMETRYCOLLECTION
+122 GEOMETRYCOLLECTION
+123 GEOMETRYCOLLECTION
+SELECT fid, IsEmpty(g) FROM gis_geometry;
+fid IsEmpty(g)
+101 0
+102 0
+103 0
+104 0
+105 0
+106 0
+107 0
+108 0
+109 0
+110 0
+111 0
+112 0
+113 0
+114 0
+115 0
+116 0
+117 0
+118 0
+119 0
+120 0
+121 0
+122 0
+123 0
+SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+fid AsText(Envelope(g))
+101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+122 GEOMETRYCOLLECTION EMPTY
+123 GEOMETRYCOLLECTION EMPTY
+SELECT fid, X(g) FROM gis_point;
+fid X(g)
+101 10
+102 20
+103 20
+104 10
+SELECT fid, Y(g) FROM gis_point;
+fid Y(g)
+101 10
+102 10
+103 20
+104 20
+SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+fid AsText(StartPoint(g))
+105 POINT(0 0)
+106 POINT(10 10)
+107 POINT(10 10)
+SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+fid AsText(EndPoint(g))
+105 POINT(10 0)
+106 POINT(10 10)
+107 POINT(40 10)
+SELECT fid, GLength(g) FROM gis_line;
+fid GLength(g)
+105 24.14213562373095
+106 40
+107 30
+SELECT fid, NumPoints(g) FROM gis_line;
+fid NumPoints(g)
+105 3
+106 5
+107 2
+SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+fid AsText(PointN(g, 2))
+105 POINT(0 10)
+106 POINT(20 10)
+107 POINT(40 10)
+SELECT fid, IsClosed(g) FROM gis_line;
+fid IsClosed(g)
+105 0
+106 1
+107 0
+SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+fid AsText(Centroid(g))
+108 POINT(15 15)
+109 POINT(25.416666666666668 25.416666666666668)
+110 POINT(20 10)
+SELECT fid, Area(g) FROM gis_polygon;
+fid Area(g)
+108 100
+109 2400
+110 450
+SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+fid AsText(ExteriorRing(g))
+108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+110 LINESTRING(0 0,30 0,30 30,0 0)
+SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+fid NumInteriorRings(g)
+108 0
+109 1
+110 0
+SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+fid AsText(InteriorRingN(g, 1))
+108 NULL
+109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+110 NULL
+SELECT fid, IsClosed(g) FROM gis_multi_line;
+fid IsClosed(g)
+114 0
+115 0
+116 0
+SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+fid AsText(Centroid(g))
+117 POINT(55.58852775304245 17.426536064113982)
+118 POINT(55.58852775304245 17.426536064113982)
+119 POINT(2 2)
+SELECT fid, Area(g) FROM gis_multi_polygon;
+fid Area(g)
+117 1684.5
+118 1684.5
+119 4.5
+SELECT fid, NumGeometries(g) from gis_multi_point;
+fid NumGeometries(g)
+111 4
+112 4
+113 2
+SELECT fid, NumGeometries(g) from gis_multi_line;
+fid NumGeometries(g)
+114 2
+115 1
+116 2
+SELECT fid, NumGeometries(g) from gis_multi_polygon;
+fid NumGeometries(g)
+117 2
+118 2
+119 1
+SELECT fid, NumGeometries(g) from gis_geometrycollection;
+fid NumGeometries(g)
+120 2
+121 2
+122 0
+123 0
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+fid AsText(GeometryN(g, 2))
+111 POINT(10 10)
+112 POINT(11 11)
+113 POINT(4 10)
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+fid AsText(GeometryN(g, 2))
+114 LINESTRING(16 0,16 23,16 48)
+115 NULL
+116 LINESTRING(2 5,5 8,21 7)
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+fid AsText(GeometryN(g, 2))
+117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+119 NULL
+SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+fid AsText(GeometryN(g, 2))
+120 LINESTRING(0 0,10 10)
+121 LINESTRING(3 6,7 9)
+122 NULL
+123 NULL
+SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+fid AsText(GeometryN(g, 1))
+120 POINT(0 0)
+121 POINT(44 6)
+122 NULL
+123 NULL
+SELECT g1.fid as first, g2.fid as second,
+Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+first second w c o e d t i r
+120 120 1 1 0 1 0 1 1 0
+120 121 0 0 1 0 0 0 1 0
+120 122 0 1 NULL 0 NULL 0 NULL 0
+120 123 0 1 NULL 0 NULL 0 NULL 0
+121 120 0 0 1 0 0 0 1 0
+121 121 1 1 0 1 0 1 1 0
+121 122 0 1 NULL 0 NULL 0 NULL 0
+121 123 0 1 NULL 0 NULL 0 NULL 0
+122 120 1 0 NULL 0 NULL 0 NULL 0
+122 121 1 0 NULL 0 NULL 0 NULL 0
+122 122 1 1 NULL 1 NULL 0 NULL 0
+122 123 1 1 NULL 1 NULL 0 NULL 0
+123 120 1 0 NULL 0 NULL 0 NULL 0
+123 121 1 0 NULL 0 NULL 0 NULL 0
+123 122 1 1 NULL 1 NULL 0 NULL 0
+123 123 1 1 NULL 1 NULL 0 NULL 0
+DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+USE gis_ogs;
+# Lakes
+INSERT INTO lakes VALUES (
+101, 'BLUE LAKE',
+PolyFromText(
+'POLYGON(
+ (52 18,66 23,73 9,48 6,52 18),
+ (59 18,67 18,67 13,59 13,59 18)
+ )',
+101));
+# Road Segments
+INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+LineFromText(
+'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+LineFromText(
+'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+LineFromText(
+'LINESTRING( 70 38, 72 48 )' ,101));
+INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+LineFromText(
+'LINESTRING( 70 38, 84 42 )' ,101));
+INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+1,
+LineFromText(
+'LINESTRING( 28 26, 28 0 )',101));
+# DividedRoutes
+INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+MLineFromText(
+'MULTILINESTRING((10 48,10 21,10 0),
+ (16 0,16 23,16 48))', 101));
+# Forests
+INSERT INTO forests VALUES(109, 'Green Forest',
+MPolyFromText(
+'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+ (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+101));
+# Bridges
+INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+'POINT( 44 31 )', 101));
+# Streams
+INSERT INTO streams VALUES(111, 'Cam Stream',
+LineFromText(
+'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+INSERT INTO streams VALUES(112, NULL,
+LineFromText(
+'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+# Buildings
+INSERT INTO buildings VALUES(113, '123 Main Street',
+PointFromText(
+'POINT( 52 30 )', 101),
+PolyFromText(
+'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+INSERT INTO buildings VALUES(114, '215 Main Street',
+PointFromText(
+'POINT( 64 33 )', 101),
+PolyFromText(
+'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+# Ponds
+INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+MPolyFromText(
+'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+ ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+# Named Places
+INSERT INTO named_places VALUES(117, 'Ashton',
+PolyFromText(
+'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+INSERT INTO named_places VALUES(118, 'Goose Island',
+PolyFromText(
+'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+# Map Neatlines
+INSERT INTO map_neatlines VALUES(115,
+PolyFromText(
+'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+SELECT Dimension(shore)
+FROM lakes
+WHERE name = 'Blue Lake';
+Dimension(shore)
+2
+SELECT GeometryType(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+GeometryType(centerlines)
+MULTILINESTRING
+SELECT AsText(boundary)
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(boundary)
+POLYGON((67 13,67 18,59 18,59 13,67 13))
+SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(PolyFromWKB(AsBinary(boundary),101))
+POLYGON((67 13,67 18,59 18,59 13,67 13))
+SELECT SRID(boundary)
+FROM named_places
+WHERE name = 'Goose Island';
+SRID(boundary)
+101
+SELECT IsEmpty(centerline)
+FROM road_segments
+WHERE name = 'Route 5'
+AND aliases = 'Main Street';
+IsEmpty(centerline)
+0
+SELECT AsText(Envelope(boundary))
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(Envelope(boundary))
+POLYGON((59 13,67 13,67 18,59 18,59 13))
+SELECT X(position)
+FROM bridges
+WHERE name = 'Cam Bridge';
+X(position)
+44
+SELECT Y(position)
+FROM bridges
+WHERE name = 'Cam Bridge';
+Y(position)
+31
+SELECT AsText(StartPoint(centerline))
+FROM road_segments
+WHERE fid = 102;
+AsText(StartPoint(centerline))
+POINT(0 18)
+SELECT AsText(EndPoint(centerline))
+FROM road_segments
+WHERE fid = 102;
+AsText(EndPoint(centerline))
+POINT(44 31)
+SELECT GLength(centerline)
+FROM road_segments
+WHERE fid = 106;
+GLength(centerline)
+26
+SELECT NumPoints(centerline)
+FROM road_segments
+WHERE fid = 102;
+NumPoints(centerline)
+5
+SELECT AsText(PointN(centerline, 1))
+FROM road_segments
+WHERE fid = 102;
+AsText(PointN(centerline, 1))
+POINT(0 18)
+SELECT AsText(Centroid(boundary))
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(Centroid(boundary))
+POINT(63 15.5)
+SELECT Area(boundary)
+FROM named_places
+WHERE name = 'Goose Island';
+Area(boundary)
+40
+SELECT AsText(ExteriorRing(shore))
+FROM lakes
+WHERE name = 'Blue Lake';
+AsText(ExteriorRing(shore))
+LINESTRING(52 18,66 23,73 9,48 6,52 18)
+SELECT NumInteriorRings(shore)
+FROM lakes
+WHERE name = 'Blue Lake';
+NumInteriorRings(shore)
+1
+SELECT AsText(InteriorRingN(shore, 1))
+FROM lakes
+WHERE name = 'Blue Lake';
+AsText(InteriorRingN(shore, 1))
+LINESTRING(59 18,67 18,67 13,59 13,59 18)
+SELECT NumGeometries(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+NumGeometries(centerlines)
+2
+SELECT AsText(GeometryN(centerlines, 2))
+FROM divided_routes
+WHERE name = 'Route 75';
+AsText(GeometryN(centerlines, 2))
+LINESTRING(16 0,16 23,16 48)
+SELECT IsClosed(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+IsClosed(centerlines)
+0
+SELECT GLength(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+GLength(centerlines)
+96
+SELECT AsText(Centroid(shores))
+FROM ponds
+WHERE fid = 120;
+AsText(Centroid(shores))
+POINT(25 42)
+SELECT Area(shores)
+FROM ponds
+WHERE fid = 120;
+Area(shores)
+8
+SELECT ST_Equals(boundary,
+PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+FROM named_places
+WHERE name = 'Goose Island';
+ST_Equals(boundary,
+PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+1
+SELECT ST_Disjoint(centerlines, boundary)
+FROM divided_routes, named_places
+WHERE divided_routes.name = 'Route 75'
+AND named_places.name = 'Ashton';
+ST_Disjoint(centerlines, boundary)
+1
+SELECT ST_Touches(centerline, shore)
+FROM streams, lakes
+WHERE streams.name = 'Cam Stream'
+AND lakes.name = 'Blue Lake';
+ST_Touches(centerline, shore)
+1
+SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+FROM road_segments, divided_routes
+WHERE road_segments.fid = 102
+AND divided_routes.name = 'Route 75';
+Crosses(road_segments.centerline, divided_routes.centerlines)
+1
+SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+FROM road_segments, divided_routes
+WHERE road_segments.fid = 102
+AND divided_routes.name = 'Route 75';
+ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+1
+SELECT ST_Contains(forests.boundary, named_places.boundary)
+FROM forests, named_places
+WHERE forests.name = 'Green Forest'
+AND named_places.name = 'Ashton';
+ST_Contains(forests.boundary, named_places.boundary)
+0
+SELECT ST_Distance(position, boundary)
+FROM bridges, named_places
+WHERE bridges.name = 'Cam Bridge'
+AND named_places.name = 'Ashton';
+ST_Distance(position, boundary)
+12
+SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+FROM named_places, forests
+WHERE named_places.name = 'Ashton'
+AND forests.name = 'Green Forest';
+AsText(ST_Difference(named_places.boundary, forests.boundary))
+POLYGON((56 34,62 48,84 48,84 42,56 34))
+SELECT AsText(ST_Union(shore, boundary))
+FROM lakes, named_places
+WHERE lakes.name = 'Blue Lake'
+AND named_places.name = 'Goose Island';
+AsText(ST_Union(shore, boundary))
+POLYGON((48 6,52 18,66 23,73 9,48 6))
+SELECT AsText(ST_SymDifference(shore, boundary))
+FROM lakes, named_places
+WHERE lakes.name = 'Blue Lake'
+AND named_places.name = 'Ashton';
+AsText(ST_SymDifference(shore, boundary))
+MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
+SELECT count(*)
+FROM buildings, bridges
+WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+count(*)
+1
+DROP DATABASE gis_ogs;
+USE test;
+DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+DROP DATABASE IF EXISTS gis_ogs;
+CREATE DATABASE gis_ogs;
+CREATE TABLE gis_point (fid <INT_COLUMN>, g POINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+USE gis_ogs;
+CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+shore POLYGON NOT NULL, SPATIAL INDEX s(shore)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
+num_lanes INT <CUSTOM_COL_OPTIONS>,
+centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+num_lanes INT <CUSTOM_COL_OPTIONS>,
+centerlines MULTILINESTRING NOT NULL, SPATIAL INDEX c(centerlines)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+boundary MULTIPOLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+position POINT NOT NULL, SPATIAL INDEX p(position)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+position POINT NOT NULL,
+footprint POLYGON NOT NULL, SPATIAL INDEX p(position), SPATIAL INDEX f(footprint)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+type CHAR(64) <CUSTOM_COL_OPTIONS>,
+shores MULTIPOLYGON NOT NULL, SPATIAL INDEX s(shores)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
+name CHAR(64) <CUSTOM_COL_OPTIONS>,
+boundary POLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
+neatline POLYGON NOT NULL, SPATIAL INDEX n(neatline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+USE test;
+SHOW FIELDS FROM gis_point;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g point NO MUL NULL
+SHOW FIELDS FROM gis_line;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g linestring NO MUL NULL
+SHOW FIELDS FROM gis_polygon;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g polygon NO MUL NULL
+SHOW FIELDS FROM gis_multi_point;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g multipoint NO MUL NULL
+SHOW FIELDS FROM gis_multi_line;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g multilinestring NO MUL NULL
+SHOW FIELDS FROM gis_multi_polygon;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g multipolygon NO MUL NULL
+SHOW FIELDS FROM gis_geometrycollection;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g geometrycollection NO MUL NULL
+SHOW FIELDS FROM gis_geometry;
+Field Type Null Key Default Extra
+fid int(11) YES NULL
+g geometry NO NULL
+INSERT INTO gis_point VALUES
+(101, PointFromText('POINT(10 10)')),
+(102, PointFromText('POINT(20 10)')),
+(103, PointFromText('POINT(20 20)')),
+(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+INSERT INTO gis_line VALUES
+(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+INSERT INTO gis_polygon VALUES
+(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+INSERT INTO gis_multi_point VALUES
+(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+INSERT INTO gis_multi_line VALUES
+(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+INSERT INTO gis_multi_polygon VALUES
+(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+INSERT INTO gis_geometrycollection VALUES
+(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+(122, GeomFromText('GeometryCollection()')),
+(123, GeomFromText('GeometryCollection EMPTY'));
+INSERT into gis_geometry SELECT * FROM gis_point;
+INSERT into gis_geometry SELECT * FROM gis_line;
+INSERT into gis_geometry SELECT * FROM gis_polygon;
+INSERT into gis_geometry SELECT * FROM gis_multi_point;
+INSERT into gis_geometry SELECT * FROM gis_multi_line;
+INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+SELECT fid, AsText(g) FROM gis_point;
+fid AsText(g)
+101 POINT(10 10)
+102 POINT(20 10)
+103 POINT(20 20)
+104 POINT(10 20)
+SELECT fid, AsText(g) FROM gis_line;
+fid AsText(g)
+105 LINESTRING(0 0,0 10,10 0)
+106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+107 LINESTRING(10 10,40 10)
+SELECT fid, AsText(g) FROM gis_polygon;
+fid AsText(g)
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+110 POLYGON((0 0,30 0,30 30,0 0))
+SELECT fid, AsText(g) FROM gis_multi_point;
+fid AsText(g)
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
+SELECT fid, AsText(g) FROM gis_multi_line;
+fid AsText(g)
+114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+115 MULTILINESTRING((10 48,10 21,10 0))
+116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+SELECT fid, AsText(g) FROM gis_multi_polygon;
+fid AsText(g)
+117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+SELECT fid, AsText(g) FROM gis_geometrycollection;
+fid AsText(g)
+120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+122 GEOMETRYCOLLECTION EMPTY
+123 GEOMETRYCOLLECTION EMPTY
+SELECT fid, AsText(g) FROM gis_geometry;
+fid AsText(g)
+101 POINT(10 10)
+102 POINT(20 10)
+103 POINT(20 20)
+104 POINT(10 20)
+105 LINESTRING(0 0,0 10,10 0)
+106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+107 LINESTRING(10 10,40 10)
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+110 POLYGON((0 0,30 0,30 30,0 0))
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
+114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+115 MULTILINESTRING((10 48,10 21,10 0))
+116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+122 GEOMETRYCOLLECTION EMPTY
+123 GEOMETRYCOLLECTION EMPTY
+SELECT fid, Dimension(g) FROM gis_geometry;
+fid Dimension(g)
+101 0
+102 0
+103 0
+104 0
+105 1
+106 1
+107 1
+108 2
+109 2
+110 2
+111 0
+112 0
+113 0
+114 1
+115 1
+116 1
+117 2
+118 2
+119 2
+120 1
+121 1
+122 0
+123 0
+SELECT fid, GeometryType(g) FROM gis_geometry;
+fid GeometryType(g)
+101 POINT
+102 POINT
+103 POINT
+104 POINT
+105 LINESTRING
+106 LINESTRING
+107 LINESTRING
+108 POLYGON
+109 POLYGON
+110 POLYGON
+111 MULTIPOINT
+112 MULTIPOINT
+113 MULTIPOINT
+114 MULTILINESTRING
+115 MULTILINESTRING
+116 MULTILINESTRING
+117 MULTIPOLYGON
+118 MULTIPOLYGON
+119 MULTIPOLYGON
+120 GEOMETRYCOLLECTION
+121 GEOMETRYCOLLECTION
+122 GEOMETRYCOLLECTION
+123 GEOMETRYCOLLECTION
+SELECT fid, IsEmpty(g) FROM gis_geometry;
+fid IsEmpty(g)
+101 0
+102 0
+103 0
+104 0
+105 0
+106 0
+107 0
+108 0
+109 0
+110 0
+111 0
+112 0
+113 0
+114 0
+115 0
+116 0
+117 0
+118 0
+119 0
+120 0
+121 0
+122 0
+123 0
+SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+fid AsText(Envelope(g))
+101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+122 GEOMETRYCOLLECTION EMPTY
+123 GEOMETRYCOLLECTION EMPTY
+SELECT fid, X(g) FROM gis_point;
+fid X(g)
+101 10
+102 20
+103 20
+104 10
+SELECT fid, Y(g) FROM gis_point;
+fid Y(g)
+101 10
+102 10
+103 20
+104 20
+SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+fid AsText(StartPoint(g))
+105 POINT(0 0)
+106 POINT(10 10)
+107 POINT(10 10)
+SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+fid AsText(EndPoint(g))
+105 POINT(10 0)
+106 POINT(10 10)
+107 POINT(40 10)
+SELECT fid, GLength(g) FROM gis_line;
+fid GLength(g)
+105 24.14213562373095
+106 40
+107 30
+SELECT fid, NumPoints(g) FROM gis_line;
+fid NumPoints(g)
+105 3
+106 5
+107 2
+SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+fid AsText(PointN(g, 2))
+105 POINT(0 10)
+106 POINT(20 10)
+107 POINT(40 10)
+SELECT fid, IsClosed(g) FROM gis_line;
+fid IsClosed(g)
+105 0
+106 1
+107 0
+SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+fid AsText(Centroid(g))
+108 POINT(15 15)
+109 POINT(25.416666666666668 25.416666666666668)
+110 POINT(20 10)
+SELECT fid, Area(g) FROM gis_polygon;
+fid Area(g)
+108 100
+109 2400
+110 450
+SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+fid AsText(ExteriorRing(g))
+108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+110 LINESTRING(0 0,30 0,30 30,0 0)
+SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+fid NumInteriorRings(g)
+108 0
+109 1
+110 0
+SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+fid AsText(InteriorRingN(g, 1))
+108 NULL
+109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+110 NULL
+SELECT fid, IsClosed(g) FROM gis_multi_line;
+fid IsClosed(g)
+114 0
+115 0
+116 0
+SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+fid AsText(Centroid(g))
+117 POINT(55.58852775304245 17.426536064113982)
+118 POINT(55.58852775304245 17.426536064113982)
+119 POINT(2 2)
+SELECT fid, Area(g) FROM gis_multi_polygon;
+fid Area(g)
+117 1684.5
+118 1684.5
+119 4.5
+SELECT fid, NumGeometries(g) from gis_multi_point;
+fid NumGeometries(g)
+111 4
+112 4
+113 2
+SELECT fid, NumGeometries(g) from gis_multi_line;
+fid NumGeometries(g)
+114 2
+115 1
+116 2
+SELECT fid, NumGeometries(g) from gis_multi_polygon;
+fid NumGeometries(g)
+117 2
+118 2
+119 1
+SELECT fid, NumGeometries(g) from gis_geometrycollection;
+fid NumGeometries(g)
+120 2
+121 2
+122 0
+123 0
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+fid AsText(GeometryN(g, 2))
+111 POINT(10 10)
+112 POINT(11 11)
+113 POINT(4 10)
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+fid AsText(GeometryN(g, 2))
+114 LINESTRING(16 0,16 23,16 48)
+115 NULL
+116 LINESTRING(2 5,5 8,21 7)
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+fid AsText(GeometryN(g, 2))
+117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+119 NULL
+SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+fid AsText(GeometryN(g, 2))
+120 LINESTRING(0 0,10 10)
+121 LINESTRING(3 6,7 9)
+122 NULL
+123 NULL
+SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+fid AsText(GeometryN(g, 1))
+120 POINT(0 0)
+121 POINT(44 6)
+122 NULL
+123 NULL
+SELECT g1.fid as first, g2.fid as second,
+Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+first second w c o e d t i r
+120 120 1 1 0 1 0 1 1 0
+120 121 0 0 1 0 0 0 1 0
+120 122 0 1 NULL 0 NULL 0 NULL 0
+120 123 0 1 NULL 0 NULL 0 NULL 0
+121 120 0 0 1 0 0 0 1 0
+121 121 1 1 0 1 0 1 1 0
+121 122 0 1 NULL 0 NULL 0 NULL 0
+121 123 0 1 NULL 0 NULL 0 NULL 0
+122 120 1 0 NULL 0 NULL 0 NULL 0
+122 121 1 0 NULL 0 NULL 0 NULL 0
+122 122 1 1 NULL 1 NULL 0 NULL 0
+122 123 1 1 NULL 1 NULL 0 NULL 0
+123 120 1 0 NULL 0 NULL 0 NULL 0
+123 121 1 0 NULL 0 NULL 0 NULL 0
+123 122 1 1 NULL 1 NULL 0 NULL 0
+123 123 1 1 NULL 1 NULL 0 NULL 0
+DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+USE gis_ogs;
+# Lakes
+INSERT INTO lakes VALUES (
+101, 'BLUE LAKE',
+PolyFromText(
+'POLYGON(
+ (52 18,66 23,73 9,48 6,52 18),
+ (59 18,67 18,67 13,59 13,59 18)
+ )',
+101));
+# Road Segments
+INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+LineFromText(
+'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+LineFromText(
+'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+LineFromText(
+'LINESTRING( 70 38, 72 48 )' ,101));
+INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+LineFromText(
+'LINESTRING( 70 38, 84 42 )' ,101));
+INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+1,
+LineFromText(
+'LINESTRING( 28 26, 28 0 )',101));
+# DividedRoutes
+INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+MLineFromText(
+'MULTILINESTRING((10 48,10 21,10 0),
+ (16 0,16 23,16 48))', 101));
+# Forests
+INSERT INTO forests VALUES(109, 'Green Forest',
+MPolyFromText(
+'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+ (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+101));
+# Bridges
+INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+'POINT( 44 31 )', 101));
+# Streams
+INSERT INTO streams VALUES(111, 'Cam Stream',
+LineFromText(
+'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+INSERT INTO streams VALUES(112, NULL,
+LineFromText(
+'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+# Buildings
+INSERT INTO buildings VALUES(113, '123 Main Street',
+PointFromText(
+'POINT( 52 30 )', 101),
+PolyFromText(
+'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+INSERT INTO buildings VALUES(114, '215 Main Street',
+PointFromText(
+'POINT( 64 33 )', 101),
+PolyFromText(
+'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+# Ponds
+INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+MPolyFromText(
+'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+ ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+# Named Places
+INSERT INTO named_places VALUES(117, 'Ashton',
+PolyFromText(
+'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+INSERT INTO named_places VALUES(118, 'Goose Island',
+PolyFromText(
+'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+# Map Neatlines
+INSERT INTO map_neatlines VALUES(115,
+PolyFromText(
+'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+SELECT Dimension(shore)
+FROM lakes
+WHERE name = 'Blue Lake';
+Dimension(shore)
+2
+SELECT GeometryType(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+GeometryType(centerlines)
+MULTILINESTRING
+SELECT AsText(boundary)
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(boundary)
+POLYGON((67 13,67 18,59 18,59 13,67 13))
+SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(PolyFromWKB(AsBinary(boundary),101))
+POLYGON((67 13,67 18,59 18,59 13,67 13))
+SELECT SRID(boundary)
+FROM named_places
+WHERE name = 'Goose Island';
+SRID(boundary)
+101
+SELECT IsEmpty(centerline)
+FROM road_segments
+WHERE name = 'Route 5'
+AND aliases = 'Main Street';
+IsEmpty(centerline)
+0
+SELECT AsText(Envelope(boundary))
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(Envelope(boundary))
+POLYGON((59 13,67 13,67 18,59 18,59 13))
+SELECT X(position)
+FROM bridges
+WHERE name = 'Cam Bridge';
+X(position)
+44
+SELECT Y(position)
+FROM bridges
+WHERE name = 'Cam Bridge';
+Y(position)
+31
+SELECT AsText(StartPoint(centerline))
+FROM road_segments
+WHERE fid = 102;
+AsText(StartPoint(centerline))
+POINT(0 18)
+SELECT AsText(EndPoint(centerline))
+FROM road_segments
+WHERE fid = 102;
+AsText(EndPoint(centerline))
+POINT(44 31)
+SELECT GLength(centerline)
+FROM road_segments
+WHERE fid = 106;
+GLength(centerline)
+26
+SELECT NumPoints(centerline)
+FROM road_segments
+WHERE fid = 102;
+NumPoints(centerline)
+5
+SELECT AsText(PointN(centerline, 1))
+FROM road_segments
+WHERE fid = 102;
+AsText(PointN(centerline, 1))
+POINT(0 18)
+SELECT AsText(Centroid(boundary))
+FROM named_places
+WHERE name = 'Goose Island';
+AsText(Centroid(boundary))
+POINT(63 15.5)
+SELECT Area(boundary)
+FROM named_places
+WHERE name = 'Goose Island';
+Area(boundary)
+40
+SELECT AsText(ExteriorRing(shore))
+FROM lakes
+WHERE name = 'Blue Lake';
+AsText(ExteriorRing(shore))
+LINESTRING(52 18,66 23,73 9,48 6,52 18)
+SELECT NumInteriorRings(shore)
+FROM lakes
+WHERE name = 'Blue Lake';
+NumInteriorRings(shore)
+1
+SELECT AsText(InteriorRingN(shore, 1))
+FROM lakes
+WHERE name = 'Blue Lake';
+AsText(InteriorRingN(shore, 1))
+LINESTRING(59 18,67 18,67 13,59 13,59 18)
+SELECT NumGeometries(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+NumGeometries(centerlines)
+2
+SELECT AsText(GeometryN(centerlines, 2))
+FROM divided_routes
+WHERE name = 'Route 75';
+AsText(GeometryN(centerlines, 2))
+LINESTRING(16 0,16 23,16 48)
+SELECT IsClosed(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+IsClosed(centerlines)
+0
+SELECT GLength(centerlines)
+FROM divided_routes
+WHERE name = 'Route 75';
+GLength(centerlines)
+96
+SELECT AsText(Centroid(shores))
+FROM ponds
+WHERE fid = 120;
+AsText(Centroid(shores))
+POINT(25 42)
+SELECT Area(shores)
+FROM ponds
+WHERE fid = 120;
+Area(shores)
+8
+SELECT ST_Equals(boundary,
+PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+FROM named_places
+WHERE name = 'Goose Island';
+ST_Equals(boundary,
+PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+1
+SELECT ST_Disjoint(centerlines, boundary)
+FROM divided_routes, named_places
+WHERE divided_routes.name = 'Route 75'
+AND named_places.name = 'Ashton';
+ST_Disjoint(centerlines, boundary)
+1
+SELECT ST_Touches(centerline, shore)
+FROM streams, lakes
+WHERE streams.name = 'Cam Stream'
+AND lakes.name = 'Blue Lake';
+ST_Touches(centerline, shore)
+1
+SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+FROM road_segments, divided_routes
+WHERE road_segments.fid = 102
+AND divided_routes.name = 'Route 75';
+Crosses(road_segments.centerline, divided_routes.centerlines)
+1
+SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+FROM road_segments, divided_routes
+WHERE road_segments.fid = 102
+AND divided_routes.name = 'Route 75';
+ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+1
+SELECT ST_Contains(forests.boundary, named_places.boundary)
+FROM forests, named_places
+WHERE forests.name = 'Green Forest'
+AND named_places.name = 'Ashton';
+ST_Contains(forests.boundary, named_places.boundary)
+0
+SELECT ST_Distance(position, boundary)
+FROM bridges, named_places
+WHERE bridges.name = 'Cam Bridge'
+AND named_places.name = 'Ashton';
+ST_Distance(position, boundary)
+12
+SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+FROM named_places, forests
+WHERE named_places.name = 'Ashton'
+AND forests.name = 'Green Forest';
+AsText(ST_Difference(named_places.boundary, forests.boundary))
+POLYGON((56 34,62 48,84 48,84 42,56 34))
+SELECT AsText(ST_Union(shore, boundary))
+FROM lakes, named_places
+WHERE lakes.name = 'Blue Lake'
+AND named_places.name = 'Goose Island';
+AsText(ST_Union(shore, boundary))
+POLYGON((48 6,52 18,66 23,73 9,48 6))
+SELECT AsText(ST_SymDifference(shore, boundary))
+FROM lakes, named_places
+WHERE lakes.name = 'Blue Lake'
+AND named_places.name = 'Ashton';
+AsText(ST_SymDifference(shore, boundary))
+MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
+SELECT count(*)
+FROM buildings, bridges
+WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+count(*)
+1
+DROP DATABASE gis_ogs;
+USE test;
diff --git a/mysql-test/suite/storage_engine/type_spatial_indexes.test b/mysql-test/suite/storage_engine/type_spatial_indexes.test
new file mode 100644
index 00000000000..ae9fc592a3a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_spatial_indexes.test
@@ -0,0 +1,15 @@
+#
+# Indexes on spatial objects
+# (spatial and non-spatial indexes)
+#
+
+--source have_engine.inc
+
+--let $index = $default_index
+--source type_spatial.inc
+
+let $index = SPATIAL;
+--source type_spatial.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_text.inc b/mysql-test/suite/storage_engine/type_text.inc
new file mode 100644
index 00000000000..0f31e91c776
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_text.inc
@@ -0,0 +1,65 @@
+#
+# TEXT column types
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition =
+ t TEXT $col_opts,
+ t0 TEXT(0) $col_opts,
+ t1 TEXT(1) $col_opts,
+ t300 TEXT(300) $col_opts,
+ tm TEXT(65535) $col_opts,
+ t70k TEXT(70000) $col_opts,
+ t17m TEXT(17000000) $col_opts,
+ tt TINYTEXT $col_opts,
+ m MEDIUMTEXT $col_opts,
+ l LONGTEXT $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = TEXT types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ # Valid values
+ # (cannot get MAX for all columns due to max_allowed_packet limitations)
+
+ INSERT INTO t1 VALUES
+ ('','','','','','','','','',''),
+ ('a','b','c','d','e','f','g','h','i','j'),
+ ('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
+ ( REPEAT('a',65535), REPEAT('b',65535), REPEAT('c',255), REPEAT('d',65535), REPEAT('e',65535), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',255), REPEAT('i',1048576), REPEAT('j',1048576) );
+
+ --sorted_result
+ SELECT LENGTH(t), LENGTH(t0), LENGTH(t1), LENGTH(t300), LENGTH(tm), LENGTH(t70k), LENGTH(t17m), LENGTH(tt), LENGTH(m), LENGTH(l) FROM t1;
+
+ # Invalid values (produce warnings, except for mediumtext and longtext columns for which the values are within limits)
+
+ INSERT INTO t1 VALUES
+ ( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
+
+ --sorted_result
+ SELECT LENGTH(t), LENGTH(t0), LENGTH(t1), LENGTH(t300), LENGTH(tm), LENGTH(t70k), LENGTH(t17m), LENGTH(tt), LENGTH(m), LENGTH(l) FROM t1;
+
+ --let $error_codes = ER_TOO_BIG_DISPLAYWIDTH
+ --let $alter_definition = ADD COLUMN ttt TEXT(4294967296)
+ --source alter_table.inc
+ if ($mysql_errname != ER_TOO_BIG_DISPLAYWIDTH)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+ }
+ DROP TABLE t1;
+}
+
+
diff --git a/mysql-test/suite/storage_engine/type_text.result b/mysql-test/suite/storage_engine/type_text.result
new file mode 100644
index 00000000000..b3ca7a8d9da
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_text.result
@@ -0,0 +1,54 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (t TEXT <CUSTOM_COL_OPTIONS>,
+t0 TEXT(0) <CUSTOM_COL_OPTIONS>,
+t1 TEXT(1) <CUSTOM_COL_OPTIONS>,
+t300 TEXT(300) <CUSTOM_COL_OPTIONS>,
+tm TEXT(65535) <CUSTOM_COL_OPTIONS>,
+t70k TEXT(70000) <CUSTOM_COL_OPTIONS>,
+t17m TEXT(17000000) <CUSTOM_COL_OPTIONS>,
+tt TINYTEXT <CUSTOM_COL_OPTIONS>,
+m MEDIUMTEXT <CUSTOM_COL_OPTIONS>,
+l LONGTEXT <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+t text # # #
+t0 text # # #
+t1 tinytext # # #
+t300 text # # #
+tm text # # #
+t70k mediumtext # # #
+t17m longtext # # #
+tt tinytext # # #
+m mediumtext # # #
+l longtext # # #
+INSERT INTO t1 VALUES
+('','','','','','','','','',''),
+('a','b','c','d','e','f','g','h','i','j'),
+('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
+( REPEAT('a',65535), REPEAT('b',65535), REPEAT('c',255), REPEAT('d',65535), REPEAT('e',65535), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',255), REPEAT('i',1048576), REPEAT('j',1048576) );
+SELECT LENGTH(t), LENGTH(t0), LENGTH(t1), LENGTH(t300), LENGTH(tm), LENGTH(t70k), LENGTH(t17m), LENGTH(tt), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m) LENGTH(tt) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+INSERT INTO t1 VALUES
+( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
+Warnings:
+Warning 1265 Data truncated for column 't' at row 1
+Warning 1265 Data truncated for column 't0' at row 1
+Warning 1265 Data truncated for column 't1' at row 1
+Warning 1265 Data truncated for column 't300' at row 1
+Warning 1265 Data truncated for column 'tm' at row 1
+Warning 1265 Data truncated for column 'tt' at row 1
+SELECT LENGTH(t), LENGTH(t0), LENGTH(t1), LENGTH(t300), LENGTH(tm), LENGTH(t70k), LENGTH(t17m), LENGTH(tt), LENGTH(m), LENGTH(l) FROM t1;
+LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m) LENGTH(tt) LENGTH(m) LENGTH(l)
+0 0 0 0 0 0 0 0 0 0
+1 1 1 1 1 1 1 1 1 1
+5 5 5 5 5 5 5 5 5 6
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
+ALTER TABLE t1 ADD COLUMN ttt TEXT(4294967296);
+ERROR 42000: Display width out of range for 'ttt' (max = 4294967295)
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_text.test b/mysql-test/suite/storage_engine/type_text.test
new file mode 100644
index 00000000000..63e710195d2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_text.test
@@ -0,0 +1,10 @@
+#
+# TEXT column types
+#
+
+--source have_engine.inc
+
+--source type_text.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_text_indexes.result b/mysql-test/suite/storage_engine/type_text_indexes.result
new file mode 100644
index 00000000000..a23373e2c0d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_text_indexes.result
@@ -0,0 +1,137 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (t TEXT <CUSTOM_COL_OPTIONS>,
+tt TINYTEXT <CUSTOM_COL_OPTIONS>,
+m MEDIUMTEXT <CUSTOM_COL_OPTIONS>,
+l LONGTEXT <CUSTOM_COL_OPTIONS>,
+<CUSTOM_INDEX> t (t(32))
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 # 1 t # # 32 NULL # #
+INSERT INTO t1 (t,tt,m,l) VALUES
+('','','',''),
+('a','b','c','d'),
+('b','d','c','b'),
+('test1','test2','test3','test4'),
+(REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+('abc','def','ghi','jkl'),
+('test2','test3','test4','test5'),
+('test3','test4','test5','test6'),
+(REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+(REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+SELECT SUBSTRING(t,16) AS f FROM t1 WHERE t IN ('test1','test2') ORDER BY f;
+f
+
+
+DROP TABLE t1;
+CREATE TABLE t1 (t TEXT <CUSTOM_COL_OPTIONS>,
+tt TINYTEXT <CUSTOM_COL_OPTIONS>,
+m MEDIUMTEXT <CUSTOM_COL_OPTIONS>,
+l LONGTEXT <CUSTOM_COL_OPTIONS>,
+PRIMARY KEY t (t(32))
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 t # # 32 NULL # #
+INSERT INTO t1 (t,tt,m,l) VALUES
+('','','',''),
+('a','b','c','d'),
+('b','d','c','b'),
+('test1','test2','test3','test4'),
+(REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+('abc','def','ghi','jkl'),
+('test2','test3','test4','test5'),
+('test3','test4','test5','test6'),
+(REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+(REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+EXPLAIN SELECT SUBSTRING(t,16) AS f FROM t1 WHERE t IN ('test1','test2') ORDER BY f;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # PRIMARY # # # #
+SELECT SUBSTRING(t,16) AS f FROM t1 WHERE t IN ('test1','test2') ORDER BY f;
+f
+
+
+EXPLAIN SELECT SUBSTRING(t,16) AS f FROM t1 IGNORE INDEX (PRIMARY) WHERE t IN ('test1','test2') ORDER BY f;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # NULL # # # #
+SELECT SUBSTRING(t,16) AS f FROM t1 IGNORE INDEX (PRIMARY) WHERE t IN ('test1','test2') ORDER BY f;
+f
+
+
+DROP TABLE t1;
+CREATE TABLE t1 (t TEXT <CUSTOM_COL_OPTIONS>,
+tt TINYTEXT <CUSTOM_COL_OPTIONS>,
+m MEDIUMTEXT <CUSTOM_COL_OPTIONS>,
+l LONGTEXT <CUSTOM_COL_OPTIONS>,
+UNIQUE INDEX l_tt (l(256),tt(64))
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 l_tt 1 l # # 256 NULL # #
+t1 0 l_tt 2 tt # # 64 NULL # #
+INSERT INTO t1 (t,tt,m,l) VALUES
+('','','',''),
+('a','b','c','d'),
+('b','d','c','b'),
+('test1','test2','test3','test4'),
+(REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+('abc','def','ghi','jkl'),
+('test2','test3','test4','test5'),
+('test3','test4','test5','test6'),
+(REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+(REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+EXPLAIN SELECT SUBSTRING(tt,64), SUBSTRING(l,256) FROM t1 WHERE tt!=l AND l NOT IN ('test1') ORDER BY tt, l DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # l_tt # # # # #
+SELECT SUBSTRING(tt,64), SUBSTRING(l,256) FROM t1 WHERE tt!=l AND l NOT IN ('test1') ORDER BY tt, l DESC;
+SUBSTRING(tt,64) SUBSTRING(l,256)
+
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+
+
+fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+
+
+
+EXPLAIN SELECT SUBSTRING(tt,64), SUBSTRING(l,256) FROM t1 FORCE INDEX (l_t) WHERE tt!=l AND l NOT IN ('test1') ORDER BY tt, l DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # l_tt l_tt # # # #
+SELECT SUBSTRING(tt,64), SUBSTRING(l,256) FROM t1 FORCE INDEX (l_t) WHERE tt!=l AND l NOT IN ('test1') ORDER BY tt, l DESC;
+SUBSTRING(tt,64) SUBSTRING(l,256)
+
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+
+
+fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+
+
+
+DROP TABLE t1;
+CREATE TABLE t1 (t TEXT <CUSTOM_COL_OPTIONS>,
+tt TINYTEXT <CUSTOM_COL_OPTIONS>,
+m MEDIUMTEXT <CUSTOM_COL_OPTIONS>,
+l LONGTEXT <CUSTOM_COL_OPTIONS>,
+INDEX (m(128))
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW INDEX IN t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 m 1 m # # 128 NULL # #
+INSERT INTO t1 (t,tt,m,l) VALUES
+('','','',''),
+('a','b','c','d'),
+('b','d','c','b'),
+('test1','test2','test3','test4'),
+(REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+('abc','def','ghi','jkl'),
+('test2','test3','test4','test5'),
+('test3','test4','test5','test6'),
+(REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+(REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+EXPLAIN SELECT SUBSTRING(m,128) AS f FROM t1 WHERE m = 'test1' ORDER BY f DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+# # # # # m # # # #
+SELECT SUBSTRING(m,128) AS f FROM t1 WHERE m = 'test1' ORDER BY f DESC;
+f
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_text_indexes.test b/mysql-test/suite/storage_engine/type_text_indexes.test
new file mode 100644
index 00000000000..091717f5a9e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_text_indexes.test
@@ -0,0 +1,175 @@
+#
+# TEXT columns with indexes
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Default index as configured in define_engine
+
+let $create_definition =
+ t TEXT $col_indexed_opts,
+ tt TINYTEXT $col_opts,
+ m MEDIUMTEXT $col_opts,
+ l LONGTEXT $col_opts,
+ $default_index t (t(32))
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = TEXT types or indexes on them
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (t,tt,m,l) VALUES
+ ('','','',''),
+ ('a','b','c','d'),
+ ('b','d','c','b'),
+ ('test1','test2','test3','test4'),
+ (REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+ ('abc','def','ghi','jkl'),
+ ('test2','test3','test4','test5'),
+ ('test3','test4','test5','test6'),
+ (REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+ (REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+
+ SELECT SUBSTRING(t,16) AS f FROM t1 WHERE t IN ('test1','test2') ORDER BY f;
+
+ DROP TABLE t1;
+}
+
+# PK, UNIQUE INDEX, INDEX
+
+let $create_definition =
+ t TEXT $col_indexed_opts,
+ tt TINYTEXT $col_opts,
+ m MEDIUMTEXT $col_opts,
+ l LONGTEXT $col_opts,
+ PRIMARY KEY t (t(32))
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = TEXT types or PK
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (t,tt,m,l) VALUES
+ ('','','',''),
+ ('a','b','c','d'),
+ ('b','d','c','b'),
+ ('test1','test2','test3','test4'),
+ (REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+ ('abc','def','ghi','jkl'),
+ ('test2','test3','test4','test5'),
+ ('test3','test4','test5','test6'),
+ (REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+ (REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(t,16) AS f FROM t1 WHERE t IN ('test1','test2') ORDER BY f;
+ SELECT SUBSTRING(t,16) AS f FROM t1 WHERE t IN ('test1','test2') ORDER BY f;
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(t,16) AS f FROM t1 IGNORE INDEX (PRIMARY) WHERE t IN ('test1','test2') ORDER BY f;
+ SELECT SUBSTRING(t,16) AS f FROM t1 IGNORE INDEX (PRIMARY) WHERE t IN ('test1','test2') ORDER BY f;
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ t TEXT $col_opts,
+ tt TINYTEXT $col_indexed_opts,
+ m MEDIUMTEXT $col_opts,
+ l LONGTEXT $col_indexed_opts,
+ UNIQUE INDEX l_tt (l(256),tt(64))
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = TEXT types or unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (t,tt,m,l) VALUES
+ ('','','',''),
+ ('a','b','c','d'),
+ ('b','d','c','b'),
+ ('test1','test2','test3','test4'),
+ (REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+ ('abc','def','ghi','jkl'),
+ ('test2','test3','test4','test5'),
+ ('test3','test4','test5','test6'),
+ (REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+ (REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+
+ # Here we are getting possible key l_t, but not the final key
+ --replace_column 1 # 2 # 3 # 4 # 6 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(tt,64), SUBSTRING(l,256) FROM t1 WHERE tt!=l AND l NOT IN ('test1') ORDER BY tt, l DESC;
+ SELECT SUBSTRING(tt,64), SUBSTRING(l,256) FROM t1 WHERE tt!=l AND l NOT IN ('test1') ORDER BY tt, l DESC;
+
+ --replace_column 1 # 2 # 3 # 4 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(tt,64), SUBSTRING(l,256) FROM t1 FORCE INDEX (l_t) WHERE tt!=l AND l NOT IN ('test1') ORDER BY tt, l DESC;
+ SELECT SUBSTRING(tt,64), SUBSTRING(l,256) FROM t1 FORCE INDEX (l_t) WHERE tt!=l AND l NOT IN ('test1') ORDER BY tt, l DESC;
+ DROP TABLE t1;
+}
+
+let $create_definition =
+ t TEXT $col_opts,
+ tt TINYTEXT $col_opts,
+ m MEDIUMTEXT $col_indexed_opts,
+ l LONGTEXT $col_opts,
+ INDEX (m(128))
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = TEXT types or non-unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 6 # 7 # 10 # 11 #
+ SHOW INDEX IN t1;
+
+ INSERT INTO t1 (t,tt,m,l) VALUES
+ ('','','',''),
+ ('a','b','c','d'),
+ ('b','d','c','b'),
+ ('test1','test2','test3','test4'),
+ (REPEAT('a',128),REPEAT('b',128),REPEAT('c',128),REPEAT('d',128)),
+ ('abc','def','ghi','jkl'),
+ ('test2','test3','test4','test5'),
+ ('test3','test4','test5','test6'),
+ (REPEAT('b',128),REPEAT('f',128),REPEAT('e',128),REPEAT('d',128)),
+ (REPEAT('c',128),REPEAT('b',128),REPEAT('c',128),REPEAT('e',128));
+
+ --replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
+ EXPLAIN SELECT SUBSTRING(m,128) AS f FROM t1 WHERE m = 'test1' ORDER BY f DESC;
+ SELECT SUBSTRING(m,128) AS f FROM t1 WHERE m = 'test1' ORDER BY f DESC;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_varbinary.inc b/mysql-test/suite/storage_engine/type_varbinary.inc
new file mode 100644
index 00000000000..5801f228567
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_varbinary.inc
@@ -0,0 +1,101 @@
+#
+# VARBINARY column types
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+let $create_definition =
+ v0 VARBINARY(0) $col_opts,
+ v1 VARBINARY(1) $col_opts,
+ v64 VARBINARY(64) $col_opts,
+ v65000 VARBINARY(65000) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = VARBINARY types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ --let $create_definition = v VARBINARY(65532) $col_opts
+ --let $table_name = t2
+ --source create_table.inc
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t2;
+
+ # Valid values
+
+ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','','','');
+ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that an article doesn\'t already exist','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+ For developers who want to code on MariaDB or MySQL
+
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+
+ For MariaDB / MySQL end users
+
+ * MariaDB Crash Course by Ben Forta
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o Free to read in the Knowledgebase!
+
+ * MySQL (4th Edition) by Paul DuBois
+ o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+
+ * MySQL Cookbook by Paul DuBois
+ o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
+
+ --sorted_result
+ SELECT HEX(v0), HEX(v1), HEX(v64), HEX(v65000) FROM t1;
+
+ # Invalid values
+
+ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('y', 'yy', REPEAT('c',65), REPEAT('abcdefghi ',6501));
+ INSERT INTO t1 (v0,v1,v64,v65000) SELECT v65000, v65000, v65000, CONCAT(v65000,v1) FROM t1;
+
+ --sorted_result
+ SELECT HEX(v0), HEX(v1), HEX(v64), LENGTH(HEX(v65000)) FROM t1;
+
+ --let $alter_definition = ADD COLUMN v65536 VARBINARY(65536) $col_opts
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE or BLOB types
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+ }
+
+ DROP TABLE t1, t2;
+}
+
+
diff --git a/mysql-test/suite/storage_engine/type_varbinary.result b/mysql-test/suite/storage_engine/type_varbinary.result
new file mode 100644
index 00000000000..309de3fe387
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_varbinary.result
@@ -0,0 +1,92 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (v0 VARBINARY(0) <CUSTOM_COL_OPTIONS>,
+v1 VARBINARY(1) <CUSTOM_COL_OPTIONS>,
+v64 VARBINARY(64) <CUSTOM_COL_OPTIONS>,
+v65000 VARBINARY(65000) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varbinary(0) # # #
+v1 varbinary(1) # # #
+v64 varbinary(64) # # #
+v65000 varbinary(65000) # # #
+CREATE TABLE t2 (v VARBINARY(65532) <CUSTOM_COL_OPTIONS>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t2;
+Field Type Null Key Default Extra
+v varbinary(65532) # # #
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','','','');
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that an article doesn\'t already exist','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+ For developers who want to code on MariaDB or MySQL
+
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+
+ For MariaDB / MySQL end users
+
+ * MariaDB Crash Course by Ben Forta
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o Free to read in the Knowledgebase!
+
+ * MySQL (4th Edition) by Paul DuBois
+ o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+
+ * MySQL Cookbook by Paul DuBois
+ o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
+SELECT HEX(v0), HEX(v1), HEX(v64), HEX(v65000) FROM t1;
+HEX(v0) HEX(v1) HEX(v64) HEX(v65000)
+
+ 79 4F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C7265616479206578697374 486572652069732061206C697374206F66207265636F6D6D656E64656420626F6F6B73206F6E204D61726961444220616E64204D7953514C2E2057652776652070726F7669646564206C696E6B7320746F20416D617A6F6E2E636F6D206865726520666F7220636F6E76656E69656E63652C2062757420746865792063616E20626520666F756E64206174206D616E79206F7468657220626F6F6B73746F7265732C20626F7468206F6E6C696E6520616E64206F66662E0A0A2020496620796F752077616E7420746F206861766520796F7572206661766F72697465204D7953514C202F204D61726961444220626F6F6B206C697374656420686572652C20706C65617365206C65617665206120636F6D6D656E742E0A2020466F7220646576656C6F706572732077686F2077616E7420746F20636F6465206F6E204D617269614442206F72204D7953514C0A0A2020202020202A20556E6465727374616E64696E67204D7953514C20496E7465726E616C73206279205361736861205061636865762C20666F726D6572204D7953514C20646576656C6F706572206174204D7953514C2041422E0A2020202020202020202020206F205468697320697320746865206F6E6C7920626F6F6B207765206B6E6F772061626F75742074686174206465736372696265732074686520696E7465726E616C73206F66204D617269614442202F204D7953514C2E2041206D757374206861766520666F7220616E796F6E652077686F2077616E747320746F20756E6465727374616E6420616E6420646576656C6F70206F6E204D617269614442210A2020202020202020202020206F204E6F7420616C6C20746F706963732061726520636F766572656420616E6420736F6D652070617274732061726520736C696768746C79206F757464617465642C20627574207374696C6C20746865206265737420626F6F6B206F6E207468697320746F7069632E200A2020202020202A204D7953514C20352E3120506C7567696E20446576656C6F706D656E742062792053657267656920476F6C75626368696B20616E6420416E64726577204875746368696E67730A2020202020202020202020206F2041206D757374207265616420666F7220616E796F6E652077616E74696E6720746F207772697465206120706C7567696E20666F72204D6172696144422C207772697474656E20627920746865205365726765692077686F2064657369676E65642074686520706C7567696E20696E7465726661636520666F72204D7953514C20616E64204D61726961444221200A0A2020466F72204D617269614442202F204D7953514C20656E642075736572730A0A2020202020202A204D61726961444220437261736820436F757273652062792042656E20466F7274610A2020202020202020202020206F204669727374204D61726961444220626F6F6B210A2020202020202020202020206F20466F722070656F706C652077686F2077616E7420746F206C6561726E2053514C20616E642074686520626173696373206F66204D6172696144422E0A2020202020202020202020206F204E6F77207368697070696E672E20507572636861736520617420416D617A6F6E2E636F6D206F7220796F7572206661766F7269746520626F6F6B73656C6C65722E200A0A2020202020202A2053514C2D393920436F6D706C6574652C205265616C6C792062792050657465722047756C75747A616E20262054727564792050656C7A65722E0A2020202020202020202020206F2045766572797468696E6720796F752077616E74656420746F206B6E6F772061626F7574207468652053514C203939207374616E646172642E20457863656C6C656E74207265666572656E636520626F6F6B210A2020202020202020202020206F204672656520746F207265616420696E20746865204B6E6F776C656467656261736521200A0A2020202020202A204D7953514C20283474682045646974696F6E29206279205061756C204475426F69730A2020202020202020202020206F20546865202764656661756C742720626F6F6B20746F207265616420696620796F7520776F6E7420746F206C6561726E20746F20757365204D7953514C202F204D6172696144422E200A0A2020202020202A204D7953514C20436F6F6B626F6F6B206279205061756C204475426F69730A2020202020202020202020206F2041206C6F74206F66206578616D706C6573206F6620686F7720746F20757365204D7953514C2E204173207769746820616C6C206F66205061756C277320626F6F6B732C206974277320776F727468206974732077656967687420696E20676F6C6420616E64206576656E20656E6A6F7961626C652072656164696E6720666F7220737563682061202764727927207375626A6563742E200A0A2020202020202A204869676820506572666F726D616E6365204D7953514C2C205365636F6E642045646974696F6E2C204279204261726F6E20536368776172747A2C205065746572205A6169747365762C20566164696D20546B616368656E6B6F2C204A6572656D7920442E205A61776F646E792C2041726A656E204C656E747A2C20446572656B204A2E2042616C6C696E672C20657420616C2E0A2020202020202020202020206F20224869676820506572666F726D616E6365204D7953514C2069732074686520646566696E697469766520677569646520746F206275696C64696E6720666173742C2072656C6961626C652073797374656D732077697468204D7953514C2E205772697474656E206279206E6F74656420657870657274732077697468207965617273206F66207265616C2D776F726C6420657870657269656E6365206275696C64696E672076657279206C617267652073797374656D732C207468697320626F6F6B20636F7665727320657665727920617370656374206F66204D7953514C20706572666F726D616E636520696E2064657461696C2C20616E6420666F6375736573206F6E20726F627573746E6573732C2073656375726974792C20616E64206461746120696E746567726974792E204C6561726E20616476616E63656420746563686E697175657320696E20646570746820736F20796F752063616E206272696E67206F7574204D7953514C27732066756C6C20706F7765722E22202846726F6D2074686520626F6F6B206465736372697074696F6E206174204F275265696C6C7929200A0A2020202020202A204D7953514C2041646D696E20436F6F6B626F6F6B0A2020202020202020202020206F204120717569636B20737465702D62792D7374657020677569646520666F72204D7953514C20757365727320616E642064617461626173652061646D696E6973747261746F727320746F207461636B6C65207265616C2D776F726C64206368616C6C656E6765732077697468204D7953514C20636F6E66696775726174696F6E20616E642061646D696E697374726174696F6E200A0A2020202020202A204D7953514C20352E302043657274696669636174696F6E2053747564792047756964652C204279205061756C204475426F69732C2053746566616E2048696E7A2C204361727374656E20506564657273656E0A2020202020202020202020206F205468697320697320746865206F6666696369616C20677569646520746F20636F766572207468652070617373696E67206F66207468652074776F204D7953514C2043657274696669636174696F6E206578616D696E6174696F6E732E2049742069732076616C69642074696C6C2076657273696F6E20352E30206F6620746865207365727665722C20736F207768696C65206974206D697373657320616C6C2074686520666561747572657320617661696C61626C6520696E204D7953514C20352E3120616E6420677265617465722028696E636C7564696E67204D61726961444220352E3120616E642067726561746572292C2069742070726F7669646573206120676F6F6420626173696320756E6465727374616E64696E67206F66204D7953514C20666F722074686520656E642D757365722E20
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('y', 'yy', REPEAT('c',65), REPEAT('abcdefghi ',6501));
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 1
+Warning 1265 Data truncated for column 'v1' at row 1
+Warning 1265 Data truncated for column 'v64' at row 1
+Warning 1265 Data truncated for column 'v65000' at row 1
+INSERT INTO t1 (v0,v1,v64,v65000) SELECT v65000, v65000, v65000, CONCAT(v65000,v1) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 2
+Warning 1265 Data truncated for column 'v1' at row 2
+Warning 1265 Data truncated for column 'v64' at row 2
+Warning 1265 Data truncated for column 'v0' at row 3
+Warning 1265 Data truncated for column 'v1' at row 3
+Warning 1265 Data truncated for column 'v64' at row 3
+Warning 1265 Data truncated for column 'v65000' at row 3
+SELECT HEX(v0), HEX(v1), HEX(v64), LENGTH(HEX(v65000)) FROM t1;
+HEX(v0) HEX(v1) HEX(v64) LENGTH(HEX(v65000))
+ 0
+ 0
+ 48 486572652069732061206C697374206F66207265636F6D6D656E64656420626F6F6B73206F6E204D61726961444220616E64204D7953514C2E20576527766520 5932
+ 61 61626364656667686920616263646566676869206162636465666768692061626364656667686920616263646566676869206162636465666768692061626364 130000
+ 79 4F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C7265616479206578697374 5930
+ 79 63636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363 130000
+ALTER TABLE t1 ADD COLUMN v65536 VARBINARY(65536) <CUSTOM_COL_OPTIONS>;
+Warnings:
+Note 1246 Converting column 'v65536' from VARBINARY to BLOB
+Note 1246 Converting column 'v65536' from VARBINARY to BLOB
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varbinary(0) # # #
+v1 varbinary(1) # # #
+v64 varbinary(64) # # #
+v65000 varbinary(65000) # # #
+v65536 mediumblob # # #
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/type_varbinary.test b/mysql-test/suite/storage_engine/type_varbinary.test
new file mode 100644
index 00000000000..65240995522
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_varbinary.test
@@ -0,0 +1,10 @@
+#
+# VARBINARY column types
+#
+
+--source have_engine.inc
+
+--source type_varbinary.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/type_varchar.inc b/mysql-test/suite/storage_engine/type_varchar.inc
new file mode 100644
index 00000000000..472f74e0dd1
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_varchar.inc
@@ -0,0 +1,100 @@
+#
+# VARCHAR column types
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+let $create_definition =
+ v0 VARCHAR(0) $col_opts,
+ v1 VARCHAR(1) $col_opts,
+ v64 VARCHAR(64) $col_opts,
+ v65000 VARCHAR(65000) $col_opts
+;
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = CHAR or VARCHAR types
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+
+ --let $table_name = t2
+ --let $create_definition = v VARCHAR(65532) $col_opts
+ --source create_table.inc
+
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t2;
+
+ # Valid values
+
+ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','','','');
+ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that an article doesn\'t already exist','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+ For developers who want to code on MariaDB or MySQL
+
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+
+ For MariaDB / MySQL end users
+
+ * MariaDB Crash Course by Ben Forta
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o Free to read in the Knowledgebase!
+
+ * MySQL (4th Edition) by Paul DuBois
+ o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+
+ * MySQL Cookbook by Paul DuBois
+ o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ # Invalid values
+
+ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('y', 'yy', REPEAT('c',65), REPEAT('abcdefghi ',6501));
+ INSERT INTO t1 (v0,v1,v64,v65000) SELECT v65000, v65000, v65000, CONCAT(v65000,v1) FROM t1;
+
+ --sorted_result
+ SELECT v0, v1, v64, LENGTH(v65000) FROM t1;
+
+ --let $alter_definition = ADD COLUMN v65536 VARCHAR(65536) $col_opts
+ --source alter_table.inc
+ if ($mysql_errname)
+ {
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE or TEXT types
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --replace_column 3 # 4 # 5 #
+ SHOW COLUMNS IN t1;
+ }
+ DROP TABLE t1, t2;
+}
+
diff --git a/mysql-test/suite/storage_engine/type_varchar.result b/mysql-test/suite/storage_engine/type_varchar.result
new file mode 100644
index 00000000000..055c8dcd7ca
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_varchar.result
@@ -0,0 +1,127 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (v0 VARCHAR(0) <CUSTOM_COL_OPTIONS>,
+v1 VARCHAR(1) <CUSTOM_COL_OPTIONS>,
+v64 VARCHAR(64) <CUSTOM_COL_OPTIONS>,
+v65000 VARCHAR(65000) <CUSTOM_COL_OPTIONS>
+) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varchar(0) # # #
+v1 varchar(1) # # #
+v64 varchar(64) # # #
+v65000 varchar(65000) # # #
+CREATE TABLE t2 (v VARCHAR(65532) <CUSTOM_COL_OPTIONS>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t2;
+Field Type Null Key Default Extra
+v varchar(65532) # # #
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','','','');
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that an article doesn\'t already exist','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+ For developers who want to code on MariaDB or MySQL
+
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+
+ For MariaDB / MySQL end users
+
+ * MariaDB Crash Course by Ben Forta
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o Free to read in the Knowledgebase!
+
+ * MySQL (4th Edition) by Paul DuBois
+ o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+
+ * MySQL Cookbook by Paul DuBois
+ o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+
+ * MySQL Admin Cookbook
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
+SELECT * FROM t1;
+v0 v1 v64 v65000
+
+
+
+
+
+
+
+
+
+
+
+ y Once there, double check that an article doesn't already exist Here is a list of recommended books on MariaDB and MySQL. We've provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+ o "High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL's full power." (From the book description at O'Reilly)
+ o A lot of examples of how to use MySQL. As with all of Paul's books, it's worth its weight in gold and even enjoyable reading for such a 'dry' subject.
+ o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+ o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+ o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+ o First MariaDB book!
+ o For people who want to learn SQL and the basics of MariaDB.
+ o Free to read in the Knowledgebase!
+ o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+ o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+ o The 'default' book to read if you wont to learn to use MySQL / MariaDB.
+ o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user.
+ o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+ * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+ * MariaDB Crash Course by Ben Forta
+ * MySQL (4th Edition) by Paul DuBois
+ * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+ * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+ * MySQL Admin Cookbook
+ * MySQL Cookbook by Paul DuBois
+ * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+ * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+ For MariaDB / MySQL end users
+ For developers who want to code on MariaDB or MySQL
+ If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('y', 'yy', REPEAT('c',65), REPEAT('abcdefghi ',6501));
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 1
+Warning 1265 Data truncated for column 'v1' at row 1
+Warning 1265 Data truncated for column 'v64' at row 1
+Warning 1265 Data truncated for column 'v65000' at row 1
+INSERT INTO t1 (v0,v1,v64,v65000) SELECT v65000, v65000, v65000, CONCAT(v65000,v1) FROM t1;
+Warnings:
+Warning 1265 Data truncated for column 'v0' at row 2
+Warning 1265 Data truncated for column 'v1' at row 2
+Warning 1265 Data truncated for column 'v64' at row 2
+Warning 1265 Data truncated for column 'v0' at row 3
+Warning 1265 Data truncated for column 'v1' at row 3
+Warning 1265 Data truncated for column 'v64' at row 3
+Warning 1265 Data truncated for column 'v65000' at row 3
+SELECT v0, v1, v64, LENGTH(v65000) FROM t1;
+v0 v1 v64 LENGTH(v65000)
+ 0
+ 0
+ H Here is a list of recommended books on MariaDB and MySQL. We've 2966
+ a abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcd 65000
+ y Once there, double check that an article doesn't already exist 2965
+ y cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 65000
+ALTER TABLE t1 ADD COLUMN v65536 VARCHAR(65536) <CUSTOM_COL_OPTIONS>;
+Warnings:
+Note 1246 Converting column 'v65536' from VARCHAR to TEXT
+Note 1246 Converting column 'v65536' from VARCHAR to TEXT
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+v0 varchar(0) # # #
+v1 varchar(1) # # #
+v64 varchar(64) # # #
+v65000 varchar(65000) # # #
+v65536 mediumtext # # #
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/type_varchar.test b/mysql-test/suite/storage_engine/type_varchar.test
new file mode 100644
index 00000000000..8f7c5e72a72
--- /dev/null
+++ b/mysql-test/suite/storage_engine/type_varchar.test
@@ -0,0 +1,10 @@
+#
+# VARCHAR column types
+#
+
+--source have_engine.inc
+
+--source type_varchar.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/unexpected_result.inc b/mysql-test/suite/storage_engine/unexpected_result.inc
new file mode 100644
index 00000000000..2552988dddc
--- /dev/null
+++ b/mysql-test/suite/storage_engine/unexpected_result.inc
@@ -0,0 +1,50 @@
+#
+# This include file prints a standard message about possibly unsupported functionality
+# when a statement finished not as expected.
+# Usage:
+# --let $functionality = Foreign keys # optional
+# --let $my_last_stmt = INSERT INTO t VALUES (1) # optional
+
+--let $versions =
+
+if (!$functionality)
+{
+ --let $functionality = Functionality
+}
+if ($mysql_errname)
+{
+ --let $result = finished with $mysql_errname
+ if ($mysql_errname == ER_SYNTAX_ERROR)
+ {
+ --let $functionality = $functionality or the syntax
+ }
+ if ($mysql_errname == ER_ILLEGAL_HA)
+ {
+ --let $functionality = $functionality or the syntax
+ --let $versions = unsupported
+ }
+}
+if (!$mysql_errname)
+{
+ --let $result = succeeded unexpectedly
+}
+if (!$versions)
+{
+ --let $versions = unsupported|malfunctioning, or the problem was caused by previous errors
+}
+
+--echo # ------------ UNEXPECTED RESULT ------------
+if ($my_last_stmt)
+{
+ --echo # [ $my_last_stmt ]
+}
+--echo # The statement|command $result.
+--echo # $functionality or the mix could be $versions.
+--echo # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+--echo # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+--echo # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+--echo # -------------------------------------------
+
+--let $my_last_stmt =
+--let $functionality =
+
diff --git a/mysql-test/suite/storage_engine/update.result b/mysql-test/suite/storage_engine/update.result
new file mode 100644
index 00000000000..3b96558c7c5
--- /dev/null
+++ b/mysql-test/suite/storage_engine/update.result
@@ -0,0 +1,50 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+UPDATE t1 SET a=a+100;
+SELECT * FROM t1;
+a b
+101 a
+101 a
+10100 foobar
+10100 foobar
+102 b
+102 b
+103 c
+103 c
+104 d
+104 d
+105 e
+105 e
+UPDATE t1 SET a=a-100, b=DEFAULT WHERE a>100;
+SELECT * FROM t1;
+a b
+1 NULL
+1 NULL
+10000 NULL
+10000 NULL
+2 NULL
+2 NULL
+3 NULL
+3 NULL
+4 NULL
+4 NULL
+5 NULL
+5 NULL
+UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY b DESC, a ASC LIMIT 1;
+SELECT * FROM t1;
+a b
+1 NULL
+1 update
+10000 NULL
+10000 NULL
+2 NULL
+2 NULL
+3 NULL
+3 NULL
+4 NULL
+4 NULL
+5 NULL
+5 NULL
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/update.test b/mysql-test/suite/storage_engine/update.test
new file mode 100644
index 00000000000..4f892fa547d
--- /dev/null
+++ b/mysql-test/suite/storage_engine/update.test
@@ -0,0 +1,43 @@
+#
+# Basic UPDATE statements.
+# UPDATE LOW_PRIORITY is covered in update_low_prio test
+# UPDATE IGNORE is covered in update_ignore test
+# Multi-table update is covered in update_multi test
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+
+UPDATE t1 SET a=a+100;
+if ($mysql_errname)
+{
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --sorted_result
+ SELECT * FROM t1;
+
+ UPDATE t1 SET a=a-100, b=DEFAULT WHERE a>100;
+ --sorted_result
+ SELECT * FROM t1;
+
+ # ORDER BY and LIMIT
+ UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY b DESC, a ASC LIMIT 1;
+ --sorted_result
+ SELECT * FROM t1;
+}
+
+# Cleanup
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/update_ignore.result b/mysql-test/suite/storage_engine/update_ignore.result
new file mode 100644
index 00000000000..26b7168196a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/update_ignore.result
@@ -0,0 +1,54 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t2 (c,d) SELECT b, a FROM t1;
+UPDATE IGNORE t1 SET b = 'upd1' WHERE b IS NOT NULL ORDER BY a LIMIT 1;
+SELECT * FROM t1;
+a b
+1 a
+1 upd1
+10000 foobar
+10000 foobar
+2 b
+2 b
+3 c
+3 c
+4 d
+4 d
+5 e
+5 e
+UPDATE IGNORE t1, t2 SET b = 'upd2a', c = 'upd2b'
+WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );
+Warnings:
+Warning 1242 Subquery returns more than 1 row
+SELECT * FROM t1;
+a b
+1 a
+1 upd2a
+10000 upd2a
+10000 upd2a
+2 upd2a
+2 upd2a
+3 upd2a
+3 upd2a
+4 upd2a
+4 upd2a
+5 upd2a
+5 upd2a
+SELECT * FROM t2;
+c d
+upd2b 1
+upd2b 1
+upd2b 10000
+upd2b 10000
+upd2b 2
+upd2b 2
+upd2b 3
+upd2b 3
+upd2b 4
+upd2b 4
+upd2b 5
+upd2b 5
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/update_ignore.test b/mysql-test/suite/storage_engine/update_ignore.test
new file mode 100644
index 00000000000..ddd4f7405a3
--- /dev/null
+++ b/mysql-test/suite/storage_engine/update_ignore.test
@@ -0,0 +1,43 @@
+#
+# UPDATE IGNORE
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+
+--let $table_name = t2
+--let $create_definition = c $char_col, d $int_col
+--source create_table.inc
+INSERT INTO t2 (c,d) SELECT b, a FROM t1;
+
+UPDATE IGNORE t1 SET b = 'upd1' WHERE b IS NOT NULL ORDER BY a LIMIT 1;
+if ($mysql_errname)
+{
+ --let $functionality = UPDATE IGNORE
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --sorted_result
+ SELECT * FROM t1;
+
+ UPDATE IGNORE t1, t2 SET b = 'upd2a', c = 'upd2b'
+ WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );
+ --sorted_result
+ SELECT * FROM t1;
+ --sorted_result
+ SELECT * FROM t2;
+}
+
+# Cleanup
+DROP TABLE t1, t2;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/update_low_prio.result b/mysql-test/suite/storage_engine/update_low_prio.result
new file mode 100644
index 00000000000..31a31b6be62
--- /dev/null
+++ b/mysql-test/suite/storage_engine/update_low_prio.result
@@ -0,0 +1,66 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (11,'foobar'),(12,'b');
+SET LOW_PRIORITY_UPDATES = 0;
+SET lock_wait_timeout = 4;
+connect con1,localhost,root,,;
+SET lock_wait_timeout = 2;
+SELECT a+SLEEP(1) FROM t1;
+connection default;
+UPDATE t1 SET a=a+10;
+connect con2,localhost,root,,;
+SET lock_wait_timeout = 3;
+SELECT a+SLEEP(1) FROM t1;
+a+SLEEP(1)
+21
+22
+connection con1;
+a+SLEEP(1)
+11
+12
+connection default;
+SELECT * FROM t1;
+a b
+21 foobar
+22 b
+connection con1;
+SELECT a+SLEEP(1) FROM t1;
+connection default;
+UPDATE LOW_PRIORITY t1 SET a=a+20;
+connection con2;
+SELECT a+SLEEP(1) FROM t1;
+a+SLEEP(1)
+21
+22
+connection con1;
+a+SLEEP(1)
+21
+22
+connection default;
+SELECT * FROM t1;
+a b
+41 foobar
+42 b
+SET LOW_PRIORITY_UPDATES = 1;
+connection con1;
+SELECT a+SLEEP(1) FROM t1;
+connection default;
+UPDATE t1 SET a=a+30;
+connection con2;
+SELECT a+SLEEP(1) FROM t1;
+a+SLEEP(1)
+41
+42
+connection con1;
+a+SLEEP(1)
+41
+42
+connection default;
+SELECT * FROM t1;
+a b
+71 foobar
+72 b
+disconnect con1;
+disconnect con2;
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/update_low_prio.test b/mysql-test/suite/storage_engine/update_low_prio.test
new file mode 100644
index 00000000000..6c089c7172f
--- /dev/null
+++ b/mysql-test/suite/storage_engine/update_low_prio.test
@@ -0,0 +1,167 @@
+#
+# UPDATE LOW_PRIORITY
+#
+--source have_engine.inc
+
+--source include/count_sessions.inc
+
+--enable_connect_log
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (11,'foobar'),(12,'b');
+
+# We will have 3 connections:
+# con1 will start SELECT which should give us enough time;
+# default will run UPDATE
+# con2 will then start another SELECT.
+# With LOW_PRIORITY_UPDATES = 0,
+# with standard UPDATE we should see old data in con1 resultset,
+# but new data in con2 resultset.
+# With UPDATE LOW_PRIORITY we should see old data in both resultsets.
+# Then we will set LOW_PRIORITY_UPDATES to 1.
+# Then with standard UPDATE we should also see old data in both resultsets.
+
+SET LOW_PRIORITY_UPDATES = 0;
+SET lock_wait_timeout = 4;
+
+# Normal UPDATE with low_priority_updates=0
+
+--connect (con1,localhost,root,,)
+SET lock_wait_timeout = 2;
+--send
+SELECT a+SLEEP(1) FROM t1;
+
+--connection default
+let $show_statement = SHOW PROCESSLIST;
+let $field = State;
+let $condition = = 'User sleep';
+# We don't need to wait long,
+# if the feature works, threads
+# should show up in the processlist right away
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+--send
+UPDATE t1 SET a=a+10;
+
+--connect (con2,localhost,root,,)
+SET lock_wait_timeout = 3;
+let $field = Info;
+let $condition = = 'UPDATE t1 SET a=a+10';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+if (!$found)
+{
+ --let $mysql_errname = timeout in wait_show_condition.inc
+ --let $functionality = Table locking
+ --source unexpected_result.inc
+}
+--sorted_result
+SELECT a+SLEEP(1) FROM t1;
+
+--connection con1
+--sorted_result
+--reap
+
+--connection default
+--reap
+if ($mysql_errname)
+{
+ --let $my_last_stmt = UPDATE t1 SET a=a+10
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+}
+
+--sorted_result
+SELECT * FROM t1;
+
+# UPDATE LOW_PRIORITY
+
+--connection con1
+--send
+SELECT a+SLEEP(1) FROM t1;
+
+--connection default
+let $field = State;
+let $condition = = 'User sleep';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+--send
+UPDATE LOW_PRIORITY t1 SET a=a+20;
+
+--connection con2
+let $field = Info;
+let $condition = = 'UPDATE LOW_PRIORITY t1 SET a=a+20';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+--sorted_result
+SELECT a+SLEEP(1) FROM t1;
+
+--connection con1
+--sorted_result
+--reap
+
+--connection default
+--reap
+--sorted_result
+SELECT * FROM t1;
+
+SET LOW_PRIORITY_UPDATES = 1;
+
+# Normal UPDATE with low_priority_updates=1
+
+--connection con1
+--send
+SELECT a+SLEEP(1) FROM t1;
+
+--connection default
+let $field = State;
+let $condition = = 'User sleep';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+--send
+UPDATE t1 SET a=a+30;
+
+--connection con2
+let $field = Info;
+let $condition = = 'UPDATE t1 SET a=a+30';
+let $wait_timeout = 2;
+--source include/wait_show_condition.inc
+if (!$found)
+{
+ --let $mysql_errname = timeout in wait_show_condition.inc
+ --let $functionality = Table locking
+ --source unexpected_result.inc
+}
+--sorted_result
+SELECT a+SLEEP(1) FROM t1;
+
+--connection con1
+--sorted_result
+--reap
+
+--connection default
+--reap
+if ($mysql_errname)
+{
+ --let $my_last_stmt = UPDATE t1 SET a=a+30
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+}
+--sorted_result
+SELECT * FROM t1;
+
+--disconnect con1
+--disconnect con2
+
+--connection default
+# Cleanup
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/update_multi.result b/mysql-test/suite/storage_engine/update_multi.result
new file mode 100644
index 00000000000..42b2f239dd2
--- /dev/null
+++ b/mysql-test/suite/storage_engine/update_multi.result
@@ -0,0 +1,65 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t2 (c,d) SELECT b, a FROM t1;
+UPDATE t1, t2 SET t1.a = t2.d+100, t2.c = 'multi' WHERE c < b AND a + d != 1;
+SELECT * FROM t1;
+a b
+1 a
+1 a
+101 b
+101 b
+101 c
+101 c
+101 d
+101 d
+101 e
+101 e
+101 foobar
+101 foobar
+SELECT * FROM t2;
+c d
+foobar 10000
+foobar 10000
+multi 1
+multi 1
+multi 2
+multi 2
+multi 3
+multi 3
+multi 4
+multi 4
+multi 5
+multi 5
+UPDATE t2, t1 SET t2.d = DEFAULT WHERE c = 'foobar' and b = c;
+SELECT * FROM t1;
+a b
+1 a
+1 a
+101 b
+101 b
+101 c
+101 c
+101 d
+101 d
+101 e
+101 e
+101 foobar
+101 foobar
+SELECT * FROM t2;
+c d
+foobar NULL
+foobar NULL
+multi 1
+multi 1
+multi 2
+multi 2
+multi 3
+multi 3
+multi 4
+multi 4
+multi 5
+multi 5
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/update_multi.test b/mysql-test/suite/storage_engine/update_multi.test
new file mode 100644
index 00000000000..589a8319382
--- /dev/null
+++ b/mysql-test/suite/storage_engine/update_multi.test
@@ -0,0 +1,44 @@
+#
+# Multi-table UPDATE statements.
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+--source create_table.inc
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
+INSERT INTO t1 (a,b) SELECT a, b FROM t1;
+
+--let $table_name = t2
+--let $create_definition = c $char_col, d $int_col
+--source create_table.inc
+INSERT INTO t2 (c,d) SELECT b, a FROM t1;
+
+UPDATE t1, t2 SET t1.a = t2.d+100, t2.c = 'multi' WHERE c < b AND a + d != 1;
+if ($mysql_errname)
+{
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --sorted_result
+ SELECT * FROM t1;
+ --sorted_result
+ SELECT * FROM t2;
+
+ UPDATE t2, t1 SET t2.d = DEFAULT WHERE c = 'foobar' and b = c;
+ --sorted_result
+ SELECT * FROM t1;
+ --sorted_result
+ SELECT * FROM t2;
+}
+
+# Cleanup
+DROP TABLE t1, t2;
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/update_with_keys.result b/mysql-test/suite/storage_engine/update_with_keys.result
new file mode 100644
index 00000000000..8250f31a19e
--- /dev/null
+++ b/mysql-test/suite/storage_engine/update_with_keys.result
@@ -0,0 +1,90 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, INDEX(b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
+UPDATE t1 SET a=100, b='f' WHERE b IN ('b','c');
+UPDATE t1 SET b='m' WHERE b = 'f';
+UPDATE t1 SET b='z' WHERE a < 2;
+UPDATE t1 SET b='';
+SELECT * FROM t1;
+a b
+1
+100
+100
+4
+5
+6
+7
+8
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, UNIQUE INDEX(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(0,'f'),(100,'a');
+UPDATE t1 SET a=a+200;
+UPDATE t1 SET a=0 WHERE a > 250;
+UPDATE t1 SET a=205 WHERE a=200;
+ERROR 23000: Duplicate entry '205' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+UPDATE t1 SET a=12345 ORDER BY a, b LIMIT 1;
+SELECT * FROM t1;
+a b
+12345 a
+200 f
+201 a
+202 b
+203 c
+204 d
+205 e
+UPDATE t1 SET a=80 WHERE a IN (202,203);
+ERROR 23000: Duplicate entry '80' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, UNIQUE INDEX(a,b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(100,'a'),(6,'f');
+UPDATE t1 SET a=6 WHERE a=3;
+UPDATE t1 SET a=100 WHERE a=1;
+ERROR 23000: Duplicate entry '100-a' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+UPDATE t1 SET a=4, b='d' WHERE b='f';
+ERROR 23000: Duplicate entry '4-d' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+UPDATE t1 SET a=a+1;
+SELECT * FROM t1;
+a b
+101 a
+2 a
+3 b
+5 d
+6 e
+7 c
+7 f
+UPDATE t1 SET b='z';
+ERROR 23000: Duplicate entry '7-z' for key 'a'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(0,'f'),(100,'a');
+UPDATE t1 SET a=a+200;
+UPDATE t1 SET a=0 WHERE a > 250;
+UPDATE t1 SET a=205 WHERE a=200;
+ERROR 23000: Duplicate entry '205' for key 'PRIMARY'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+UPDATE t1 SET a=12345 ORDER BY a DESC, b LIMIT 1;
+SELECT * FROM t1;
+a b
+0 a
+12345 e
+200 f
+201 a
+202 b
+203 c
+204 d
+UPDATE t1 SET a=80 WHERE a IN (202,203);
+ERROR 23000: Duplicate entry '80' for key 'PRIMARY'
+# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+# If you got a difference in error message, just add it to rdiff file
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/update_with_keys.test b/mysql-test/suite/storage_engine/update_with_keys.test
new file mode 100644
index 00000000000..578ee3b3294
--- /dev/null
+++ b/mysql-test/suite/storage_engine/update_with_keys.test
@@ -0,0 +1,152 @@
+#
+# UPDATE statements for tables with keys
+#
+--source have_engine.inc
+--source have_default_index.inc
+
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $create_definition = a $int_col, b $char_col, INDEX(b)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Non-unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
+ UPDATE t1 SET a=100, b='f' WHERE b IN ('b','c');
+ if ($mysql_errname)
+ {
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ UPDATE t1 SET b='m' WHERE b = 'f';
+ UPDATE t1 SET b='z' WHERE a < 2;
+ UPDATE t1 SET b='';
+ --sorted_result
+ SELECT * FROM t1;
+ }
+ DROP TABLE t1;
+}
+
+--let $create_definition = a $int_col, b $char_col, UNIQUE INDEX(a)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Unique keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(0,'f'),(100,'a');
+ UPDATE t1 SET a=a+200;
+ if ($mysql_errname)
+ {
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ UPDATE t1 SET a=0 WHERE a > 250;
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ UPDATE t1 SET a=205 WHERE a=200;
+ --source check_errors.inc
+ UPDATE t1 SET a=12345 ORDER BY a, b LIMIT 1;
+ --sorted_result
+ SELECT * FROM t1;
+
+ # We'll check that the next update causes an error,
+ # but won't check the result because it might be different depending
+ # on whether the engine is transactional or not
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ UPDATE t1 SET a=80 WHERE a IN (202,203);
+ --source check_errors.inc
+ }
+ DROP TABLE t1;
+}
+
+--let $create_definition = a $int_col, b $char_col, UNIQUE INDEX(a,b)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Unique keys or multi-part keys
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(100,'a'),(6,'f');
+ UPDATE t1 SET a=6 WHERE a=3;
+ if ($mysql_errname)
+ {
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ UPDATE t1 SET a=100 WHERE a=1;
+ --source check_errors.inc
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ UPDATE t1 SET a=4, b='d' WHERE b='f';
+ --source check_errors.inc
+ UPDATE t1 SET a=a+1;
+ --sorted_result
+ SELECT * FROM t1;
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ UPDATE t1 SET b='z';
+ --source check_errors.inc
+ }
+ DROP TABLE t1;
+}
+
+--let $create_definition = a $int_col PRIMARY KEY, b $char_col
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Primary key
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(0,'f'),(100,'a');
+ UPDATE t1 SET a=a+200;
+ if ($mysql_errname)
+ {
+ --let $functionality = UPDATE
+ --source unexpected_result.inc
+ }
+ if (!$mysql_errname)
+ {
+ UPDATE t1 SET a=0 WHERE a > 250;
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ UPDATE t1 SET a=205 WHERE a=200;
+ --source check_errors.inc
+ UPDATE t1 SET a=12345 ORDER BY a DESC, b LIMIT 1;
+
+ --sorted_result
+ SELECT * FROM t1;
+
+ # We'll check that the next update causes an error,
+ # but won't check the result because it might be different depending
+ # on whether the engine is transactional or not
+
+ --let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
+ UPDATE t1 SET a=80 WHERE a IN (202,203);
+ --source check_errors.inc
+ }
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/storage_engine/vcol.result b/mysql-test/suite/storage_engine/vcol.result
new file mode 100644
index 00000000000..bae7636f6cb
--- /dev/null
+++ b/mysql-test/suite/storage_engine/vcol.result
@@ -0,0 +1,69 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a int(11) # #
+b int(11) # # VIRTUAL
+INSERT INTO t1 (a) VALUES (1),(2);
+INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+Warnings:
+Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+SELECT * FROM t1;
+a b
+1 2
+2 3
+3 4
+4 5
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a int(11) # #
+b int(11) # # PERSISTENT
+INSERT INTO t1 (a) VALUES (1),(2);
+INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+Warnings:
+Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+SELECT * FROM t1;
+a b
+1 2
+2 3
+3 4
+4 5
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) VIRTUAL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a int(11) # #
+b int(11) # # VIRTUAL
+INSERT INTO t1 (a) VALUES (1),(2);
+INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+Warnings:
+Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+SELECT * FROM t1;
+a b
+1 2
+2 3
+3 4
+4 5
+DROP TABLE t1;
+CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+SHOW COLUMNS IN t1;
+Field Type Null Key Default Extra
+a int(11) # #
+b int(11) # # PERSISTENT
+INSERT INTO t1 (a) VALUES (1),(2);
+INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+Warnings:
+Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+SELECT * FROM t1;
+a b
+1 2
+2 3
+3 4
+4 5
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/vcol.test b/mysql-test/suite/storage_engine/vcol.test
new file mode 100644
index 00000000000..90819ffbd47
--- /dev/null
+++ b/mysql-test/suite/storage_engine/vcol.test
@@ -0,0 +1,72 @@
+#
+# Virtual columns
+#
+
+--source have_engine.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $create_definition = a $int_col, b $int_col GENERATED ALWAYS AS (a+1);
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $create_statement
+ --let $functionality = Virtual columns
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ --replace_column 3 # 5 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (a) VALUES (1),(2);
+ INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+ --sorted_result
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+
+ let $create_definition = a $int_col, b $int_col GENERATED ALWAYS AS (a+1) PERSISTENT;
+ --source create_table.inc
+
+ --replace_column 3 # 5 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (a) VALUES (1),(2);
+ INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+ --sorted_result
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+
+ let $create_definition = a $int_col, b $int_col GENERATED ALWAYS AS (a+1) VIRTUAL;
+ --source create_table.inc
+
+ --replace_column 3 # 5 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (a) VALUES (1),(2);
+ INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+ --sorted_result
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+
+ let $create_definition = a $int_col, b $int_col AS (a+1) PERSISTENT;
+ --source create_table.inc
+
+ --replace_column 3 # 5 #
+ SHOW COLUMNS IN t1;
+
+ INSERT INTO t1 (a) VALUES (1),(2);
+ INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+ --sorted_result
+ SELECT * FROM t1;
+
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+
diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result
index 692545ae0fb..1bd4e394f6a 100644
--- a/mysql-test/suite/sys_vars/r/all_vars.result
+++ b/mysql-test/suite/sys_vars/r/all_vars.result
@@ -10,6 +10,5 @@ there should be *no* long test name listed below:
select distinct variable_name as `there should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null;
there should be *no* variables listed below:
-expensive_subquery_limit
drop table t1;
drop table t2;
diff --git a/mysql-test/suite/sys_vars/r/default_master_connection_basic.result b/mysql-test/suite/sys_vars/r/default_master_connection_basic.result
new file mode 100644
index 00000000000..78425049324
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/default_master_connection_basic.result
@@ -0,0 +1,94 @@
+SET @start_session_value = @@session.default_master_connection;
+SELECT @start_session_value;
+@start_session_value
+
+SET @@session.default_master_connection = 'bar';
+SET @@session.default_master_connection = DEFAULT;
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+
+SET @@session.default_master_connection = @start_session_value;
+SELECT @@session.default_master_connection = '';
+@@session.default_master_connection = ''
+1
+SET @@global.default_master_connection = 'master1';
+ERROR HY000: Variable 'default_master_connection' is a SESSION variable and can't be used with SET GLOBAL
+SELECT @@global.default_master_connection;
+ERROR HY000: Variable 'default_master_connection' is a SESSION variable
+SET @@session.default_master_connection = 'master1';
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+master1
+SET @@session.default_master_connection = '';
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+
+SET @@session.default_master_connection = '1234-5678';
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+1234-5678
+SET @@session.default_master_connection = '@!*/"';
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+@!*/"
+SET @@session.default_master_connection = REPEAT('a',191);
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+SET @@session.default_master_connection = master2;
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+master2
+SET @@session.default_master_connection = 1;
+ERROR 42000: Incorrect argument type to variable 'default_master_connection'
+SET @@session.default_master_connection = 65530.30;
+ERROR 42000: Incorrect argument type to variable 'default_master_connection'
+SET @@session.default_master_connection = FALSE;
+ERROR 42000: Incorrect argument type to variable 'default_master_connection'
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+master2
+SET @@session.default_master_connection = REPEAT('a',192);
+ERROR 42000: Variable 'default_master_connection' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+master2
+SET @@session.default_master_connection = NULL;
+ERROR 42000: Variable 'default_master_connection' can't be set to the value of 'NULL'
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+master2
+SELECT @@global.default_master_connection = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='default_master_connection';
+ERROR HY000: Variable 'default_master_connection' is a SESSION variable
+SELECT @@session.default_master_connection = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='default_master_connection';
+@@session.default_master_connection = VARIABLE_VALUE
+1
+SET @@default_master_connection = 'foo';
+SELECT @@default_master_connection = @@local.default_master_connection;
+@@default_master_connection = @@local.default_master_connection
+1
+SELECT @@local.default_master_connection = @@session.default_master_connection;
+@@local.default_master_connection = @@session.default_master_connection
+1
+SET default_master_connection = 'foo';
+SELECT @@default_master_connection;
+@@default_master_connection
+foo
+SET local.default_master_connection = 'foo';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default_master_connection = 'foo'' at line 1
+SELECT local.default_master_connection;
+ERROR 42S02: Unknown table 'local' in field list
+SET session.default_master_connection = 'foo';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default_master_connection = 'foo'' at line 1
+SELECT session.default_master_connection;
+ERROR 42S02: Unknown table 'session' in field list
+SELECT default_master_connection = @@session.default_master_connection;
+ERROR 42S22: Unknown column 'default_master_connection' in 'field list'
+SET @@session.default_master_connection = @start_session_value;
+SELECT @@session.default_master_connection;
+@@session.default_master_connection
+
diff --git a/mysql-test/suite/sys_vars/r/expensive_subquery_limit_basic.result b/mysql-test/suite/sys_vars/r/expensive_subquery_limit_basic.result
new file mode 100644
index 00000000000..1617de21001
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/expensive_subquery_limit_basic.result
@@ -0,0 +1,52 @@
+SET @start_global_value = @@global.expensive_subquery_limit;
+SELECT @start_global_value;
+@start_global_value
+100
+select @@global.expensive_subquery_limit;
+@@global.expensive_subquery_limit
+100
+select @@session.expensive_subquery_limit;
+@@session.expensive_subquery_limit
+100
+show global variables like 'expensive_subquery_limit';
+Variable_name Value
+expensive_subquery_limit 100
+show session variables like 'expensive_subquery_limit';
+Variable_name Value
+expensive_subquery_limit 100
+select * from information_schema.global_variables where variable_name='expensive_subquery_limit';
+VARIABLE_NAME VARIABLE_VALUE
+EXPENSIVE_SUBQUERY_LIMIT 100
+select * from information_schema.session_variables where variable_name='expensive_subquery_limit';
+VARIABLE_NAME VARIABLE_VALUE
+EXPENSIVE_SUBQUERY_LIMIT 100
+set global expensive_subquery_limit=10;
+set session expensive_subquery_limit=20;
+select @@global.expensive_subquery_limit;
+@@global.expensive_subquery_limit
+10
+select @@session.expensive_subquery_limit;
+@@session.expensive_subquery_limit
+20
+show global variables like 'expensive_subquery_limit';
+Variable_name Value
+expensive_subquery_limit 10
+show session variables like 'expensive_subquery_limit';
+Variable_name Value
+expensive_subquery_limit 20
+select * from information_schema.global_variables where variable_name='expensive_subquery_limit';
+VARIABLE_NAME VARIABLE_VALUE
+EXPENSIVE_SUBQUERY_LIMIT 10
+select * from information_schema.session_variables where variable_name='expensive_subquery_limit';
+VARIABLE_NAME VARIABLE_VALUE
+EXPENSIVE_SUBQUERY_LIMIT 20
+set global expensive_subquery_limit=1.1;
+ERROR 42000: Incorrect argument type to variable 'expensive_subquery_limit'
+set global expensive_subquery_limit=1e1;
+ERROR 42000: Incorrect argument type to variable 'expensive_subquery_limit'
+set global expensive_subquery_limit="foo";
+ERROR 42000: Incorrect argument type to variable 'expensive_subquery_limit'
+SET @@global.expensive_subquery_limit = @start_global_value;
+SELECT @@global.expensive_subquery_limit;
+@@global.expensive_subquery_limit
+100
diff --git a/mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result b/mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result
index 441fb4cd362..268d40c1be3 100644
--- a/mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result
@@ -50,7 +50,7 @@ Warnings:
Warning 1292 Truncated incorrect innodb_flush_log_at_trx_commit value: '1001'
SELECT @@global.innodb_flush_log_at_trx_commit;
@@global.innodb_flush_log_at_trx_commit
-2
+3
'#----------------------FN_DYNVARS_046_05------------------------#'
SELECT @@global.innodb_flush_log_at_trx_commit =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -60,22 +60,22 @@ VARIABLE_VALUE
1
SELECT @@global.innodb_flush_log_at_trx_commit;
@@global.innodb_flush_log_at_trx_commit
-2
+3
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_flush_log_at_trx_commit';
VARIABLE_VALUE
-2
+3
'#---------------------FN_DYNVARS_046_06-------------------------#'
SET @@global.innodb_flush_log_at_trx_commit = OFF;
ERROR 42000: Incorrect argument type to variable 'innodb_flush_log_at_trx_commit'
SELECT @@global.innodb_flush_log_at_trx_commit;
@@global.innodb_flush_log_at_trx_commit
-2
+3
SET @@global.innodb_flush_log_at_trx_commit = ON;
ERROR 42000: Incorrect argument type to variable 'innodb_flush_log_at_trx_commit'
SELECT @@global.innodb_flush_log_at_trx_commit;
@@global.innodb_flush_log_at_trx_commit
-2
+3
'#---------------------FN_DYNVARS_046_07----------------------#'
SET @@global.innodb_flush_log_at_trx_commit = TRUE;
SELECT @@global.innodb_flush_log_at_trx_commit;
diff --git a/mysql-test/suite/sys_vars/r/innodb_merge_sort_block_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_merge_sort_block_size_basic.result
new file mode 100644
index 00000000000..90c2954e43d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_merge_sort_block_size_basic.result
@@ -0,0 +1,24 @@
+SELECT @@global.innodb_merge_sort_block_size;
+@@global.innodb_merge_sort_block_size
+1048576
+SELECT @@session.innodb_merge_sort_block_size;
+@@session.innodb_merge_sort_block_size
+1048576
+SET @old_global=@@global.innodb_merge_sort_block_size;
+SET @old_session=@@session.innodb_merge_sort_block_size;
+SET @@global.innodb_merge_sort_block_size = 2*1024*1024;
+SET @@session.innodb_merge_sort_block_size = 4*1024*1024;
+SELECT @@global.innodb_merge_sort_block_size;
+@@global.innodb_merge_sort_block_size
+2097152
+SELECT @@session.innodb_merge_sort_block_size;
+@@session.innodb_merge_sort_block_size
+4194304
+SET @@global.innodb_merge_sort_block_size = 1024*1024*1024+1;
+Warnings:
+Warning 1292 Truncated incorrect innodb_merge_sort_block_size value: '1073741825'
+SELECT @@global.innodb_merge_sort_block_size;
+@@global.innodb_merge_sort_block_size
+1073741824
+SET @@global.innodb_merge_sort_block_size=@old_global;
+SET @@session.innodb_merge_sort_block_size=@old_session;
diff --git a/mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result b/mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result
index d61e9dd20b0..6025e28ccaa 100644
--- a/mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result
@@ -1,7 +1,7 @@
SET @start_value = @@global.max_relay_log_size;
SELECT @start_value;
@start_value
-0
+1073741824
'#--------------------FN_DYNVARS_082_01------------------------#'
SET @@global.max_relay_log_size = 5000;
Warnings:
@@ -9,7 +9,7 @@ Warning 1292 Truncated incorrect max_relay_log_size value: '5000'
SET @@global.max_relay_log_size = DEFAULT;
SELECT @@global.max_relay_log_size;
@@global.max_relay_log_size
-0
+1073741824
'#---------------------FN_DYNVARS_082_02-------------------------#'
SET @@global.max_relay_log_size = @start_value;
SELECT @@global.max_relay_log_size = 1024;
@@ -17,15 +17,17 @@ SELECT @@global.max_relay_log_size = 1024;
0
'#--------------------FN_DYNVARS_082_03------------------------#'
SET @@global.max_relay_log_size = 0;
+Warnings:
+Warning 1292 Truncated incorrect max_relay_log_size value: '0'
SELECT @@global.max_relay_log_size;
@@global.max_relay_log_size
-0
+4096
SET @@global.max_relay_log_size = 1;
Warnings:
Warning 1292 Truncated incorrect max_relay_log_size value: '1'
SELECT @@global.max_relay_log_size;
@@global.max_relay_log_size
-0
+4096
SET @@global.max_relay_log_size = 1073741824;
SELECT @@global.max_relay_log_size;
@@global.max_relay_log_size
@@ -48,7 +50,7 @@ Warnings:
Warning 1292 Truncated incorrect max_relay_log_size value: '-1'
SELECT @@global.max_relay_log_size;
@@global.max_relay_log_size
-0
+4096
SET @@global.max_relay_log_size = 100000000000;
Warnings:
Warning 1292 Truncated incorrect max_relay_log_size value: '100000000000'
@@ -65,7 +67,7 @@ Warnings:
Warning 1292 Truncated incorrect max_relay_log_size value: '-1024'
SELECT @@global.max_relay_log_size;
@@global.max_relay_log_size
-0
+4096
SET @@global.max_relay_log_size = 1073741825;
Warnings:
Warning 1292 Truncated incorrect max_relay_log_size value: '1073741825'
@@ -90,9 +92,9 @@ SELECT @@global.max_relay_log_size;
1073741824
'#-------------------FN_DYNVARS_082_05----------------------------#'
SET @@session.max_relay_log_size = 4096;
-ERROR HY000: Variable 'max_relay_log_size' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@session.max_relay_log_size;
-ERROR HY000: Variable 'max_relay_log_size' is a GLOBAL variable
+@@session.max_relay_log_size
+4096
'#----------------------FN_DYNVARS_082_06------------------------#'
SELECT @@global.max_relay_log_size = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -110,11 +112,13 @@ Warnings:
Warning 1292 Truncated incorrect max_relay_log_size value: '1'
SELECT @@global.max_relay_log_size;
@@global.max_relay_log_size
-0
+4096
SET @@global.max_relay_log_size = FALSE;
+Warnings:
+Warning 1292 Truncated incorrect max_relay_log_size value: '0'
SELECT @@global.max_relay_log_size;
@@global.max_relay_log_size
-0
+4096
'#---------------------FN_DYNVARS_082_08----------------------#'
SET @@global.max_relay_log_size = 5000;
Warnings:
@@ -124,7 +128,8 @@ SELECT @@max_relay_log_size = @@global.max_relay_log_size;
1
'#---------------------FN_DYNVARS_082_09----------------------#'
SET max_relay_log_size = 6000;
-ERROR HY000: Variable 'max_relay_log_size' is a GLOBAL variable and should be set with SET GLOBAL
+Warnings:
+Warning 1292 Truncated incorrect max_relay_log_size value: '6000'
SELECT @@max_relay_log_size;
@@max_relay_log_size
4096
@@ -141,4 +146,4 @@ ERROR 42S22: Unknown column 'max_relay_log_size' in 'field list'
SET @@global.max_relay_log_size = @start_value;
SELECT @@global.max_relay_log_size;
@@global.max_relay_log_size
-0
+1073741824
diff --git a/mysql-test/suite/sys_vars/r/slave_max_allowed_packet_basic.result b/mysql-test/suite/sys_vars/r/slave_max_allowed_packet_basic.result
new file mode 100644
index 00000000000..a5fe9b35ed5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/slave_max_allowed_packet_basic.result
@@ -0,0 +1,147 @@
+SET @start_value = @@global.slave_max_allowed_packet;
+SELECT @start_value;
+@start_value
+1073741824
+'#--------------------FN_DYNVARS_072_01------------------------#'
+SET @@global.slave_max_allowed_packet = 5000;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '5000'
+SET @@global.slave_max_allowed_packet = DEFAULT;
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1073741824
+'#---------------------FN_DYNVARS_072_02-------------------------#'
+SET @@global.slave_max_allowed_packet = @start_value;
+SELECT @@global.slave_max_allowed_packet = 1073741824;
+@@global.slave_max_allowed_packet = 1073741824
+1
+'Bug# 34876: Incorrect Default Value is assigned to variable';
+'#--------------------FN_DYNVARS_072_03------------------------#'
+SET @@global.slave_max_allowed_packet = 1024;
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1024
+SET @@global.slave_max_allowed_packet = 1073741824;
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1073741824
+SET @@global.slave_max_allowed_packet = 1073741824;
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1073741824
+SET @@global.slave_max_allowed_packet = 1025;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '1025'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1024
+SET @@global.slave_max_allowed_packet = 65535;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '65535'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+64512
+'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
+'#--------------------FN_DYNVARS_072_04-------------------------#'
+SET @@global.slave_max_allowed_packet = -1;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '-1'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1024
+SET @@global.slave_max_allowed_packet = 100000000000;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '100000000000'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1073741824
+SET @@global.slave_max_allowed_packet = 10000.01;
+ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1073741824
+SET @@global.slave_max_allowed_packet = -1024;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '-1024'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1024
+SET @@global.slave_max_allowed_packet = 4294967296;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '4294967296'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1073741824
+SET @@global.slave_max_allowed_packet = 1023;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '1023'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1024
+'Bug # 34837: Errors are not coming on assigning invalid values to variable';
+SET @@global.slave_max_allowed_packet = ON;
+ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1024
+SET @@global.slave_max_allowed_packet = 'test';
+ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1024
+'#-------------------FN_DYNVARS_072_05----------------------------#'
+SET @@session.slave_max_allowed_packet = 4096;
+ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable and should be set with SET GLOBAL
+SELECT @@session.slave_max_allowed_packet;
+ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable
+'#----------------------FN_DYNVARS_072_06------------------------#'
+SELECT @@global.slave_max_allowed_packet = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='slave_max_allowed_packet';
+@@global.slave_max_allowed_packet = VARIABLE_VALUE
+1
+SELECT @@slave_max_allowed_packet = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='slave_max_allowed_packet';
+@@slave_max_allowed_packet = VARIABLE_VALUE
+1
+'#---------------------FN_DYNVARS_072_07----------------------#'
+SET @@global.slave_max_allowed_packet = TRUE;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '1'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1024
+SET @@global.slave_max_allowed_packet = FALSE;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '0'
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1024
+'#---------------------FN_DYNVARS_072_08----------------------#'
+SET @@global.slave_max_allowed_packet = 5000;
+Warnings:
+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '5000'
+SELECT @@slave_max_allowed_packet = @@global.slave_max_allowed_packet;
+@@slave_max_allowed_packet = @@global.slave_max_allowed_packet
+1
+'#---------------------FN_DYNVARS_072_09----------------------#'
+SET slave_max_allowed_packet = 6000;
+ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable and should be set with SET GLOBAL
+SELECT @@slave_max_allowed_packet;
+@@slave_max_allowed_packet
+4096
+SET local.slave_max_allowed_packet = 7000;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'slave_max_allowed_packet = 7000' at line 1
+SELECT local.slave_max_allowed_packet;
+ERROR 42S02: Unknown table 'local' in field list
+SET global.slave_max_allowed_packet = 8000;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'slave_max_allowed_packet = 8000' at line 1
+SELECT global.slave_max_allowed_packet;
+ERROR 42S02: Unknown table 'global' in field list
+SELECT slave_max_allowed_packet = @@session.slave_max_allowed_packet;
+ERROR 42S22: Unknown column 'slave_max_allowed_packet' in 'field list'
+SET @@global.slave_max_allowed_packet = @start_value;
+SELECT @@global.slave_max_allowed_packet;
+@@global.slave_max_allowed_packet
+1073741824
diff --git a/mysql-test/suite/sys_vars/r/sql_slave_skip_counter_basic.result b/mysql-test/suite/sys_vars/r/sql_slave_skip_counter_basic.result
index e6d9aff7141..0e1d7af5485 100644
--- a/mysql-test/suite/sys_vars/r/sql_slave_skip_counter_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_slave_skip_counter_basic.result
@@ -35,9 +35,6 @@ VARIABLE_VALUE
1024
'#--------------------FN_DYNVARS_165_03-------------------------#'
SET @@sql_slave_skip_counter = 10;
-ERROR HY000: Variable 'sql_slave_skip_counter' is a GLOBAL variable and should be set with SET GLOBAL
SET @@session.sql_slave_skip_counter = 12;
-ERROR HY000: Variable 'sql_slave_skip_counter' is a GLOBAL variable and should be set with SET GLOBAL
SET @@local.sql_slave_skip_counter = 13;
-ERROR HY000: Variable 'sql_slave_skip_counter' is a GLOBAL variable and should be set with SET GLOBAL
SET @@global.sql_slave_skip_counter = 0;
diff --git a/mysql-test/suite/sys_vars/t/default_master_connection_basic.test b/mysql-test/suite/sys_vars/t/default_master_connection_basic.test
new file mode 100644
index 00000000000..627a236aaa7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/default_master_connection_basic.test
@@ -0,0 +1,128 @@
+############## mysql-test\t\default_master_connection_basic.test ###############
+#
+# Implemented in the scope of MDEV-253
+# The variable is SESSION-only
+#
+
+--source include/not_embedded.inc
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_session_value = @@session.default_master_connection;
+SELECT @start_session_value;
+
+###################################################################
+# Display the DEFAULT value of default_master_connection #
+###################################################################
+
+SET @@session.default_master_connection = 'bar';
+SET @@session.default_master_connection = DEFAULT;
+SELECT @@session.default_master_connection;
+
+###################################################################
+# Check the DEFAULT value of default_master_connection #
+###################################################################
+
+SET @@session.default_master_connection = @start_session_value;
+SELECT @@session.default_master_connection = '';
+
+#################################################
+# Check that the GLOBAL scope is not applicable #
+#################################################
+
+--error ER_LOCAL_VARIABLE
+SET @@global.default_master_connection = 'master1';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.default_master_connection;
+
+####################################################################################
+# Change the value of default_master_connection to a valid value for SESSION Scope #
+####################################################################################
+
+SET @@session.default_master_connection = 'master1';
+SELECT @@session.default_master_connection;
+SET @@session.default_master_connection = '';
+SELECT @@session.default_master_connection;
+SET @@session.default_master_connection = '1234-5678';
+SELECT @@session.default_master_connection;
+SET @@session.default_master_connection = '@!*/"';
+SELECT @@session.default_master_connection;
+SET @@session.default_master_connection = REPEAT('a',191);
+SELECT @@session.default_master_connection;
+SET @@session.default_master_connection = master2;
+SELECT @@session.default_master_connection;
+
+
+#####################################################################
+# Change the value of default_master_connection to an invalid value #
+#####################################################################
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_master_connection = 1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_master_connection = 65530.30;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_master_connection = FALSE;
+SELECT @@session.default_master_connection;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.default_master_connection = REPEAT('a',192);
+SELECT @@session.default_master_connection;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.default_master_connection = NULL;
+SELECT @@session.default_master_connection;
+
+###############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches value in variable #
+###############################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.default_master_connection = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='default_master_connection';
+
+SELECT @@session.default_master_connection = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='default_master_connection';
+
+
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@default_master_connection = 'foo';
+SELECT @@default_master_connection = @@local.default_master_connection;
+SELECT @@local.default_master_connection = @@session.default_master_connection;
+
+
+###################################################################################
+# Check if default_master_connection can be accessed with and without @@ sign #
+###################################################################################
+
+SET default_master_connection = 'foo';
+SELECT @@default_master_connection;
+--Error ER_PARSE_ERROR
+SET local.default_master_connection = 'foo';
+--Error ER_UNKNOWN_TABLE
+SELECT local.default_master_connection;
+--Error ER_PARSE_ERROR
+SET session.default_master_connection = 'foo';
+--Error ER_UNKNOWN_TABLE
+SELECT session.default_master_connection;
+--Error ER_BAD_FIELD_ERROR
+SELECT default_master_connection = @@session.default_master_connection;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@session.default_master_connection = @start_session_value;
+SELECT @@session.default_master_connection;
+
+
+#############################################################
+# END OF default_master_connection TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/expensive_subquery_limit_basic.test b/mysql-test/suite/sys_vars/t/expensive_subquery_limit_basic.test
new file mode 100644
index 00000000000..c86433e94f5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/expensive_subquery_limit_basic.test
@@ -0,0 +1,38 @@
+SET @start_global_value = @@global.expensive_subquery_limit;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+select @@global.expensive_subquery_limit;
+select @@session.expensive_subquery_limit;
+show global variables like 'expensive_subquery_limit';
+show session variables like 'expensive_subquery_limit';
+select * from information_schema.global_variables where variable_name='expensive_subquery_limit';
+select * from information_schema.session_variables where variable_name='expensive_subquery_limit';
+
+#
+# show that it's writable
+#
+set global expensive_subquery_limit=10;
+set session expensive_subquery_limit=20;
+select @@global.expensive_subquery_limit;
+select @@session.expensive_subquery_limit;
+show global variables like 'expensive_subquery_limit';
+show session variables like 'expensive_subquery_limit';
+select * from information_schema.global_variables where variable_name='expensive_subquery_limit';
+select * from information_schema.session_variables where variable_name='expensive_subquery_limit';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global expensive_subquery_limit=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global expensive_subquery_limit=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global expensive_subquery_limit="foo";
+
+SET @@global.expensive_subquery_limit = @start_global_value;
+SELECT @@global.expensive_subquery_limit;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_merge_sort_block_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_merge_sort_block_size_basic.test
new file mode 100644
index 00000000000..2ec4870f345
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_merge_sort_block_size_basic.test
@@ -0,0 +1,19 @@
+--source include/have_xtradb.inc
+
+SELECT @@global.innodb_merge_sort_block_size;
+SELECT @@session.innodb_merge_sort_block_size;
+
+SET @old_global=@@global.innodb_merge_sort_block_size;
+SET @old_session=@@session.innodb_merge_sort_block_size;
+
+SET @@global.innodb_merge_sort_block_size = 2*1024*1024;
+SET @@session.innodb_merge_sort_block_size = 4*1024*1024;
+
+SELECT @@global.innodb_merge_sort_block_size;
+SELECT @@session.innodb_merge_sort_block_size;
+
+SET @@global.innodb_merge_sort_block_size = 1024*1024*1024+1;
+SELECT @@global.innodb_merge_sort_block_size;
+
+SET @@global.innodb_merge_sort_block_size=@old_global;
+SET @@session.innodb_merge_sort_block_size=@old_session;
diff --git a/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test b/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test
index e39778baca8..05d0fd1be82 100644
--- a/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test
@@ -24,7 +24,7 @@
###############################################################################
--source include/load_sysvars.inc
-
+--source include/not_embedded.inc
###################################################################
# START OF max_relay_log_size TESTS #
@@ -105,9 +105,7 @@ SELECT @@global.max_relay_log_size;
# Test if accessing session max_relay_log_size gives error #
########################################################################
---Error ER_GLOBAL_VARIABLE
SET @@session.max_relay_log_size = 4096;
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.max_relay_log_size;
@@ -150,7 +148,6 @@ SELECT @@max_relay_log_size = @@global.max_relay_log_size;
# Check if max_relay_log_size can be accessed with and without @@ sign #
#############################################################################
---Error ER_GLOBAL_VARIABLE
SET max_relay_log_size = 6000;
SELECT @@max_relay_log_size;
--Error ER_PARSE_ERROR
diff --git a/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test b/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test
new file mode 100644
index 00000000000..4caaae84906
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test
@@ -0,0 +1,177 @@
+############## mysql-test\t\slave_max_allowed_packet_basic.test ##################
+# #
+# Variable Name: slave_max_allowed_packet #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:1073741824 #
+# Range: 1024 - 1073741824 #
+# #
+# #
+# #
+# Description: Test Cases of Dynamic System Variable slave_max_allowed_packet #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF slave_max_allowed_packet TESTS #
+########################################################################
+
+
+###########################################################################
+# Saving initial value of slave_max_allowed_packet in a temporary variable#
+###########################################################################
+
+SET @start_value = @@global.slave_max_allowed_packet;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_072_01------------------------#'
+########################################################################
+# Display the DEFAULT value of slave_max_allowed_packet #
+########################################################################
+
+SET @@global.slave_max_allowed_packet = 5000;
+SET @@global.slave_max_allowed_packet = DEFAULT;
+SELECT @@global.slave_max_allowed_packet;
+
+
+--echo '#---------------------FN_DYNVARS_072_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.slave_max_allowed_packet = @start_value;
+SELECT @@global.slave_max_allowed_packet = 1073741824;
+--echo 'Bug# 34876: Incorrect Default Value is assigned to variable';
+
+--echo '#--------------------FN_DYNVARS_072_03------------------------#'
+########################################################################
+# Change the value of slave_max_allowed_packet to a valid value #
+########################################################################
+
+SET @@global.slave_max_allowed_packet = 1024;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 1073741824;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 1073741824;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 1025;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 65535;
+SELECT @@global.slave_max_allowed_packet;
+--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
+
+
+--echo '#--------------------FN_DYNVARS_072_04-------------------------#'
+###########################################################################
+# Change the value of slave_max_allowed_packet to invalid value #
+###########################################################################
+
+SET @@global.slave_max_allowed_packet = -1;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 100000000000;
+SELECT @@global.slave_max_allowed_packet;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_max_allowed_packet = 10000.01;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = -1024;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 4294967296;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 1023;
+SELECT @@global.slave_max_allowed_packet;
+
+--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_max_allowed_packet = ON;
+SELECT @@global.slave_max_allowed_packet;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_max_allowed_packet = 'test';
+SELECT @@global.slave_max_allowed_packet;
+
+
+--echo '#-------------------FN_DYNVARS_072_05----------------------------#'
+###########################################################################
+# Test if accessing session slave_max_allowed_packet gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.slave_max_allowed_packet = 4096;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.slave_max_allowed_packet;
+
+
+--echo '#----------------------FN_DYNVARS_072_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.slave_max_allowed_packet = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='slave_max_allowed_packet';
+
+SELECT @@slave_max_allowed_packet = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='slave_max_allowed_packet';
+
+
+--echo '#---------------------FN_DYNVARS_072_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.slave_max_allowed_packet = TRUE;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = FALSE;
+SELECT @@global.slave_max_allowed_packet;
+
+
+--echo '#---------------------FN_DYNVARS_072_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.slave_max_allowed_packet = 5000;
+SELECT @@slave_max_allowed_packet = @@global.slave_max_allowed_packet;
+
+
+--echo '#---------------------FN_DYNVARS_072_09----------------------#'
+################################################################################
+# Check if slave_max_allowed_packet can be accessed with and without @@ sign #
+################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET slave_max_allowed_packet = 6000;
+SELECT @@slave_max_allowed_packet;
+--Error ER_PARSE_ERROR
+SET local.slave_max_allowed_packet = 7000;
+--Error ER_UNKNOWN_TABLE
+SELECT local.slave_max_allowed_packet;
+--Error ER_PARSE_ERROR
+SET global.slave_max_allowed_packet = 8000;
+--Error ER_UNKNOWN_TABLE
+SELECT global.slave_max_allowed_packet;
+--Error ER_BAD_FIELD_ERROR
+SELECT slave_max_allowed_packet = @@session.slave_max_allowed_packet;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.slave_max_allowed_packet = @start_value;
+SELECT @@global.slave_max_allowed_packet;
+
+
+########################################################################
+# END OF slave_max_allowed_packet TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test b/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test
index 10ca47133b7..e1ea74f33c3 100644
--- a/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test
+++ b/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test
@@ -22,6 +22,11 @@
# server-system-variables.html #
# #
###############################################################################
+# #
+# Modification date: 2012-09-30 #
+# With implementation of MDEV-253, the variable scope can be session #
+# #
+###############################################################################
--source include/not_embedded.inc
--source include/load_sysvars.inc
@@ -88,11 +93,8 @@ WHERE VARIABLE_NAME='sql_slave_skip_counter';
# Checking if variable is accessible with session scope #
###################################################################
---Error ER_GLOBAL_VARIABLE
SET @@sql_slave_skip_counter = 10;
---Error ER_GLOBAL_VARIABLE
SET @@session.sql_slave_skip_counter = 12;
---Error ER_GLOBAL_VARIABLE
SET @@local.sql_slave_skip_counter = 13;
SET @@global.sql_slave_skip_counter = 0;
diff --git a/mysql-test/t/adddate_454.test b/mysql-test/t/adddate_454.test
new file mode 100644
index 00000000000..1d69cdc9558
--- /dev/null
+++ b/mysql-test/t/adddate_454.test
@@ -0,0 +1,9 @@
+#
+# MDEV-454 Addition of a time interval reduces the resulting value
+#
+create table t1 (d date);
+insert into t1 values ('2012-00-00');
+select * from t1;
+update t1 set d = adddate(d, interval 1 day);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
index 884e0fabb5e..15156b89d8e 100644
--- a/mysql-test/t/auto_increment.test
+++ b/mysql-test/t/auto_increment.test
@@ -104,7 +104,7 @@ explain extended select last_insert_id();
--error ER_DUP_ENTRY
insert into t1 set i = 254;
select last_insert_id();
---error ER_DUP_ENTRY
+--error 167
insert into t1 set i = null;
select last_insert_id();
drop table t1;
@@ -113,6 +113,7 @@ create table t1 (i tinyint unsigned not null auto_increment, key (i));
insert into t1 set i = 254;
insert into t1 set i = null;
select last_insert_id();
+--error 167
insert into t1 set i = null;
select last_insert_id();
drop table t1;
@@ -353,7 +354,7 @@ INSERT INTO t1 VALUES (18446744073709551601);
SET @@SESSION.AUTO_INCREMENT_INCREMENT=10;
SELECT @@SESSION.AUTO_INCREMENT_OFFSET;
---error ER_WARN_DATA_OUT_OF_RANGE
+--error 167
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
SELECT * FROM t1;
diff --git a/mysql-test/t/auto_increment_ranges.inc b/mysql-test/t/auto_increment_ranges.inc
new file mode 100644
index 00000000000..a94aa46d38e
--- /dev/null
+++ b/mysql-test/t/auto_increment_ranges.inc
@@ -0,0 +1,240 @@
+#
+# Test of auto_increment at end of range
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+--echo #
+--echo # Testing ranges with smallint
+--echo #
+let $type=smallint;
+let $range_max=32767;
+
+eval create table t1 (a $type primary key auto_increment);
+eval insert into t1 values($range_max);
+--error 167
+insert into t1 values(NULL);
+truncate table t1;
+eval insert into t1 values($range_max-1);
+insert into t1 values(NULL);
+--error 167
+insert into t1 values(NULL);
+select * from t1;
+truncate table t1;
+--error 167
+eval insert into t1 values($range_max),(NULL);
+select * from t1;
+truncate table t1;
+--error 167
+eval insert into t1 values($range_max-1),(NULL),(NULL);
+truncate table t1;
+eval insert into t1 values($range_max+1);
+select * from t1;
+--error 167
+eval insert into t1 values(NULL);
+drop table t1;
+
+--echo #
+--echo # Testing ranges with unsigned smallint
+--echo #
+
+let $type=smallint unsigned;
+let $range_max=65535;
+
+eval create table t1 (a $type primary key auto_increment);
+eval insert into t1 values($range_max);
+--error 167
+insert into t1 values(NULL);
+truncate table t1;
+eval insert into t1 values($range_max-1);
+insert into t1 values(NULL);
+--error 167
+insert into t1 values(NULL);
+select * from t1;
+truncate table t1;
+--error 167
+eval insert into t1 values($range_max),(NULL);
+select * from t1;
+truncate table t1;
+--error 167
+eval insert into t1 values($range_max-1),(NULL),(NULL);
+truncate table t1;
+eval insert into t1 values($range_max+1);
+select * from t1;
+--error 167
+eval insert into t1 values(NULL);
+drop table t1;
+
+--echo #
+--echo # Testing ranges with integer
+--echo #
+
+let $type=int;
+let $range_max=2147483647;
+
+eval create table t1 (a $type primary key auto_increment);
+eval insert into t1 values($range_max);
+--error 167
+insert into t1 values(NULL);
+truncate table t1;
+eval insert into t1 values($range_max-1);
+insert into t1 values(NULL);
+--error 167
+insert into t1 values(NULL);
+select * from t1;
+truncate table t1;
+--error 167
+eval insert into t1 values($range_max),(NULL);
+select * from t1;
+truncate table t1;
+--error 167
+eval insert into t1 values($range_max-1),(NULL),(NULL);
+truncate table t1;
+eval insert into t1 values($range_max+1);
+select * from t1;
+--error 167
+eval insert into t1 values(NULL);
+drop table t1;
+
+--echo #
+--echo # Testing ranges with unsigned integer
+--echo #
+
+let $type=int unsigned;
+let $range_max=4294967295;
+
+eval create table t1 (a $type primary key auto_increment);
+eval insert into t1 values($range_max);
+--error 167
+insert into t1 values(NULL);
+truncate table t1;
+eval insert into t1 values($range_max-1);
+insert into t1 values(NULL);
+--error 167
+insert into t1 values(NULL);
+select * from t1;
+truncate table t1;
+--error 167
+eval insert into t1 values($range_max),(NULL);
+select * from t1;
+truncate table t1;
+--error 167
+eval insert into t1 values($range_max-1),(NULL),(NULL);
+truncate table t1;
+eval insert into t1 values($range_max+1);
+select * from t1;
+--error 167
+eval insert into t1 values(NULL);
+drop table t1;
+
+--echo #
+--echo # Testing ranges with bigint
+--echo #
+
+let $type=bigint;
+let $range_max=cast(9223372036854775807 as unsigned);
+
+eval create table t1 (a $type primary key auto_increment);
+eval insert into t1 values($range_max);
+--error 167
+insert into t1 values(NULL);
+truncate table t1;
+eval insert into t1 values($range_max-1);
+insert into t1 values(NULL);
+--error 167
+insert into t1 values(NULL);
+select * from t1;
+truncate table t1;
+--error 167
+eval insert into t1 values($range_max),(NULL);
+select * from t1;
+truncate table t1;
+--error 167
+eval insert into t1 values($range_max-1),(NULL),(NULL);
+truncate table t1;
+eval insert into t1 values($range_max+1);
+select * from t1;
+--error 167
+eval insert into t1 values(NULL);
+drop table t1;
+
+--echo #
+--echo # Testing ranges with unsigned bigint
+--echo #
+
+let $type=bigint unsigned;
+let $range_max=18446744073709551615;
+
+eval create table t1 (a $type primary key auto_increment);
+eval insert into t1 values($range_max-1);
+--error ER_AUTOINC_READ_FAILED
+insert into t1 values(NULL);
+--error ER_AUTOINC_READ_FAILED
+insert into t1 values(NULL);
+truncate table t1;
+eval insert into t1 values($range_max-1);
+--error ER_AUTOINC_READ_FAILED
+insert into t1 values(NULL);
+--error ER_AUTOINC_READ_FAILED
+insert into t1 values(NULL);
+select * from t1;
+truncate table t1;
+--error ER_AUTOINC_READ_FAILED
+eval insert into t1 values($range_max),(NULL);
+select * from t1;
+truncate table t1;
+--error ER_AUTOINC_READ_FAILED
+eval insert into t1 values($range_max-1),(NULL),(NULL);
+drop table t1;
+
+--echo #
+--echo # Test IGNORE and strict mode
+--echo #
+create table t1 (a smallint primary key auto_increment);
+insert ignore into t1 values(32766),(NULL),(NULL),(1);
+select * from t1;
+truncate table t1;
+
+set @org_mode=@@sql_mode;
+set @@sql_mode='ansi,traditional';
+insert ignore into t1 values(32766),(NULL),(NULL);
+truncate table t1;
+--error 167
+insert into t1 values(32766),(NULL),(NULL);
+set @@sql_mode=@org_mode;
+drop table t1;
+
+--echo #
+--echo # Test auto increment with negative numbers
+--echo #
+CREATE TABLE t1 (a INTEGER AUTO_INCREMENT, PRIMARY KEY (a));
+INSERT INTO t1 VALUES (NULL), (2), (-5), (NULL);
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES (-5), (NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # Test inserting a value out-of-range into an auto increment column
+--echo #
+CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (32768);
+--error 167
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Test old behaviour
+--echo #
+create table t1 (a smallint primary key auto_increment);
+insert into t1 values(32766),(NULL);
+delete from t1 where a=32767;
+--error 167
+insert into t1 values(NULL);
+drop table t1;
diff --git a/mysql-test/t/auto_increment_ranges_innodb.test b/mysql-test/t/auto_increment_ranges_innodb.test
new file mode 100644
index 00000000000..c2afee7ac66
--- /dev/null
+++ b/mysql-test/t/auto_increment_ranges_innodb.test
@@ -0,0 +1,7 @@
+#
+# Test of auto_increment at end of range
+#
+
+--source include/have_innodb.inc
+set default_storage_engine=innodb;
+--source auto_increment_ranges.inc
diff --git a/mysql-test/t/auto_increment_ranges_myisam.test b/mysql-test/t/auto_increment_ranges_myisam.test
new file mode 100644
index 00000000000..90e84377540
--- /dev/null
+++ b/mysql-test/t/auto_increment_ranges_myisam.test
@@ -0,0 +1,7 @@
+#
+# Test of auto_increment at end of range
+#
+
+set default_storage_engine=MYISAM;
+--source auto_increment_ranges.inc
+
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index 9d6cc7d375a..f536f556780 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -175,6 +175,16 @@ drop table t1, t2;
--echo End of 5.0 tests
#
+# lp:1001510
+# Bug #11764313 57135: CRASH IN ITEM_FUNC_CASE::FIND_ITEM WITH CASE WHEN
+# ELSE CLAUSE
+#
+
+CREATE TABLE t1(a YEAR);
+SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
+DROP TABLE t1;
+
+#
# lp:839387 Assertion `(Item_result)i != TIME_RESULT' failed with CASE + datetime
#
@@ -182,3 +192,4 @@ create table t1 (f1 time);
insert t1 values ('00:00:00'),('00:01:00');
select case t1.f1 when '00:00:00' then 1 end from t1;
drop table t1;
+
diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test
index 103244eb2f7..d2b2a7e5523 100644
--- a/mysql-test/t/compare.test
+++ b/mysql-test/t/compare.test
@@ -86,3 +86,11 @@ SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
DROP TABLE t1;
--echo End of 5.0 tests
+
+#
+# Bug #11764818 57692: Crash in item_func_in::val_int() with ZEROFILL
+#
+
+CREATE TABLE t1(a INT ZEROFILL);
+SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2;
+DROP TABLE t1;
diff --git a/mysql-test/t/create-big.test b/mysql-test/t/create-big.test
index d487608f7e1..8d916f8da82 100644
--- a/mysql-test/t/create-big.test
+++ b/mysql-test/t/create-big.test
@@ -132,11 +132,20 @@ set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
--send create table t1 select 1 as i;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
---error ER_TABLE_EXISTS_ERROR
-alter table t3 rename to t1;
+--send alter table t3 rename to t1
+connection addconroot2;
+# Wait until the above ALTER TABLE RENAME is blocked due to CREATE
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t3 rename to t1";
+--source include/wait_condition.inc
set debug_sync='now SIGNAL go';
connection default;
--reap
+connection addconroot1;
+--error ER_TABLE_EXISTS_ERROR
+--reap
connection default;
show create table t1;
drop table t1;
@@ -146,11 +155,21 @@ set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
--send create table t1 select 1 as i;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
---error ER_TABLE_EXISTS_ERROR
-alter table t3 rename to t1, add k int;
+--send alter table t3 rename to t1, add k int
+connection addconroot2;
+# Wait until the above ALTER TABLE RENAME is blocked due to CREATE
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t3 rename to t1, add k int";
+--source include/wait_condition.inc
set debug_sync='now SIGNAL go';
connection default;
--reap
+connection addconroot1;
+--error ER_TABLE_EXISTS_ERROR
+--reap
+connection default;
show create table t1;
drop table t1,t3;
diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test
index 5fc01e4467e..91221b4f7c7 100644
--- a/mysql-test/t/ctype_utf32.test
+++ b/mysql-test/t/ctype_utf32.test
@@ -854,6 +854,11 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
GROUP BY id
ORDER BY l DESC;
+--echo #
+--echo # incorrect charset for val_str_ascii
+--echo #
+
+SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second;
--echo #
--echo # End of 5.5 tests
diff --git a/mysql-test/t/datetime_456.test b/mysql-test/t/datetime_456.test
new file mode 100644
index 00000000000..0c187959d52
--- /dev/null
+++ b/mysql-test/t/datetime_456.test
@@ -0,0 +1,8 @@
+#
+# MDEV-456 An out-of-range datetime value (with a 5-digit year) can be created and cause troubles
+#
+create table t1 (d datetime);
+insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')),
+ (from_days(3652499));
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test
index 82204e1bfac..6ce6e439919 100644
--- a/mysql-test/t/errors.test
+++ b/mysql-test/t/errors.test
@@ -189,3 +189,12 @@ INSERT INTO t2 VALUES (1,0) ON DUPLICATE KEY UPDATE
INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE
b=(SELECT VALUES(a)+2 FROM t1);
DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-492: incorrect error check before sending OK in mysql_update
+--echo #
+CREATE TABLE t1 (a CHAR(3), b BLOB);
+--error ER_DYN_COL_DATA
+UPDATE t1 SET a = 'new'
+WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
+drop table t1;
diff --git a/mysql-test/t/features.test b/mysql-test/t/features.test
new file mode 100644
index 00000000000..cdfc9413da5
--- /dev/null
+++ b/mysql-test/t/features.test
@@ -0,0 +1,111 @@
+# Testing of feature statistics
+
+-- source include/have_geometry.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+show status like "feature%";
+
+--echo #
+--echo # Feature GIS
+--echo #
+
+CREATE TABLE t1 (g POINT);
+SHOW FIELDS FROM t1;
+INSERT INTO t1 VALUES
+ (PointFromText('POINT(10 10)')),
+ (PointFromText('POINT(20 10)')),
+ (PointFromText('POINT(20 20)')),
+ (PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+drop table t1;
+
+show status like "feature_gis";
+
+--echo #
+--echo # Feature dynamic columns
+--echo #
+set @a= COLUMN_CREATE(1, 1212 AS int);
+set @b= column_add(@a, 2, 1212 as integer);
+select column_get(@b, 2 as integer);
+
+show status like "feature_dynamic_columns";
+
+--echo #
+--echo # Feature fulltext
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) engine=myisam;
+INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
+ ('Full-text indexes', 'are called collections'),
+ ('Only MyISAM tables','support collections'),
+ ('Function MATCH ... AGAINST()','is used to do a search'),
+ ('Full-text search in MySQL', 'implements vector space model');
+select * from t1 where MATCH(a,b) AGAINST ("collections");
+select * from t1 where MATCH(a,b) AGAINST ("indexes");
+drop table t1;
+
+# We need the following when running with --ps-protocol
+--replace_result 4 2
+show status like "feature_fulltext";
+
+
+--echo #
+--echo # Feature locale
+--echo #
+
+SET lc_messages=sr_RS;
+SET lc_messages=en_US;
+show status like "feature_locale";
+
+--echo #
+--echo # Feature subquery
+--echo #
+
+select (select 2);
+SELECT (SELECT 1) UNION SELECT (SELECT 2);
+
+create table t1 (a int);
+insert into t1 values (2);
+select (select a from t1 where t1.a=t2.a), a from t1 as t2;
+drop table t1;
+--replace_result 8 4
+show status like "feature_subquery";
+
+--echo #
+--echo # Feature timezone
+--echo #
+
+SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
+set time_zone="+03:00";
+SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
+set time_zone= @@global.time_zone;
+show status like "feature_timezone";
+
+--echo #
+--echo # Feature triggers
+--echo #
+
+create table t1 (i int);
+--echo # let us test some very simple trigger
+create trigger trg before insert on t1 for each row set @a:=1;
+set @a:=0;
+select @a;
+insert into t1 values (1),(2);
+select @a;
+SHOW TRIGGERS IN test like 't1';
+drop trigger trg;
+drop table t1;
+
+show status like "%trigger%";
+
+--echo #
+--echo # Feature xml
+--echo #
+SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
+SELECT extractValue(@xml,'/a');
+select updatexml('<div><div><span>1</span><span>2</span></div></div>',
+ '/','<tr><td>1</td><td>2</td></tr>') as upd1;
+--replace_result 4 2
+show status like "feature_xml";
diff --git a/mysql-test/t/filesort_debug.test b/mysql-test/t/filesort_debug.test
index f89d46a7bd0..c375334ad29 100644
--- a/mysql-test/t/filesort_debug.test
+++ b/mysql-test/t/filesort_debug.test
@@ -11,7 +11,7 @@ SET @old_debug= @@session.debug;
CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
-SET session debug_dbug= '+d,make_sort_keys_alloc_fail';
+SET session debug_dbug= '+d,alloc_sort_buffer_fail';
CALL mtr.add_suppression("Out of sort memory");
--error ER_OUT_OF_SORTMEMORY
SELECT * FROM t1 ORDER BY f1 ASC, f0;
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index 037e2fcaa73..a1df9359d30 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -701,3 +701,11 @@ disconnect con1;
connection default;
COMMIT;
DROP TABLE t1;
+
+--echo #
+--echo # Test flushing slave or relay logs twice
+--echo #
+--error ER_WRONG_USAGE
+flush relay logs,relay logs;
+--error ER_WRONG_USAGE
+flush slave,slave;
diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test
index bfe91f1f587..6706792d162 100644
--- a/mysql-test/t/func_group_innodb.test
+++ b/mysql-test/t/func_group_innodb.test
@@ -84,20 +84,6 @@ select count(*), min(7), max(7) from t2m, t1i;
drop table t1m, t1i, t2m, t2i;
-
---echo #
---echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
---echo #
-
-CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
- KEY(b, c, a(765))) ENGINE=INNODB;
-INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
-
-SELECT MIN(c) FROM t1 GROUP BY b;
-EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
-
-DROP TABLE t1;
-
--echo #
--echo # Bug #57954: BIT_AND function returns incorrect results when
--echo # semijoin=on
@@ -173,4 +159,19 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
DROP TABLE t1;
+--echo # End of test BUG#12713907
+
+--echo #
+--echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
+--echo #
+
+CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
+ KEY(b, c, a(765))) ENGINE=INNODB;
+INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
+
+SELECT MIN(c) FROM t1 GROUP BY b;
+EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
+
+DROP TABLE t1;
+
--echo End of 5.5 tests
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 42705975b88..57ef68595bf 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -526,7 +526,7 @@ SELECT MAKETIME(0, 0, 4294967296);
SELECT MAKETIME(CAST(-1 AS UNSIGNED), 0, 0);
# check if EXTRACT() handles out-of-range values correctly
-SELECT EXTRACT(HOUR FROM '100000:02:03');
+SELECT EXTRACT(HOUR FROM '10000:02:03');
# check if we get proper warnings if both input string truncation
# and out-of-range value occur
@@ -1172,3 +1172,5 @@ select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetim
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
+--error ER_TOO_BIG_PRECISION
+select now(258);
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index f4c9de4e7da..b0ad8329cfb 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -1293,6 +1293,21 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
#WHERE lakes.name = 'Blue Lake';
DROP DATABASE gis_ogs;
+
+--echo #
+--echo # BUG #1043845 st_distance() results are incorrect depending on variable order
+--echo #
+
+select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
+ -95.9673057475387 36.1344478941074,
+ -95.9673063519371 36.134484524621,
+ -95.9673049102515 36.1343976584193)'),
+ geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
+select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
+ geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
+ -95.9673057475387 36.1344478941074,
+ -95.9673063519371 36.134484524621,
+ -95.9673049102515 36.1343976584193) ')) ;
USE test;
@@ -1344,4 +1359,3 @@ SELECT 1 FROM g1 WHERE a >= ANY
DROP TABLE g1;
--echo End of 5.5 tests
-
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 86f1d3d05d1..2a346867da2 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1493,3 +1493,52 @@ SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1;
DROP TABLE t1;
--echo #End of test#49771
+
+--echo #
+--echo # Bug #58782
+--echo # Missing rows with SELECT .. WHERE .. IN subquery
+--echo # with full GROUP BY and no aggr
+--echo #
+
+CREATE TABLE t1 (
+ pk INT NOT NULL,
+ col_int_nokey INT,
+ PRIMARY KEY (pk)
+);
+
+INSERT INTO t1 VALUES (10,7);
+INSERT INTO t1 VALUES (11,1);
+INSERT INTO t1 VALUES (12,5);
+INSERT INTO t1 VALUES (13,3);
+
+## original query:
+
+SELECT pk AS field1, col_int_nokey AS field2
+FROM t1
+WHERE col_int_nokey > 0
+GROUP BY field1, field2;
+
+## store query results in a new table:
+
+CREATE TABLE where_subselect
+ SELECT pk AS field1, col_int_nokey AS field2
+ FROM t1
+ WHERE col_int_nokey > 0
+ GROUP BY field1, field2
+;
+
+## query the new table and compare to original using WHERE ... IN():
+
+SELECT *
+FROM where_subselect
+WHERE (field1, field2) IN (
+ SELECT pk AS field1, col_int_nokey AS field2
+ FROM t1
+ WHERE col_int_nokey > 0
+ GROUP BY field1, field2
+);
+
+DROP TABLE t1;
+DROP TABLE where_subselect;
+
+--echo # End of Bug #58782
diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test
index 0fd3c54c787..6a1cb53dc40 100644
--- a/mysql-test/t/index_merge_innodb.test
+++ b/mysql-test/t/index_merge_innodb.test
@@ -156,6 +156,21 @@ select * from t1 where t1.zone_id=830 AND modified=9;
drop table t0, t1;
+--echo #
+--echo # MDEV-376: Wrong result (missing rows) with index_merge+index_merge_intersection, join
+--echo #
+CREATE TABLE t1 (
+ a INT, b CHAR(1), c CHAR(1), KEY(a), KEY(b)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (8,'v','v'),(8,'m','m'),(9,'d','d');
+
+
+SELECT ta.* FROM t1 AS ta, t1 AS tb
+WHERE ( tb.b != ta.b OR tb.a = ta.a )
+ AND ( tb.b = ta.c OR tb.b = ta.b );
+
+DROP TABLE t1;
set optimizer_switch= @optimizer_switch_save;
diff --git a/mysql-test/t/last_value.test b/mysql-test/t/last_value.test
new file mode 100644
index 00000000000..41cfdb5482d
--- /dev/null
+++ b/mysql-test/t/last_value.test
@@ -0,0 +1,46 @@
+#
+# Tests for the LAST_VALUE function
+#
+
+--disable_warnings
+drop table if exists t1;
+drop database if exists mysqltest;
+--enable_warnings
+
+# CREATE TABLE `queue` (
+# `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+# `priority` int(11) DEFAULT NULL,
+# `state` int(11) DEFAULT NULL,
+# `pid` int(10) unsigned DEFAULT NULL,
+# `dat` varbinary(200) DEFAULT NULL,
+# PRIMARY KEY (`id`)
+# )
+
+CREATE TABLE t1 (a INT, b INT, c INT, d INT);
+INSERT INTO t1 VALUES (1,3,0,NULL),(2,2,0,NULL),(3,4,0,NULL),(4,2,0,NULL);
+SELECT * FROM t1;
+UPDATE t1 SET c=LAST_VALUE(@last_a:=a,@last_b:=b,@last_c:=c,1), d=4211 WHERE c=0 ORDER BY b DESC LIMIT 1;
+SELECT @last_a, @last_b, @last_c;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Test with different types
+#
+# PS protocol gives slightly different metadata for the length
+--enable_metadata
+--disable_ps_protocol
+SELECT LAST_VALUE(@last_a:=1,@last_b:=1);
+select @last_b;
+--enable_ps_protocol
+SELECT LAST_VALUE(@last_a:=1,@last_b:=1.0);
+select @last_b;
+SELECT LAST_VALUE(@last_a:=1,@last_b:="hello");
+select @last_b;
+SELECT date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03"));
+select @last_b;
+SELECT LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL);
+select @last_b;
+--disable_metadata
+--error ER_PARSE_ERROR
+SELECT LAST_VALUE();
diff --git a/mysql-test/t/mdev375.test b/mysql-test/t/mdev375.test
new file mode 100644
index 00000000000..fe259b37808
--- /dev/null
+++ b/mysql-test/t/mdev375.test
@@ -0,0 +1,22 @@
+#
+# MDEV-375 Server crashes in THD::print_aborted_warning with log_warnings > 3
+#
+--source include/not_embedded.inc
+
+SET GLOBAL log_warnings=4;
+SET GLOBAL max_connections=2;
+
+--connect (con1,localhost,root,,)
+SELECT 1;
+--connect (con2,localhost,root,,)
+SELECT 2;
+--disable_query_log
+--error ER_CON_COUNT_ERROR
+--connect (con3,localhost,root,,)
+--enable_query_log
+
+--connection default
+SELECT 0;
+
+SET GLOBAL log_warnings=default;
+SET GLOBAL max_connections=default;
diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test
index 71617b86330..a05b5a624d9 100644
--- a/mysql-test/t/mysql_plugin.test
+++ b/mysql-test/t/mysql_plugin.test
@@ -372,11 +372,11 @@ let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQL_DATADIR --basedir=$MYSQ
--echo # Show the help.
--echo #
replace_result $MYSQL_PLUGIN mysql_plugin;
---replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/
+--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/ /XX[a-z]/XX/
--exec $MYSQL_PLUGIN --help
replace_result $MYSQL_PLUGIN mysql_plugin;
---replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/
+--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/ /XX[a-z]/XX/
--exec $MYSQL_PLUGIN --version
#
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
index 740c4078f20..986e180db13 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -23,7 +23,7 @@ insert into t1 values(null, "b");
set timestamp=@a+2;
--let $binlog_pos_760=query_get_value(SHOW MASTER STATUS, Position, 1)
insert into t1 values(null, "c");
---let $binlog_pos_951=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000001' from $binlog_pos_760, Pos, 4)
+--let $binlog_pos_951=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000001' from $binlog_pos_760, Pos, 5)
set timestamp=@a+4;
insert into t1 values(null, "d");
insert into t1 values(null, "e");
@@ -31,8 +31,8 @@ insert into t1 values(null, "e");
flush logs;
set timestamp=@a+1; # this could happen on a slave
insert into t1 values(null, "f");
---let $binlog_pos_135=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 3)
---let $binlog_pos_203=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 4)
+--let $binlog_pos_135=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 4)
+--let $binlog_pos_203=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 5)
# delimiters are for easier debugging in future
@@ -50,22 +50,22 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--disable_query_log
select "--- offset --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --offset=3 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
-let $start_pos= `select @binlog_start_pos + 653`;
+let $start_pos= `select @binlog_start_pos + 693`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
-let $stop_pos= `select @binlog_start_pos + 653`;
+let $stop_pos= `select @binlog_start_pos + 693`;
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
-let $start_pos= `select @binlog_start_pos + 653`;
-let $stop_pos= `select @binlog_start_pos + 770`;
+let $start_pos= `select @binlog_start_pos + 693`;
+let $stop_pos= `select @binlog_start_pos + 810`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
@@ -88,16 +88,16 @@ flush logs;
--disable_query_log
select "--- offset --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --offset=3 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
-let $start_pos= `select @binlog_start_pos + 653`;
+let $start_pos= `select @binlog_start_pos + 693`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
-let $stop_pos= `select @binlog_start_pos + 69`;
+let $stop_pos= `select @binlog_start_pos + 109`;
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
@@ -117,22 +117,22 @@ select "--- Remote --" as "";
--disable_query_log
select "--- offset --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --offset=3 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
-let $start_pos= `select @binlog_start_pos + 653`;
+let $start_pos= `select @binlog_start_pos + 693`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --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
-let $stop_pos= `select @binlog_start_pos + 653`;
+let $stop_pos= `select @binlog_start_pos + 693`;
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --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
-let $start_pos= `select @binlog_start_pos + 653`;
-let $stop_pos= `select @binlog_start_pos + 770`;
+let $start_pos= `select @binlog_start_pos + 693`;
+let $stop_pos= `select @binlog_start_pos + 810`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
@@ -152,16 +152,16 @@ select "--- Remote with 2 binlogs on command line --" as "";
--disable_query_log
select "--- offset --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=2 --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 --offset=3 --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-position --" as "";
--enable_query_log
-let $start_pos= `select @binlog_start_pos + 653`;
+let $start_pos= `select @binlog_start_pos + 693`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --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
-let $stop_pos= `select @binlog_start_pos + 28`;
+let $stop_pos= `select @binlog_start_pos + 68`;
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --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 "";
diff --git a/mysql-test/t/mysqldump-max.test b/mysql-test/t/mysqldump-max.test
index 27c1a3ce20c..d0a4870ba31 100644
--- a/mysql-test/t/mysqldump-max.test
+++ b/mysql-test/t/mysqldump-max.test
@@ -1194,7 +1194,7 @@ DROP TABLE t2;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mwl136.sql
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS LIMIT 6,3;
+SHOW BINLOG EVENTS LIMIT 7,3;
--perl
my $f= "$ENV{MYSQLTEST_VARDIR}/tmp/mwl136.sql";
open F, '<', $f or die "Failed to open $f: $!\n";
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index a7585bea4f8..ffbec36873e 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -2120,6 +2120,11 @@ insert into t1 values ("Abcd");
--error $errno1,ER_PARSE_ERROR
garbage;
+let $errno_multi = $errno1,ER_NO_SUCH_TABLE,$errno2,1062;
+
+--error $errno_multi
+SELECT * FROM non_existing_table;
+
drop table t2;
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index a6f50107cbe..adb7e361a4f 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -865,6 +865,7 @@ CALL mtr.add_suppression("Out of sort memory");
--error ER_OUT_OF_SORTMEMORY
select * from t1 order by b;
drop table t1;
+set session sort_buffer_size= 30000;
--echo #
--echo # Bug #39844: Query Crash Mysql Server 5.0.67
@@ -1391,7 +1392,205 @@ ORDER BY t2.c LIMIT 5;
DROP TABLE t1,t2,t3;
-#
+--echo #
+--echo # WL#1393 - Optimizing filesort with small limit
+--echo #
+
+CREATE TABLE t1(f0 int auto_increment primary key, f1 int, f2 varchar(200));
+INSERT INTO t1(f1, f2) VALUES
+(0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
+(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
+(11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
+(16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
+(21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
+(26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
+(31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
+(36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
+(41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
+(46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
+(51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
+(56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
+(61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
+(66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
+(71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
+(76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
+(81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
+(86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
+(91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
+(96,"96"),(97,"97"),(98,"98"),(99,"99");
+
+################
+## Test sort when source data fits in memory
+
+SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 100;
+SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 30;
+SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 0;
+SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 30;
+SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 0;
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 20;
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0;
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10;
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10;
+
+################
+## Test sort when source data does not fit in memory
+set sort_buffer_size= 32768;
+CREATE TEMPORARY TABLE tmp (f1 int, f2 varchar(20));
+INSERT INTO tmp SELECT f1, f2 FROM t1;
+INSERT INTO t1(f1, f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1, f2 FROM t1;
+INSERT INTO t1(f1, f2) SELECT * FROM tmp;
+
+SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 30;
+SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 0;
+SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 30;
+SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 0;
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 20;
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0;
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10;
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10;
+
+################
+## Test with SQL_CALC_FOUND_ROWS
+set sort_buffer_size= 32768;
+SELECT SQL_CALC_FOUND_ROWS * FROM t1
+ORDER BY f1, f0 LIMIT 30;
+SELECT FOUND_ROWS();
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1
+ORDER BY f1, f0 LIMIT 0;
+SELECT FOUND_ROWS();
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
+ORDER BY f2, f0 LIMIT 20;
+SELECT FOUND_ROWS();
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
+ORDER BY f2, f0 LIMIT 0;
+SELECT FOUND_ROWS();
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
+ORDER BY f2, f0 LIMIT 10 OFFSET 10;
+SELECT FOUND_ROWS();
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
+ORDER BY f2, f0 LIMIT 0 OFFSET 10;
+SELECT FOUND_ROWS();
+
+################
+## Test sorting with join
+## These are re-written to use PQ during execution.
+set sort_buffer_size= 327680;
+
+SELECT * FROM t1 JOIN tmp on t1.f2=tmp.f2
+ORDER BY tmp.f1, f0 LIMIT 30;
+
+SELECT * FROM t1 JOIN tmp on t1.f2=tmp.f2
+ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 JOIN tmp on t1.f2=tmp.f2
+ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
+SELECT FOUND_ROWS();
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 JOIN tmp on t1.f2=tmp.f2
+WHERE t1.f2>20
+ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
+SELECT FOUND_ROWS();
+
+################
+## Test views
+CREATE VIEW v1 as SELECT * FROM t1 ORDER BY f1, f0 LIMIT 30;
+SELECT * FROM v1;
+drop view v1;
+
+CREATE VIEW v1 as SELECT * FROM t1 ORDER BY f1, f0 LIMIT 100;
+SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30;
+
+CREATE VIEW v2 as SELECT * FROM t1 ORDER BY f2, f0 LIMIT 100;
+SELECT * FROM v1 JOIN v2 on v1.f1=v2.f1 ORDER BY v1.f2,v1.f0,v2.f0
+LIMIT 30;
+
+################
+## Test group & having
+SELECT floor(f1/10) f3, count(f2) FROM t1
+GROUP BY 1 ORDER BY 2,1 LIMIT 5;
+
+SELECT floor(f1/10) f3, count(f2) FROM t1
+GROUP BY 1 ORDER BY 2,1 LIMIT 0;
+
+################
+## Test SP
+delimiter |;
+CREATE PROCEDURE wl1393_sp_test()
+BEGIN
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 30;
+SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 15 OFFSET 15;
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
+ORDER BY f2, f0 LIMIT 15 OFFSET 15;
+SELECT FOUND_ROWS();
+SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30;
+END|
+CALL wl1393_sp_test()|
+DROP PROCEDURE wl1393_sp_test|
+delimiter ;|
+
+################
+## Test with subqueries
+SELECT d1.f1, d1.f2 FROM t1
+LEFT JOIN (SELECT * FROM t1 ORDER BY f1 LIMIT 30) d1 on t1.f1=d1.f1
+ORDER BY d1.f2 DESC LIMIT 30;
+
+SELECT * FROM t1 WHERE f1 = (SELECT f1 FROM t1 ORDER BY 1 LIMIT 1);
+
+--error ER_SUBQUERY_NO_1_ROW
+SELECT * FROM t1 WHERE f1 = (SELECT f1 FROM t1 ORDER BY 1 LIMIT 2);
+
+DROP TABLE t1, tmp;
+DROP VIEW v1, v2;
+
+--echo # end of WL#1393 - Optimizing filesort with small limit
+
+--echo #
+--echo # Bug #58761
+--echo # Crash in Field::is_null in field.h on subquery in WHERE clause
+--echo #
+
+CREATE TABLE t1 (
+ pk INT NOT NULL AUTO_INCREMENT,
+ col_int_key INT DEFAULT NULL,
+ col_varchar_key VARCHAR(1) DEFAULT NULL,
+ PRIMARY KEY (pk),
+ KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+
+INSERT INTO t1 VALUES (27,7,'x');
+INSERT INTO t1 VALUES (28,6,'m');
+INSERT INTO t1 VALUES (29,4,'c');
+
+CREATE TABLE where_subselect
+ SELECT DISTINCT `pk` AS field1 , `pk` AS field2
+ FROM t1 AS alias1
+ WHERE alias1 . `col_int_key` > 229
+ OR alias1 . `col_varchar_key` IS NOT NULL
+ GROUP BY field1, field2
+;
+
+SELECT *
+FROM where_subselect
+WHERE (field1, field2) IN (
+ SELECT DISTINCT `pk` AS field1 , `pk` AS field2
+ FROM t1 AS alias1
+ WHERE alias1 . `col_int_key` > 229
+ OR alias1 . `col_varchar_key` IS NOT NULL
+ GROUP BY field1, field2
+);
+
+DROP TABLE t1;
+DROP TABLE where_subselect;
+
+--echo # End of Bug #58761
+
+##
# Bug#35844: Covering index for ref access not compatible with ORDER BY list
#
@@ -1613,3 +1812,42 @@ SELECT t2.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b;
drop table t1,t2;
--echo End of 5.2 tests
+
+--echo #
+--echo # Bug mdev-449: ORDER BY with small sort_buffer_size
+--echo #
+
+CREATE TABLE t1(f0 int auto_increment primary key, f1 int, f2 varchar(200));
+INSERT INTO t1(f1, f2) VALUES
+(0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
+(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
+(11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
+(16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
+(21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
+(26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
+(31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
+(36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
+(41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
+(46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
+(51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
+(56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
+(61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
+(66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
+(71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
+(76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
+(81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
+(86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
+(91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
+(96,"96"),(97,"97"),(98,"98"),(99,"99");
+
+set @save_sort_buffer_size= @@sort_buffer_size;
+set sort_buffer_size= 2000;
+
+SELECT * FROM t1 ORDER BY f1 DESC, f0;
+
+set sort_buffer_size= @save_sort_buffer_size;
+
+DROP TABLE t1;
+
+--echo End of 5.3 tests
+
diff --git a/mysql-test/t/order_by_sortkey.test b/mysql-test/t/order_by_sortkey.test
new file mode 100644
index 00000000000..43de028496e
--- /dev/null
+++ b/mysql-test/t/order_by_sortkey.test
@@ -0,0 +1,64 @@
+#
+# WL#1393 - ORDER BY with LIMIT tests
+#
+# A big test in a separate file, so that we can run the original
+# order_by test with --debug without timeout.
+#
+# All the sort keys fit in memory, but the addon fields do not.
+#
+CREATE TABLE t1(
+ f0 int auto_increment PRIMARY KEY,
+ f1 int,
+ f2 varchar(200)
+);
+
+INSERT INTO t1(f1, f2) VALUES
+(0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
+(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
+(11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
+(16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
+(21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
+(26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
+(31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
+(36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
+(41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
+(46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
+(51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
+(56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
+(61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
+(66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
+(71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
+(76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
+(81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
+(86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
+(91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
+(96,"96"),(97,"97"),(98,"98"),(99,"99");
+
+CREATE TEMPORARY TABLE tmp (f1 int, f2 varchar(20));
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+INSERT INTO tmp SELECT f1,f2 FROM t1;
+INSERT INTO t1(f1,f2) SELECT * FROM tmp;
+
+# Test when only sortkeys fits to memory
+set sort_buffer_size= 32768;
+
+FLUSH STATUS;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+SELECT * FROM t1 ORDER BY f2 LIMIT 100;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+DROP TABLE t1, tmp;
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
index d477843b22b..2c8cfafb90a 100644
--- a/mysql-test/t/parser.test
+++ b/mysql-test/t/parser.test
@@ -553,7 +553,7 @@ select master_pos_wait();
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select master_pos_wait(1);
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select master_pos_wait(1, 2, 3, 4);
+select master_pos_wait(1, 2, 3, 4, 5);
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select rand(1, 2, 3);
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 08c028c8224..ef0d3df6661 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -2476,3 +2476,13 @@ SELECT 1 FROM t1 AS t1_0 JOIN t1 ON t1_0.a LIKE (SELECT 1 FROM t1);
SELECT * FROM vtmp;
DROP VIEW vtmp;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-365 "Got assertion when doing alter table on a partition"
+--echo #
+
+CREATE TABLE t1 ( i INT ) ENGINE=Aria PARTITION BY HASH(i) PARTITIONS 2;
+INSERT INTO t1 VALUES (1),(2),(2),(3),(4);
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+SELECT * from t1 order by i;
+DROP TABLE t1;
diff --git a/mysql-test/t/partition_cache_innodb.test b/mysql-test/t/partition_cache_innodb.test
new file mode 100644
index 00000000000..dbcfea3088c
--- /dev/null
+++ b/mysql-test/t/partition_cache_innodb.test
@@ -0,0 +1,14 @@
+# t/cache_innodb.test
+#
+# Last update:
+# 2006-07-26 ML test refactored (MySQL 5.1)
+# main code t/innodb_cache.test --> include/query_cache.inc
+# new wrapper t/cache_innodb.test
+#
+
+--source include/have_query_cache.inc
+--source include/have_innodb.inc
+--source include/have_partition.inc
+let $engine_type= innodb;
+
+--source include/query_cache_partitions.inc
diff --git a/mysql-test/t/partition_cache_myisam.test b/mysql-test/t/partition_cache_myisam.test
new file mode 100644
index 00000000000..5347225f6da
--- /dev/null
+++ b/mysql-test/t/partition_cache_myisam.test
@@ -0,0 +1,14 @@
+# t/cache_innodb.test
+#
+# Last update:
+# 2006-07-26 ML test refactored (MySQL 5.1)
+# main code t/innodb_cache.test --> include/query_cache.inc
+# new wrapper t/cache_innodb.test
+#
+
+--source include/have_query_cache.inc
+
+--source include/have_partition.inc
+let $engine_type= myisam;
+
+--source include/query_cache_partitions.inc
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index d955b46469c..ff28631862c 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3125,7 +3125,7 @@ DROP TABLE t1;
--echo End of 5.1 tests.
--echo #
---echo # LP bug#1001500 Crash on the second execution of the PS for
+--echo # lp:1001500 Crash on the second execution of the PS for
--echo # a query with degenerated conjunctive condition
--echo # (see also mysql bug#12582849)
--echo #
@@ -3572,94 +3572,4 @@ show status like '%Handler_read%';
deallocate prepare st;
drop table t1;
---echo #
---echo # LP bug#993459 Execution of PS for a query with GROUP BY
---echo # returns wrong result (see also mysql bug#13805127)
---echo #
-
-PREPARE s1 FROM
-"
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2
-";
-
---echo
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:99345900:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
---echo
-SET @x = 2;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
---echo
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
-DEALLOCATE PREPARE s1;
-
--echo # End of 5.3 tests
diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test
index ff910bdf5cf..3d32a8c0da6 100644
--- a/mysql-test/t/replace.test
+++ b/mysql-test/t/replace.test
@@ -25,9 +25,9 @@ drop table t1;
create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value");
insert into t1 values (126,"first"),(63, "middle"),(0,"last");
---error ER_DUP_ENTRY
+--error 167
insert into t1 values (0,"error");
---error ER_DUP_ENTRY
+--error 167
replace into t1 values (0,"error");
replace into t1 values (126,"first updated");
replace into t1 values (63,default);
diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test
new file mode 100644
index 00000000000..6ae9484db71
--- /dev/null
+++ b/mysql-test/t/show_explain.test
@@ -0,0 +1,1115 @@
+#
+# Tests for SHOW EXPLAIN FOR functionality
+#
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t0, t1, t2, t3, t4;
+drop view if exists v1;
+--enable_warnings
+
+#
+# Testcases in this file do not work with embedded server. The reason for this
+# is that we use the following commands for synchronization:
+#
+# set @show_explain_probe_select_id=1;
+# set debug_dbug='d,show_explain_probe_join_exec_start';
+# send select count(*) from t1 where a < 100000;
+#
+# When ran with mysqltest_embedded, this translates into:
+#
+# Thread1> DBUG_PUSH("d,show_explain_probe_join_exec_start");
+# Thread1> create another thread for doing "send ... reap"
+# Thread2> mysql_parse("select count(*) from t1 where a < 100000");
+#
+# That is, "select count(*) ..." is ran in a thread for which DBUG_PUSH(...)
+# has not been called. As a result, show_explain_probe_join_exec_start does not fire, and
+# "select count(*) ..." does not wait till its SHOW EXPLAIN command, and the
+# test fails.
+#
+-- source include/not_embedded.inc
+
+
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int);
+insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C;
+alter table t1 add b int, add c int, add filler char(32);
+update t1 set b=a, c=a, filler='fooo';
+alter table t1 add key(a), add key(b);
+
+#
+# Try killing a non-existent thread
+#
+--error ER_NO_SUCH_THREAD
+show explain for 2000000000;
+
+--error ER_SET_CONSTANTS_ONLY
+show explain for (select max(a) from t0);
+
+#
+# Setup two threads and their ids
+#
+let $thr1=`select connection_id()`;
+connect (con1, localhost, root,,);
+connection con1;
+let $thr2=`select connection_id()`;
+connection default;
+
+# SHOW EXPLAIN FOR <idle thread>
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+
+# SHOW EXPLAIN FOR <ourselves>
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr1;
+
+let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
+
+#
+# Test SHOW EXPLAIN for simple queries
+#
+connection con1;
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send select count(*) from t1 where a < 100000;
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+
+send select max(c) from t1 where a < 10;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+
+--echo # We can catch EXPLAIN, too.
+set @show_expl_tmp= @@optimizer_switch;
+set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
+send explain select max(c) from t1 where a < 10;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+set optimizer_switch= @show_expl_tmp;
+
+
+--echo # UNION, first branch
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send explain select a from t0 A union select a+1 from t0 B;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+
+--echo # UNION, second branch
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send explain select a from t0 A union select a+1 from t0 B;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+
+--echo # Uncorrelated subquery, select
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 B) from t0 A where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+
+--echo # Uncorrelated subquery, explain
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send explain select a, (select max(a) from t0 B) from t0 A where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+--echo # correlated subquery, select
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+--echo # correlated subquery, explain
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+--echo # correlated subquery, select, while inside the subquery
+set @show_explain_probe_select_id=2; # <---
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+--echo # correlated subquery, explain, while inside the subquery
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+
+--echo # correlated subquery, explain, while inside the subquery
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+# TODO: explain in the parent subuqery when the un-correlated child has been
+# run (and have done irreversible cleanups)
+# ^^ Is this at all possible after 5.3?
+# Maybe, for 5.3 try this:
+# - run before/after the parent has invoked child's optimization
+# - run after materialization
+
+--echo # Try to do SHOW EXPLAIN for a query that runs a SET command:
+--echo # I've found experimentally that select_id==2 here...
+--echo #
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send set @foo= (select max(a) from t0 where sin(a) >0);
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+--echo #
+--echo # Attempt SHOW EXPLAIN for an UPDATE
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+connection con1;
+reap;
+drop table t2;
+
+--echo #
+--echo # Attempt SHOW EXPLAIN for a DELETE
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+connection con1;
+reap;
+drop table t2;
+
+
+--echo #
+--echo # Multiple SHOW EXPLAIN calls for one select
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+evalp show explain for $thr2;
+evalp show explain for $thr2;
+connection con1;
+reap;
+drop table t2;
+
+--echo #
+--echo # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
+--echo #
+explain select * from t0 order by a;
+
+set debug_dbug='d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+send select * from t0 order by a;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+--echo #
+--echo # SHOW EXPLAIN for SELECT ... with "Using temporary"
+--echo #
+connection default;
+explain select distinct a from t0;
+connection con1;
+
+set debug_dbug='d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+send select distinct a from t0;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+--echo #
+--echo # SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
+--echo #
+connection default;
+explain select distinct a from t0;
+connection con1;
+
+set debug_dbug='d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+send select distinct a from t0;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+
+--echo #
+--echo # MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY
+--echo #
+CREATE TABLE t2 ( a INT );
+INSERT INTO t2 VALUES (1),(2),(1),(4),(2);
+explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
+
+set debug_dbug='d,show_explain_in_find_all_keys';
+send SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
+
+connection default;
+--source include/wait_condition.inc
+--echo # FIXED by "conservative assumptions about when QEP is available" fix:
+--echo # NOTE: current code will not show "Using join buffer":
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+DROP TABLE t2;
+
+
+--echo #
+--echo # MDEV-239: Assertion `field_types == 0 ... ' failed in Protocol_text::store(double, uint32, String*) with
+--echo # SHOW EXPLAIN over EXPLAIN EXTENDED
+--echo #
+
+
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (1),(2),(1),(4),(2);
+
+EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+send EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+DROP TABLE t2;
+
+
+--echo #
+--echo # MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed in
+--echo # JOIN::print_explain on query with a JOIN, TEMPTABLE view,
+--echo #
+CREATE TABLE t3 (a INT);
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t3;
+INSERT INTO t3 VALUES (8);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9);
+explain SELECT * FROM v1, t2;
+
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+send SELECT * FROM v1, t2;
+
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+DROP VIEW v1;
+DROP TABLE t2, t3;
+
+--echo #
+--echo # MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries
+--echo #
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+send select sleep(1);
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+
+
+--echo #
+--echo # Same as above, but try another reason for JOIN to be degenerate
+--echo #
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+send select * from t0 where 1>10;
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+
+--echo #
+--echo # Same as above, but try another reason for JOIN to be degenerate (2)
+--echo #
+create table t3(a int primary key);
+insert into t3 select a from t0;
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+send select * from t0,t3 where t3.a=112233;
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+drop table t3;
+
+--echo #
+--echo # MDEV-270: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with
+--echo # select tables optimized away
+--echo #
+
+CREATE TABLE t2 (pk INT PRIMARY KEY, a INT ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+ (1,4),(2,62),(3,7),(4,1),(5,0),(6,7),(7,7),(8,1),(9,7),(10,1),
+ (11,5),(12,2),(13,0),(14,1),(15,8),(16,1),(17,1),(18,9),(19,1),(20,5) ;
+
+explain SELECT * FROM t2 WHERE a =
+ (SELECT MAX(a) FROM t2
+ WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
+ );
+
+set @show_explain_probe_select_id=2;
+set debug_dbug='d,show_explain_probe_do_select';
+send SELECT * FROM t2 WHERE a =
+ (SELECT MAX(a) FROM t2
+ WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
+ );
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+drop table t2;
+
+
+--echo #
+--echo # MDEV-273: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with impossible WHERE
+--echo #
+CREATE TABLE t2 (a1 INT, KEY(a1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+ (4),(6),(7),(1),(0),(7),(7),(1),(7),(1),
+ (5),(2),(0),(1),(8),(1),(1),(9),(1),(5);
+
+CREATE TABLE t3 (b1 INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES
+ (4),(5),(8),(4),(8),(2),(9),(6),(4),(8),
+ (3),(5),(9),(6),(8),(3),(2),(6),(3),(1),
+ (4),(3),(1),(7),(0),(0),(9),(5),(9),(0),
+ (2),(2),(5),(9),(1),(4),(8),(6),(5),(5),
+ (1),(7),(2),(8),(9),(3),(2),(6),(6),(5),
+ (4),(3),(2),(7),(4),(6),(0),(8),(5),(8),
+ (2),(9),(7),(5),(7),(0),(4),(3),(1),(0),
+ (6),(2),(8),(3),(7),(3),(5),(5),(1),(2),
+ (1),(7),(1),(9),(9),(8),(3);
+CREATE TABLE t4 (c1 INT) ENGINE=MyISAM;
+
+EXPLAIN
+SELECT count(*) FROM t2, t3
+WHERE a1 < ALL (
+ SELECT a1 FROM t2
+ WHERE a1 IN ( SELECT a1 FROM t2, t4 )
+);
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_do_select';
+send
+SELECT count(*) FROM t2, t3
+WHERE a1 < ALL (
+ SELECT a1 FROM t2
+ WHERE a1 IN ( SELECT a1 FROM t2, t4 )
+);
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+drop table t2, t3, t4;
+
+--echo #
+--echo # MDEV-275: SHOW EXPLAIN: server crashes in JOIN::print_explain with IN subquery and aggregate function
+--echo #
+CREATE TABLE t2 ( `pk` INT NOT NULL PRIMARY KEY, `a1` INT NOT NULL, KEY(`a1`)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+ (1,5),(2,4),(3,6),(4,9),(5,2),(6,8),(7,4),(8,8),(9,0),(10,43),
+ (11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2);
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_end';
+send
+ SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`);
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-305: SHOW EXPLAIN: ref returned by SHOW EXPLAIN is different from the normal EXPLAIN ('const' vs empty string)
+--echo #
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES (3),(1),(5),(1);
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+
+send SELECT 'test' FROM t1 WHERE a=1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-299: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN changes back and forth during query execution
+--echo #
+
+create table t1 (key1 int, col1 int, col2 int, filler char(100), key(key1));
+insert into t1 select A.a+ 10 * B.a, 10, 10, 'filler-data' from t0 A, t0 B;
+
+# Make matches 3 records
+update t1 set col1=3, col2=10 where key1=1; # small range
+update t1 set col1=3, col2=1000 where key1=2; # big range
+update t1 set col1=3, col2=10 where key1=3; # small range again
+update t1 set col1=3, col2=1000 where key1=4; # big range
+
+set @tmp_mdev299_jcl= @@join_cache_level;
+set join_cache_level=0;
+
+explain select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_test_if_quick_select';
+
+send
+select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+set debug_dbug='';
+drop table t1;
+
+--echo #
+--echo # MDEV-297: SHOW EXPLAIN: Server gets stuck until timeout occurs while
+--echo # executing SHOW INDEX and SHOW EXPLAIN in parallel
+--echo #
+CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c));
+INSERT INTO t1 (a) VALUES (3),(1),(5),(1);
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+
+send SHOW INDEX FROM t1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-324: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN for a query with TEMPTABLE view
+--echo # loses 'DERIVED' line on the way without saying that the plan was already deleted
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+
+EXPLAIN SELECT a + 1 FROM v1;
+
+set debug_dbug='d,show_explain_probe_join_tab_preread';
+set @show_explain_probe_select_id=1;
+
+send
+ SELECT a + 1 FROM v1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+set debug_dbug='';
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-323: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN loses
+--echo # 'UNION RESULT' line on the way without saying that the plan was already deleted
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (4),(6);
+
+EXPLAIN
+SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
+
+set debug_dbug='d,show_explain_probe_union_read';
+send
+SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+
+set debug_dbug='';
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-327: SHOW EXPLAIN: Different select_type in plans produced by SHOW EXPLAIN
+--echo # and standard EXPLAIN: 'SUBQUERY' vs 'DEPENDENT SUBQUERY'
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+INSERT INTO t1 VALUES
+(4),(6),(3),(5),(3),(246),(2),(9),(3),(8),
+(1),(8),(8),(5),(7),(5),(1),(6),(2),(9);
+
+CREATE TABLE t2 (b INT) ENGINE=Aria;
+INSERT INTO t2 VALUES
+(1),(7),(4),(7),(0),(2),(9),(4),(0),(9),
+(1),(3),(8),(8),(18),(84),(6),(3),(6),(6);
+
+EXPLAIN
+SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
+WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+--send
+SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
+WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+set debug_dbug='';
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Test that SHOW EXPLAIN will print 'Distinct'.
+--echo #
+CREATE TABLE t1 (a int(10) unsigned not null primary key,b int(10) unsigned);
+INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1);
+
+CREATE TABLE t3 (a int(10) unsigned, key(A), b text);
+INSERT INTO t3 VALUES (1,'1'),(2,'2');
+
+create temporary table t4 select * from t3;
+insert into t3 select * from t4;
+insert into t4 select * from t3;
+insert into t3 select * from t4;
+insert into t4 select * from t3;
+insert into t3 select * from t4;
+insert into t4 select * from t3;
+insert into t3 select * from t4;
+explain select distinct t1.a from t1,t3 where t1.a=t3.a;
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+--send
+select distinct t1.a from t1,t3 where t1.a=t3.a;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+set debug_dbug='';
+
+drop table t1,t3,t4;
+
+--echo #
+--echo # ---------- SHOW EXPLAIN and permissions -----------------
+--echo #
+grant ALL on test.* to test2@localhost;
+
+# Give the user SUPER privilege so it can set debug_dbug variable.
+grant super on *.* to test2@localhost;
+connect (con2, localhost, test2,,);
+connection con1;
+
+--echo #
+--echo # First, make sure that user 'test2' cannot do SHOW EXPLAIN on us
+--echo #
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send
+select * from t0 where a < 3;
+
+connection default;
+--source include/wait_condition.inc
+
+connection con2;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+evalp show explain for $thr2;
+
+connection default;
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+set debug_dbug='';
+
+--echo #
+--echo # Check that user test2 can do SHOW EXPLAIN on its own queries
+--echo #
+connect (con3, localhost, test2,,);
+
+connection con2;
+let $thr_con2=`select connection_id()`;
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send
+select * from t0 where a < 3;
+
+connection con1;
+let $save_wait_condition= $wait_condition;
+let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr_con2;
+--source include/wait_condition.inc
+
+connection con3;
+evalp show explain for $thr_con2;
+
+connection con2;
+reap;
+
+connection con1;
+
+disconnect con3;
+let $wait_condition= $save_wait_condition;
+--echo #
+--echo # Now, grant test2 a PROCESSLIST permission, and see that he's able to observe us
+--echo #
+disconnect con2;
+grant process on *.* to test2@localhost;
+connect (con2, localhost, test2,,);
+connection con1;
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send
+select * from t0 where a < 3;
+
+connection default;
+--source include/wait_condition.inc
+
+connection con2;
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+set debug_dbug='';
+
+revoke all privileges on test.* from test2@localhost;
+drop user test2@localhost;
+
+disconnect con2;
+--echo #
+--echo # Test that it is possible to KILL a SHOW EXPLAIN command that's waiting
+--echo # on its target thread
+--echo #
+connect (con2, localhost, root,,);
+connect (con3, localhost, root,,);
+connection con2;
+create table t1 (pk int primary key, data char(64)) engine=innodb;
+insert into t1 select A.a + 10 * B.a + 100 * C.a, 'data1' from t0 A, t0 B, t0 C;
+
+--echo # Lock two threads
+set autocommit=0;
+select * from t1 where pk between 10 and 20 for update;
+
+connection con1;
+set autocommit=0;
+# This will freeze
+send
+select * from t1 where pk between 10 and 20 for update;
+
+# run SHOW EXPLAIN on a frozen thread
+connection default;
+let $save_wait_condition= $wait_condition;
+let $wait_condition= select State='Sending data' from information_schema.processlist where id=$thr2;
+let $thr_default=`select connection_id()`;
+--source include/wait_condition.inc
+--echo # do: send_eval show explain for thr2;
+--disable_query_log
+send_eval show explain for $thr2;
+--enable_query_log
+
+# kill the SHOW EXPLAIN command
+connection con3;
+let $wait_condition= select State='show explain' from information_schema.processlist where id=$thr_default;
+--source include/wait_condition.inc
+evalp kill query $thr_default;
+
+connection default;
+--error ER_QUERY_INTERRUPTED
+reap;
+
+connection con2;
+rollback;
+
+connection con1;
+reap;
+
+drop table t1;
+disconnect con3;
+disconnect con2;
+let $wait_condition= $save_wait_condition;
+
+--echo #
+--echo # Check that the I_S table is invisible
+--echo #
+select table_name from information_schema.tables where table_schema='information_schema' and table_name like '%explain%';
+
+--echo #
+--echo # MDEV-325: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN is different from standard EXPLAIN: type ALL vs 'index_merge'..
+--echo #
+CREATE TABLE t1 (a INT, b INT, KEY(a), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+(8,0),(128,5050),(5372,8),(234,7596),(2,0),(2907,8930),(1,0),
+(0,5224),(8,7638),(960,5),(9872,1534),(0,2295),(3408,9809),
+(7,0),(1168,0),(2089,5570),(0,205),(88,1018),(0,26528),
+(0,0),(4,5567),(1444,145),(6,0),(1,7535),(7793,534),(70,9),
+(178,1),(44,5),(189,0),(3,0);
+
+EXPLAIN
+SELECT a+SLEEP(0.01) FROM t1
+WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
+ORDER BY b;
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+--send
+SELECT a+SLEEP(0.01) FROM t1
+WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
+ORDER BY b;
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_do_select';
+--send
+SELECT a+SLEEP(0.01) FROM t1
+WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
+ORDER BY b;
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+
+set debug_dbug='';
+
+drop table t1;
+
+--echo #
+--echo # MDEV-298: SHOW EXPLAIN: Plan returned by SHOW EXPLAIN only contains
+--echo # 'Using temporary' while the standard EXPLAIN says 'Using temporary; Using filesort'
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),
+ (10),(11),(12),(13),(14),(15),(16);
+INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12, t1 t13;
+
+EXPLAIN SELECT a FROM t1 GROUP BY a;
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+--send
+SELECT a FROM t1 GROUP BY a;
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+
+set debug_dbug='';
+
+drop table t1;
+
+--echo #
+--echo # MDEV-408: SHOW EXPLAIN: Some values are chopped off in SHOW EXPLAIN output
+--echo #
+CREATE TABLE t1 (a INT, b VARCHAR(35)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (3989,'Abilene'),(3873,'Akron');
+
+CREATE TABLE t2 (c INT, d VARCHAR(52) PRIMARY KEY, KEY(c)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (86,'English'),(87,'Russian');
+
+explain SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+--send
+SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+
+set debug_dbug='';
+
+drop table t1, t2;
+
+--echo #
+--echo # MDEV-412: SHOW EXPLAIN: Server crashes in JOIN::print_explain on a query with inner join and ORDER BY the same column twice
+--echo #
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(3), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+(3795,'USA'),(3913,'USA'),(3846,'ITA'),(4021,'USA'),(4005,'RUS'),(4038,'USA'),
+(3825,'USA'),(3840,'USA'),(3987,'USA'),(3807,'USA'),(3896,'USA'),(4052,'USA'),
+(3973,'USA'),(3982,'ITA'),(3965,'USA'),(3852,'RUS'),(4006,'USA'),(3800,'USA'),
+(4020,'USA'),(4040,'USA'),(3916,'USA'),(3817,'USA'),(3885,'USA'),(3802,'USA'),
+(4009,'ITA'),(3895,'USA'),(3963,'RUS'),(4045,'USA'),(3988,'USA'),(3815,'USA'),
+(4063,'USA'),(3978,'USA'),(4019,'USA'),(3954,'USA'),(3950,'USA'),(3974,'ITA'),
+(4054,'USA'),(4061,'RUS'),(3976,'USA'),(3966,'USA'),(3957,'USA'),(3981,'USA'),
+(3923,'USA'),(3876,'USA'),(3819,'USA'),(3877,'USA'),(3829,'ITA'),(3964,'USA'),
+(4053,'RUS'),(3917,'USA'),(3874,'USA'),(4023,'USA'),(4001,'USA'),(3872,'USA'),
+(3890,'USA'),(3962,'USA'),(3886,'USA'),(4026,'ITA'),(3869,'USA'),(3937,'RUS'),
+(3975,'USA'),(3944,'USA'),(3908,'USA'),(3867,'USA'),(3947,'USA'),(3838,'USA'),
+(3796,'USA'),(3893,'USA'),(3920,'ITA'),(3994,'USA'),(3875,'RUS'),(4011,'USA'),
+(4013,'USA'),(3810,'USA'),(3834,'USA'),(3968,'USA'),(3931,'USA'),(3839,'USA'),
+(4042,'USA'),(4039,'ITA'),(3811,'USA'),(3837,'RUS'),(4041,'USA'),(3884,'USA'),
+(3894,'USA'),(3879,'USA'),(3942,'USA'),(3959,'USA'),(3814,'USA'),(4044,'USA'),
+(3971,'ITA'),(3823,'USA'),(3793,'RUS'),(3855,'USA'),(3905,'USA'),(3865,'USA'),
+(4046,'USA'),(3990,'USA'),(4022,'USA'),(3833,'USA'),(3918,'USA'),(4064,'ITA'),
+(3821,'USA'),(3836,'RUS'),(3921,'USA'),(3914,'USA'),(3888,'USA');
+
+CREATE TABLE t2 (c VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('USA');
+
+CREATE TABLE t3 (d VARCHAR(3), e VARCHAR(52), PRIMARY KEY (d,e)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES
+('JPN','Japanese'),('KOR','Korean'),('POL','Polish'),('PRT','Portuguese'),
+('ESP','Spanish'),('FRA','French'),('VNM','Vietnamese');
+
+explain
+SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_do_select';
+
+send
+SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+
+set debug_dbug='';
+
+DROP TABLE t1,t2,t3;
+
+
+--echo #
+--echo # MDEV-423: SHOW EXPLAIN: 'Using where' for a subquery is shown in EXPLAIN, but not in SHOW EXPLAIN output
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7),(0),(9),(3),(4),(2),(5),(7),(0),(9),(3),(4),(2),(5);
+
+CREATE TABLE t2 (b INT, c INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+(0,4),(8,6),(1,3),(8,5),(9,3),(24,246),(6,2),(1,9),(6,3),(2,8),
+(4,1),(8,8),(4,8),(4,5),(7,7),(4,5),(1,1),(9,6),(4,2),(8,9);
+
+create table t3 like t2;
+insert into t3 select * from t2;
+
+explain
+SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
+WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+
+send
+SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
+WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+
+connection con1;
+reap;
+
+set debug_dbug='';
+
+DROP TABLE t1,t2,t3;
+
+--echo #
+--echo # MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree)
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (8),(9);
+
+EXPLAIN SELECT * FROM t1
+WHERE ( 8, 89 ) IN ( SELECT b, SUM( DISTINCT b ) FROM t2 GROUP BY b );
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Check if queries in non-default charsets work.
+--echo #
+
+set names cp1251;
+# The below are two Russian letters with codes E3FB in cp1251 encoding.
+select charset('ãû');
+select hex('ãû');
+
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+
+send
+select * from t0 where length('ãû') = a;
+
+connection default;
+set names utf8;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+set names default;
+
+connection con1;
+# The constant should be two letters, the last looking like 'bl'
+reap;
+
+set debug_dbug='';
+set names default;
+
+--echo #
+--echo # MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref if FOR contains a non-numeric value
+--echo #
+--error ER_SET_CONSTANTS_ONLY
+show explain for foo;
+
+--echo # End
+drop table t0;
diff --git a/mysql-test/t/show_explain_ps.test b/mysql-test/t/show_explain_ps.test
new file mode 100644
index 00000000000..4ad1e4304de
--- /dev/null
+++ b/mysql-test/t/show_explain_ps.test
@@ -0,0 +1,51 @@
+#
+# Test how SHOW EXPLAIN is represented in performance schema
+#
+--source include/have_debug.inc
+--source include/have_perfschema.inc
+# Like all other perfschema tests, we don't work on embedded server:
+--source include/not_embedded.inc
+
+--disable_warnings
+drop table if exists t0, t1;
+--enable_warnings
+
+select * from performance_schema.setup_instruments where name like '%show_explain%';
+
+--echo # We've got no instances
+select * from performance_schema.cond_instances where name like '%show_explain%';
+
+--echo # Check out if our cond is hit.
+
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+let $thr1=`select connection_id()`;
+connect (con1, localhost, root,,);
+connection con1;
+let $thr2=`select connection_id()`;
+connection default;
+
+let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
+
+#
+# Test SHOW EXPLAIN for simple queries
+#
+connection con1;
+set @show_explain_probe_select_id=1;
+set debug_dbug='d,show_explain_probe_join_exec_start';
+send select count(*) from t0 where a < 100000;
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+
+set debug_dbug='';
+
+select event_name
+from performance_schema.events_waits_history_long
+where event_name='wait/synch/cond/sql/show_explain';
+
+drop table t0;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 148ee6172b2..7fc8dad3bb9 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9111,9 +9111,14 @@ DROP FUNCTION f1;
--echo # ------------------------------------------------------------------
--echo #
---echo # LP bug#993459 Execution of PS for a query with GROUP BY
+--echo # lp:993459 Execution of PS for a query with GROUP BY
--echo # returns wrong result (see also mysql bug#13805127)
--echo #
+
+--echo
+--echo # Bug#13805127: Stored program cache produces wrong result in same THD
+--echo
+
delimiter |;
CREATE PROCEDURE p1(x INT UNSIGNED)
@@ -9147,7 +9152,7 @@ CALL p1(1);
DROP PROCEDURE p1;
--echo #
---echo # LP bug#1002157 : testing stored function
+--echo # lp:1002157 : testing stored function
--echo # bug#62125 result for null incorrectly yields 1292 warning.
--echo #
diff --git a/mysql-test/t/str_to_datetime_457.test b/mysql-test/t/str_to_datetime_457.test
new file mode 100644
index 00000000000..dd25f98ebdd
--- /dev/null
+++ b/mysql-test/t/str_to_datetime_457.test
@@ -0,0 +1,26 @@
+#
+# MDEV-457 Inconsistent data truncation on datetime values with fractional seconds represented as strings with no delimiters
+# (and other problems with str_to_datetime)
+#
+
+# first was ok, second was not
+select cast('01:02:03 ' as time), cast('01:02:03 ' as time);
+# first two were ok, third was not
+select cast('2002-011-012' as date), cast('2002.11.12' as date), cast('2002.011.012' as date);
+# only two microsecond digits were ok, third was truncated with a warning
+select cast('2012103123595912' as datetime(6)), cast('20121031235959123' as datetime(6));
+# zero string date was considered 'out of range'. Must be either ok or invalid format
+select cast(0 as date), cast('0000-00-00' as date), cast('0' as date);
+# first was ok, second was not
+select extract(hour from '100000:02:03'), extract(hour from '100000:02:03 ');
+
+--echo #
+--echo # backward compatibility craziness
+--echo #
+select cast('12:00:00.12.34.56' as time); # was 12:00:00
+select cast('12:00:00 12.34.56' as time); # was 12:34:56
+select cast('12:00:00-12.34.56' as time); # was 12:00:00
+select cast('12:00:00.12.34.56' as datetime);
+select cast('12:00:00-12.34.56' as datetime);
+select cast('12:00:00 12.34.56' as datetime);
+select cast('12:00:00.123456' as time);
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 85dc68f5d99..9f35ecc43f1 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -5576,7 +5576,28 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
drop table t1;
--echo #
---echo # LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+--echo # MDEV-367: Different results with and without subquery_cache on
+--echo # a query with a constant NOT IN condition
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+
+set @mdev367_optimizer_switch = @@optimizer_switch;
+
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+set optimizer_switch=@mdev367_optimizer_switch;
+
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+set optimizer_switch=@mdev367_optimizer_switch;
+
+DROP TABLE t1;
+
+--echo #
+--echo # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
--echo # precomputed and thus not part of optimization
--echo #
@@ -5686,5 +5707,65 @@ SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t
drop table t1,t2;
---echo # return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
+--echo #
+--echo # MDEV-410: EXPLAIN shows type=range, while SHOW EXPLAIN and userstat show full table scan is used
+--echo #
+CREATE TABLE t1 (a VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('USA');
+
+CREATE TABLE t2 (b INT, c VARCHAR(52), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3813,'United States'),(3940,'Russia');
+
+CREATE TABLE t3 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (12),(22),(9),(45);
+
+create table t4 like t3;
+insert into t4 select * from t3;
+
+--echo # This should not show range access for table t2
+explain
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+
+set @tmp_mdev410=@@global.userstat;
+set global userstat=on;
+flush table_statistics;
+flush index_statistics;
+
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+
+--echo # The following shows that t2 was indeed scanned with a full scan.
+show table_statistics;
+show index_statistics;
+set global userstat=@tmp_mdev410;
+
+DROP TABLE t1,t2,t3,t4;
+
+--echo #
+--echo # MDEV-430: Server crashes in select_describe on EXPLAIN with
+--echo # materialization+semijoin, 2 nested subqueries, aggregate functions
+--echo #
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
+--echo #
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+
+DROP TABLE t1,t2;
+
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index b53967e35e5..50b34eece89 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -185,6 +185,75 @@ SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d;
DROP TABLE t;
--echo #
+--echo # LP BUG#1009187, MDEV-373, MYSQL bug#58628
+--echo # Wrong result for a query with [NOT] IN subquery predicate if
+--echo # the left part of the predicate is explicit NULL
+--echo #
+
+CREATE TABLE t1 (pk INT NOT NULL, i INT NOT NULL);
+INSERT INTO t1 VALUES (0,10), (1,20), (2,30), (3,40);
+
+CREATE TABLE t2a (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i,pk));
+INSERT INTO t2a VALUES (0,0), (1,1), (2,2), (3,3);
+
+CREATE TABLE t2b (pk INT, i INT);
+INSERT INTO t2b VALUES (0,0), (1,1), (2,2), (3,3);
+
+CREATE TABLE t2c (pk INT NOT NULL, i INT NOT NULL);
+INSERT INTO t2c VALUES (0,0), (1,1), (2,2), (3,3);
+create index it2c on t2c (i,pk);
+
+CREATE TABLE t2d (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i));
+INSERT INTO t2d VALUES (0,0), (1,1), (2,2), (3,3);
+
+EXPLAIN
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
+SELECT * FROM t1 WHERE 1+NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
+SELECT * FROM t1 WHERE NULL IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) IS UNKNOWN;
+SELECT t1.pk, NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) FROM t1;
+
+EXPLAIN
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk);
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk);
+SELECT * FROM t1 WHERE NULL IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) IS UNKNOWN;
+SELECT t1.pk, NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) FROM t1;
+
+EXPLAIN
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk);
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk);
+SELECT * FROM t1 WHERE NULL IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) IS UNKNOWN;
+SELECT t1.pk, NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) FROM t1;
+
+EXPLAIN
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk);
+SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk);
+SELECT * FROM t1 WHERE NULL IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) IS UNKNOWN;
+SELECT t1.pk, NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) FROM t1;
+
+EXPLAIN
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
+SELECT (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk) from t1;
+
+EXPLAIN
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
+SELECT (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk) from t1;
+
+EXPLAIN
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
+SELECT (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk) from t1;
+
+EXPLAIN
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
+SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
+SELECT (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk) from t1;
+
+drop table t1, t2a, t2b, t2c, t2d;
+
+--echo #
--echo # End of 5.1 tests.
--echo #
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index 3af8f31062c..523e1774a9c 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -244,6 +244,54 @@ drop procedure p1;
drop tables t1,t2,t3;
--echo #
+--echo # Bug #58756
+--echo # Crash in heap_rrnd on query with HAVING ... IN (subquery) + LIMIT
+--echo #
+
+CREATE TABLE t1 (
+ col_time_key time DEFAULT NULL,
+ col_datetime_key datetime DEFAULT NULL,
+ col_varchar_nokey varchar(1) DEFAULT NULL,
+ KEY col_time_key (col_time_key),
+ KEY col_datetime_key (col_datetime_key)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO t1 VALUES ('17:53:30','2005-11-10 12:40:29','h');
+INSERT INTO t1 VALUES ('11:35:49','2009-04-25 00:00:00','b');
+INSERT INTO t1 VALUES (NULL,'2002-11-27 00:00:00','s');
+INSERT INTO t1 VALUES ('06:01:40','2004-01-26 20:32:32','e');
+INSERT INTO t1 VALUES ('05:45:11','2007-10-26 11:41:40','j');
+INSERT INTO t1 VALUES ('00:00:00','2005-10-07 00:00:00','e');
+INSERT INTO t1 VALUES ('00:00:00','2000-07-15 05:00:34','f');
+INSERT INTO t1 VALUES ('06:11:01','2000-04-03 16:33:32','v');
+INSERT INTO t1 VALUES ('13:02:46',NULL,'x');
+INSERT INTO t1 VALUES ('21:44:25','2001-04-25 01:26:12','m');
+INSERT INTO t1 VALUES ('22:43:58','2000-12-27 00:00:00','c');
+
+CREATE TABLE t2 (
+ col_time_key time DEFAULT NULL,
+ col_datetime_key datetime DEFAULT NULL,
+ col_varchar_nokey varchar(1) DEFAULT NULL,
+ KEY col_time_key (col_time_key),
+ KEY col_datetime_key (col_datetime_key)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO t2 VALUES ('11:28:45','2004-10-11 18:13:16','w');
+
+SELECT col_time_key, col_datetime_key
+FROM
+( SELECT * FROM t1 ) AS table1
+HAVING ( 'r' , 'e' ) IN
+ ( SELECT col_varchar_nokey , col_varchar_nokey FROM t2 )
+ORDER BY col_datetime_key
+LIMIT 10;
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+--echo # End of Bug #58756
+
+--echo #
--echo # Bug#60085 crash in Item::save_in_field() with time data type
--echo #
diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test
index 0a0c73da39b..685587fe3c5 100644
--- a/mysql-test/t/type_year.test
+++ b/mysql-test/t/type_year.test
@@ -161,6 +161,14 @@ SELECT COUNT(*) AS total_rows, MIN(c1+0) AS min_value, MAX(c1+0) FROM t1;
DROP TABLE t1;
--echo #
+--echo # WL#6219: Deprecate and remove YEAR(2) type
+--echo #
+
+CREATE TABLE t1 (c1 YEAR(2), c2 YEAR(4));
+ALTER TABLE t1 MODIFY COLUMN c2 YEAR(2);
+DROP TABLE t1;
+
+--echo #
--echo End of 5.1 tests
#
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 0585073a6f5..c4881f7df3f 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4613,6 +4613,54 @@ DROP TRIGGER tr;
DROP VIEW v1;
DROP TABLE t1,t2,t3;
+--echo #
+--echo # LP bug#1007622 Server crashes in handler::increment_statistics on
+--echo # inserting into a view over a view
+--echo #
+
+flush status;
+--disable_ps_protocol
+CREATE TABLE t1 (a INT);
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.* FROM t1 AS a1, t1 AS a2;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
+INSERT INTO v2 (a) VALUES (1) ;
+select * from t1;
+drop view v2,v1;
+drop table t1;
+show status like '%view%';
+show status like 'Opened_table%';
+--enable_ps_protocol
+
+--echo #
+--echo # MDEV-486 LP BUG#1010116 Incorrect query results in
+--echo # view and derived tables
+--echo #
+
+SELECT
+`Derived1`.`id`,
+`Derived2`.`Val1`
+FROM (select 30631 as `id`) AS `Derived1` LEFT OUTER JOIN (SELECT
+2 as `id`,
+1 AS `Val1`
+FROM (select 30631 as `id`) AS `Derived3`) AS `Derived2` ON `Derived1`.`id` = `Derived2`.`id`;
+
+create table t1 ( id int );
+insert into t1 values (30631);
+create table t2 ( id int );
+insert into t2 values (30631);
+create algorithm=MERGE view v2 as select 2 as id, 1 as val1 from t2;
+select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
+drop view v2;
+drop table t1,t2;
+
+create table t1 ( id int );
+insert into t1 values (30631);
+create table t2 ( id int );
+insert into t2 values (30631);
+create algorithm=MERGE view v2 as select 2 as id, id is null as bbb, id as iddqd, 1 as val1 from t2;
+select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
+drop view v2;
+drop table t1,t2;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysql-test/t/xa_binlog.test b/mysql-test/t/xa_binlog.test
index 48f1dc6dfaa..430d45ab86a 100644
--- a/mysql-test/t/xa_binlog.test
+++ b/mysql-test/t/xa_binlog.test
@@ -27,6 +27,6 @@ SELECT * FROM t1 ORDER BY a;
--replace_column 2 # 5 #
--replace_regex /xid=[0-9]+/xid=XX/
-SHOW BINLOG EVENTS LIMIT 1,9;
+SHOW BINLOG EVENTS LIMIT 2,9;
DROP TABLE t1;
diff --git a/mysys/charset-def.c b/mysys/charset-def.c
index 4183b1fcd99..e9f2ecdea49 100644
--- a/mysys/charset-def.c
+++ b/mysys/charset-def.c
@@ -326,7 +326,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_utf16_hungarian_uca_ci);
add_compiled_collation(&my_charset_utf16_sinhala_uca_ci);
add_compiled_collation(&my_charset_utf16_croatian_uca_ci);
-#endif /* HAVE_UCA_COLLATIOINS */
+#endif /* HAVE_UCA_COLLATIONS */
#endif /* HAVE_CHARSET_utf16 */
diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c
index d23ef129aa2..6ab6ba3aae0 100644
--- a/mysys/lf_alloc-pin.c
+++ b/mysys/lf_alloc-pin.c
@@ -271,7 +271,7 @@ static int ptr_cmp(void **a, void **b)
void _lf_pinbox_free(LF_PINS *pins, void *addr)
{
add_to_purgatory(pins, addr);
- if (pins->purgatory_count % LF_PURGATORY_SIZE)
+ if (pins->purgatory_count % LF_PURGATORY_SIZE == 0)
_lf_pinbox_real_free(pins);
}
diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c
index 83cfe1a1639..38b212c65f0 100644
--- a/mysys/lf_hash.c
+++ b/mysys/lf_hash.c
@@ -268,8 +268,10 @@ static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs,
int res= lfind(head, cs, hashnr, key, keylen, &cursor, pins);
if (res)
_lf_pin(pins, 2, cursor.curr);
- _lf_unpin(pins, 0);
+ else
+ _lf_unpin(pins, 2);
_lf_unpin(pins, 1);
+ _lf_unpin(pins, 0);
return res ? cursor.curr : 0;
}
diff --git a/mysys/mf_fn_ext.c b/mysys/mf_fn_ext.c
index 47fc67cabbd..cbf0d5dd9e4 100644
--- a/mysys/mf_fn_ext.c
+++ b/mysys/mf_fn_ext.c
@@ -52,3 +52,40 @@ char *fn_ext(const char *name)
pos=strchr(gpos,FN_EXTCHAR);
DBUG_RETURN((char*) (pos ? pos : strend(gpos)));
} /* fn_ext */
+
+
+/*
+ Return a pointer to the extension of the filename.
+
+ SYNOPSIS
+ fn_ext()
+ name Name of file
+
+ DESCRIPTION
+ The extension is defined as everything after the last extension character
+ (normally '.') after the directory name.
+
+ RETURN VALUES
+ Pointer to to the extension character. If there isn't any extension,
+ points at the end ASCII(0) of the filename.
+*/
+
+char *fn_ext2(const char *name)
+{
+ register const char *pos, *gpos;
+ DBUG_ENTER("fn_ext");
+ DBUG_PRINT("mfunkt",("name: '%s'",name));
+
+#if defined(FN_DEVCHAR) || defined(BASKSLASH_MBTAIL)
+ {
+ char buff[FN_REFLEN];
+ size_t res_length;
+ gpos= name+ dirname_part(buff,(char*) name, &res_length);
+ }
+#else
+ if (!(gpos= strrchr(name, FN_LIBCHAR)))
+ gpos= name;
+#endif
+ pos=strrchr(gpos,FN_EXTCHAR);
+ DBUG_RETURN((char*) (pos ? pos : strend(gpos)));
+} /* fn_ext */
diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c
index 3c23d0737e7..ff05b7fa485 100644
--- a/mysys/mf_iocache2.c
+++ b/mysys/mf_iocache2.c
@@ -287,6 +287,40 @@ my_off_t my_b_filelength(IO_CACHE *info)
}
+size_t
+my_b_write_backtick_quote(IO_CACHE *info, const char *str, size_t len)
+{
+ const uchar *start;
+ const uchar *p= (const uchar *)str;
+ const uchar *end= p + len;
+ size_t count;
+ size_t total= 0;
+
+ if (my_b_write(info, (uchar *)"`", 1))
+ return (size_t)-1;
+ ++total;
+ for (;;)
+ {
+ start= p;
+ while (p < end && *p != '`')
+ ++p;
+ count= p - start;
+ if (count && my_b_write(info, start, count))
+ return (size_t)-1;
+ total+= count;
+ if (p >= end)
+ break;
+ if (my_b_write(info, (uchar *)"``", 2))
+ return (size_t)-1;
+ total+= 2;
+ ++p;
+ }
+ if (my_b_write(info, (uchar *)"`", 1))
+ return (size_t)-1;
+ ++total;
+ return total;
+}
+
/*
Simple printf version. Supports '%s', '%d', '%u', "%ld" and "%lu"
Used for logging in MySQL
@@ -311,6 +345,7 @@ size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
uint minimum_width_sign;
uint precision; /* as yet unimplemented for anything but %b */
my_bool is_zero_padded;
+ my_bool backtick_quoting;
/*
Store the location of the beginning of a format directive, for the
@@ -345,6 +380,7 @@ size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
fmt++;
is_zero_padded= FALSE;
+ backtick_quoting= FALSE;
minimum_width_sign= 1;
minimum_width= 0;
precision= 0;
@@ -357,6 +393,8 @@ process_flags:
minimum_width_sign= -1; fmt++; goto process_flags;
case '0':
is_zero_padded= TRUE; fmt++; goto process_flags;
+ case '`':
+ backtick_quoting= TRUE; fmt++; goto process_flags;
case '#':
/** @todo Implement "#" conversion flag. */ fmt++; goto process_flags;
case ' ':
@@ -400,9 +438,19 @@ process_flags:
reg2 char *par = va_arg(args, char *);
size_t length2 = strlen(par);
/* TODO: implement precision */
- out_length+= length2;
- if (my_b_write(info, (uchar*) par, length2))
- goto err;
+ if (backtick_quoting)
+ {
+ size_t total= my_b_write_backtick_quote(info, par, length2);
+ if (total == (size_t)-1)
+ goto err;
+ out_length+= total;
+ }
+ else
+ {
+ out_length+= length2;
+ if (my_b_write(info, (uchar*) par, length2))
+ goto err;
+ }
}
else if (*fmt == 'b') /* Sized buffer parameter, only precision makes sense */
{
@@ -433,7 +481,11 @@ process_flags:
memset(buffz, '0', minimum_width - length2);
else
memset(buffz, ' ', minimum_width - length2);
- my_b_write(info, buffz, minimum_width - length2);
+ if (my_b_write(info, buffz, minimum_width - length2))
+ {
+ my_afree(buffz);
+ goto err;
+ }
my_afree(buffz);
}
diff --git a/mysys/mf_radix.c b/mysys/mf_radix.c
index 582ca76b8f8..2df1220acdd 100644
--- a/mysys/mf_radix.c
+++ b/mysys/mf_radix.c
@@ -25,6 +25,11 @@
/* Radixsort */
+my_bool radixsort_is_appliccable(uint n_items, size_t size_of_element)
+{
+ return size_of_element <= 20 && n_items >= 1000 && n_items < 100000;
+}
+
void radixsort_for_str_ptr(uchar **base, uint number_of_elements, size_t size_of_element, uchar **buffer)
{
uchar **end,**ptr,**buffer_ptr;
diff --git a/mysys/mf_sort.c b/mysys/mf_sort.c
index 9ef02787716..b2c58c26624 100644
--- a/mysys/mf_sort.c
+++ b/mysys/mf_sort.c
@@ -23,7 +23,7 @@ void my_string_ptr_sort(uchar *base, uint items, size_t size)
#if INT_MAX > 65536L
uchar **ptr=0;
- if (size <= 20 && items >= 1000 && items < 100000 &&
+ if (radixsort_is_appliccable(items, size) &&
(ptr= (uchar**) my_malloc(items*sizeof(char*),MYF(0))))
{
radixsort_for_str_ptr((uchar**) base,items,size,ptr);
diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c
index 97ecd881af1..63964916d6f 100644
--- a/mysys/my_chsize.c
+++ b/mysys/my_chsize.c
@@ -67,13 +67,6 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
goto err;
}
DBUG_RETURN(0);
-#elif defined(HAVE_CHSIZE)
- if (chsize(fd, (off_t) newlength))
- {
- my_errno=errno;
- goto err;
- }
- DBUG_RETURN(0);
#else
/*
Fill space between requested length and true length with 'filler'
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index facc1569943..c1b0a129a30 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -691,15 +691,13 @@ static int setval(const struct my_option *opts, void *value, char *argument,
*((double*) value)= getopt_double(argument, opts, &err);
break;
case GET_STR:
- if (argument == enabled_my_option)
- break; /* string options don't use this default of "1" */
- *((char**) value)= argument;
+ /* If no argument or --enable-string-option, set string to "" */
+ *((char**) value)= argument == enabled_my_option ? (char*) "" : argument;
break;
case GET_STR_ALLOC:
- if (argument == enabled_my_option)
- break; /* string options don't use this default of "1" */
my_free(*((char**) value));
- if (!(*((char**) value)= my_strdup(argument, MYF(MY_WME))))
+ if (!(*((char**) value)= my_strdup(argument == enabled_my_option ? "" :
+ argument, MYF(MY_WME))))
{
res= EXIT_OUT_OF_MEMORY;
goto ret;
diff --git a/mysys/my_lock.c b/mysys/my_lock.c
index c9e599904fa..54ec3838b58 100644
--- a/mysys/my_lock.c
+++ b/mysys/my_lock.c
@@ -212,7 +212,7 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
if (lockf(fd,locktype,length) != -1)
DBUG_RETURN(0);
#endif /* HAVE_FCNTL */
-#endif /* HAVE_LOCKING */
+#endif /* _WIN32 */
/* We got an error. We don't want EACCES errors */
my_errno=(errno == EACCES) ? EAGAIN : errno ? errno : -1;
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index d29cbcc5048..20e53a23ab5 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -30,20 +30,6 @@
uint thd_lib_detected= 0;
-/* To allow use of pthread_getspecific with two arguments */
-
-#ifdef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC
-#undef pthread_getspecific
-
-void *my_pthread_getspecific_imp(pthread_key_t key)
-{
- void *value;
- if (pthread_getspecific(key,(void *) &value))
- return 0;
- return value;
-}
-#endif
-
/*
Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7
(and DEC OSF/1 3.2 too)
@@ -51,18 +37,6 @@ void *my_pthread_getspecific_imp(pthread_key_t key)
int my_pthread_create_detached=1;
-#if defined(HAVE_NONPOSIX_SIGWAIT) || defined(HAVE_DEC_3_2_THREADS)
-
-int my_sigwait(const sigset_t *set,int *sig)
-{
- int signal=sigwait((sigset_t*) set);
- if (signal < 0)
- return errno;
- *sig=signal;
- return 0;
-}
-#endif
-
/* localtime_r for SCO 3.2V4.2 */
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
@@ -117,7 +91,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res)
** Author: Gary Wisniewski <garyw@spidereye.com.au>, much modified by Monty
****************************************************************************/
-#if !defined(HAVE_SIGWAIT) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS)
+#if !defined(HAVE_SIGWAIT) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads)
#if !defined(DONT_USE_SIGSUSPEND)
@@ -269,13 +243,7 @@ void *sigwait_thread(void *set_arg)
for (;;)
{ /* Wait for signals */
-#ifdef HAVE_NOT_BROKEN_SELECT
- fd_set fd;
- FD_ZERO(&fd);
- select(0,&fd,0,0,0);
-#else
sleep(1); /* Because of broken BSDI */
-#endif
}
}
@@ -352,39 +320,6 @@ int sigwait(sigset_t *setp, int *sigp)
#undef pthread_attr_getstacksize
/*****************************************************************************
-** Patches for AIX and DEC OSF/1 3.2
-*****************************************************************************/
-
-#if defined(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT)
-
-#include <netdb.h>
-
-int my_pthread_mutex_noposix_init(pthread_mutex_t *mp,
- const pthread_mutexattr_t *attr)
-{
- int error;
- if (!attr)
- error=pthread_mutex_init(mp,pthread_mutexattr_default);
- else
- error=pthread_mutex_init(mp,*attr);
- return error;
-}
-
-int my_pthread_cond_noposix_init(pthread_cond_t *mp,
- const pthread_condattr_t *attr)
-{
- int error;
- if (!attr)
- error=pthread_cond_init(mp,pthread_condattr_default);
- else
- error=pthread_cond_init(mp,*attr);
- return error;
-}
-
-#endif
-
-
-/*****************************************************************************
Patches for HPUX
We need these because the pthread_mutex.. code returns -1 on error,
instead of the error code.
@@ -394,7 +329,7 @@ int my_pthread_cond_noposix_init(pthread_cond_t *mp,
this has to be added here.
****************************************************************************/
-#if defined(HPUX10) || defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT)
+#if defined(HPUX10)
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime)
diff --git a/mysys/my_rename.c b/mysys/my_rename.c
index 6704d7c87d0..b89bc4c8fbd 100644
--- a/mysys/my_rename.c
+++ b/mysys/my_rename.c
@@ -27,22 +27,6 @@ int my_rename(const char *from, const char *to, myf MyFlags)
DBUG_ENTER("my_rename");
DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
-#if defined(HAVE_FILE_VERSIONS)
- { /* Check that there isn't a old file */
- int save_errno;
- MY_STAT my_stat_result;
- save_errno=my_errno;
- if (my_stat(to,&my_stat_result,MYF(0)))
- {
- my_errno=EEXIST;
- error= -1;
- if (MyFlags & MY_FAE+MY_WME)
- my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,my_errno);
- DBUG_RETURN(error);
- }
- my_errno=save_errno;
- }
-#endif
#if defined(HAVE_RENAME)
#if defined(__WIN__)
/*
diff --git a/mysys/my_sync.c b/mysys/my_sync.c
index 3853d30632e..88bcb685271 100644
--- a/mysys/my_sync.c
+++ b/mysys/my_sync.c
@@ -49,6 +49,13 @@ void thr_set_sync_wait_callback(void (*before_wait)(void),
(which is correct behaviour, if we know that the other thread synced the
file before closing)
+ MY_SYNC_FILESIZE is useful when syncing a file after it has been extended.
+ On Linux, fdatasync() on ext3/ext4 file systems does not properly flush
+ to disk the inode data required to preserve the added data across a crash
+ (this looks to be a bug). But when a file is extended, inode data will most
+ likely need flushing in any case, so passing MY_SYNC_FILESIZE as flags
+ is not likely to be any slower, and will be crash safe on Linux ext3/ext4.
+
RETURN
0 ok
-1 error
@@ -84,8 +91,12 @@ int my_sync(File fd, myf my_flags)
DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back"));
#endif
#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
- res= fdatasync(fd);
-#elif defined(HAVE_FSYNC)
+ if (!(my_flags & MY_SYNC_FILESIZE))
+ res= fdatasync(fd);
+ else
+ {
+#endif
+#if defined(HAVE_FSYNC)
res= fsync(fd);
if (res == -1 && errno == ENOLCK)
res= 0; /* Result Bug in Old FreeBSD */
@@ -95,6 +106,9 @@ int my_sync(File fd, myf my_flags)
#error Cannot find a way to sync a file, durability in danger
res= 0; /* No sync (strange OS) */
#endif
+#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
+ }
+#endif
} while (res == -1 && errno == EINTR);
if (res)
diff --git a/mysys/my_write.c b/mysys/my_write.c
index dc04b60f613..c4cba7a927d 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -47,6 +47,11 @@ size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
#else
writtenbytes= write(Filedes, Buffer, Count);
#endif
+ DBUG_EXECUTE_IF("simulate_file_write_error",
+ {
+ errno= ENOSPC;
+ writtenbytes= (size_t) -1;
+ });
if (writtenbytes == Count)
break;
if (writtenbytes != (size_t) -1)
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 45f4220c835..17cda782b30 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -43,9 +43,6 @@
#undef pthread_cond_wait
#undef pthread_cond_timedwait
#undef safe_mutex_free_deadlock_data
-#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
-#define pthread_mutex_init(a,b) my_pthread_noposix_mutex_init((a),(b))
-#endif
#endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
diff --git a/mysys/waiting_threads.c b/mysys/waiting_threads.c
index f7e74e012d2..0a9474e68b4 100644
--- a/mysys/waiting_threads.c
+++ b/mysys/waiting_threads.c
@@ -193,7 +193,9 @@ uint32 wt_success_stats;
static my_atomic_rwlock_t cycle_stats_lock, wait_stats_lock, success_stats_lock;
+#ifdef HAVE_PSI_INTERFACE
extern PSI_cond_key key_WT_RESOURCE_cond;
+#endif
#ifdef SAFE_STATISTICS
#define incr(VAR, LOCK) \
diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c
index d8211294910..4f549142e72 100644
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@ -107,7 +107,7 @@ static int conv(int n, const struct pam_message **msg,
#define DO(X) if ((status = (X)) != PAM_SUCCESS) goto end
-#ifdef SOLARIS
+#if defined(SOLARIS) || defined(__sun)
typedef void** pam_get_item_3_arg;
#else
typedef const void** pam_get_item_3_arg;
diff --git a/plugin/semisync/semisync.cc b/plugin/semisync/semisync.cc
index 83c7791c14b..022773eed0a 100644
--- a/plugin/semisync/semisync.cc
+++ b/plugin/semisync/semisync.cc
@@ -26,5 +26,5 @@ const unsigned long Trace::kTraceDetail = 0x0010;
const unsigned long Trace::kTraceNetWait = 0x0020;
const unsigned long Trace::kTraceFunction = 0x0040;
-const char ReplSemiSyncBase::kSyncHeader[2] =
+const unsigned char ReplSemiSyncBase::kSyncHeader[2] =
{ReplSemiSyncBase::kPacketMagicNum, 0};
diff --git a/plugin/semisync/semisync.h b/plugin/semisync/semisync.h
index 80d7624f73a..4208048bacb 100644
--- a/plugin/semisync/semisync.h
+++ b/plugin/semisync/semisync.h
@@ -72,7 +72,7 @@ public:
class ReplSemiSyncBase
:public Trace {
public:
- static const char kSyncHeader[2]; /* three byte packet header */
+ static const unsigned char kSyncHeader[2]; /* three byte packet header */
/* Constants in network packet header. */
static const unsigned char kPacketMagicNum;
diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc
index 4778b132431..88ffdd8ee73 100644
--- a/plugin/semisync/semisync_master.cc
+++ b/plugin/semisync/semisync_master.cc
@@ -1048,11 +1048,12 @@ int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id,
ulong log_file_len = 0;
ulong packet_len;
int result = -1;
-
struct timespec start_ts;
ulong trc_level = trace_level_;
LINT_INIT_STRUCT(start_ts);
+ LINT_INIT_STRUCT(start_ts);
+
function_enter(kWho);
assert((unsigned char)event_buf[1] == kPacketMagicNum);
diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc
index 20c9911e92a..70aa744604e 100644
--- a/plugin/semisync/semisync_master_plugin.cc
+++ b/plugin/semisync/semisync_master_plugin.cc
@@ -180,7 +180,7 @@ static MYSQL_SYSVAR_ULONG(timeout, rpl_semi_sync_master_timeout,
"The timeout value (in ms) for semi-synchronous replication in the master",
NULL, // check
fix_rpl_semi_sync_master_timeout, // update
- 10000, 0, ~0L, 1);
+ 10000, 0, ~0UL, 1);
static MYSQL_SYSVAR_BOOL(wait_no_slave, rpl_semi_sync_master_wait_no_slave,
PLUGIN_VAR_OPCMDARG,
@@ -194,7 +194,7 @@ static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_master_trace_level,
"The tracing level for semi-sync replication.",
NULL, // check
&fix_rpl_semi_sync_master_trace_level, // update
- 32, 0, ~0L, 1);
+ 32, 0, ~0UL, 1);
static SYS_VAR* semi_sync_master_system_vars[]= {
MYSQL_SYSVAR(enabled),
@@ -297,10 +297,10 @@ DEF_SHOW_FUNC(avg_trx_wait_time, SHOW_LONG)
static SHOW_VAR semi_sync_master_status_vars[]= {
{"Rpl_semi_sync_master_status",
(char*) &SHOW_FNAME(status),
- SHOW_FUNC},
+ SHOW_SIMPLE_FUNC},
{"Rpl_semi_sync_master_clients",
(char*) &SHOW_FNAME(clients),
- SHOW_FUNC},
+ SHOW_SIMPLE_FUNC},
{"Rpl_semi_sync_master_yes_tx",
(char*) &rpl_semi_sync_master_yes_transactions,
SHOW_LONG},
@@ -309,7 +309,7 @@ static SHOW_VAR semi_sync_master_status_vars[]= {
SHOW_LONG},
{"Rpl_semi_sync_master_wait_sessions",
(char*) &SHOW_FNAME(wait_sessions),
- SHOW_FUNC},
+ SHOW_SIMPLE_FUNC},
{"Rpl_semi_sync_master_no_times",
(char*) &rpl_semi_sync_master_off_times,
SHOW_LONG},
@@ -321,22 +321,22 @@ static SHOW_VAR semi_sync_master_status_vars[]= {
SHOW_LONG},
{"Rpl_semi_sync_master_tx_wait_time",
(char*) &SHOW_FNAME(trx_wait_time),
- SHOW_FUNC},
+ SHOW_SIMPLE_FUNC},
{"Rpl_semi_sync_master_tx_waits",
(char*) &SHOW_FNAME(trx_wait_num),
- SHOW_FUNC},
+ SHOW_SIMPLE_FUNC},
{"Rpl_semi_sync_master_tx_avg_wait_time",
(char*) &SHOW_FNAME(avg_trx_wait_time),
- SHOW_FUNC},
+ SHOW_SIMPLE_FUNC},
{"Rpl_semi_sync_master_net_wait_time",
(char*) &SHOW_FNAME(net_wait_time),
- SHOW_FUNC},
+ SHOW_SIMPLE_FUNC},
{"Rpl_semi_sync_master_net_waits",
(char*) &SHOW_FNAME(net_wait_num),
- SHOW_FUNC},
+ SHOW_SIMPLE_FUNC},
{"Rpl_semi_sync_master_net_avg_wait_time",
(char*) &SHOW_FNAME(avg_net_wait_time),
- SHOW_FUNC},
+ SHOW_SIMPLE_FUNC},
{NULL, NULL, SHOW_LONG},
};
diff --git a/plugin/semisync/semisync_slave_plugin.cc b/plugin/semisync/semisync_slave_plugin.cc
index d5472b9cc83..5d373fa0862 100644
--- a/plugin/semisync/semisync_slave_plugin.cc
+++ b/plugin/semisync/semisync_slave_plugin.cc
@@ -161,7 +161,7 @@ static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_slave_trace_level,
"The tracing level for semi-sync replication.",
NULL, // check
&fix_rpl_semi_sync_trace_level, // update
- 32, 0, ~0L, 1);
+ 32, 0, ~0UL, 1);
static SYS_VAR* semi_sync_slave_system_vars[]= {
MYSQL_SYSVAR(enabled),
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index a0a2e446609..91a47bf3d48 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -283,6 +283,7 @@ SET(mysql_config_COMPONENT COMPONENT Development)
SET(msql2mysql_COMPONENT COMPONENT Client)
SET(mysqlaccess_COMPONENT COMPONENT Client)
SET(mysql_find_rows_COMPONENT COMPONENT Client)
+SET(mytop_COMPONENT Client)
IF(WIN32)
# On Windows, some .sh and some .pl.in files are configured
@@ -311,7 +312,6 @@ IF(WIN32)
ENDFOREACH()
ELSE()
# On Unix, most of the files end up in the bin directory
- SET(mysql_config_COMPONENT COMPONENT Development)
SET(BIN_SCRIPTS
msql2mysql
mysql_config
@@ -322,6 +322,7 @@ ELSE()
mysqlaccess
mysql_convert_table_format
mysql_find_rows
+ mytop
mysqlhotcopy
mysqldumpslow
mysqld_multi
diff --git a/scripts/fill_help_tables.sql b/scripts/fill_help_tables.sql
index 7751c37cbc3..939f15ed45a 100644
--- a/scripts/fill_help_tables.sql
+++ b/scripts/fill_help_tables.sql
@@ -1,18 +1,19 @@
--- Copyright (c) 2003, &year, Oracle and/or its affiliates. All rights reserved.
--- Copyright (C) 2011 Monty Program Ab
---
+-- Copyright (c) 2003, 2008-2012, Oracle and/or its affiliates. All rights reserved.
+--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; version 2 of the License.
---
+--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
---
+--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
--- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+-- DO NOT EDIT THIS FILE. It is generated automatically.
-- To use this file, load its contents into the mysql database. For example,
-- with the mysql client program, process the file like this, where
@@ -28,547 +29,553 @@ delete from help_keyword;
delete from help_relation;
insert into help_category (help_category_id,name,parent_category_id,url) values (1,'Geographic',0,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (2,'Polygon properties',32,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (3,'WKT',32,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (4,'Numeric Functions',36,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (5,'Plugins',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (6,'MBR',32,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (7,'Control flow functions',36,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (8,'Transactions',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (9,'Account Management',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (10,'Point properties',32,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (11,'Encryption Functions',36,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (12,'LineString properties',32,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (13,'Logical operators',36,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (14,'Miscellaneous Functions',36,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (15,'Information Functions',36,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (16,'Functions and Modifiers for Use with GROUP BY',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (17,'Comparison operators',36,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (18,'Bit Functions',36,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (19,'Table Maintenance',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (20,'Data Types',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (21,'User-Defined Functions',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (22,'Compound Statements',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (23,'Geometry constructors',32,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (24,'GeometryCollection properties',1,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (25,'Administration',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (26,'Data Manipulation',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (27,'Utility',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (28,'Language Structure',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (29,'Geometry relations',32,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (30,'Date and Time Functions',36,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (31,'WKB',32,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (32,'Geographic Features',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (33,'Contents',0,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (34,'Geometry properties',32,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (35,'String Functions',36,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (36,'Functions',33,'');
-insert into help_category (help_category_id,name,parent_category_id,url) values (37,'Data Definition',33,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (2,'Polygon properties',34,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (3,'WKT',34,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (4,'Numeric Functions',38,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (5,'Plugins',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (6,'MBR',34,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (7,'Control flow functions',38,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (8,'Transactions',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (9,'Help Metadata',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (10,'Account Management',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (11,'Point properties',34,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (12,'Encryption Functions',38,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (13,'LineString properties',34,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (14,'Miscellaneous Functions',38,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (15,'Logical operators',38,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (16,'Functions and Modifiers for Use with GROUP BY',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (17,'Information Functions',38,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (18,'Comparison operators',38,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (19,'Bit Functions',38,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (20,'Table Maintenance',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (21,'User-Defined Functions',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (22,'Data Types',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (23,'Compound Statements',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (24,'Geometry constructors',34,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (25,'GeometryCollection properties',1,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (26,'Administration',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (27,'Data Manipulation',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (28,'Utility',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (29,'Language Structure',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (30,'Geometry relations',34,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (31,'Date and Time Functions',38,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (32,'WKB',34,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (33,'Procedures',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (34,'Geographic Features',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (35,'Contents',0,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (36,'Geometry properties',34,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (37,'String Functions',38,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (38,'Functions',35,'');
+insert into help_category (help_category_id,name,parent_category_id,url) values (39,'Data Definition',35,'');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (0,16,'MIN','Syntax:\nMIN([DISTINCT] expr)\n\nReturns the minimum value of expr. MIN() may take a string argument; in\nsuch cases, it returns the minimum string value. See\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-indexes.html. The DISTINCT\nkeyword can be used to find the minimum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMIN() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,26,'JOIN','MySQL supports the following JOIN syntaxes for the table_references\npart of SELECT statements and multiple-table DELETE and UPDATE\nstatements:\n\ntable_references:\n table_reference [, table_reference] ...\n\ntable_reference:\n table_factor\n | join_table\n\ntable_factor:\n tbl_name [[AS] alias] [index_hint_list]\n | table_subquery [AS] alias\n | ( table_references )\n | { OJ table_reference LEFT OUTER JOIN table_reference\n ON conditional_expr }\n\njoin_table:\n table_reference [INNER | CROSS] JOIN table_factor [join_condition]\n | table_reference STRAIGHT_JOIN table_factor\n | table_reference STRAIGHT_JOIN table_factor ON conditional_expr\n | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition\n | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor\n\njoin_condition:\n ON conditional_expr\n | USING (column_list)\n\nindex_hint_list:\n index_hint [, index_hint] ...\n\nindex_hint:\n USE {INDEX|KEY}\n [{FOR {JOIN|ORDER BY|GROUP BY}] ([index_list])\n | IGNORE {INDEX|KEY}\n [{FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n | FORCE {INDEX|KEY}\n [{FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n\nindex_list:\n index_name [, index_name] ...\n\nA table reference is also known as a join expression.\n\nThe syntax of table_factor is extended in comparison with the SQL\nStandard. The latter accepts only table_reference, not a list of them\ninside a pair of parentheses.\n\nThis is a conservative extension if we consider each comma in a list of\ntable_reference items as equivalent to an inner join. For example:\n\nSELECT * FROM t1 LEFT JOIN (t2, t3, t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nis equivalent to:\n\nSELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nIn MySQL, CROSS JOIN is a syntactic equivalent to INNER JOIN (they can\nreplace each other). In standard SQL, they are not equivalent. INNER\nJOIN is used with an ON clause, CROSS JOIN is used otherwise.\n\nIn general, parentheses can be ignored in join expressions containing\nonly inner join operations. MySQL also supports nested joins (see\nhttp://dev.mysql.com/doc/refman/5.1/en/nested-join-optimization.html).\n\nIndex hints can be specified to affect how the MySQL optimizer makes\nuse of indexes. For more information, see\nhttp://dev.mysql.com/doc/refman/5.1/en/index-hints.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/join.html\n\n','SELECT left_tbl.*\n FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id\n WHERE right_tbl.id IS NULL;\n','http://dev.mysql.com/doc/refman/5.1/en/join.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,35,'HEX','Syntax:\nHEX(N_or_S)\n\nIf N_or_S is a number, returns a string representation of the\nhexadecimal value of N, where N is a longlong (BIGINT) number. This is\nequivalent to CONV(N,10,16).\n\nIf N_or_S is a string, returns a hexadecimal string representation of\nN_or_S where each character in N_or_S is converted to two hexadecimal\ndigits. The inverse of this operation is performed by the UNHEX()\nfunction.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT HEX(255);\n -> \'FF\'\nmysql> SELECT 0x616263;\n -> \'abc\'\nmysql> SELECT HEX(\'abc\');\n -> 616263\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (3,26,'REPLACE','Syntax:\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [(col_name,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name\n SET col_name={expr | DEFAULT}, ...\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n\nREPLACE works exactly like INSERT, except that if an old row in the\ntable has the same value as a new row for a PRIMARY KEY or a UNIQUE\nindex, the old row is deleted before the new row is inserted. See [HELP\nINSERT].\n\nREPLACE is a MySQL extension to the SQL standard. It either inserts, or\ndeletes and inserts. For another MySQL extension to standard SQL ---\nthat either inserts or updates --- see\nhttp://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html.\n\nNote that unless the table has a PRIMARY KEY or UNIQUE index, using a\nREPLACE statement makes no sense. It becomes equivalent to INSERT,\nbecause there is no index to be used to determine whether a new row\nduplicates another.\n\nValues for all columns are taken from the values specified in the\nREPLACE statement. Any missing columns are set to their default values,\njust as happens for INSERT. You cannot refer to values from the current\nrow and use them in the new row. If you use an assignment such as SET\ncol_name = col_name + 1, the reference to the column name on the right\nhand side is treated as DEFAULT(col_name), so the assignment is\nequivalent to SET col_name = DEFAULT(col_name) + 1.\n\nTo use REPLACE, you must have both the INSERT and DELETE privileges for\nthe table.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/replace.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/replace.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (4,29,'CONTAINS','Contains(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 completely contains g2. This\ntests the opposite relationship as Within().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (5,34,'SRID','SRID(g)\n\nReturns an integer indicating the Spatial Reference System ID for the\ngeometry value g.\n\nIn MySQL, the SRID value is just an integer associated with the\ngeometry value. All calculations are done assuming Euclidean (planar)\ngeometry.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT SRID(GeomFromText(\'LineString(1 1,2 2)\',101));\n+-----------------------------------------------+\n| SRID(GeomFromText(\'LineString(1 1,2 2)\',101)) |\n+-----------------------------------------------+\n| 101 |\n+-----------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (6,30,'CURRENT_TIMESTAMP','Syntax:\nCURRENT_TIMESTAMP, CURRENT_TIMESTAMP()\n\nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (7,25,'SHOW CONTRIBUTORS','Syntax:\nSHOW CONTRIBUTORS\n\nThe SHOW CONTRIBUTORS statement displays information about the people\nwho contribute to MySQL source or to causes that we support. For each\ncontributor, it displays Name, Location, and Comment values.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-contributors.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-contributors.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (8,16,'VARIANCE','Syntax:\nVARIANCE(expr)\n\nReturns the population standard variance of expr. This is an extension\nto standard SQL. The standard SQL function VAR_POP() can be used\ninstead.\n\nVARIANCE() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (9,37,'DROP SERVER','Syntax:\nDROP SERVER [ IF EXISTS ] server_name\n\nDrops the server definition for the server named server_name. The\ncorresponding row within the mysql.servers table will be deleted. This\nstatement requires the SUPER privilege.\n\nDropping a server for a table does not affect any FEDERATED tables that\nused this connection information when they were created. See [HELP\nCREATE SERVER].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-server.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-server.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (10,25,'SHOW AUTHORS','Syntax:\nSHOW AUTHORS\n\nThe SHOW AUTHORS statement displays information about the people who\nwork on MySQL. For each author, it displays Name, Location, and Comment\nvalues.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-authors.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-authors.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (11,16,'VAR_SAMP','Syntax:\nVAR_SAMP(expr)\n\nReturns the sample variance of expr. That is, the denominator is the\nnumber of rows minus one.\n\nVAR_SAMP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (12,35,'CONCAT','Syntax:\nCONCAT(str1,str2,...)\n\nReturns the string that results from concatenating the arguments. May\nhave one or more arguments. If all arguments are nonbinary strings, the\nresult is a nonbinary string. If the arguments include any binary\nstrings, the result is a binary string. A numeric argument is converted\nto its equivalent binary string form; if you want to avoid that, you\ncan use an explicit type cast, as in this example:\n\nSELECT CONCAT(CAST(int_col AS CHAR), char_col);\n\nCONCAT() returns NULL if any argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT CONCAT(\'My\', \'S\', \'QL\');\n -> \'MySQL\'\nmysql> SELECT CONCAT(\'My\', NULL, \'QL\');\n -> NULL\nmysql> SELECT CONCAT(14.3);\n -> \'14.3\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (13,32,'GEOMETRY HIERARCHY','Geometry is the base class. It is an abstract class. The instantiable\nsubclasses of Geometry are restricted to zero-, one-, and\ntwo-dimensional geometric objects that exist in two-dimensional\ncoordinate space. All instantiable geometry classes are defined so that\nvalid instances of a geometry class are topologically closed (that is,\nall defined geometries include their boundary).\n\nThe base Geometry class has subclasses for Point, Curve, Surface, and\nGeometryCollection:\n\no Point represents zero-dimensional objects.\n\no Curve represents one-dimensional objects, and has subclass\n LineString, with sub-subclasses Line and LinearRing.\n\no Surface is designed for two-dimensional objects and has subclass\n Polygon.\n\no GeometryCollection has specialized zero-, one-, and two-dimensional\n collection classes named MultiPoint, MultiLineString, and\n MultiPolygon for modeling geometries corresponding to collections of\n Points, LineStrings, and Polygons, respectively. MultiCurve and\n MultiSurface are introduced as abstract superclasses that generalize\n the collection interfaces to handle Curves and Surfaces.\n\nGeometry, Curve, Surface, MultiCurve, and MultiSurface are defined as\nnoninstantiable classes. They define a common set of methods for their\nsubclasses and are included for extensibility.\n\nPoint, LineString, Polygon, GeometryCollection, MultiPoint,\nMultiLineString, and MultiPolygon are instantiable classes.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/gis-geometry-class-hierarchy.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/gis-geometry-class-hierarchy.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (14,35,'CHAR FUNCTION','Syntax:\nCHAR(N,... [USING charset_name])\n\nCHAR() interprets each argument N as an integer and returns a string\nconsisting of the characters given by the code values of those\nintegers. NULL values are skipped.\nBy default, CHAR() returns a binary string. To produce a string in a\ngiven character set, use the optional USING clause:\n\nmysql> SELECT CHARSET(CHAR(0x65)), CHARSET(CHAR(0x65 USING utf8));\n+---------------------+--------------------------------+\n| CHARSET(CHAR(0x65)) | CHARSET(CHAR(0x65 USING utf8)) |\n+---------------------+--------------------------------+\n| binary | utf8 |\n+---------------------+--------------------------------+\n\nIf USING is given and the result string is illegal for the given\ncharacter set, a warning is issued. Also, if strict SQL mode is\nenabled, the result from CHAR() becomes NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT CHAR(77,121,83,81,\'76\');\n -> \'MySQL\'\nmysql> SELECT CHAR(77,77.3,\'77.3\');\n -> \'MMM\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (15,20,'DATETIME','DATETIME\n\nA date and time combination. The supported range is \'1000-01-01\n00:00:00\' to \'9999-12-31 23:59:59\'. MySQL displays DATETIME values in\n\'YYYY-MM-DD HH:MM:SS\' format, but allows assignment of values to\nDATETIME columns using either strings or numbers.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (16,22,'OPEN','Syntax:\nOPEN cursor_name\n\nThis statement opens a previously declared cursor.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/open.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/open.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (17,25,'SHOW CREATE TRIGGER','Syntax:\nSHOW CREATE TRIGGER trigger_name\n\nThis statement shows a CREATE TRIGGER statement that creates the given\ntrigger.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-create-trigger.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (18,25,'SHOW CREATE PROCEDURE','Syntax:\nSHOW CREATE PROCEDURE proc_name\n\nThis statement is a MySQL extension. It returns the exact string that\ncan be used to re-create the named stored procedure. A similar\nstatement, SHOW CREATE FUNCTION, displays information about stored\nfunctions (see [HELP SHOW CREATE FUNCTION]).\n\nBoth statements require that you be the owner of the routine or have\nSELECT access to the mysql.proc table. If you do not have privileges\nfor the routine itself, the value displayed for the Create Procedure or\nCreate Function field will be NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-procedure.html\n\n','mysql> SHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row ***************************\n Procedure: simpleproc\n sql_mode:\n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nmysql> SHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row ***************************\n Function: hello\n sql_mode:\n Create Function: CREATE FUNCTION `hello`(s CHAR(20))\n RETURNS CHAR(50)\n RETURN CONCAT(\'Hello, \',s,\'!\')\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.1/en/show-create-procedure.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (19,20,'INTEGER','INTEGER[(M)] [UNSIGNED] [ZEROFILL]\n\nThis type is a synonym for INT.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (20,35,'LOWER','Syntax:\nLOWER(str)\n\nReturns the string str with all characters changed to lowercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nmysql> SELECT LOWER(\'QUADRATICALLY\');\n -> \'quadratically\'\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings\n(BINARY, VARBINARY, BLOB). To perform lettercase conversion, convert\nthe string to a nonbinary string:\n\nmysql> SET @str = BINARY \'New York\';\nmysql> SELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+-------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+-------------+-----------------------------------+\n| New York | new york |\n+-------------+-----------------------------------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,25,'SHOW COLUMNS','Syntax:\nSHOW [FULL] COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW COLUMNS displays information about the columns in a given table.\nIt also works for views. The LIKE clause, if present, indicates which\ncolumn names to match. The WHERE clause can be given to select rows\nusing more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nmysql> SHOW COLUMNS FROM City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nIf the data types differ from what you expect them to be based on a\nCREATE TABLE statement, note that MySQL sometimes changes data types\nwhen you create or alter a table. The conditions under which this\noccurs are described in\nhttp://dev.mysql.com/doc/refman/5.1/en/silent-column-changes.html.\n\nThe FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. In other words, these two statements are equivalent:\n\nmysql> SHOW COLUMNS FROM mytable FROM mydb;\nmysql> SHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for nonbinary string columns, or NULL\nfor other columns. This value is displayed only if you use the FULL\nkeyword.\n\nThe Null field contains YES if NULL values can be stored in the column,\nNO if not.\n\nThe Key field indicates whether the column is indexed:\n\no If Key is empty, the column either is not indexed or is indexed only\n as a secondary column in a multiple-column, nonunique index.\n\no If Key is PRI, the column is a PRIMARY KEY or is one of the columns\n in a multiple-column PRIMARY KEY.\n\no If Key is UNI, the column is the first column of a UNIQUE index. (A\n UNIQUE index allows multiple NULL values, but you can tell whether\n the column allows NULL by checking the Null field.)\n\no If Key is MUL, the column is the first column of a nonunique index in\n which multiple occurrences of a given value are allowed within the\n column.\n\nIf more than one of the Key values applies to a given column of a\ntable, Key displays the one with the highest priority, in the order\nPRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values\nand there is no PRIMARY KEY in the table. A UNIQUE index may display as\nMUL if several columns form a composite UNIQUE index; although the\ncombination of the columns is unique, each column can still hold\nmultiple occurrences of a given value.\n\nThe Default field indicates the default value that is assigned to the\ncolumn.\n\nThe Extra field contains any additional information that is available\nabout a given column. The value is nonempty in these cases:\nauto_increment for columns that have the AUTO_INCREMENT attribute; as\nof MySQL 5.1.23, on update CURRENT_TIMESTAMP for TIMESTAMP columns that\nhave the ON UPDATE CURRENT_TIMESTAMP attribute.\n\nPrivileges indicates the privileges you have for the column. This value\nis displayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed\nonly if you use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. You can also list a table\'s\ncolumns with the mysqlshow db_name tbl_name command.\n\nThe DESCRIBE statement provides information similar to SHOW COLUMNS.\nSee [HELP DESCRIBE].\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements\nalso provide information about tables. See [HELP SHOW].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-columns.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-columns.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (22,37,'CREATE TRIGGER','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n TRIGGER trigger_name trigger_time trigger_event\n ON tbl_name FOR EACH ROW trigger_stmt\n\nThis statement creates a new trigger. A trigger is a named database\nobject that is associated with a table, and that activates when a\nparticular event occurs for the table. The trigger becomes associated\nwith the table named tbl_name, which must refer to a permanent table.\nYou cannot associate a trigger with a TEMPORARY table or a view.\n\nCREATE TRIGGER requires the TRIGGER privilege for the table associated\nwith the trigger. If binary logging is enabled, the CREATE TRIGGER\nstatement might also require the SUPER privilege, as described in\nhttp://dev.mysql.com/doc/refman/5.1/en/stored-programs-logging.html.\nSUPER may also be required depending on the DEFINER value, as described\nlater. (Before MySQL 5.1.6, there is no TRIGGER privilege and this\nstatement requires the SUPER privilege in all cases.)\n\nThe DEFINER clause determines the security context to be used when\nchecking access privileges at trigger activation time.\n\ntrigger_time is the trigger action time. It can be BEFORE or AFTER to\nindicate that the trigger activates before or after each row to be\nmodified.\n\ntrigger_event indicates the kind of statement that activates the\ntrigger. The trigger_event can be one of the following:\n\no INSERT: The trigger is activated whenever a new row is inserted into\n the table; for example, through INSERT, LOAD DATA, and REPLACE\n statements.\n\no UPDATE: The trigger is activated whenever a row is modified; for\n example, through UPDATE statements.\n\no DELETE: The trigger is activated whenever a row is deleted from the\n table; for example, through DELETE and REPLACE statements. However,\n DROP TABLE and TRUNCATE TABLE statements on the table do not activate\n this trigger, because they do not use DELETE. Dropping a partition\n does not activate DELETE triggers, either. See [HELP TRUNCATE TABLE].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-trigger.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (23,30,'MONTH','Syntax:\nMONTH(date)\n\nReturns the month for date, in the range 1 to 12 for January to\nDecember, or 0 for dates such as \'0000-00-00\' or \'2008-00-00\' that have\na zero month part.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MONTH(\'2008-02-03\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (24,20,'TINYINT','TINYINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA very small integer. The signed range is -128 to 127. The unsigned\nrange is 0 to 255.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (25,25,'SHOW TRIGGERS','Syntax:\nSHOW TRIGGERS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TRIGGERS lists the triggers currently defined for tables in a\ndatabase (the default database unless a FROM clause is given). This\nstatement requires the TRIGGER privilege (prior to MySQL 5.1.22, it\nrequires the SUPER privilege). The LIKE clause, if present, indicates\nwhich table names to match and causes the statement to display triggers\nfor those tables. The WHERE clause can be given to select rows using\nmore general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nFor the trigger ins_sum as defined in\nhttp://dev.mysql.com/doc/refman/5.1/en/triggers.html, the output of\nthis statement is as shown here:\n\nmysql> SHOW TRIGGERS LIKE \'acc%\'\\G\n*************************** 1. row ***************************\n Trigger: ins_sum\n Event: INSERT\n Table: account\n Statement: SET @sum = @sum + NEW.amount\n Timing: BEFORE\n Created: NULL\n sql_mode:\n Definer: myname@localhost\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\ncharacter_set_client is the session value of the character_set_client\nsystem variable when the trigger was created. collation_connection is\nthe session value of the collation_connection system variable when the\ntrigger was created. Database Collation is the collation of the\ndatabase with which the trigger is associated. These columns were added\nin MySQL 5.1.21.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-triggers.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-triggers.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (26,14,'MASTER_POS_WAIT','Syntax:\nMASTER_POS_WAIT(log_name,log_pos[,timeout])\n\nThis function is useful for control of master/slave synchronization. It\nblocks until the slave has read and applied all updates up to the\nspecified position in the master log. The return value is the number of\nlog events the slave had to wait for to advance to the specified\nposition. The function returns NULL if the slave SQL thread is not\nstarted, the slave\'s master information is not initialized, the\narguments are incorrect, or an error occurs. It returns -1 if the\ntimeout has been exceeded. If the slave SQL thread stops while\nMASTER_POS_WAIT() is waiting, the function returns NULL. If the slave\nis past the specified position, the function returns immediately.\n\nIf a timeout value is specified, MASTER_POS_WAIT() stops waiting when\ntimeout seconds have elapsed. timeout must be greater than 0; a zero or\nnegative timeout means no timeout.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (27,35,'REGEXP','Syntax:\nexpr REGEXP pat, expr RLIKE pat\n\nPerforms a pattern match of a string expression expr against a pattern\npat. The pattern can be an extended regular expression. The syntax for\nregular expressions is discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/regexp.html. Returns 1 if expr\nmatches pat; otherwise it returns 0. If either expr or pat is NULL, the\nresult is NULL. RLIKE is a synonym for REGEXP, provided for mSQL\ncompatibility.\n\nThe pattern need not be a literal string. For example, it can be\nspecified as a string expression or table column.\n\n*Note*: Because MySQL uses the C escape syntax in strings (for example,\n"\\n" to represent the newline character), you must double any "\\" that\nyou use in your REGEXP strings.\n\nREGEXP is not case sensitive, except when used with binary strings.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/regexp.html\n\n','mysql> SELECT \'Monty!\' REGEXP \'.*\';\n -> 1\nmysql> SELECT \'new*\\n*line\' REGEXP \'new\\\\*.\\\\*line\';\n -> 1\nmysql> SELECT \'a\' REGEXP \'A\', \'a\' REGEXP BINARY \'A\';\n -> 1 0\nmysql> SELECT \'a\' REGEXP \'^[a-d]\';\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/regexp.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (28,22,'IF STATEMENT','Syntax:\nIF search_condition THEN statement_list\n [ELSEIF search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND IF\n\nIF implements a basic conditional construct. If the search_condition\nevaluates to true, the corresponding SQL statement list is executed. If\nno search_condition matches, the statement list in the ELSE clause is\nexecuted. Each statement_list consists of one or more statements.\n\n*Note*: There is also an IF() function, which differs from the IF\nstatement described here. See\nhttp://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/if-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/if-statement.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (29,18,'^','Syntax:\n^\n\nBitwise XOR:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html\n\n','mysql> SELECT 1 ^ 1;\n -> 0\nmysql> SELECT 1 ^ 0;\n -> 1\nmysql> SELECT 11 ^ 3;\n -> 8\n','http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (30,37,'DROP VIEW','Syntax:\nDROP VIEW [IF EXISTS]\n view_name [, view_name] ...\n [RESTRICT | CASCADE]\n\nDROP VIEW removes one or more views. You must have the DROP privilege\nfor each view. If any of the views named in the argument list do not\nexist, MySQL returns an error indicating by name which nonexisting\nviews it was unable to drop, but it also drops all of the views in the\nlist that do exist.\n\nThe IF EXISTS clause prevents an error from occurring for views that\ndon\'t exist. When this clause is given, a NOTE is generated for each\nnonexistent view. See [HELP SHOW WARNINGS].\n\nRESTRICT and CASCADE, if given, are parsed and ignored.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-view.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-view.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (31,29,'WITHIN','Within(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially within g2. This\ntests the opposite relationship as Contains().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (32,30,'WEEK','Syntax:\nWEEK(date[,mode])\n\nThis function returns the week number for date. The two-argument form\nof WEEK() allows you to specify whether the week starts on Sunday or\nMonday and whether the return value should be in the range from 0 to 53\nor from 1 to 53. If the mode argument is omitted, the value of the\ndefault_week_format system variable is used. See\nhttp://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT WEEK(\'2008-02-20\');\n -> 7\nmysql> SELECT WEEK(\'2008-02-20\',0);\n -> 7\nmysql> SELECT WEEK(\'2008-02-20\',1);\n -> 8\nmysql> SELECT WEEK(\'2008-12-31\',1);\n -> 53\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (33,25,'SHOW PLUGINS','Syntax:\nSHOW PLUGINS\n\nSHOW PLUGINS displays information about server plugins.\n\nmysql> SHOW PLUGINS\\G\n*************************** 1. row ***************************\n Name: binlog\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 2. row ***************************\n Name: CSV\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 3. row ***************************\n Name: MEMORY\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 4. row ***************************\n Name: MyISAM\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n...\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-plugins.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-plugins.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (34,21,'DROP FUNCTION UDF','Syntax:\nDROP FUNCTION function_name\n\nThis statement drops the user-defined function (UDF) named\nfunction_name.\n\nTo drop a function, you must have the DELETE privilege for the mysql\ndatabase. This is because DROP FUNCTION removes a row from the\nmysql.func system table that records the function\'s name, type, and\nshared library name.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-function-udf.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-function-udf.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (35,25,'PREPARE','Syntax:\nPREPARE stmt_name FROM preparable_stmt\n\nThe PREPARE statement prepares a statement and assigns it a name,\nstmt_name, by which to refer to the statement later. Statement names\nare not case sensitive. preparable_stmt is either a string literal or a\nuser variable that contains the text of the statement. The text must\nrepresent a single SQL statement, not multiple statements. Within the\nstatement, "?" characters can be used as parameter markers to indicate\nwhere data values are to be bound to the query later when you execute\nit. The "?" characters should not be enclosed within quotes, even if\nyou intend to bind them to string values. Parameter markers can be used\nonly where data values should appear, not for SQL keywords,\nidentifiers, and so forth.\n\nIf a prepared statement with the given name already exists, it is\ndeallocated implicitly before the new statement is prepared. This means\nthat if the new statement contains an error and cannot be prepared, an\nerror is returned and no statement with the given name exists.\n\nA prepared statement is executed with EXECUTE and released with\nDEALLOCATE PREPARE.\n\nThe scope of a prepared statement is the session within which it is\ncreated. Other sessions cannot see it.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/prepare.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/prepare.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (36,8,'LOCK','Syntax:\nLOCK TABLES\n tbl_name [[AS] alias] lock_type\n [, tbl_name [[AS] alias] lock_type] ...\n\nlock_type:\n READ [LOCAL]\n | [LOW_PRIORITY] WRITE\n\nUNLOCK TABLES\n\nMySQL enables client sessions to acquire table locks explicitly for the\npurpose of cooperating with other sessions for access to tables, or to\nprevent other sessions from modifying tables during periods when a\nsession requires exclusive access to them. A session can acquire or\nrelease locks only for itself. One session cannot acquire locks for\nanother session or release locks held by another session.\n\nLocks may be used to emulate transactions or to get more speed when\nupdating tables. This is explained in more detail later in this\nsection.\n\nLOCK TABLES explicitly acquires table locks for the current client\nsession. Table locks can be acquired for base tables or views. You must\nhave the LOCK TABLES privilege, and the SELECT privilege for each\nobject to be locked.\n\nFor view locking, LOCK TABLES adds all base tables used in the view to\nthe set of tables to be locked and locks them automatically. If you\nlock a table explicitly with LOCK TABLES, any tables used in triggers\nare also locked implicitly, as described in\nhttp://dev.mysql.com/doc/refman/5.1/en/lock-tables-and-triggers.html.\n\nUNLOCK TABLES explicitly releases any table locks held by the current\nsession.\n\nAnother use for UNLOCK TABLES is to release the global read lock\nacquired with the FLUSH TABLES WITH READ LOCK statement, which enables\nyou to lock all tables in all databases. See [HELP FLUSH]. (This is a\nvery convenient way to get backups if you have a file system such as\nVeritas that can take snapshots in time.)\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/lock-tables.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/lock-tables.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (37,35,'UPDATEXML','Syntax:\nUpdateXML(xml_target, xpath_expr, new_xml)\n\nThis function replaces a single portion of a given fragment of XML\nmarkup xml_target with a new XML fragment new_xml, and then returns the\nchanged XML. The portion of xml_target that is replaced matches an\nXPath expression xpath_expr supplied by the user. If no expression\nmatching xpath_expr is found, or if multiple matches are found, the\nfunction returns the original xml_target XML fragment. All three\narguments should be strings.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html\n\n','mysql> SELECT\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a\', \'<e>fff</e>\') AS val1,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/b\', \'<e>fff</e>\') AS val2,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'//b\', \'<e>fff</e>\') AS val3,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val4,\n -> UpdateXML(\'<a><d></d><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val5\n -> \\G\n\n*************************** 1. row ***************************\nval1: <e>fff</e>\nval2: <a><b>ccc</b><d></d></a>\nval3: <a><e>fff</e><d></d></a>\nval4: <a><b>ccc</b><e>fff</e></a>\nval5: <a><d></d><b>ccc</b><d></d></a>\n','http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (38,25,'RESET SLAVE','Syntax:\nRESET SLAVE\n\nRESET SLAVE makes the slave forget its replication position in the\nmaster\'s binary log. This statement is meant to be used for a clean\nstart: It deletes the master.info and relay-log.info files, all the\nrelay log files, and starts a new relay log file. To use RESET SLAVE,\nthe slave replication threads must be stopped (use STOP SLAVE if\nnecessary).\n\n*Note*: All relay log files are deleted, even if they have not been\ncompletely executed by the slave SQL thread. (This is a condition\nlikely to exist on a replication slave if you have issued a STOP SLAVE\nstatement or if the slave is highly loaded.)\n\nConnection information stored in the master.info file is immediately\nreset using any values specified in the corresponding startup options.\nThis information includes values such as master host, master port,\nmaster user, and master password. If the slave SQL thread was in the\nmiddle of replicating temporary tables when it was stopped, and RESET\nSLAVE is issued, these replicated temporary tables are deleted on the\nslave.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/reset-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/reset-slave.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (39,25,'SHOW BINARY LOGS','Syntax:\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nLists the binary log files on the server. This statement is used as\npart of the procedure described in [HELP PURGE BINARY LOGS], that shows\nhow to determine which logs can be purged.\n\nmysql> SHOW BINARY LOGS;\n+---------------+-----------+\n| Log_name | File_size |\n+---------------+-----------+\n| binlog.000015 | 724935 |\n| binlog.000016 | 733481 |\n+---------------+-----------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-binary-logs.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-binary-logs.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (40,23,'POLYGON','Polygon(ls1,ls2,...)\n\nConstructs a Polygon value from a number of LineString or WKB\nLineString arguments. If any argument does not represent a LinearRing\n(that is, not a closed and simple LineString), the return value is\nNULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (41,30,'MINUTE','Syntax:\nMINUTE(time)\n\nReturns the minute for time, in the range 0 to 59.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MINUTE(\'2008-02-03 10:05:03\');\n -> 5\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (42,30,'DAY','Syntax:\nDAY(date)\n\nDAY() is a synonym for DAYOFMONTH().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (43,35,'MID','Syntax:\nMID(str,pos,len)\n\nMID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (44,14,'UUID','Syntax:\nUUID()\n\nReturns a Universal Unique Identifier (UUID) generated according to\n"DCE 1.1: Remote Procedure Call" (Appendix A) CAE (Common Applications\nEnvironment) Specifications published by The Open Group in October 1997\n(Document Number C706,\nhttp://www.opengroup.org/public/pubs/catalog/c706.htm).\n\nA UUID is designed as a number that is globally unique in space and\ntime. Two calls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate computers\nthat are not connected to each other.\n\nA UUID is a 128-bit number represented by a utf8 string of five\nhexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:\n\no The first three numbers are generated from a timestamp.\n\no The fourth number preserves temporal uniqueness in case the timestamp\n value loses monotonicity (for example, due to daylight saving time).\n\no The fifth number is an IEEE 802 node number that provides spatial\n uniqueness. A random number is substituted if the latter is not\n available (for example, because the host computer has no Ethernet\n card, or we do not know how to find the hardware address of an\n interface on your operating system). In this case, spatial uniqueness\n cannot be guaranteed. Nevertheless, a collision should have very low\n probability.\n\n Currently, the MAC address of an interface is taken into account only\n on FreeBSD and Linux. On other operating systems, MySQL uses a\n randomly generated 48-bit number.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','mysql> SELECT UUID();\n -> \'6ccd780c-baba-1026-9564-0040f4311e29\'\n','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (45,23,'LINESTRING','LineString(pt1,pt2,...)\n\nConstructs a LineString value from a number of Point or WKB Point\narguments. If the number of arguments is less than two, the return\nvalue is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (46,14,'SLEEP','Syntax:\nSLEEP(duration)\n\nSleeps (pauses) for the number of seconds given by the duration\nargument, then returns 0. If SLEEP() is interrupted, it returns 1. The\nduration may have a fractional part given in microseconds.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (47,15,'CONNECTION_ID','Syntax:\nCONNECTION_ID()\n\nReturns the connection ID (thread ID) for the connection. Every\nconnection has an ID that is unique among the set of currently\nconnected clients.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT CONNECTION_ID();\n -> 23786\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (48,26,'DELETE','Syntax:\nSingle-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n\nMultiple-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE]\n tbl_name[.*] [, tbl_name[.*]] ...\n FROM table_references\n [WHERE where_condition]\n\nOr:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE]\n FROM tbl_name[.*] [, tbl_name[.*]] ...\n USING table_references\n [WHERE where_condition]\n\nFor the single-table syntax, the DELETE statement deletes rows from\ntbl_name and returns a count of the number of deleted rows. This count\ncan be obtained by calling the ROW_COUNT() function (see\nhttp://dev.mysql.com/doc/refman/5.1/en/information-functions.html). The\nWHERE clause, if given, specifies the conditions that identify which\nrows to delete. With no WHERE clause, all rows are deleted. If the\nORDER BY clause is specified, the rows are deleted in the order that is\nspecified. The LIMIT clause places a limit on the number of rows that\ncan be deleted.\n\nFor the multiple-table syntax, DELETE deletes from each tbl_name the\nrows that satisfy the conditions. In this case, ORDER BY and LIMIT\ncannot be used.\n\nwhere_condition is an expression that evaluates to true for each row to\nbe deleted. It is specified as described in\nhttp://dev.mysql.com/doc/refman/5.1/en/select.html.\n\nCurrently, you cannot delete from a table and select from the same\ntable in a subquery.\n\nYou need the DELETE privilege on a table to delete rows from it. You\nneed only the SELECT privilege for any columns that are only read, such\nas those named in the WHERE clause.\n\nAs stated, a DELETE statement with no WHERE clause deletes all rows. A\nfaster way to do this, when you do not need to know the number of\ndeleted rows, is to use TRUNCATE TABLE. However, within a transaction\nor if you have a lock on the table, TRUNCATE TABLE cannot be used\nwhereas DELETE can. See [HELP TRUNCATE TABLE], and [HELP LOCK].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/delete.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/delete.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (49,4,'ROUND','Syntax:\nROUND(X), ROUND(X,D)\n\nRounds the argument X to D decimal places. The rounding algorithm\ndepends on the data type of X. D defaults to 0 if not specified. D can\nbe negative to cause D digits left of the decimal point of the value X\nto become zero.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT ROUND(-1.23);\n -> -1\nmysql> SELECT ROUND(-1.58);\n -> -2\nmysql> SELECT ROUND(1.58);\n -> 2\nmysql> SELECT ROUND(1.298, 1);\n -> 1.3\nmysql> SELECT ROUND(1.298, 0);\n -> 1\nmysql> SELECT ROUND(23.298, -1);\n -> 20\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (50,7,'NULLIF','Syntax:\nNULLIF(expr1,expr2)\n\nReturns NULL if expr1 = expr2 is true, otherwise returns expr1. This is\nthe same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html\n\n','mysql> SELECT NULLIF(1,1);\n -> NULL\nmysql> SELECT NULLIF(1,2);\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (51,22,'CLOSE','Syntax:\nCLOSE cursor_name\n\nThis statement closes a previously opened cursor.\n\nIf not closed explicitly, a cursor is closed at the end of the compound\nstatement in which it was declared.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/close.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/close.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (52,25,'STOP SLAVE','Syntax:\nSTOP SLAVE [thread_type [, thread_type] ... ]\n\nthread_type: IO_THREAD | SQL_THREAD\n\nStops the slave threads. STOP SLAVE requires the SUPER privilege.\n\nLike START SLAVE, this statement may be used with the IO_THREAD and\nSQL_THREAD options to name the thread or threads to be stopped.\n\n*Note*: The transactional behavior of STOP SLAVE changed in MySQL\n5.1.35. Previously, it took effect immediately. Beginning with MySQL\n5.1.35, it waits until any current replication event group affecting\none or more non-transactional tables has finished executing (if there\nis any such replication group), or until the user issues a KILL QUERY\nor KILL CONNECTION statement. (Bug#319\n(http://bugs.mysql.com/bug.php?id=319), Bug#38205\n(http://bugs.mysql.com/bug.php?id=38205))\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/stop-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/stop-slave.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (53,30,'TIMEDIFF','Syntax:\nTIMEDIFF(expr1,expr2)\n\nTIMEDIFF() returns expr1 - expr2 expressed as a time value. expr1 and\nexpr2 are time or date-and-time expressions, but both must be of the\nsame type.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIMEDIFF(\'2000:01:01 00:00:00\',\n -> \'2000:01:01 00:00:00.000001\');\n -> \'-00:00:00.000001\'\nmysql> SELECT TIMEDIFF(\'2008-12-31 23:59:59.000001\',\n -> \'2008-12-30 01:01:01.000002\');\n -> \'46:58:57.999999\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (54,35,'REPLACE FUNCTION','Syntax:\nREPLACE(str,from_str,to_str)\n\nReturns the string str with all occurrences of the string from_str\nreplaced by the string to_str. REPLACE() performs a case-sensitive\nmatch when searching for from_str.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT REPLACE(\'www.mysql.com\', \'w\', \'Ww\');\n -> \'WwWwWw.mysql.com\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (55,27,'USE','Syntax:\nUSE db_name\n\nThe USE db_name statement tells MySQL to use the db_name database as\nthe default (current) database for subsequent statements. The database\nremains the default until the end of the session or another USE\nstatement is issued:\n\nUSE db1;\nSELECT COUNT(*) FROM mytable; # selects from db1.mytable\nUSE db2;\nSELECT COUNT(*) FROM mytable; # selects from db2.mytable\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/use.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/use.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (56,3,'LINEFROMTEXT','LineFromText(wkt[,srid]), LineStringFromText(wkt[,srid])\n\nConstructs a LINESTRING value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (57,7,'CASE OPERATOR','Syntax:\nCASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN\nresult ...] [ELSE result] END\n\nCASE WHEN [condition] THEN result [WHEN [condition] THEN result ...]\n[ELSE result] END\n\nThe first version returns the result where value=compare_value. The\nsecond version returns the result for the first condition that is true.\nIf there was no matching result value, the result after ELSE is\nreturned, or NULL if there is no ELSE part.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html\n\n','mysql> SELECT CASE 1 WHEN 1 THEN \'one\'\n -> WHEN 2 THEN \'two\' ELSE \'more\' END;\n -> \'one\'\nmysql> SELECT CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END;\n -> \'true\'\nmysql> SELECT CASE BINARY \'B\'\n -> WHEN \'a\' THEN 1 WHEN \'b\' THEN 2 END;\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (58,25,'SHOW MASTER STATUS','Syntax:\nSHOW MASTER STATUS\n\nThis statement provides status information about the binary log files\nof the master. It requires either the SUPER or REPLICATION CLIENT\nprivilege.\n\nExample:\n\nmysql> SHOW MASTER STATUS;\n+---------------+----------+--------------+------------------+\n| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |\n+---------------+----------+--------------+------------------+\n| mysql-bin.003 | 73 | test | manual,mysql |\n+---------------+----------+--------------+------------------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-master-status.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-master-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (59,30,'ADDTIME','Syntax:\nADDTIME(expr1,expr2)\n\nADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time\nor datetime expression, and expr2 is a time expression.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT ADDTIME(\'2007-12-31 23:59:59.999999\', \'1 1:1:1.000002\');\n -> \'2008-01-02 01:01:01.000001\'\nmysql> SELECT ADDTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n -> \'03:00:01.999997\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (60,32,'SPATIAL','MySQL can create spatial indexes using syntax similar to that for\ncreating regular indexes, but extended with the SPATIAL keyword.\nCurrently, columns in spatial indexes must be declared NOT NULL. The\nfollowing examples demonstrate how to create spatial indexes:\n\no With CREATE TABLE:\n\nCREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g));\n\no With ALTER TABLE:\n\nALTER TABLE geom ADD SPATIAL INDEX(g);\n\no With CREATE INDEX:\n\nCREATE SPATIAL INDEX sp_index ON geom (g);\n\nFor MyISAM tables, SPATIAL INDEX creates an R-tree index. For storage\nengines that support nonspatial indexing of spatial columns, the engine\ncreates a B-tree index. A B-tree index on spatial values will be useful\nfor exact-value lookups, but not for range scans.\n\nFor more information on indexing spatial columns, see [HELP CREATE\nINDEX].\n\nTo drop spatial indexes, use ALTER TABLE or DROP INDEX:\n\no With ALTER TABLE:\n\nALTER TABLE geom DROP INDEX g;\n\no With DROP INDEX:\n\nDROP INDEX sp_index ON geom;\n\nExample: Suppose that a table geom contains more than 32,000\ngeometries, which are stored in the column g of type GEOMETRY. The\ntable also has an AUTO_INCREMENT column fid for storing object ID\nvalues.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-indexes.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-indexes.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (61,30,'TIMESTAMPDIFF','Syntax:\nTIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)\n\nReturns datetime_expr2 - datetime_expr1, where datetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One expression may be\na date and the other a datetime; a date value is treated as a datetime\nhaving the time part \'00:00:00\' where necessary. The unit for the\nresult (an integer) is given by the unit argument. The legal values for\nunit are the same as those listed in the description of the\nTIMESTAMPADD() function.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMPDIFF(MONTH,\'2003-02-01\',\'2003-05-01\');\n -> 3\nmysql> SELECT TIMESTAMPDIFF(YEAR,\'2002-05-01\',\'2001-01-01\');\n -> -1\nmysql> SELECT TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01 12:05:55\');\n -> 128885\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (62,35,'UPPER','Syntax:\nUPPER(str)\n\nReturns the string str with all characters changed to uppercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nmysql> SELECT UPPER(\'Hej\');\n -> \'HEJ\'\n\nUPPER() is ineffective when applied to binary strings (BINARY,\nVARBINARY, BLOB). The description of LOWER() shows how to perform\nlettercase conversion of binary strings.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (63,30,'FROM_UNIXTIME','Syntax:\nFROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)\n\nReturns a representation of the unix_timestamp argument as a value in\n\'YYYY-MM-DD HH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on\nwhether the function is used in a string or numeric context. The value\nis expressed in the current time zone. unix_timestamp is an internal\ntimestamp value such as is produced by the UNIX_TIMESTAMP() function.\n\nIf format is given, the result is formatted according to the format\nstring, which is used the same way as listed in the entry for the\nDATE_FORMAT() function.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT FROM_UNIXTIME(1196440219);\n -> \'2007-11-30 10:30:19\'\nmysql> SELECT FROM_UNIXTIME(1196440219) + 0;\n -> 20071130103019.000000\nmysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),\n -> \'%Y %D %M %h:%i:%s %x\');\n -> \'2007 30th November 10:30:59 2007\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (64,20,'MEDIUMBLOB','MEDIUMBLOB\n\nA BLOB column with a maximum length of 16,777,215 (224 - 1) bytes. Each\nMEDIUMBLOB value is stored using a three-byte length prefix that\nindicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (65,7,'IFNULL','Syntax:\nIFNULL(expr1,expr2)\n\nIf expr1 is not NULL, IFNULL() returns expr1; otherwise it returns\nexpr2. IFNULL() returns a numeric or string value, depending on the\ncontext in which it is used.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html\n\n','mysql> SELECT IFNULL(1,0);\n -> 1\nmysql> SELECT IFNULL(NULL,10);\n -> 10\nmysql> SELECT IFNULL(1/0,10);\n -> 10\nmysql> SELECT IFNULL(1/0,\'yes\');\n -> \'yes\'\n','http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (66,25,'SHOW FUNCTION CODE','Syntax:\nSHOW FUNCTION CODE func_name\n\nThis statement is similar to SHOW PROCEDURE CODE but for stored\nfunctions. See [HELP SHOW PROCEDURE CODE].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-function-code.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-function-code.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (67,25,'SHOW ERRORS','Syntax:\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW COUNT(*) ERRORS\n\nThis statement is similar to SHOW WARNINGS, except that instead of\ndisplaying errors, warnings, and notes, it displays only errors.\n\nThe LIMIT clause has the same syntax as for the SELECT statement. See\nhttp://dev.mysql.com/doc/refman/5.1/en/select.html.\n\nThe SHOW COUNT(*) ERRORS statement displays the number of errors. You\ncan also retrieve this number from the error_count variable:\n\nSHOW COUNT(*) ERRORS;\nSELECT @@error_count;\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-errors.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-errors.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (68,17,'LEAST','Syntax:\nLEAST(value1,value2,...)\n\nWith two or more arguments, returns the smallest (minimum-valued)\nargument. The arguments are compared using the following rules:\n\no If the return value is used in an INTEGER context or all arguments\n are integer-valued, they are compared as integers.\n\no If the return value is used in a REAL context or all arguments are\n real-valued, they are compared as reals.\n\no If any argument is a case-sensitive string, the arguments are\n compared as case-sensitive strings.\n\no In all other cases, the arguments are compared as case-insensitive\n strings.\n\nLEAST() returns NULL if any argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT LEAST(2,0);\n -> 0\nmysql> SELECT LEAST(34.0,3.0,5.0,767.0);\n -> 3.0\nmysql> SELECT LEAST(\'B\',\'A\',\'C\');\n -> \'A\'\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (69,17,'=','=\n\nEqual:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 1 = 0;\n -> 0\nmysql> SELECT \'0\' = 0;\n -> 1\nmysql> SELECT \'0.0\' = 0;\n -> 1\nmysql> SELECT \'0.01\' = 0;\n -> 0\nmysql> SELECT \'.01\' = 0.01;\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (70,35,'REVERSE','Syntax:\nREVERSE(str)\n\nReturns the string str with the order of the characters reversed.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT REVERSE(\'abc\');\n -> \'cba\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (71,17,'ISNULL','Syntax:\nISNULL(expr)\n\nIf expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT ISNULL(1+1);\n -> 0\nmysql> SELECT ISNULL(1/0);\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (72,20,'BINARY','BINARY(M)\n\nThe BINARY type is similar to the CHAR type, but stores binary byte\nstrings rather than nonbinary character strings. M represents the\ncolumn length in bytes.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (73,20,'BLOB DATA TYPE','A BLOB is a binary large object that can hold a variable amount of\ndata. The four BLOB types are TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB.\nThese differ only in the maximum length of the values they can hold.\nThe four TEXT types are TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. These\ncorrespond to the four BLOB types and have the same maximum lengths and\nstorage requirements. See\nhttp://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/blob.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/blob.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (74,34,'BOUNDARY','Boundary(g)\n\nReturns a geometry that is the closure of the combinatorial boundary of\nthe geometry value g.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (75,9,'CREATE USER','Syntax:\nCREATE USER user [IDENTIFIED BY [PASSWORD] \'password\']\n [, user [IDENTIFIED BY [PASSWORD] \'password\']] ...\n\nThe CREATE USER statement creates new MySQL accounts. To use it, you\nmust have the global CREATE USER privilege or the INSERT privilege for\nthe mysql database. For each account, CREATE USER creates a new row in\nthe mysql.user table that has no privileges. An error occurs if the\naccount already exists. Each account is named using the same format as\nfor the GRANT statement; for example, \'jeffrey\'@\'localhost\'. If you\nspecify only the user name part of the account name, a host name part\nof \'%\' is used. For additional information about specifying account\nnames, see [HELP GRANT].\n\nThe account can be given a password with the optional IDENTIFIED BY\nclause. The user value and the password are given the same way as for\nthe GRANT statement. In particular, to specify the password in plain\ntext, omit the PASSWORD keyword. To specify the password as the hashed\nvalue as returned by the PASSWORD() function, include the PASSWORD\nkeyword. See [HELP GRANT].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-user.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-user.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (76,23,'POINT','Point(x,y)\n\nConstructs a Point using its coordinates.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (77,15,'CURRENT_USER','Syntax:\nCURRENT_USER, CURRENT_USER()\n\nReturns the user name and host name combination for the MySQL account\nthat the server used to authenticate the current client. This account\ndetermines your access privileges. The return value is a string in the\nutf8 character set.\n\nThe value of CURRENT_USER() can differ from the value of USER().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT USER();\n -> \'davida@localhost\'\nmysql> SELECT * FROM mysql.user;\nERROR 1044: Access denied for user \'\'@\'localhost\' to\ndatabase \'mysql\'\nmysql> SELECT CURRENT_USER();\n -> \'@localhost\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (78,35,'LCASE','Syntax:\nLCASE(str)\n\nLCASE() is a synonym for LOWER().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (79,17,'<=','Syntax:\n<=\n\nLess than or equal:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 0.1 <= 2;\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (80,25,'SHOW PROFILES','Syntax:\nSHOW PROFILE [type [, type] ... ]\n [FOR QUERY n]\n [LIMIT row_count [OFFSET offset]]\n\ntype:\n ALL\n | BLOCK IO\n | CONTEXT SWITCHES\n | CPU\n | IPC\n | MEMORY\n | PAGE FAULTS\n | SOURCE\n | SWAPS\n\nThe SHOW PROFILES and SHOW PROFILE statements display profiling\ninformation that indicates resource usage for statements executed\nduring the course of the current session.\n\nProfiling is controlled by the profiling session variable, which has a\ndefault value of 0 (OFF). Profiling is enabled by setting profiling to\n1 or ON:\n\nmysql> SET profiling = 1;\n\nSHOW PROFILES displays a list of the most recent statements sent to the\nmaster. The size of the list is controlled by the\nprofiling_history_size session variable, which has a default value of\n15. The maximum value is 100. Setting the value to 0 has the practical\neffect of disabling profiling.\n\nAll statements are profiled except SHOW PROFILES and SHOW PROFILE, so\nyou will find neither of those statements in the profile list.\nMalformed statements are profiled. For example, SHOW PROFILING is an\nillegal statement, and a syntax error occurs if you try to execute it,\nbut it will show up in the profiling list.\n\nSHOW PROFILE displays detailed information about a single statement.\nWithout the FOR QUERY n clause, the output pertains to the most\nrecently executed statement. If FOR QUERY n is included, SHOW PROFILE\ndisplays information for statement n. The values of n correspond to the\nQuery_ID values displayed by SHOW PROFILES.\n\nThe LIMIT row_count clause may be given to limit the output to\nrow_count rows. If LIMIT is given, OFFSET offset may be added to begin\nthe output offset rows into the full set of rows.\n\nBy default, SHOW PROFILE displays Status and Duration columns. The\nStatus values are like the State values displayed by SHOW PROCESSLIST,\nalthought there might be some minor differences in interpretion for the\ntwo statements for some status values (see\nhttp://dev.mysql.com/doc/refman/5.1/en/thread-information.html).\n\nOptional type values may be specified to display specific additional\ntypes of information:\n\no ALL displays all information\n\no BLOCK IO displays counts for block input and output operations\n\no CONTEXT SWITCHES displays counts for voluntary and involuntary\n context switches\n\no CPU displays user and system CPU usage times\n\no IPC displays counts for messages sent and received\n\no MEMORY is not currently implemented\n\no PAGE FAULTS displays counts for major and minor page faults\n\no SOURCE displays the names of functions from the source code, together\n with the name and line number of the file in which the function\n occurs\n\no SWAPS displays swap counts\n\nProfiling is enabled per session. When a session ends, its profiling\ninformation is lost.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-profiles.html\n\n','mysql> SELECT @@profiling;\n+-------------+\n| @@profiling |\n+-------------+\n| 0 |\n+-------------+\n1 row in set (0.00 sec)\n\nmysql> SET profiling = 1;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> DROP TABLE IF EXISTS t1;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nmysql> CREATE TABLE T1 (id INT);\nQuery OK, 0 rows affected (0.01 sec)\n\nmysql> SHOW PROFILES;\n+----------+----------+--------------------------+\n| Query_ID | Duration | Query |\n+----------+----------+--------------------------+\n| 0 | 0.000088 | SET PROFILING = 1 |\n| 1 | 0.000136 | DROP TABLE IF EXISTS t1 |\n| 2 | 0.011947 | CREATE TABLE t1 (id INT) |\n+----------+----------+--------------------------+\n3 rows in set (0.00 sec)\n\nmysql> SHOW PROFILE;\n+----------------------+----------+\n| Status | Duration |\n+----------------------+----------+\n| checking permissions | 0.000040 |\n| creating table | 0.000056 |\n| After create | 0.011363 |\n| query end | 0.000375 |\n| freeing items | 0.000089 |\n| logging slow query | 0.000019 |\n| cleaning up | 0.000005 |\n+----------------------+----------+\n7 rows in set (0.00 sec)\n\nmysql> SHOW PROFILE FOR QUERY 1;\n+--------------------+----------+\n| Status | Duration |\n+--------------------+----------+\n| query end | 0.000107 |\n| freeing items | 0.000008 |\n| logging slow query | 0.000015 |\n| cleaning up | 0.000006 |\n+--------------------+----------+\n4 rows in set (0.00 sec)\n\nmysql> SHOW PROFILE CPU FOR QUERY 2;\n+----------------------+----------+----------+------------+\n| Status | Duration | CPU_user | CPU_system |\n+----------------------+----------+----------+------------+\n| checking permissions | 0.000040 | 0.000038 | 0.000002 |\n| creating table | 0.000056 | 0.000028 | 0.000028 |\n| After create | 0.011363 | 0.000217 | 0.001571 |\n| query end | 0.000375 | 0.000013 | 0.000028 |\n| freeing items | 0.000089 | 0.000010 | 0.000014 |\n| logging slow query | 0.000019 | 0.000009 | 0.000010 |\n| cleaning up | 0.000005 | 0.000003 | 0.000002 |\n+----------------------+----------+----------+------------+\n7 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.1/en/show-profiles.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (81,26,'UPDATE','Syntax:\nSingle-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_reference\n SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n\nMultiple-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_references\n SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n\nFor the single-table syntax, the UPDATE statement updates columns of\nexisting rows in the named table with new values. The SET clause\nindicates which columns to modify and the values they should be given.\nEach value can be given as an expression, or the keyword DEFAULT to set\na column explicitly to its default value. The WHERE clause, if given,\nspecifies the conditions that identify which rows to update. With no\nWHERE clause, all rows are updated. If the ORDER BY clause is\nspecified, the rows are updated in the order that is specified. The\nLIMIT clause places a limit on the number of rows that can be updated.\n\nFor the multiple-table syntax, UPDATE updates rows in each table named\nin table_references that satisfy the conditions. In this case, ORDER BY\nand LIMIT cannot be used.\n\nwhere_condition is an expression that evaluates to true for each row to\nbe updated.\n\ntable_references and where_condition are is specified as described in\nhttp://dev.mysql.com/doc/refman/5.1/en/select.html.\n\nYou need the UPDATE privilege only for columns referenced in an UPDATE\nthat are actually updated. You need only the SELECT privilege for any\ncolumns that are read but not modified.\n\nThe UPDATE statement supports the following modifiers:\n\no If you use the LOW_PRIORITY keyword, execution of the UPDATE is\n delayed until no other clients are reading from the table. This\n affects only storage engines that use only table-level locking (such\n as MyISAM, MEMORY, and MERGE).\n\no If you use the IGNORE keyword, the update statement does not abort\n even if errors occur during the update. Rows for which duplicate-key\n conflicts occur are not updated. Rows for which columns are updated\n to values that would cause data conversion errors are updated to the\n closest valid values instead.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/update.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/update.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (82,17,'IS NOT NULL','Syntax:\nIS NOT NULL\n\nTests whether a value is not NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;\n -> 1, 1, 0\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (83,22,'CASE STATEMENT','Syntax:\nCASE case_value\n WHEN when_value THEN statement_list\n [WHEN when_value THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n\nOr:\n\nCASE\n WHEN search_condition THEN statement_list\n [WHEN search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n\nThe CASE statement for stored programs implements a complex conditional\nconstruct. If a search_condition evaluates to true, the corresponding\nSQL statement list is executed. If no search condition matches, the\nstatement list in the ELSE clause is executed. Each statement_list\nconsists of one or more statements.\n\nIf no when_value or search_condition matches the value tested and the\nCASE statement contains no ELSE clause, a Case not found for CASE\nstatement error results.\n\nEach statement_list consists of one or more statements; an empty\nstatement_list is not allowed. To handle situations where no value is\nmatched by any WHEN clause, use an ELSE containing an empty BEGIN ...\nEND block, as shown in this example: DELIMITER | CREATE PROCEDURE p()\nBEGIN DECLARE v INT DEFAULT 1; CASE v WHEN 2 THEN SELECT v; WHEN 3 THEN\nSELECT 0; ELSE BEGIN END; END CASE; END; | (The indentation used here\nin the ELSE clause is for purposes of clarity only, and is not\notherwise significant.)\n\n*Note*: The syntax of the CASE statement used inside stored programs\ndiffers slightly from that of the SQL CASE expression described in\nhttp://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html. The\nCASE statement cannot have an ELSE NULL clause, and it is terminated\nwith END CASE instead of END.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/case-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/case-statement.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (84,25,'EXECUTE STATEMENT','Syntax:\nEXECUTE stmt_name\n [USING @var_name [, @var_name] ...]\n\nAfter preparing a statement with PREPARE, you execute it with an\nEXECUTE statement that refers to the prepared statement name. If the\nprepared statement contains any parameter markers, you must supply a\nUSING clause that lists user variables containing the values to be\nbound to the parameters. Parameter values can be supplied only by user\nvariables, and the USING clause must name exactly as many variables as\nthe number of parameter markers in the statement.\n\nYou can execute a given prepared statement multiple times, passing\ndifferent variables to it or setting the variables to different values\nbefore each execution.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/execute.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/execute.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (85,37,'DROP INDEX','Syntax:\nDROP [ONLINE|OFFLINE] INDEX index_name ON tbl_name\n\nDROP INDEX drops the index named index_name from the table tbl_name.\nThis statement is mapped to an ALTER TABLE statement to drop the index.\nSee [HELP ALTER TABLE].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-index.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-index.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (86,35,'MATCH AGAINST','Syntax:\nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n\nMySQL has support for full-text indexing and searching:\n\no A full-text index in MySQL is an index of type FULLTEXT.\n\no Full-text indexes can be used only with MyISAM tables, and can be\n created only for CHAR, VARCHAR, or TEXT columns.\n\no A FULLTEXT index definition can be given in the CREATE TABLE\n statement when a table is created, or added later using ALTER TABLE\n or CREATE INDEX.\n\no For large data sets, it is much faster to load your data into a table\n that has no FULLTEXT index and then create the index after that, than\n to load data into a table that has an existing FULLTEXT index.\n\nFull-text searching is performed using MATCH() ... AGAINST syntax.\nMATCH() takes a comma-separated list that names the columns to be\nsearched. AGAINST takes a string to search for, and an optional\nmodifier that indicates what type of search to perform. The search\nstring must be a literal string, not a variable or a column name. There\nare three types of full-text searches:\n\no A boolean search interprets the search string using the rules of a\n special query language. The string contains the words to search for.\n It can also contain operators that specify requirements such that a\n word must be present or absent in matching rows, or that it should be\n weighted higher or lower than usual. Common words such as "some" or\n "then" are stopwords and do not match if present in the search\n string. The IN BOOLEAN MODE modifier specifies a boolean search. For\n more information, see\n http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html.\n\no A natural language search interprets the search string as a phrase in\n natural human language (a phrase in free text). There are no special\n operators. The stopword list applies. In addition, words that are\n present in 50% or more of the rows are considered common and do not\n match. Full-text searches are natural language searches if the IN\n NATURAL LANGUAGE MODE modifier is given or if no modifier is given.\n\no A query expansion search is a modification of a natural language\n search. The search string is used to perform a natural language\n search. Then words from the most relevant rows returned by the search\n are added to the search string and the search is done again. The\n query returns the rows from the second search. The IN NATURAL\n LANGUAGE MODE WITH QUERY EXPANSION or WITH QUERY EXPANSION modifier\n specifies a query expansion search. For more information, see\n http://dev.mysql.com/doc/refman/5.1/en/fulltext-query-expansion.html.\n\nThe IN NATURAL LANGUAGE MODE and IN NATURAL LANGUAGE MODE WITH QUERY\nEXPANSION modifiers were added in MySQL 5.1.7.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html\n\n','mysql> SELECT id, body, MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE) AS score\n -> FROM articles WHERE MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE);\n+----+-------------------------------------+-----------------+\n| id | body | score |\n+----+-------------------------------------+-----------------+\n| 4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014 |\n| 6 | When configured properly, MySQL ... | 1.3114095926285 |\n+----+-------------------------------------+-----------------+\n2 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,37,'CREATE EVENT','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n EVENT\n [IF NOT EXISTS]\n event_name\n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO sql_statement;\n\nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval\n [STARTS timestamp [+ INTERVAL interval] ...]\n [ENDS timestamp [+ INTERVAL interval] ...]\n\ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n\nThis statement creates and schedules a new event. It requires the EVENT\nprivilege for the schema in which the event is to be created (and\nperhaps SUPER depending on the DEFINER value, as described later). The\nevent will not run unless the Event Scheduler is enabled. For\ninformation about checking Event Scheduler status and enabling it if\nnecessary, see\nhttp://dev.mysql.com/doc/refman/5.1/en/events-configuration.html.\n\nThe minimum requirements for a valid CREATE EVENT statement are as\nfollows:\n\no The keywords CREATE EVENT plus an event name, which uniquely\n identifies the event within a database schema. (Prior to MySQL\n 5.1.12, the event name needed to be unique only among events created\n by the same user within a schema.)\n\no An ON SCHEDULE clause, which determines when and how often the event\n executes.\n\no A DO clause, which contains the SQL statement to be executed by an\n event.\n\nThis is an example of a minimal CREATE EVENT statement:\n\nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n\nThe previous statement creates an event named myevent. This event\nexecutes once --- one hour following its creation --- by running an SQL\nstatement that increments the value of the myschema.mytable table\'s\nmycol column by 1.\n\nThe event_name must be a valid MySQL identifier with a maximum length\nof 64 characters. Event names are not case sensitive, so you cannot\nhave two events named myevent and MyEvent in the same schema. In\ngeneral, the rules governing event names are the same as those for\nnames of stored routines. See\nhttp://dev.mysql.com/doc/refman/5.1/en/identifiers.html.\n\nAn event is associated with a schema. If no schema is indicated as part\nof event_name, the default (current) schema is assumed. To create an\nevent in a specific schema, qualify the event name with a schema using\nschema_name.event_name syntax.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-event.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-event.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (88,4,'ABS','Syntax:\nABS(X)\n\nReturns the absolute value of X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT ABS(2);\n -> 2\nmysql> SELECT ABS(-32);\n -> 32\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (89,31,'POLYFROMWKB','PolyFromWKB(wkb[,srid]), PolygonFromWKB(wkb[,srid])\n\nConstructs a POLYGON value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (90,35,'NOT LIKE','Syntax:\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n\nThis is the same as NOT (expr LIKE pat [ESCAPE \'escape_char\']).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (91,35,'SPACE','Syntax:\nSPACE(N)\n\nReturns a string consisting of N space characters.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT SPACE(6);\n -> \' \'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (92,6,'MBR DEFINITION','Its MBR (Minimum Bounding Rectangle), or Envelope. This is the bounding\ngeometry, formed by the minimum and maximum (X,Y) coordinates:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/gis-class-geometry.html\n\n','((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n','http://dev.mysql.com/doc/refman/5.1/en/gis-class-geometry.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (93,23,'GEOMETRYCOLLECTION','GeometryCollection(g1,g2,...)\n\nConstructs a GeometryCollection.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (94,16,'MAX','Syntax:\nMAX([DISTINCT] expr)\n\nReturns the maximum value of expr. MAX() may take a string argument; in\nsuch cases, it returns the maximum string value. See\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-indexes.html. The DISTINCT\nkeyword can be used to find the maximum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMAX() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (95,21,'CREATE FUNCTION UDF','Syntax:\nCREATE [AGGREGATE] FUNCTION function_name RETURNS {STRING|INTEGER|REAL|DECIMAL}\n SONAME shared_library_name\n\nA user-defined function (UDF) is a way to extend MySQL with a new\nfunction that works like a native (built-in) MySQL function such as\nABS() or CONCAT().\n\nfunction_name is the name that should be used in SQL statements to\ninvoke the function. The RETURNS clause indicates the type of the\nfunction\'s return value. DECIMAL is a legal value after RETURNS, but\ncurrently DECIMAL functions return string values and should be written\nlike STRING functions.\n\nshared_library_name is the basename of the shared object file that\ncontains the code that implements the function. The file must be\nlocated in the plugin directory. This directory is given by the value\nof the plugin_dir system variable.\n\n*Note*: This is a change in MySQL 5.1. For earlier versions of MySQL,\nthe shared object can be located in any directory that is searched by\nyour system\'s dynamic linker.\n\nTo create a function, you must have the INSERT privilege for the mysql\ndatabase. This is necessary because CREATE FUNCTION adds a row to the\nmysql.func system table that records the function\'s name, type, and\nshared library name. If you do not have this table, you should run the\nmysql_upgrade command to create it. See\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-upgrade.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-function-udf.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-function-udf.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (96,4,'*','Syntax:\n*\n\nMultiplication:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','mysql> SELECT 3*5;\n -> 15\nmysql> SELECT 18014398509481984*18014398509481984.0;\n -> 324518553658426726783156020576256.0\nmysql> SELECT 18014398509481984*18014398509481984;\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,20,'TIMESTAMP','TIMESTAMP\n\nA timestamp. The range is \'1970-01-01 00:00:01\' UTC to \'2038-01-19\n03:14:07\' UTC. TIMESTAMP values are stored as the number of seconds\nsince the epoch (\'1970-01-01 00:00:00\' UTC). A TIMESTAMP cannot\nrepresent the value \'1970-01-01 00:00:00\' because that is equivalent to\n0 seconds from the epoch and the value 0 is reserved for representing\n\'0000-00-00 00:00:00\', the "zero" TIMESTAMP value.\n\nA TIMESTAMP column is useful for recording the date and time of an\nINSERT or UPDATE operation. By default, the first TIMESTAMP column in a\ntable is automatically set to the date and time of the most recent\noperation if you do not assign it a value yourself. You can also set\nany TIMESTAMP column to the current date and time by assigning it a\nNULL value. Variations on automatic initialization and update\nproperties are described in\nhttp://dev.mysql.com/doc/refman/5.1/en/timestamp.html.\n\nA TIMESTAMP value is returned as a string in the format \'YYYY-MM-DD\nHH:MM:SS\' with a display width fixed at 19 characters. To obtain the\nvalue as a number, you should add +0 to the timestamp column.\n\n*Note*: The TIMESTAMP format that was used prior to MySQL 4.1 is not\nsupported in MySQL 5.1; see MySQL 3.23, 4.0, 4.1 Reference Manual for\ninformation regarding the old format.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (98,11,'DES_DECRYPT','Syntax:\nDES_DECRYPT(crypt_str[,key_str])\n\nDecrypts a string encrypted with DES_ENCRYPT(). If an error occurs,\nthis function returns NULL.\n\nThis function works only if MySQL has been configured with SSL support.\nSee http://dev.mysql.com/doc/refman/5.1/en/secure-connections.html.\n\nIf no key_str argument is given, DES_DECRYPT() examines the first byte\nof the encrypted string to determine the DES key number that was used\nto encrypt the original string, and then reads the key from the DES key\nfile to decrypt the message. For this to work, the user must have the\nSUPER privilege. The key file can be specified with the --des-key-file\nserver option.\n\nIf you pass this function a key_str argument, that string is used as\nthe key for decrypting the message.\n\nIf the crypt_str argument does not appear to be an encrypted string,\nMySQL returns the given crypt_str.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (99,25,'CACHE INDEX','Syntax:\nCACHE INDEX\n tbl_index_list [, tbl_index_list] ...\n IN key_cache_name\n\ntbl_index_list:\n tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]\n\nThe CACHE INDEX statement assigns table indexes to a specific key\ncache. It is used only for MyISAM tables.\n\nThe following statement assigns indexes from the tables t1, t2, and t3\nto the key cache named hot_cache:\n\nmysql> CACHE INDEX t1, t2, t3 IN hot_cache;\n+---------+--------------------+----------+----------+\n| Table | Op | Msg_type | Msg_text |\n+---------+--------------------+----------+----------+\n| test.t1 | assign_to_keycache | status | OK |\n| test.t2 | assign_to_keycache | status | OK |\n| test.t3 | assign_to_keycache | status | OK |\n+---------+--------------------+----------+----------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/cache-index.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/cache-index.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (100,12,'ENDPOINT','EndPoint(ls)\n\nReturns the Point that is the endpoint of the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#linestring-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (101,11,'COMPRESS','Syntax:\nCOMPRESS(string_to_compress)\n\nCompresses a string and returns the result as a binary string. This\nfunction requires MySQL to have been compiled with a compression\nlibrary such as zlib. Otherwise, the return value is always NULL. The\ncompressed string can be uncompressed with UNCOMPRESS().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','mysql> SELECT LENGTH(COMPRESS(REPEAT(\'a\',1000)));\n -> 21\nmysql> SELECT LENGTH(COMPRESS(\'\'));\n -> 0\nmysql> SELECT LENGTH(COMPRESS(\'a\'));\n -> 13\nmysql> SELECT LENGTH(COMPRESS(REPEAT(\'a\',16)));\n -> 15\n','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (102,26,'INSERT','Syntax:\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nOr:\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name\n SET col_name={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nOr:\n\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nINSERT inserts new rows into an existing table. The INSERT ... VALUES\nand INSERT ... SET forms of the statement insert rows based on\nexplicitly specified values. The INSERT ... SELECT form inserts rows\nselected from another table or tables. INSERT ... SELECT is discussed\nfurther in [HELP INSERT SELECT].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/insert.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/insert.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (103,16,'COUNT','Syntax:\nCOUNT(expr)\n\nReturns a count of the number of non-NULL values of expr in the rows\nretrieved by a SELECT statement. The result is a BIGINT value.\n\nCOUNT() returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT student.student_name,COUNT(*)\n -> FROM student,course\n -> WHERE student.student_id=course.student_id\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (104,26,'HANDLER','Syntax:\nHANDLER tbl_name OPEN [ [AS] alias]\n\nHANDLER tbl_name READ index_name { = | <= | >= | < | > } (value1,value2,...)\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ { FIRST | NEXT }\n [ WHERE where_condition ] [LIMIT ... ]\n\nHANDLER tbl_name CLOSE\n\nThe HANDLER statement provides direct access to table storage engine\ninterfaces. It is available for MyISAM and InnoDB tables.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/handler.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/handler.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (105,3,'MLINEFROMTEXT','MLineFromText(wkt[,srid]), MultiLineStringFromText(wkt[,srid])\n\nConstructs a MULTILINESTRING value using its WKT representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (106,31,'GEOMCOLLFROMWKB','GeomCollFromWKB(wkb[,srid]), GeometryCollectionFromWKB(wkb[,srid])\n\nConstructs a GEOMETRYCOLLECTION value using its WKB representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (107,37,'RENAME TABLE','Syntax:\nRENAME TABLE tbl_name TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n\nThis statement renames one or more tables.\n\nThe rename operation is done atomically, which means that no other\nsession can access any of the tables while the rename is running. For\nexample, if you have an existing table old_table, you can create\nanother table new_table that has the same structure but is empty, and\nthen replace the existing table with the empty one as follows (assuming\nthat backup_table does not already exist):\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/rename-table.html\n\n','CREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO old_table;\n','http://dev.mysql.com/doc/refman/5.1/en/rename-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (108,20,'BOOLEAN','BOOL, BOOLEAN\n\nThese types are synonyms for TINYINT(1). A value of zero is considered\nfalse. Nonzero values are considered true:\n\nmysql> SELECT IF(0, \'true\', \'false\');\n+------------------------+\n| IF(0, \'true\', \'false\') |\n+------------------------+\n| false |\n+------------------------+\n\nmysql> SELECT IF(1, \'true\', \'false\');\n+------------------------+\n| IF(1, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n\nmysql> SELECT IF(2, \'true\', \'false\');\n+------------------------+\n| IF(2, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n\nHowever, the values TRUE and FALSE are merely aliases for 1 and 0,\nrespectively, as shown here:\n\nmysql> SELECT IF(0 = FALSE, \'true\', \'false\');\n+--------------------------------+\n| IF(0 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| true |\n+--------------------------------+\n\nmysql> SELECT IF(1 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(1 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| true |\n+-------------------------------+\n\nmysql> SELECT IF(2 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(2 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| false |\n+-------------------------------+\n\nmysql> SELECT IF(2 = FALSE, \'true\', \'false\');\n+--------------------------------+\n| IF(2 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| false |\n+--------------------------------+\n\nThe last two statements display the results shown because 2 is equal to\nneither 1 nor 0.\n\nWe intend to implement full boolean type handling, in accordance with\nstandard SQL, in a future MySQL release.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (109,14,'DEFAULT','Syntax:\nDEFAULT(col_name)\n\nReturns the default value for a table column. An error results if the\ncolumn has no default value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','mysql> UPDATE t SET i = DEFAULT(i)+1 WHERE id < 100;\n','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (110,4,'MOD','Syntax:\nMOD(N,M), N % M, N MOD M\n\nModulo operation. Returns the remainder of N divided by M.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT MOD(234, 10);\n -> 4\nmysql> SELECT 253 % 7;\n -> 1\nmysql> SELECT MOD(29,9);\n -> 2\nmysql> SELECT 29 MOD 9;\n -> 2\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (111,20,'TINYTEXT','TINYTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 255 (28 - 1) characters. The\neffective maximum length is less if the value contains multi-byte\ncharacters. Each TINYTEXT value is stored using a one-byte length\nprefix that indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (112,19,'OPTIMIZE TABLE','Syntax:\nOPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nOPTIMIZE TABLE should be used if you have deleted a large part of a\ntable or if you have made many changes to a table with variable-length\nrows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT columns).\nDeleted rows are maintained in a linked list and subsequent INSERT\noperations reuse old row positions. You can use OPTIMIZE TABLE to\nreclaim the unused space and to defragment the data file.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBeginning with MySQL 5.1.27, OPTIMIZE TABLE is also supported for\npartitioned tables. Also beginning with MySQL 5.1.27, you can use ALTER\nTABLE ... OPTIMIZE PARTITION to optimize one or more partitions; for\nmore information, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.1/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (113,11,'DECODE','Syntax:\nDECODE(crypt_str,pass_str)\n\nDecrypts the encrypted string crypt_str using pass_str as the password.\ncrypt_str should be a string returned from ENCODE().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (114,17,'<=>','Syntax:\n<=>\n\nNULL-safe equal. This operator performs an equality comparison like the\n= operator, but returns 1 rather than NULL if both operands are NULL,\nand 0 rather than NULL if one operand is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;\n -> 1, 1, 0\nmysql> SELECT 1 = 1, NULL = NULL, 1 = NULL;\n -> 1, NULL, NULL\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (115,27,'HELP STATEMENT','Syntax:\nHELP \'search_string\'\n\nThe HELP statement returns online information from the MySQL Reference\nmanual. Its proper operation requires that the help tables in the mysql\ndatabase be initialized with help topic information (see\nhttp://dev.mysql.com/doc/refman/5.1/en/server-side-help-support.html).\n\nThe HELP statement searches the help tables for the given search string\nand displays the result of the search. The search string is not case\nsensitive.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/help.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/help.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (116,25,'LOAD DATA FROM MASTER','Syntax:\nLOAD DATA FROM MASTER\n\nThis feature is deprecated and should be avoided. It is subject to\nremoval in a future version of MySQL.\n\nSince the current implementation of LOAD DATA FROM MASTER and LOAD\nTABLE FROM MASTER is very limited, these statements are deprecated as\nof MySQL 4.1 and removed in MySQL 5.5.\n\nThe recommended alternative solution to using LOAD DATA FROM MASTER or\nLOAD TABLE FROM MASTER is using mysqldump or mysqlhotcopy. The latter\nrequires Perl and two Perl modules (DBI and DBD:mysql) and works for\nMyISAM and ARCHIVE tables only. With mysqldump, you can create SQL\ndumps on the master and pipe (or copy) these to a mysql client on the\nslave. This has the advantage of working for all storage engines, but\ncan be quite slow, since it works using SELECT.\n\nThis statement takes a snapshot of the master and copies it to the\nslave. It updates the values of MASTER_LOG_FILE and MASTER_LOG_POS so\nthat the slave starts replicating from the correct position. Any table\nand database exclusion rules specified with the --replicate-*-do-* and\n--replicate-*-ignore-* options are honored. --replicate-rewrite-db is\nnot taken into account because a user could use this option to set up a\nnonunique mapping such as --replicate-rewrite-db="db1->db3" and\n--replicate-rewrite-db="db2->db3", which would confuse the slave when\nloading tables from the master.\n\nUse of this statement is subject to the following conditions:\n\no It works only for MyISAM tables. Attempting to load a non-MyISAM\n table results in the following error:\n\nERROR 1189 (08S01): Net error reading from master\n\no It acquires a global read lock on the master while taking the\n snapshot, which prevents updates on the master during the load\n operation.\n\nIf you are loading large tables, you might have to increase the values\nof net_read_timeout and net_write_timeout on both the master and slave\nservers. See\nhttp://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html.\n\nNote that LOAD DATA FROM MASTER does not copy any tables from the mysql\ndatabase. This makes it easy to have different users and privileges on\nthe master and the slave.\n\nTo use LOAD DATA FROM MASTER, the replication account that is used to\nconnect to the master must have the RELOAD and SUPER privileges on the\nmaster and the SELECT privilege for all master tables you want to load.\nAll master tables for which the user does not have the SELECT privilege\nare ignored by LOAD DATA FROM MASTER. This is because the master hides\nthem from the user: LOAD DATA FROM MASTER calls SHOW DATABASES to know\nthe master databases to load, but SHOW DATABASES returns only databases\nfor which the user has some privilege. See [HELP SHOW DATABASES]. On\nthe slave side, the user that issues LOAD DATA FROM MASTER must have\nprivileges for dropping and creating the databases and tables that are\ncopied.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/load-data-from-master.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/load-data-from-master.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (117,25,'RESET','Syntax:\nRESET reset_option [, reset_option] ...\n\nThe RESET statement is used to clear the state of various server\noperations. You must have the RELOAD privilege to execute RESET.\n\nRESET acts as a stronger version of the FLUSH statement. See [HELP\nFLUSH].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/reset.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/reset.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (118,14,'GET_LOCK','Syntax:\nGET_LOCK(str,timeout)\n\nTries to obtain a lock with a name given by the string str, using a\ntimeout of timeout seconds. Returns 1 if the lock was obtained\nsuccessfully, 0 if the attempt timed out (for example, because another\nclient has previously locked the name), or NULL if an error occurred\n(such as running out of memory or the thread was killed with mysqladmin\nkill). If you have a lock obtained with GET_LOCK(), it is released when\nyou execute RELEASE_LOCK(), execute a new GET_LOCK(), or your\nconnection terminates (either normally or abnormally). Locks obtained\nwith GET_LOCK() do not interact with transactions. That is, committing\na transaction does not release any such locks obtained during the\ntransaction.\n\nThis function can be used to implement application locks or to simulate\nrecord locks. Names are locked on a server-wide basis. If a name has\nbeen locked by one client, GET_LOCK() blocks any request by another\nclient for a lock with the same name. This allows clients that agree on\na given lock name to use the name to perform cooperative advisory\nlocking. But be aware that it also allows a client that is not among\nthe set of cooperating clients to lock a name, either inadvertently or\ndeliberately, and thus prevent any of the cooperating clients from\nlocking that name. One way to reduce the likelihood of this is to use\nlock names that are database-specific or application-specific. For\nexample, use lock names of the form db_name.str or app_name.str.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','mysql> SELECT GET_LOCK(\'lock1\',10);\n -> 1\nmysql> SELECT IS_FREE_LOCK(\'lock2\');\n -> 1\nmysql> SELECT GET_LOCK(\'lock2\',10);\n -> 1\nmysql> SELECT RELEASE_LOCK(\'lock2\');\n -> 1\nmysql> SELECT RELEASE_LOCK(\'lock1\');\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (119,35,'UCASE','Syntax:\nUCASE(str)\n\nUCASE() is a synonym for UPPER().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (120,25,'SHOW BINLOG EVENTS','Syntax:\nSHOW BINLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n\nShows the events in the binary log. If you do not specify \'log_name\',\nthe first binary log is displayed.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-binlog-events.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-binlog-events.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (121,31,'MPOLYFROMWKB','MPolyFromWKB(wkb[,srid]), MultiPolygonFromWKB(wkb[,srid])\n\nConstructs a MULTIPOLYGON value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (122,22,'ITERATE','Syntax:\nITERATE label\n\nITERATE can appear only within LOOP, REPEAT, and WHILE statements.\nITERATE means "do the loop again."\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/iterate-statement.html\n\n','CREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n label1: LOOP\n SET p1 = p1 + 1;\n IF p1 < 10 THEN ITERATE label1; END IF;\n LEAVE label1;\n END LOOP label1;\n SET @x = p1;\nEND\n','http://dev.mysql.com/doc/refman/5.1/en/iterate-statement.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (123,26,'DO','Syntax:\nDO expr [, expr] ...\n\nDO executes the expressions but does not return any results. In most\nrespects, DO is shorthand for SELECT expr, ..., but has the advantage\nthat it is slightly faster when you do not care about the result.\n\nDO is useful primarily with functions that have side effects, such as\nRELEASE_LOCK().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/do.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/do.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (124,30,'CURTIME','Syntax:\nCURTIME()\n\nReturns the current time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu\nformat, depending on whether the function is used in a string or\nnumeric context. The value is expressed in the current time zone.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT CURTIME();\n -> \'23:50:26\'\nmysql> SELECT CURTIME() + 0;\n -> 235026.000000\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (125,35,'CHAR_LENGTH','Syntax:\nCHAR_LENGTH(str)\n\nReturns the length of the string str, measured in characters. A\nmulti-byte character counts as a single character. This means that for\na string containing five two-byte characters, LENGTH() returns 10,\nwhereas CHAR_LENGTH() returns 5.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (126,20,'BIGINT','BIGINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to 18446744073709551615.\n\nSERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (127,25,'SET','Syntax:\nSET variable_assignment [, variable_assignment] ...\n\nvariable_assignment:\n user_var_name = expr\n | [GLOBAL | SESSION] system_var_name = expr\n | [@@global. | @@session. | @@]system_var_name = expr\n\nThe SET statement assigns values to different types of variables that\naffect the operation of the server or your client. Older versions of\nMySQL employed SET OPTION, but this syntax is deprecated in favor of\nSET without OPTION.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/set-option.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/set-option.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (128,4,'CONV','Syntax:\nCONV(N,from_base,to_base)\n\nConverts numbers between different number bases. Returns a string\nrepresentation of the number N, converted from base from_base to base\nto_base. Returns NULL if any argument is NULL. The argument N is\ninterpreted as an integer, but may be specified as an integer or a\nstring. The minimum base is 2 and the maximum base is 36. If to_base is\na negative number, N is regarded as a signed number. Otherwise, N is\ntreated as unsigned. CONV() works with 64-bit precision.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT CONV(\'a\',16,2);\n -> \'1010\'\nmysql> SELECT CONV(\'6E\',18,8);\n -> \'172\'\nmysql> SELECT CONV(-17,10,-18);\n -> \'-H\'\nmysql> SELECT CONV(10+\'10\'+\'10\'+0xa,10,10);\n -> \'40\'\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (129,20,'DATE','DATE\n\nA date. The supported range is \'1000-01-01\' to \'9999-12-31\'. MySQL\ndisplays DATE values in \'YYYY-MM-DD\' format, but allows assignment of\nvalues to DATE columns using either strings or numbers.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (130,25,'SHOW OPEN TABLES','Syntax:\nSHOW OPEN TABLES [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW OPEN TABLES lists the non-TEMPORARY tables that are currently open\nin the table cache. See\nhttp://dev.mysql.com/doc/refman/5.1/en/table-cache.html. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in http://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nThe FROM and LIKE clauses may be used beginning with MySQL 5.1.24. The\nLIKE clause, if present, indicates which table names to match. The FROM\nclause, if present, restricts the tables shown to those present in the\ndb_name database.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-open-tables.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-open-tables.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (131,30,'EXTRACT','Syntax:\nEXTRACT(unit FROM date)\n\nThe EXTRACT() function uses the same kinds of unit specifiers as\nDATE_ADD() or DATE_SUB(), but extracts parts from the date rather than\nperforming date arithmetic.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT EXTRACT(YEAR FROM \'2009-07-02\');\n -> 2009\nmysql> SELECT EXTRACT(YEAR_MONTH FROM \'2009-07-02 01:02:03\');\n -> 200907\nmysql> SELECT EXTRACT(DAY_MINUTE FROM \'2009-07-02 01:02:03\');\n -> 20102\nmysql> SELECT EXTRACT(MICROSECOND\n -> FROM \'2003-01-02 10:30:00.000123\');\n -> 123\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (132,11,'ENCRYPT','Syntax:\nENCRYPT(str[,salt])\n\nEncrypts str using the Unix crypt() system call and returns a binary\nstring. The salt argument should be a string with at least two\ncharacters. If no salt argument is given, a random value is used.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','mysql> SELECT ENCRYPT(\'hello\');\n -> \'VxuFAJXVARROc\'\n','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (133,25,'SHOW STATUS','Syntax:\nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW STATUS provides server status information. This information also\ncan be obtained using the mysqladmin extended-status command. The LIKE\nclause, if present, indicates which variable names to match. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in http://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\nThis statement does not require any privilege. It requires only the\nability to connect to the server.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern:\n\nmysql> SHOW STATUS LIKE \'Key%\';\n+--------------------+----------+\n| Variable_name | Value |\n+--------------------+----------+\n| Key_blocks_used | 14955 |\n| Key_read_requests | 96854827 |\n| Key_reads | 162040 |\n| Key_write_requests | 7589728 |\n| Key_writes | 3813196 |\n+--------------------+----------+\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for\nall connections to MySQL. With SESSION, it displays the status values\nfor the current connection. If no modifier is present, the default is\nSESSION. LOCAL is a synonym for SESSION.\n\nSome status variables have only a global value. For these, you get the\nsame value for both GLOBAL and SESSION. The scope for each status\nvariable is listed at\nhttp://dev.mysql.com/doc/refman/5.1/en/server-status-variables.html.\n\nEach invocation of the SHOW STATUS statement uses an internal temporary\ntable and increments the global Created_tmp_tables value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-status.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (134,35,'EXTRACTVALUE','Syntax:\nExtractValue(xml_frag, xpath_expr)\n\nExtractValue() takes two string arguments, a fragment of XML markup\nxml_frag and an XPath expression xpath_expr (also known as a locator);\nit returns the text (CDATA) of the first text node which is a child of\nthe element(s) matched by the XPath expression. It is the equivalent of\nperforming a match using the xpath_expr after appending /text(). In\nother words, ExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b\') and\nExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b/text()\') produce the same\nresult.\n\nIf multiple matches are found, then the content of the first child text\nnode of each matching element is returned (in the order matched) as a\nsingle, space-delimited string.\n\nIf no matching text node is found for the expression (including the\nimplicit /text()) --- for whatever reason, as long as xpath_expr is\nvalid, and xml_frag consists of elements which are properly nested and\nclosed --- an empty string is returned. No distinction is made between\na match on an empty element and no match at all. This is by design.\n\nIf you need to determine whether no matching element was found in\nxml_frag or such an element was found but contained no child text\nnodes, you should test the result of an expression that uses the XPath\ncount() function. For example, both of these statements return an empty\nstring, as shown here:\n\nmysql> SELECT ExtractValue(\'<a><b/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue(\'<a><c/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nHowever, you can determine whether there was actually a matching\nelement using the following:\n\nmysql> SELECT ExtractValue(\'<a><b/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 1 |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue(\'<a><c/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 0 |\n+-------------------------------------+\n1 row in set (0.01 sec)\n\n*Important*: ExtractValue() returns only CDATA, and does not return any\ntags that might be contained within a matching tag, nor any of their\ncontent (see the result returned as val1 in the following example).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html\n\n','mysql> SELECT\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a\') AS val1,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a/b\') AS val2,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'//b\') AS val3,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/b\') AS val4,\n -> ExtractValue(\'<a>ccc<b>ddd</b><b>eee</b></a>\', \'//b\') AS val5;\n\n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\n+------+------+------+------+---------+\n','http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (135,11,'OLD_PASSWORD','Syntax:\nOLD_PASSWORD(str)\n\nOLD_PASSWORD() was added to MySQL when the implementation of PASSWORD()\nwas changed to improve security. OLD_PASSWORD() returns the value of\nthe old (pre-4.1) implementation of PASSWORD() as a binary string, and\nis intended to permit you to reset passwords for any pre-4.1 clients\nthat need to connect to your version 5.1 MySQL server without locking\nthem out. See\nhttp://dev.mysql.com/doc/refman/5.1/en/password-hashing.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,22,'SET VARIABLE','Syntax:\nSET var_name = expr [, var_name = expr] ...\n\nThe SET statement in stored programs is an extended version of the\ngeneral SET statement (see [HELP SET]). Each var_name may refer to a\nlocal variable declared inside a stored program, a system variable, or\na user-defined variable.\n\nThe SET statement in stored programs is implemented as part of the\npre-existing SET syntax. This allows an extended syntax of SET a=x,\nb=y, ... where different variable types (locally declared variables,\nglobal and session system variables, user-defined variables) can be\nmixed. This also allows combinations of local variables and some\noptions that make sense only for system variables; in that case, the\noptions are recognized but ignored.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/set-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/set-statement.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,35,'FORMAT','Syntax:\nFORMAT(X,D)\n\nFormats the number X to a format like \'#,###,###.##\', rounded to D\ndecimal places, and returns the result as a string. If D is 0, the\nresult has no decimal point or fractional part.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT FORMAT(12332.123456, 4);\n -> \'12,332.1235\'\nmysql> SELECT FORMAT(12332.1,4);\n -> \'12,332.1000\'\nmysql> SELECT FORMAT(12332.2,0);\n -> \'12,332\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,13,'||','Syntax:\nOR, ||\n\nLogical OR. When both operands are non-NULL, the result is 1 if any\noperand is nonzero, and 0 otherwise. With a NULL operand, the result is\n1 if the other operand is nonzero, and NULL otherwise. If both operands\nare NULL, the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html\n\n','mysql> SELECT 1 || 1;\n -> 1\nmysql> SELECT 1 || 0;\n -> 1\nmysql> SELECT 0 || 0;\n -> 0\nmysql> SELECT 0 || NULL;\n -> NULL\nmysql> SELECT 1 || NULL;\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (139,35,'BIT_LENGTH','Syntax:\nBIT_LENGTH(str)\n\nReturns the length of the string str in bits.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT BIT_LENGTH(\'text\');\n -> 32\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (140,2,'EXTERIORRING','ExteriorRing(poly)\n\nReturns the exterior ring of the Polygon value poly as a LineString.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nmysql> SELECT AsText(ExteriorRing(GeomFromText(@poly)));\n+-------------------------------------------+\n| AsText(ExteriorRing(GeomFromText(@poly))) |\n+-------------------------------------------+\n| LINESTRING(0 0,0 3,3 3,3 0,0 0) |\n+-------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#polygon-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (141,31,'GEOMFROMWKB','GeomFromWKB(wkb[,srid]), GeometryFromWKB(wkb[,srid])\n\nConstructs a geometry value of any type using its WKB representation\nand SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (142,25,'SHOW SLAVE HOSTS','Syntax:\nSHOW SLAVE HOSTS\n\nDisplays a list of replication slaves currently registered with the\nmaster. Only slaves started with the --report-host=host_name option are\nvisible in this list.\n\nThe list is displayed on any server (not just the master server). The\noutput looks like this:\n\nmysql> SHOW SLAVE HOSTS;\n+------------+-----------+------+-----------+\n| Server_id | Host | Port | Master_id |\n+------------+-----------+------+-----------+\n| 192168010 | iconnect2 | 3306 | 192168011 |\n| 1921680101 | athena | 3306 | 192168011 |\n+------------+-----------+------+-----------+\n\no Server_id: The unique server ID of the slave server, as configured in\n the server\'s option file, or on the command line with\n --server-id=value.\n\no Host: The host name of the slave server, as configured in the\n server\'s option file, or on the command line with\n --report-host=host_name. Note that this can differ from the machine\n name as configured in the operating system.\n\no Port: The port the slave server is listening on.\n\no Master_id: The unique server ID of the master server that the slave\n server is replicating from.\n\nSome MySQL versions report another variable, Rpl_recovery_rank. This\nvariable was never used, and was eventually removed.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-slave-hosts.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-slave-hosts.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (143,8,'START TRANSACTION','Syntax:\nSTART TRANSACTION [WITH CONSISTENT SNAPSHOT] | BEGIN [WORK]\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nSET autocommit = {0 | 1}\n\nThe START TRANSACTION or BEGIN statement begins a new transaction.\nCOMMIT commits the current transaction, making its changes permanent.\nROLLBACK rolls back the current transaction, canceling its changes. The\nSET autocommit statement disables or enables the default autocommit\nmode for the current session.\n\nThe optional WORK keyword is supported for COMMIT and ROLLBACK, as are\nthe CHAIN and RELEASE clauses. CHAIN and RELEASE can be used for\nadditional control over transaction completion. The value of the\ncompletion_type system variable determines the default completion\nbehavior. See\nhttp://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html.\n\n*Note*: Within all stored programs (stored procedures and functions,\ntriggers, and events), the parser treats BEGIN [WORK] as the beginning\nof a BEGIN ... END block. Begin a transaction in this context with\nSTART TRANSACTION instead.\n\nThe AND CHAIN clause causes a new transaction to begin as soon as the\ncurrent one ends, and the new transaction has the same isolation level\nas the just-terminated transaction. The RELEASE clause causes the\nserver to disconnect the current client session after terminating the\ncurrent transaction. Including the NO keyword suppresses CHAIN or\nRELEASE completion, which can be useful if the completion_type system\nvariable is set to cause chaining or release completion by default.\n\nBy default, MySQL runs with autocommit mode enabled. This means that as\nsoon as you execute a statement that updates (modifies) a table, MySQL\nstores the update on disk to make it permanent. To disable autocommit\nmode, use the following statement:\n\nSET autocommit=0;\n\nAfter disabling autocommit mode by setting the autocommit variable to\nzero, changes to transaction-safe tables (such as those for InnoDB or\nNDBCLUSTER) are not made permanent immediately. You must use COMMIT to\nstore your changes to disk or ROLLBACK to ignore the changes.\n\nTo disable autocommit mode for a single series of statements, use the\nSTART TRANSACTION statement:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/commit.html\n\n','START TRANSACTION;\nSELECT @A:=SUM(salary) FROM table1 WHERE type=1;\nUPDATE table2 SET summary=@A WHERE type=1;\nCOMMIT;\n','http://dev.mysql.com/doc/refman/5.1/en/commit.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (144,17,'BETWEEN AND','Syntax:\nexpr BETWEEN min AND max\n\nIf expr is greater than or equal to min and expr is less than or equal\nto max, BETWEEN returns 1, otherwise it returns 0. This is equivalent\nto the expression (min <= expr AND expr <= max) if all the arguments\nare of the same type. Otherwise type conversion takes place according\nto the rules described in\nhttp://dev.mysql.com/doc/refman/5.1/en/type-conversion.html, but\napplied to all the three arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 2 BETWEEN 1 AND 3, 2 BETWEEN 3 and 1;\n -> 1, 0\nmysql> SELECT 1 BETWEEN 2 AND 3;\n -> 0\nmysql> SELECT \'b\' BETWEEN \'a\' AND \'c\';\n -> 1\nmysql> SELECT 2 BETWEEN 2 AND \'3\';\n -> 1\nmysql> SELECT 2 BETWEEN 2 AND \'x-3\';\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (145,23,'MULTIPOLYGON','MultiPolygon(poly1,poly2,...)\n\nConstructs a MultiPolygon value from a set of Polygon or WKB Polygon\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (146,30,'TIME_FORMAT','Syntax:\nTIME_FORMAT(time,format)\n\nThis is used like the DATE_FORMAT() function, but the format string may\ncontain format specifiers only for hours, minutes, seconds, and\nmicroseconds. Other specifiers produce a NULL value or 0.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIME_FORMAT(\'100:00:00\', \'%H %k %h %I %l\');\n -> \'100 100 04 04 4\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (147,35,'LEFT','Syntax:\nLEFT(str,len)\n\nReturns the leftmost len characters from the string str, or NULL if any\nargument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT LEFT(\'foobarbar\', 5);\n -> \'fooba\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (148,25,'FLUSH QUERY CACHE','You can defragment the query cache to better utilize its memory with\nthe FLUSH QUERY CACHE statement. The statement does not remove any\nqueries from the cache.\n\nThe RESET QUERY CACHE statement removes all query results from the\nquery cache. The FLUSH TABLES statement also does this.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/query-cache-status-and-maintenance.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/query-cache-status-and-maintenance.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (149,20,'SET DATA TYPE','SET(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA set. A string object that can have zero or more values, each of which\nmust be chosen from the list of values \'value1\', \'value2\', ... A SET\ncolumn can have a maximum of 64 members. SET values are represented\ninternally as integers.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (150,4,'RAND','Syntax:\nRAND(), RAND(N)\n\nReturns a random floating-point value v in the range 0 <= v < 1.0. If a\nconstant integer argument N is specified, it is used as the seed value,\nwhich produces a repeatable sequence of column values. In the following\nexample, note that the sequences of values produced by RAND(3) is the\nsame both places where it occurs.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> CREATE TABLE t (i INT);\nQuery OK, 0 rows affected (0.42 sec)\n\nmysql> INSERT INTO t VALUES(1),(2),(3);\nQuery OK, 3 rows affected (0.00 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n\nmysql> SELECT i, RAND() FROM t;\n+------+------------------+\n| i | RAND() |\n+------+------------------+\n| 1 | 0.61914388706828 |\n| 2 | 0.93845168309142 |\n| 3 | 0.83482678498591 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nmysql> SELECT i, RAND(3) FROM t;\n+------+------------------+\n| i | RAND(3) |\n+------+------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.37307905813035 |\n| 3 | 0.14808605345719 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nmysql> SELECT i, RAND() FROM t;\n+------+------------------+\n| i | RAND() |\n+------+------------------+\n| 1 | 0.35877890638893 |\n| 2 | 0.28941420772058 |\n| 3 | 0.37073435016976 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nmysql> SELECT i, RAND(3) FROM t;\n+------+------------------+\n| i | RAND(3) |\n+------+------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.37307905813035 |\n| 3 | 0.14808605345719 |\n+------+------------------+\n3 rows in set (0.01 sec)\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (151,35,'RPAD','Syntax:\nRPAD(str,len,padstr)\n\nReturns the string str, right-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT RPAD(\'hi\',5,\'?\');\n -> \'hi???\'\nmysql> SELECT RPAD(\'hi\',1,\'?\');\n -> \'h\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (152,37,'CREATE DATABASE','Syntax:\nCREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n [create_specification] ...\n\ncreate_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n\nCREATE DATABASE creates a database with the given name. To use this\nstatement, you need the CREATE privilege for the database. CREATE\nSCHEMA is a synonym for CREATE DATABASE.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-database.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-database.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (153,20,'DEC','DEC[(M[,D])] [UNSIGNED] [ZEROFILL], NUMERIC[(M[,D])] [UNSIGNED]\n[ZEROFILL], FIXED[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nThese types are synonyms for DECIMAL. The FIXED synonym is available\nfor compatibility with other database systems.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (154,16,'VAR_POP','Syntax:\nVAR_POP(expr)\n\nReturns the population standard variance of expr. It considers rows as\nthe whole population, not as a sample, so it has the number of rows as\nthe denominator. You can also use VARIANCE(), which is equivalent but\nis not standard SQL.\n\nVAR_POP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (155,35,'ELT','Syntax:\nELT(N,str1,str2,str3,...)\n\nReturns str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is\nless than 1 or greater than the number of arguments. ELT() is the\ncomplement of FIELD().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT ELT(1, \'ej\', \'Heja\', \'hej\', \'foo\');\n -> \'ej\'\nmysql> SELECT ELT(4, \'ej\', \'Heja\', \'hej\', \'foo\');\n -> \'foo\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (156,37,'ALTER VIEW','Syntax:\nALTER\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n\nThis statement changes the definition of a view, which must exist. The\nsyntax is similar to that for CREATE VIEW and the effect is the same as\nfor CREATE OR REPLACE VIEW. See [HELP CREATE VIEW]. This statement\nrequires the CREATE VIEW and DROP privileges for the view, and some\nprivilege for each column referred to in the SELECT statement. As of\nMySQL 5.1.23, ALTER VIEW is allowed only to the definer or users with\nthe SUPER privilege.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/alter-view.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/alter-view.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (157,25,'SHOW DATABASES','Syntax:\nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW DATABASES lists the databases on the MySQL server host. SHOW\nSCHEMAS is a synonym for SHOW DATABASES. The LIKE clause, if present,\nindicates which database names to match. The WHERE clause can be given\nto select rows using more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nYou see only those databases for which you have some kind of privilege,\nunless you have the global SHOW DATABASES privilege. You can also get\nthis list using the mysqlshow command.\n\nIf the server was started with the --skip-show-database option, you\ncannot use this statement at all unless you have the SHOW DATABASES\nprivilege.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-databases.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-databases.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (158,18,'~','Syntax:\n~\n\nInvert all bits.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html\n\n','mysql> SELECT 5 & ~1;\n -> 4\n','http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (159,20,'TEXT','TEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 65,535 (216 - 1) characters. The\neffective maximum length is less if the value contains multi-byte\ncharacters. Each TEXT value is stored using a two-byte length prefix\nthat indicates the number of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest TEXT type large enough to hold\nvalues M characters long.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (160,35,'CONCAT_WS','Syntax:\nCONCAT_WS(separator,str1,str2,...)\n\nCONCAT_WS() stands for Concatenate With Separator and is a special form\nof CONCAT(). The first argument is the separator for the rest of the\narguments. The separator is added between the strings to be\nconcatenated. The separator can be a string, as can the rest of the\narguments. If the separator is NULL, the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last Name\');\n -> \'First name,Second name,Last Name\'\nmysql> SELECT CONCAT_WS(\',\',\'First name\',NULL,\'Last Name\');\n -> \'First name,Last Name\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (161,15,'ROW_COUNT','Syntax:\nROW_COUNT()\n\nROW_COUNT() returns the number of rows updated, inserted, or deleted by\nthe preceding statement. This is the same as the row count that the\nmysql client displays and the value from the mysql_affected_rows() C\nAPI function.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> INSERT INTO t VALUES(1),(2),(3);\nQuery OK, 3 rows affected (0.00 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n\nmysql> SELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n1 row in set (0.00 sec)\n\nmysql> DELETE FROM t WHERE i IN(1,2);\nQuery OK, 2 rows affected (0.00 sec)\n\nmysql> SELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 2 |\n+-------------+\n1 row in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (162,4,'ASIN','Syntax:\nASIN(X)\n\nReturns the arc sine of X, that is, the value whose sine is X. Returns\nNULL if X is not in the range -1 to 1.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT ASIN(0.2);\n -> 0.20135792079033\nmysql> SELECT ASIN(\'foo\');\n\n+-------------+\n| ASIN(\'foo\') |\n+-------------+\n| 0 |\n+-------------+\n1 row in set, 1 warning (0.00 sec)\n\nmysql> SHOW WARNINGS;\n+---------+------+-----------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: \'foo\' |\n+---------+------+-----------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (163,4,'SIGN','Syntax:\nSIGN(X)\n\nReturns the sign of the argument as -1, 0, or 1, depending on whether X\nis negative, zero, or positive.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT SIGN(-32);\n -> -1\nmysql> SELECT SIGN(0);\n -> 0\nmysql> SELECT SIGN(234);\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (164,30,'SEC_TO_TIME','Syntax:\nSEC_TO_TIME(seconds)\n\nReturns the seconds argument, converted to hours, minutes, and seconds,\nas a TIME value. The range of the result is constrained to that of the\nTIME data type. A warning occurs if the argument corresponds to a value\noutside that range.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT SEC_TO_TIME(2378);\n -> \'00:39:38\'\nmysql> SELECT SEC_TO_TIME(2378) + 0;\n -> 3938\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (165,20,'FLOAT','FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA small (single-precision) floating-point number. Allowable values are\n-3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to\n3.402823466E+38. These are the theoretical limits, based on the IEEE\nstandard. The actual range might be slightly smaller depending on your\nhardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits allowed by the hardware. A single-precision floating-point\nnumber is accurate to approximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all\ncalculations in MySQL are done with double precision. See\nhttp://dev.mysql.com/doc/refman/5.1/en/no-matching-rows.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (166,35,'LOCATE','Syntax:\nLOCATE(substr,str), LOCATE(substr,str,pos)\n\nThe first syntax returns the position of the first occurrence of\nsubstring substr in string str. The second syntax returns the position\nof the first occurrence of substring substr in string str, starting at\nposition pos. Returns 0 if substr is not in str.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT LOCATE(\'bar\', \'foobarbar\');\n -> 4\nmysql> SELECT LOCATE(\'xbar\', \'foobar\');\n -> 0\nmysql> SELECT LOCATE(\'bar\', \'foobarbar\', 5);\n -> 7\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,25,'SHOW EVENTS','Syntax:\nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n\nIn its simplest form, SHOW EVENTS lists all of the events in the\ncurrent schema:\n\nmysql> SELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n1 row in set (0.00 sec)\n\nmysql> SHOW EVENTS\\G\n*************************** 1. row ***************************\n Db: myschema\n Name: e_daily\n Definer: jon@ghidora\n Time zone: SYSTEM\n Type: RECURRING\n Execute at: NULL\n Interval value: 10\n Interval field: SECOND\n Starts: 2006-02-09 10:41:23\n Ends: NULL\n Status: ENABLED\n Originator: 0\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nTo see events for a specific schema, use the FROM clause. For example,\nto see events for the test schema, use the following statement:\n\nSHOW EVENTS FROM test;\n\nThe LIKE clause, if present, indicates which event names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-events.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-events.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (168,15,'CHARSET','Syntax:\nCHARSET(str)\n\nReturns the character set of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT CHARSET(\'abc\');\n -> \'latin1\'\nmysql> SELECT CHARSET(CONVERT(\'abc\' USING utf8));\n -> \'utf8\'\nmysql> SELECT CHARSET(USER());\n -> \'utf8\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (169,30,'SUBDATE','Syntax:\nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument, SUBDATE()\nis a synonym for DATE_SUB(). For information on the INTERVAL unit\nargument, see the discussion for DATE_ADD().\n\nmysql> SELECT DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\nmysql> SELECT SUBDATE(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\n\nThe second form allows the use of an integer value for days. In such\ncases, it is interpreted as the number of days to be subtracted from\nthe date or datetime expression expr.\n\nmysql> SELECT SUBDATE(\'2008-01-02 12:00:00\', 31);\n -> \'2007-12-02 12:00:00\'\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (170,30,'DAYOFYEAR','Syntax:\nDAYOFYEAR(date)\n\nReturns the day of the year for date, in the range 1 to 366.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFYEAR(\'2007-02-03\');\n -> 34\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (171,20,'LONGTEXT','LONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 4,294,967,295 or 4GB (232 - 1)\ncharacters. The effective maximum length is less if the value contains\nmulti-byte characters. The effective maximum length of LONGTEXT columns\nalso depends on the configured maximum packet size in the client/server\nprotocol and available memory. Each LONGTEXT value is stored using a\nfour-byte length prefix that indicates the number of bytes in the\nvalue.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (172,4,'%','Syntax:\nN % M\n\nModulo operation. Returns the remainder of N divided by M. For more\ninformation, see the description for the MOD() function in\nhttp://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (173,25,'KILL','Syntax:\nKILL [CONNECTION | QUERY] thread_id\n\nEach connection to mysqld runs in a separate thread. You can see which\nthreads are running with the SHOW PROCESSLIST statement and kill a\nthread with the KILL thread_id statement.\n\nKILL allows the optional CONNECTION or QUERY modifier:\n\no KILL CONNECTION is the same as KILL with no modifier: It terminates\n the connection associated with the given thread_id.\n\no KILL QUERY terminates the statement that the connection is currently\n executing, but leaves the connection itself intact.\n\nIf you have the PROCESS privilege, you can see all threads. If you have\nthe SUPER privilege, you can kill all threads and statements.\nOtherwise, you can see and kill only your own threads and statements.\n\nYou can also use the mysqladmin processlist and mysqladmin kill\ncommands to examine and kill threads.\n\n*Note*: You cannot use KILL with the Embedded MySQL Server library\nbecause the embedded server merely runs inside the threads of the host\napplication. It does not create any connection threads of its own.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/kill.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/kill.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (174,29,'DISJOINT','Disjoint(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially disjoint from (does\nnot intersect) g2.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (175,3,'ASTEXT','AsText(g), AsWKT(g)\n\nConverts a value in internal geometry format to its WKT representation\nand returns the string result.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-to-convert-geometries-between-formats.html\n\n','mysql> SET @g = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(GeomFromText(@g));\n+--------------------------+\n| AsText(GeomFromText(@g)) |\n+--------------------------+\n| LINESTRING(1 1,2 2,3 3) |\n+--------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/functions-to-convert-geometries-between-formats.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (176,35,'LPAD','Syntax:\nLPAD(str,len,padstr)\n\nReturns the string str, left-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT LPAD(\'hi\',4,\'??\');\n -> \'??hi\'\nmysql> SELECT LPAD(\'hi\',1,\'??\');\n -> \'h\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (177,19,'RESTORE TABLE','Syntax:\nRESTORE TABLE tbl_name [, tbl_name] ... FROM \'/path/to/backup/directory\'\n\n*Note*: This statement is deprecated and is removed in MySQL 5.5.\n\nRESTORE TABLE restores the table or tables from a backup that was made\nwith BACKUP TABLE. The directory should be specified as a full path\nname.\n\nExisting tables are not overwritten; if you try to restore over an\nexisting table, an error occurs. Just as for BACKUP TABLE, RESTORE\nTABLE currently works only for MyISAM tables. Restored tables are not\nreplicated from master to slave.\n\nThe backup for each table consists of its .frm format file and .MYD\ndata file. The restore operation restores those files, and then uses\nthem to rebuild the .MYI index file. Restoring takes longer than\nbacking up due to the need to rebuild the indexes. The more indexes the\ntable has, the longer it takes.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/restore-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/restore-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (178,22,'DECLARE CONDITION','Syntax:\nDECLARE condition_name CONDITION FOR condition_value\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | mysql_error_code\n\nThe DECLARE ... CONDITION statement defines a named error condition. It\nspecifies a condition that needs specific handling and associates a\nname with that condition. The name can be referred to in a subsequent\nDECLARE ... HANDLER statement. For an example, see [HELP DECLARE\nHANDLER].\n\nA condition_value for DECLARE ... CONDITION can be an SQLSTATE value (a\n5-character string literal) or a MySQL error code (a number). You\nshould not use SQLSTATE value \'00000\' or MySQL error code 0, because\nthose indicate success rather than an error condition. For a list of\nSQLSTATE values and MySQL error codes, see\nhttp://dev.mysql.com/doc/refman/5.1/en/error-messages-server.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/declare-condition.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/declare-condition.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (179,29,'OVERLAPS','Overlaps(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially overlaps g2. The term\nspatially overlaps is used if two geometries intersect and their\nintersection results in a geometry of the same dimension but not equal\nto either of the given geometries.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (180,25,'SET GLOBAL SQL_SLAVE_SKIP_COUNTER','Syntax:\nSET GLOBAL sql_slave_skip_counter = N\n\nThis statement skips the next N events from the master. This is useful\nfor recovering from replication stops caused by a statement.\n\nThis statement is valid only when the slave threads are not running.\nOtherwise, it produces an error.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/set-global-sql-slave-skip-counter.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/set-global-sql-slave-skip-counter.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (181,24,'NUMGEOMETRIES','NumGeometries(gc)\n\nReturns the number of geometries in the GeometryCollection value gc.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#geometrycollection-property-functions\n\n','mysql> SET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\nmysql> SELECT NumGeometries(GeomFromText(@gc));\n+----------------------------------+\n| NumGeometries(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#geometrycollection-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (182,30,'MONTHNAME','Syntax:\nMONTHNAME(date)\n\nReturns the full name of the month for date. As of MySQL 5.1.12, the\nlanguage used for the name is controlled by the value of the\nlc_time_names system variable\n(http://dev.mysql.com/doc/refman/5.1/en/locale-support.html).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MONTHNAME(\'2008-02-03\');\n -> \'February\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (183,36,'PROCEDURE ANALYSE','Syntax:\nANALYSE([max_elements[,max_memory]])\n\nANALYSE() is defined in the sql/sql_analyse.cc source file, which\nserves as an example of how to create a procedure for use with the\nPROCEDURE clause of SELECT statements. ANALYSE() is built in and is\navailable by default; other procedures can be created using the format\ndemonstrated in the source file.\n\nANALYSE() examines the result from a query and returns an analysis of\nthe results that suggests optimal data types for each column that may\nhelp reduce table sizes. To obtain this analysis, append PROCEDURE\nANALYSE to the end of a SELECT statement:\n\nSELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,[max_memory]])\n\nFor example:\n\nSELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);\n\nThe results show some statistics for the values returned by the query,\nand propose an optimal data type for the columns. This can be helpful\nfor checking your existing tables, or after importing new data. You may\nneed to try different settings for the arguments so that PROCEDURE\nANALYSE() does not suggest the ENUM data type when it is not\nappropriate.\n\nThe arguments are optional and are used as follows:\n\no max_elements (default 256) is the maximum number of distinct values\n that ANALYSE() notices per column. This is used by ANALYSE() to check\n whether the optimal data type should be of type ENUM; if there are\n more than max_elements distinct values, then ENUM is not a suggested\n type.\n\no max_memory (default 8192) is the maximum amount of memory that\n ANALYSE() should allocate per column while trying to find all\n distinct values.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/procedure-analyse.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/procedure-analyse.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,25,'CHANGE MASTER TO','Syntax:\nCHANGE MASTER TO option [, option] ...\n\noption:\n MASTER_BIND = \'interface_name\'\n | MASTER_HOST = \'host_name\'\n | MASTER_USER = \'user_name\'\n | MASTER_PASSWORD = \'password\'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = interval\n | MASTER_HEARTBEAT_PERIOD = interval\n | MASTER_LOG_FILE = \'master_log_name\'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = \'relay_log_name\'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = \'ca_file_name\'\n | MASTER_SSL_CAPATH = \'ca_directory_name\'\n | MASTER_SSL_CERT = \'cert_file_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n\nCHANGE MASTER TO changes the parameters that the slave server uses for\nconnecting to the master server, for reading the master binary log, and\nreading the slave relay log. It also updates the contents of the\nmaster.info and relay-log.info files. To use CHANGE MASTER TO, the\nslave replication threads must be stopped (use STOP SLAVE if\nnecessary).\n\nOptions not specified retain their value, except as indicated in the\nfollowing discussion. Thus, in most cases, there is no need to specify\noptions that do not change. For example, if the password to connect to\nyour MySQL master has changed, you just need to issue these statements\nto tell the slave about the new password:\n\nSTOP SLAVE; -- if replication was running\nCHANGE MASTER TO MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE; -- if you want to restart replication\n\nMASTER_HOST, MASTER_USER, MASTER_PASSWORD, and MASTER_PORT provide\ninformation to the slave about how to connect to its master:\n\no MASTER_HOST and MASTER_PORT are the host name (or IP address) of the\n master host and its TCP/IP port.\n\n *Note*: Replication cannot use Unix socket files. You must be able to\n connect to the master MySQL server using TCP/IP.\n\n If you specify the MASTER_HOST or MASTER_PORT option, the slave\n assumes that the master server is different from before (even if the\n option value is the same as its current value.) In this case, the old\n values for the master binary log file name and position are\n considered no longer applicable, so if you do not specify\n MASTER_LOG_FILE and MASTER_LOG_POS in the statement,\n MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4 are silently appended to it.\n\n Setting MASTER_HOST=\'\' (that is, setting its value explicitly to an\n empty string) is not the same as not setting MASTER_HOST at all.\n Setting this option to an empty string causes START SLAVE\n subsequently to fail. This issue is addressed in MySQL 5.5.\n (Bug#28796 (http://bugs.mysql.com/bug.php?id=28796))\n\no MASTER_USER and MASTER_PASSWORD are the user name and password of the\n account to use for connecting to the master.\n\nThe MASTER_SSL_xxx options provide information about using SSL for the\nconnection. They correspond to the --ssl-xxx options described in\nhttp://dev.mysql.com/doc/refman/5.1/en/ssl-options.html, and\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-solutions-ssl.html.\nMASTER_SSL_VERIFY_SERVER_CERT was added in MySQL 5.1.18. These options\ncan be changed even on slaves that are compiled without SSL support.\nThey are saved to the master.info file, but are ignored if the slave\ndoes not have SSL support enabled.\n\nMASTER_CONNECT_RETRY specifies how many seconds to wait between connect\nretries. The default is 60. The number of reconnection attempts is\nlimited by the --master-retry-count server option; for more\ninformation, see\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-options.html.\n\nThe next two options (MASTER_BIND and MASTER_HEARTBEAT_PERIOD) are\navailable in MySQL Cluster NDB 6.3 and later, but are not supported in\nmainline MySQL 5.1:\n\nMASTER_BIND is for use on replication slaves having multiple network\ninterfaces, and determines which of the slave\'s network interfaces is\nchosen for connecting to the master. It is also possible to determine\nwhich network interface is to be used in such cases by starting the\nslave mysqld process with the --master-bind option.\n\nThe ability to bind a replication slave to specific network interface\nwas added in MySQL Cluster NDB 6.3.4.\n\nMASTER_HEARTBEAT_PERIOD is used to set the interval in seconds between\nreplication heartbeats. Whenever the master\'s binary log is updated\nwith an event, the waiting period for the next heartbeat is reset.\ninterval is a decimal value having the range 0 to 4294967 seconds and a\nresolution to hundredths of a second; the smallest nonzero value is\n0.01. Heartbeats are sent by the master only if there are no unsent\nevents in the binary log file for a period longer than interval.\n\nSetting interval to 0 disables heartbeats altogether. The default value\nfor interval is equal to the value of slave_net_timeout divided by 2.\n\nSetting @@global.slave_net_timeout to a value less than that of the\ncurrent heartbeat interval results in a warning being issued. The\neffect of issuing RESET SLAVE on the heartbeat interval is to reset it\nto the default value.\n\nMASTER_HEARTBEAT_PERIOD was added in MySQL Cluster NDB 6.3.4.\n\nMASTER_LOG_FILE and MASTER_LOG_POS are the coordinates at which the\nslave I/O thread should begin reading from the master the next time the\nthread starts. RELAY_LOG_FILE and RELAY_LOG_POS are the coordinates at\nwhich the slave SQL thread should begin reading from the relay log the\nnext time the thread starts. If you specify either of MASTER_LOG_FILE\nor MASTER_LOG_POS, you cannot specify RELAY_LOG_FILE or RELAY_LOG_POS.\nIf neither of MASTER_LOG_FILE or MASTER_LOG_POS is specified, the slave\nuses the last coordinates of the slave SQL thread before CHANGE MASTER\nTO was issued. This ensures that there is no discontinuity in\nreplication, even if the slave SQL thread was late compared to the\nslave I/O thread, when you merely want to change, say, the password to\nuse.\n\nCHANGE MASTER TO deletes all relay log files and starts a new one,\nunless you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay\nlog files are kept; the relay_log_purge global variable is set silently\nto 0.\n\nCHANGE MASTER TO is useful for setting up a slave when you have the\nsnapshot of the master and have recorded the master binary log\ncoordinates corresponding to the time of the snapshot. After loading\nthe snapshot into the slave to synchronize it to the slave, you can run\nCHANGE MASTER TO MASTER_LOG_FILE=\'log_name\', MASTER_LOG_POS=log_pos on\nthe slave to specify the coodinates at which the slave should begin\nreading the master binary log.\n\nThe following example changes the master server the slave uses and\nestablishes the master binary log coordinates from which the slave\nbegins reading. This is used when you want to set up the slave to\nreplicate the master:\n\nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\n\nThe next example shows an operation that is less frequently employed.\nIt is used when the slave has relay log files that you want it to\nexecute again for some reason. To do this, the master need not be\nreachable. You need only use CHANGE MASTER TO and start the SQL thread\n(START SLAVE SQL_THREAD):\n\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (185,37,'DROP DATABASE','Syntax:\nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n\nDROP DATABASE drops all tables in the database and deletes the\ndatabase. Be very careful with this statement! To use DROP DATABASE,\nyou need the DROP privilege on the database. DROP SCHEMA is a synonym\nfor DROP DATABASE.\n\n*Important*: When a database is dropped, user privileges on the\ndatabase are not automatically dropped. See [HELP GRANT].\n\nIF EXISTS is used to prevent an error from occurring if the database\ndoes not exist.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-database.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-database.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (186,6,'MBREQUAL','MBREqual(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are the same.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (187,30,'TIMESTAMP FUNCTION','Syntax:\nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n\nWith a single argument, this function returns the date or datetime\nexpression expr as a datetime value. With two arguments, it adds the\ntime expression expr2 to the date or datetime expression expr1 and\nreturns the result as a datetime value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMP(\'2003-12-31\');\n -> \'2003-12-31 00:00:00\'\nmysql> SELECT TIMESTAMP(\'2003-12-31 12:00:00\',\'12:00:00\');\n -> \'2004-01-01 00:00:00\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (188,35,'CHARACTER_LENGTH','Syntax:\nCHARACTER_LENGTH(str)\n\nCHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (189,25,'SHOW GRANTS','Syntax:\nSHOW GRANTS [FOR user]\n\nThis statement lists the GRANT statement or statements that must be\nissued to duplicate the privileges that are granted to a MySQL user\naccount. The account is named using the same format as for the GRANT\nstatement; for example, \'jeffrey\'@\'localhost\'. If you specify only the\nuser name part of the account name, a host name part of \'%\' is used.\nFor additional information about specifying account names, see [HELP\nGRANT].\n\nmysql> SHOW GRANTS FOR \'root\'@\'localhost\';\n+---------------------------------------------------------------------+\n| Grants for root@localhost |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION |\n+---------------------------------------------------------------------+\n\nTo list the privileges granted to the account that you are using to\nconnect to the server, you can use any of the following statements:\n\nSHOW GRANTS;\nSHOW GRANTS FOR CURRENT_USER;\nSHOW GRANTS FOR CURRENT_USER();\n\nAs of MySQL 5.1.12, if SHOW GRANTS FOR CURRENT_USER (or any of the\nequivalent syntaxes) is used in DEFINER context, such as within a\nstored procedure that is defined with SQL SECURITY DEFINER), the grants\ndisplayed are those of the definer and not the invoker.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-grants.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-grants.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (190,25,'SHOW PRIVILEGES','Syntax:\nSHOW PRIVILEGES\n\nSHOW PRIVILEGES shows the list of system privileges that the MySQL\nserver supports. The exact list of privileges depends on the version of\nyour server.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-privileges.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-privileges.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (191,37,'CREATE TABLESPACE','Syntax:\nCREATE TABLESPACE tablespace_name\n ADD DATAFILE \'file_name\'\n USE LOGFILE GROUP logfile_group\n [EXTENT_SIZE [=] extent_size]\n [INITIAL_SIZE [=] initial_size]\n [AUTOEXTEND_SIZE [=] autoextend_size]\n [MAX_SIZE [=] max_size]\n [NODEGROUP [=] nodegroup_id]\n [WAIT]\n [COMMENT [=] comment_text]\n ENGINE [=] engine_name\n\nThis statement is used to create a tablespace, which can contain one or\nmore data files, providing storage space for tables. One data file is\ncreated and added to the tablespace using this statement. Additional\ndata files may be added to the tablespace by using the ALTER TABLESPACE\nstatement (see [HELP ALTER TABLESPACE]). For rules covering the naming\nof tablespaces, see\nhttp://dev.mysql.com/doc/refman/5.1/en/identifiers.html.\n\n*Note*: All MySQL Cluster Disk Data objects share the same namespace.\nThis means that each Disk Data object must be uniquely named (and not\nmerely each Disk Data object of a given type). For example, you cannot\nhave a tablespace and a log file group with the same name, or a\ntablespace and a data file with the same name.\n\nPrior to MySQL Cluster NDB 6.2.17, 6.3.23, and 6.4.3, path and file\nnames for data files could not be longer than 128 characters.\n(Bug#31770 (http://bugs.mysql.com/bug.php?id=31770))\n\nA log file group of one or more UNDO log files must be assigned to the\ntablespace to be created with the USE LOGFILE GROUP clause.\nlogfile_group must be an existing log file group created with CREATE\nLOGFILE GROUP (see\nhttp://dev.mysql.com/doc/refman/5.1/en/create-logfile-group.html).\nMultiple tablespaces may use the same log file group for UNDO logging.\n\nThe EXTENT_SIZE sets the size, in bytes, of the extents used by any\nfiles belonging to the tablespace. The default value is 1M. The minimum\nsize is 32K, and theoretical maximum is 2G, although the practical\nmaximum size depends on a number of factors. In most cases, changing\nthe extent size does not have any measurable effect on performance, and\nthe default value is recommended for all but the most unusual\nsituations.\n\nAn extent is a unit of disk space allocation. One extent is filled with\nas much data as that extent can contain before another extent is used.\nIn theory, up to 65,535 (64K) extents may used per data file; however,\nthe recommended maximum is 32,768 (32K). The recommended maximum size\nfor a single data file is 32G --- that is, 32K extents x 1 MB per\nextent. In addition, once an extent is allocated to a given partition,\nit cannot be used to store data from a different partition; an extent\ncannot store data from more than one partition. This means, for example\nthat a tablespace having a single datafile whose INITIAL_SIZE is 256 MB\nand whose EXTENT_SIZE is 128M has just two extents, and so can be used\nto store data from at most two different disk data table partitions.\n\nYou can see how many extents remain free in a given data file by\nquerying the INFORMATION_SCHEMA.FILES table, and so derive an estimate\nfor how much space remains free in the file. For further discussion and\nexamples, see http://dev.mysql.com/doc/refman/5.1/en/files-table.html.\n\nThe INITIAL_SIZE parameter sets the data file\'s total size in bytes.\nOnce the file has been created, its size cannot be changed; however,\nyou can add more data files to the tablespace using ALTER TABLESPACE\n... ADD DATAFILE. See [HELP ALTER TABLESPACE].\n\nINITIAL_SIZE is optional; its default value is 128M.\n\nOn 32-bit systems, the maximum supported value for INITIAL_SIZE is 4G.\n(Bug#29186 (http://bugs.mysql.com/bug.php?id=29186))\n\nWhen setting EXTENT_SIZE or INITIAL_SIZE (either or both), you may\noptionally follow the number with a one-letter abbreviation for an\norder of magnitude, similar to those used in my.cnf. Generally, this is\none of the letters M (for megabytes) or G (for gigabytes).\n\nINITIAL_SIZE, EXTENT_SIZE, and UNDO_BUFFER_SIZE are subject to rounding\nas follows:\n\no EXTENT_SIZE and UNDO_BUFFER_SIZE are each rounded up to the nearest\n whole multiple of 32K.\n\no INITIAL_SIZE is rounded down to the nearest whole multiple of 32K.\n\n For data files, INITIAL_SIZE is subject to further rounding; the\n result just obtained is rounded up to the nearest whole multiple of\n EXTENT_SIZE (after any rounding).\n\nThe rounding just described has always (since Disk Data tablespaces\nwere introduced in MySQL 5.1.6) been performed implicitly, but\nbeginning with MySQL Cluster NDB 6.2.19, MySQL Cluster NDB 6.3.32,\nMySQL Cluster NDB 7.0.13, and MySQL Cluster NDB 7.1.2, this rounding is\ndone explicitly, and a warning is issued by the MySQL Server when any\nsuch rounding is performed. The rounded values are also used by the NDB\nkernel for calculating INFORMATION_SCHEMA.FILES column values and other\npurposes. However, to avoid an unexpected result, we suggest that you\nalways use whole multiples of 32K in specifying these options.\n\nAUTOEXTEND_SIZE, MAX_SIZE, NODEGROUP, WAIT, and COMMENT are parsed but\nignored, and so currently have no effect. These options are intended\nfor future expansion.\n\nThe ENGINE parameter determines the storage engine which uses this\ntablespace, with engine_name being the name of the storage engine. In\nMySQL 5.1, engine_name must be one of the values NDB or NDBCLUSTER.\n\nWhen CREATE TABLESPACE is used with ENGINE = NDB, a tablespace and\nassociated data file are created on each Cluster data node. You can\nverify that the data files were created and obtain information about\nthem by querying the INFORMATION_SCHEMA.FILES table. For example:\n\nmysql> SELECT LOGFILE_GROUP_NAME, FILE_NAME, EXTRA\n -> FROM INFORMATION_SCHEMA.FILES\n -> WHERE TABLESPACE_NAME = \'newts\' AND FILE_TYPE = \'DATAFILE\';\n+--------------------+-------------+----------------+\n| LOGFILE_GROUP_NAME | FILE_NAME | EXTRA |\n+--------------------+-------------+----------------+\n| lg_3 | newdata.dat | CLUSTER_NODE=3 |\n| lg_3 | newdata.dat | CLUSTER_NODE=4 |\n+--------------------+-------------+----------------+\n2 rows in set (0.01 sec)\n\n(See http://dev.mysql.com/doc/refman/5.1/en/files-table.html.)\n\nCREATE TABLESPACE was added in MySQL 5.1.6. In MySQL 5.1, it is useful\nonly with Disk Data storage for MySQL Cluster. See\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-disk-data.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-tablespace.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-tablespace.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (192,35,'INSERT FUNCTION','Syntax:\nINSERT(str,pos,len,newstr)\n\nReturns the string str, with the substring beginning at position pos\nand len characters long replaced by the string newstr. Returns the\noriginal string if pos is not within the length of the string. Replaces\nthe rest of the string from position pos if len is not within the\nlength of the rest of the string. Returns NULL if any argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT INSERT(\'Quadratic\', 3, 4, \'What\');\n -> \'QuWhattic\'\nmysql> SELECT INSERT(\'Quadratic\', -1, 4, \'What\');\n -> \'Quadratic\'\nmysql> SELECT INSERT(\'Quadratic\', 3, 100, \'What\');\n -> \'QuWhat\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (193,4,'CRC32','Syntax:\nCRC32(expr)\n\nComputes a cyclic redundancy check value and returns a 32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The argument is\nexpected to be a string and (if possible) is treated as one if it is\nnot.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT CRC32(\'MySQL\');\n -> 3259397556\nmysql> SELECT CRC32(\'mysql\');\n -> 2501908538\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (194,13,'XOR','Syntax:\nXOR\n\nLogical XOR. Returns NULL if either operand is NULL. For non-NULL\noperands, evaluates to 1 if an odd number of operands is nonzero,\notherwise 0 is returned.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html\n\n','mysql> SELECT 1 XOR 1;\n -> 0\nmysql> SELECT 1 XOR 0;\n -> 1\nmysql> SELECT 1 XOR NULL;\n -> NULL\nmysql> SELECT 1 XOR 1 XOR 1;\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (195,12,'STARTPOINT','StartPoint(ls)\n\nReturns the Point that is the start point of the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(StartPoint(GeomFromText(@ls)));\n+---------------------------------------+\n| AsText(StartPoint(GeomFromText(@ls))) |\n+---------------------------------------+\n| POINT(1 1) |\n+---------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#linestring-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (196,22,'DECLARE VARIABLE','Syntax:\nDECLARE var_name [, var_name] ... type [DEFAULT value]\n\nThis statement is used to declare local variables within stored\nprograms. To provide a default value for the variable, include a\nDEFAULT clause. The value can be specified as an expression; it need\nnot be a constant. If the DEFAULT clause is missing, the initial value\nis NULL.\n\nLocal variables are treated like stored routine parameters with respect\nto data type and overflow checking. See [HELP CREATE PROCEDURE].\n\nLocal variable names are not case sensitive.\n\nThe scope of a local variable is within the BEGIN ... END block where\nit is declared. The variable can be referred to in blocks nested within\nthe declaring block, except those blocks that declare a variable with\nthe same name.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/declare-local-variable.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/declare-local-variable.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (197,9,'GRANT','Syntax:\nGRANT\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n TO user [IDENTIFIED BY [PASSWORD] \'password\']\n [, user [IDENTIFIED BY [PASSWORD] \'password\']] ...\n [REQUIRE {NONE | ssl_option [[AND] ssl_option] ...}]\n [WITH with_option ...]\n\nobject_type:\n TABLE\n | FUNCTION\n | PROCEDURE\n\npriv_level:\n *\n | *.*\n | db_name.*\n | db_name.tbl_name\n | tbl_name\n | db_name.routine_name\n\nssl_option:\n SSL\n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n\nwith_option:\n GRANT OPTION\n | MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n\nThe GRANT statement enables system administrators to grant privileges\nto MySQL user accounts. GRANT also serves to specify other account\ncharacteristics such as use of secure connections and limits on access\nto server resources. To use GRANT, you must have the GRANT OPTION\nprivilege, and you must have the privileges that you are granting.\n\nNormally, CREATE USER is used to create an account and GRANT to define\nits privileges. However, if an account named in a GRANT statement does\nnot already exist, GRANT may create it under the conditions described\nlater in the discussion of the NO_AUTO_CREATE_USER SQL mode.\n\nThe REVOKE statement is related to GRANT and enables administrators to\nremove account privileges. To determine what privileges an account has,\nuse SHOW GRANTS. See [HELP REVOKE], and [HELP SHOW GRANTS].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/grant.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/grant.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (198,3,'MPOLYFROMTEXT','MPolyFromText(wkt[,srid]), MultiPolygonFromText(wkt[,srid])\n\nConstructs a MULTIPOLYGON value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (199,6,'MBRINTERSECTS','MBRIntersects(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 intersect.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (200,16,'BIT_OR','Syntax:\nBIT_OR(expr)\n\nReturns the bitwise OR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (201,30,'YEARWEEK','Syntax:\nYEARWEEK(date), YEARWEEK(date,mode)\n\nReturns year and week for a date. The mode argument works exactly like\nthe mode argument to WEEK(). The year in the result may be different\nfrom the year in the date argument for the first and the last week of\nthe year.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT YEARWEEK(\'1987-01-01\');\n -> 198653\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (202,17,'NOT BETWEEN','Syntax:\nexpr NOT BETWEEN min AND max\n\nThis is the same as NOT (expr BETWEEN min AND max).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (203,17,'IS NOT','Syntax:\nIS NOT boolean_value\n\nTests a value against a boolean value, where boolean_value can be TRUE,\nFALSE, or UNKNOWN.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT UNKNOWN;\n -> 1, 1, 0\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (204,4,'LOG10','Syntax:\nLOG10(X)\n\nReturns the base-10 logarithm of X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT LOG10(2);\n -> 0.30102999566398\nmysql> SELECT LOG10(100);\n -> 2\nmysql> SELECT LOG10(-100);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (205,4,'SQRT','Syntax:\nSQRT(X)\n\nReturns the square root of a nonnegative number X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT SQRT(4);\n -> 2\nmysql> SELECT SQRT(20);\n -> 4.4721359549996\nmysql> SELECT SQRT(-16);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (206,20,'DECIMAL','DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nA packed "exact" fixed-point number. M is the total number of digits\n(the precision) and D is the number of digits after the decimal point\n(the scale). The decimal point and (for negative numbers) the "-" sign\nare not counted in M. If D is 0, values have no decimal point or\nfractional part. The maximum number of digits (M) for DECIMAL is 65.\nThe maximum number of supported decimals (D) is 30. If D is omitted,\nthe default is 0. If M is omitted, the default is 10.\n\nUNSIGNED, if specified, disallows negative values.\n\nAll basic calculations (+, -, *, /) with DECIMAL columns are done with\na precision of 65 digits.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (207,37,'CREATE INDEX','Syntax:\nCREATE [ONLINE|OFFLINE] [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name\n [index_type]\n ON tbl_name (index_col_name,...)\n [index_option] ...\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH | RTREE}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n\nCREATE INDEX is mapped to an ALTER TABLE statement to create indexes.\nSee [HELP ALTER TABLE]. CREATE INDEX cannot be used to create a PRIMARY\nKEY; use ALTER TABLE instead. For more information about indexes, see\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-indexes.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-index.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-index.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (208,37,'CREATE FUNCTION','The CREATE FUNCTION statement is used to create stored functions and\nuser-defined functions (UDFs):\n\no For information about creating stored functions, see [HELP CREATE\n PROCEDURE].\n\no For information about creating user-defined functions, see [HELP\n CREATE FUNCTION UDF].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-function.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-function.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (209,37,'ALTER DATABASE','Syntax:\nALTER {DATABASE | SCHEMA} [db_name]\n alter_specification ...\nALTER {DATABASE | SCHEMA} db_name\n UPGRADE DATA DIRECTORY NAME\n\nalter_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n\nALTER DATABASE enables you to change the overall characteristics of a\ndatabase. These characteristics are stored in the db.opt file in the\ndatabase directory. To use ALTER DATABASE, you need the ALTER privilege\non the database. ALTER SCHEMA is a synonym for ALTER DATABASE.\n\nThe CHARACTER SET clause changes the default database character set.\nThe COLLATE clause changes the default database collation.\nhttp://dev.mysql.com/doc/refman/5.1/en/charset.html, discusses\ncharacter set and collation names.\n\nYou can see what character sets and collations are available using,\nrespectively, the SHOW CHARACTER SET and SHOW COLLATION statements. See\n[HELP SHOW CHARACTER SET], and [HELP SHOW COLLATION], for more\ninformation.\n\nThe database name can be omitted from the first syntax, in which case\nthe statement applies to the default database.\n\nThe syntax that includes the UPGRADE DATA DIRECTORY NAME clause was\nadded in MySQL 5.1.23. It updates the name of the directory associated\nwith the database to use the encoding implemented in MySQL 5.1 for\nmapping database names to database directory names (see\nhttp://dev.mysql.com/doc/refman/5.1/en/identifier-mapping.html). This\nclause is for use under these conditions:\n\no It is intended when upgrading MySQL to 5.1 or later from older\n versions.\n\no It is intended to update a database directory name to the current\n encoding format if the name contains special characters that need\n encoding.\n\no The statement is used by mysqlcheck (as invoked by mysql_upgrade).\n\nFor example,if a database in MySQL 5.0 has a name of a-b-c, the name\ncontains instance of the `-\' character. In 5.0, the database directory\nis also named a-b-c, which is not necessarily safe for all file\nsystems. In MySQL 5.1 and up, the same database name is encoded as\na@002db@002dc to produce a file system-neutral directory name.\n\nWhen a MySQL installation is upgraded to MySQL 5.1 or later from an\nolder version,the server displays a name such as a-b-c (which is in the\nold format) as #mysql50#a-b-c, and you must refer to the name using the\n#mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME in this case to\nexplicitly tell the server to re-encode the database directory name to\nthe current encoding format:\n\nALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;\n\nAfter executing this statement, you can refer to the database as a-b-c\nwithout the special #mysql50# prefix.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/alter-database.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/alter-database.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (210,24,'GEOMETRYN','GeometryN(gc,N)\n\nReturns the N-th geometry in the GeometryCollection value gc.\nGeometries are numbered beginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#geometrycollection-property-functions\n\n','mysql> SET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\nmysql> SELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\n+----------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#geometrycollection-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (211,18,'<<','Syntax:\n<<\n\nShifts a longlong (BIGINT) number to the left.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html\n\n','mysql> SELECT 1 << 2;\n -> 4\n','http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (212,25,'SHOW TABLE STATUS','Syntax:\nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TABLE STATUS works likes SHOW TABLES, but provides a lot of\ninformation about each non-TEMPORARY table. You can also get this list\nusing the mysqlshow --status db_name command. The LIKE clause, if\npresent, indicates which table names to match. The WHERE clause can be\ngiven to select rows using more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (213,11,'MD5','Syntax:\nMD5(str)\n\nCalculates an MD5 128-bit checksum for the string. The value is\nreturned as a binary string of 32 hex digits, or NULL if the argument\nwas NULL. The return value can, for example, be used as a hash key.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','mysql> SELECT MD5(\'testing\');\n -> \'ae2b1fca515949e5d54fb22b8ed95575\'\n','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (214,17,'<','Syntax:\n<\n\nLess than:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 2 < 2;\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (215,30,'UNIX_TIMESTAMP','Syntax:\nUNIX_TIMESTAMP(), UNIX_TIMESTAMP(date)\n\nIf called with no argument, returns a Unix timestamp (seconds since\n\'1970-01-01 00:00:00\' UTC) as an unsigned integer. If UNIX_TIMESTAMP()\nis called with a date argument, it returns the value of the argument as\nseconds since \'1970-01-01 00:00:00\' UTC. date may be a DATE string, a\nDATETIME string, a TIMESTAMP, or a number in the format YYMMDD or\nYYYYMMDD. The server interprets date as a value in the current time\nzone and converts it to an internal value in UTC. Clients can set their\ntime zone as described in\nhttp://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT UNIX_TIMESTAMP();\n -> 1196440210\nmysql> SELECT UNIX_TIMESTAMP(\'2007-11-30 10:30:19\');\n -> 1196440219\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (216,30,'DAYOFMONTH','Syntax:\nDAYOFMONTH(date)\n\nReturns the day of the month for date, in the range 1 to 31, or 0 for\ndates such as \'0000-00-00\' or \'2008-00-00\' that have a zero day part.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFMONTH(\'2007-02-03\');\n -> 3\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (217,35,'ASCII','Syntax:\nASCII(str)\n\nReturns the numeric value of the leftmost character of the string str.\nReturns 0 if str is the empty string. Returns NULL if str is NULL.\nASCII() works for 8-bit characters.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT ASCII(\'2\');\n -> 50\nmysql> SELECT ASCII(2);\n -> 50\nmysql> SELECT ASCII(\'dx\');\n -> 100\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (218,4,'DIV','Syntax:\nDIV\n\nInteger division. Similar to FLOOR(), but is safe with BIGINT values.\nIncorrect results may occur for noninteger operands that exceed BIGINT\nrange.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','mysql> SELECT 5 DIV 2;\n -> 2\n','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (219,9,'RENAME USER','Syntax:\nRENAME USER old_user TO new_user\n [, old_user TO new_user] ...\n\nThe RENAME USER statement renames existing MySQL accounts. To use it,\nyou must have the global CREATE USER privilege or the UPDATE privilege\nfor the mysql database. An error occurs if any old account does not\nexist or any new account exists. Each account is named using the same\nformat as for the GRANT statement; for example, \'jeffrey\'@\'localhost\'.\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used. For additional information about specifying\naccount names, see [HELP GRANT].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/rename-user.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/rename-user.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (220,25,'SHOW SLAVE STATUS','Syntax:\nSHOW SLAVE STATUS\n\nThis statement provides status information on essential parameters of\nthe slave threads. It requires either the SUPER or REPLICATION CLIENT\nprivilege.\n\nIf you issue this statement using the mysql client, you can use a \\G\nstatement terminator rather than a semicolon to obtain a more readable\nvertical layout:\n\nmysql> SHOW SLAVE STATUS\\G\n*************************** 1. row ***************************\n Slave_IO_State: Waiting for master to send event\n Master_Host: localhost\n Master_User: root\n Master_Port: 3306\n Connect_Retry: 3\n Master_Log_File: gbichot-bin.005\n Read_Master_Log_Pos: 79\n Relay_Log_File: gbichot-relay-bin.005\n Relay_Log_Pos: 548\n Relay_Master_Log_File: gbichot-bin.005\n Slave_IO_Running: Yes\n Slave_SQL_Running: Yes\n Replicate_Do_DB:\n Replicate_Ignore_DB:\n Replicate_Do_Table:\n Replicate_Ignore_Table:\n Replicate_Wild_Do_Table:\n Replicate_Wild_Ignore_Table:\n Last_Errno: 0\n Last_Error:\n Skip_Counter: 0\n Exec_Master_Log_Pos: 79\n Relay_Log_Space: 552\n Until_Condition: None\n Until_Log_File:\n Until_Log_Pos: 0\n Master_SSL_Allowed: No\n Master_SSL_CA_File:\n Master_SSL_CA_Path:\n Master_SSL_Cert:\n Master_SSL_Cipher:\n Master_SSL_Key:\n Seconds_Behind_Master: 8\nMaster_SSL_Verify_Server_Cert: No\n Last_IO_Errno: 0\n Last_IO_Error:\n Last_SQL_Errno: 0\n Last_SQL_Error:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-slave-status.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-slave-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (221,32,'GEOMETRY','MySQL provides a standard way of creating spatial columns for geometry\ntypes, for example, with CREATE TABLE or ALTER TABLE. Currently,\nspatial columns are supported for MyISAM, InnoDB, NDB, and ARCHIVE\ntables. See also the annotations about spatial indexes under [HELP\nSPATIAL].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-columns.html\n\n','CREATE TABLE geom (g GEOMETRY);\n','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-columns.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (222,12,'NUMPOINTS','NumPoints(ls)\n\nReturns the number of Point objects in the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#linestring-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (223,37,'ALTER LOGFILE GROUP','Syntax:\nALTER LOGFILE GROUP logfile_group\n ADD UNDOFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n\nThis statement adds an UNDO file named \'file_name\' to an existing log\nfile group logfile_group. An ALTER LOGFILE GROUP statement has one and\nonly one ADD UNDOFILE clause. No DROP UNDOFILE clause is currently\nsupported.\n\n*Note*: All MySQL Cluster Disk Data objects share the same namespace.\nThis means that each Disk Data object must be uniquely named (and not\nmerely each Disk Data object of a given type). For example, you cannot\nhave a tablespace and an undo log file with the same name, or an undo\nlog file and a data file with the same name.\n\nPrior to MySQL Cluster NDB 6.2.17, 6.3.23, and 6.4.3, path and file\nnames for undo log files could not be longer than 128 characters.\n(Bug#31769 (http://bugs.mysql.com/bug.php?id=31769))\n\nThe optional INITIAL_SIZE parameter sets the UNDO file\'s initial size\nin bytes; if not specified, the initial size default to 128M (128\nmegabytes). You may optionally follow size with a one-letter\nabbreviation for an order of magnitude, similar to those used in\nmy.cnf. Generally, this is one of the letters M (for megabytes) or G\n(for gigabytes).\n\nOn 32-bit systems, the maximum supported value for INITIAL_SIZE is 4G.\n(Bug#29186 (http://bugs.mysql.com/bug.php?id=29186))\n\nBeginning with MySQL Cluster NDB 2.1.18, 6.3.24, and 7.0.4, the minimum\nallowed value for INITIAL_SIZE is 1M. (Bug#29574\n(http://bugs.mysql.com/bug.php?id=29574))\n\n*Note*: WAIT is parsed but otherwise ignored, and so has no effect in\nMySQL 5.1 and MySQL Cluster NDB 6.x. It is intended for future\nexpansion.\n\nThe ENGINE parameter (required) determines the storage engine which is\nused by this log file group, with engine_name being the name of the\nstorage engine. In MySQL 5.1 and MySQL Cluster NDB 6.x, the only\naccepted values for engine_name are "NDBCLUSTER" and "NDB". The two\nvalues are equivalent.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/alter-logfile-group.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/alter-logfile-group.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (224,18,'&','Syntax:\n&\n\nBitwise AND:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html\n\n','mysql> SELECT 29 & 15;\n -> 13\n','http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (225,30,'LOCALTIMESTAMP','Syntax:\nLOCALTIMESTAMP, LOCALTIMESTAMP()\n\nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (226,35,'CONVERT','Syntax:\nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n\nThe CONVERT() and CAST() functions take a value of one type and produce\na value of another type.\n\nThe type can be one of the following values:\n\no BINARY[(N)]\n\no CHAR[(N)]\n\no DATE\n\no DATETIME\n\no DECIMAL[(M[,D])]\n\no SIGNED [INTEGER]\n\no TIME\n\no UNSIGNED [INTEGER]\n\nBINARY produces a string with the BINARY data type. See\nhttp://dev.mysql.com/doc/refman/5.1/en/binary-varbinary.html for a\ndescription of how this affects comparisons. If the optional length N\nis given, BINARY(N) causes the cast to use no more than N bytes of the\nargument. Values shorter than N bytes are padded with 0x00 bytes to a\nlength of N.\n\nCHAR(N) causes the cast to use no more than N characters of the\nargument.\n\nCAST() and CONVERT(... USING ...) are standard SQL syntax. The\nnon-USING form of CONVERT() is ODBC syntax.\n\nCONVERT() with USING is used to convert data between different\ncharacter sets. In MySQL, transcoding names are the same as the\ncorresponding character set names. For example, this statement converts\nthe string \'abc\' in the default character set to the corresponding\nstring in the utf8 character set:\n\nSELECT CONVERT(\'abc\' USING utf8);\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html\n\n','SELECT enum_col FROM tbl_name ORDER BY CAST(enum_col AS CHAR);\n','http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (227,30,'ADDDATE','Syntax:\nADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument, ADDDATE()\nis a synonym for DATE_ADD(). The related function SUBDATE() is a\nsynonym for DATE_SUB(). For information on the INTERVAL unit argument,\nsee the discussion for DATE_ADD().\n\nmysql> SELECT DATE_ADD(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2008-02-02\'\nmysql> SELECT ADDDATE(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2008-02-02\'\n\nWhen invoked with the days form of the second argument, MySQL treats it\nas an integer number of days to be added to expr.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT ADDDATE(\'2008-01-02\', 31);\n -> \'2008-02-02\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (228,22,'REPEAT LOOP','Syntax:\n[begin_label:] REPEAT\n statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n\nThe statement list within a REPEAT statement is repeated until the\nsearch_condition is true. Thus, a REPEAT always enters the loop at\nleast once. statement_list consists of one or more statements, each\nterminated by a semicolon (;) statement delimiter.\n\nA REPEAT statement can be labeled. See [HELP BEGIN END] for the rules\nregarding label use.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/repeat-statement.html\n\n','mysql> delimiter //\n\nmysql> CREATE PROCEDURE dorepeat(p1 INT)\n -> BEGIN\n -> SET @x = 0;\n -> REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;\n -> END\n -> //\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> CALL dorepeat(1000)//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\n+------+\n1 row in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.1/en/repeat-statement.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (229,37,'ALTER FUNCTION','Syntax:\nALTER FUNCTION func_name [characteristic ...]\n\ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n\nThis statement can be used to change the characteristics of a stored\nfunction. More than one change may be specified in an ALTER FUNCTION\nstatement. However, you cannot change the parameters or body of a\nstored function using this statement; to make such changes, you must\ndrop and re-create the function using DROP FUNCTION and CREATE\nFUNCTION.\n\nYou must have the ALTER ROUTINE privilege for the function. (That\nprivilege is granted automatically to the function creator.) If binary\nlogging is enabled, the ALTER FUNCTION statement might also require the\nSUPER privilege, as described in\nhttp://dev.mysql.com/doc/refman/5.1/en/stored-programs-logging.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/alter-function.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/alter-function.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (230,20,'SMALLINT','SMALLINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA small integer. The signed range is -32768 to 32767. The unsigned\nrange is 0 to 65535.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (231,20,'DOUBLE PRECISION','DOUBLE PRECISION[(M,D)] [UNSIGNED] [ZEROFILL], REAL[(M,D)] [UNSIGNED]\n[ZEROFILL]\n\nThese types are synonyms for DOUBLE. Exception: If the REAL_AS_FLOAT\nSQL mode is enabled, REAL is a synonym for FLOAT rather than DOUBLE.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (232,35,'ORD','Syntax:\nORD(str)\n\nIf the leftmost character of the string str is a multi-byte character,\nreturns the code for that character, calculated from the numeric values\nof its constituent bytes using this formula:\n\n (1st byte code)\n+ (2nd byte code x 256)\n+ (3rd byte code x 2562) ...\n\nIf the leftmost character is not a multi-byte character, ORD() returns\nthe same value as the ASCII() function.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT ORD(\'2\');\n -> 50\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (233,25,'DEALLOCATE PREPARE','Syntax:\n{DEALLOCATE | DROP} PREPARE stmt_name\n\nTo deallocate a prepared statement produced with PREPARE, use a\nDEALLOCATE PREPARE statement that refers to the prepared statement\nname. Attempting to execute a prepared statement after deallocating it\nresults in an error.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/deallocate-prepare.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/deallocate-prepare.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (234,34,'ENVELOPE','Envelope(g)\n\nReturns the Minimum Bounding Rectangle (MBR) for the geometry value g.\nThe result is returned as a Polygon value.\n\nThe polygon is defined by the corner points of the bounding box:\n\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT AsText(Envelope(GeomFromText(\'LineString(1 1,2 2)\')));\n+-------------------------------------------------------+\n| AsText(Envelope(GeomFromText(\'LineString(1 1,2 2)\'))) |\n+-------------------------------------------------------+\n| POLYGON((1 1,2 1,2 2,1 2,1 1)) |\n+-------------------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (235,14,'IS_FREE_LOCK','Syntax:\nIS_FREE_LOCK(str)\n\nChecks whether the lock named str is free to use (that is, not locked).\nReturns 1 if the lock is free (no one is using the lock), 0 if the lock\nis in use, and NULL if an error occurs (such as an incorrect argument).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (236,29,'TOUCHES','Touches(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially touches g2. Two\ngeometries spatially touch if the interiors of the geometries do not\nintersect, but the boundary of one of the geometries intersects either\nthe boundary or the interior of the other.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (237,14,'INET_ATON','Syntax:\nINET_ATON(expr)\n\nGiven the dotted-quad representation of a network address as a string,\nreturns an integer that represents the numeric value of the address.\nAddresses may be 4- or 8-byte addresses.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','mysql> SELECT INET_ATON(\'209.207.224.40\');\n -> 3520061480\n','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (238,11,'UNCOMPRESS','Syntax:\nUNCOMPRESS(string_to_uncompress)\n\nUncompresses a string compressed by the COMPRESS() function. If the\nargument is not a compressed value, the result is NULL. This function\nrequires MySQL to have been compiled with a compression library such as\nzlib. Otherwise, the return value is always NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','mysql> SELECT UNCOMPRESS(COMPRESS(\'any string\'));\n -> \'any string\'\nmysql> SELECT UNCOMPRESS(\'any string\');\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (239,20,'AUTO_INCREMENT','The AUTO_INCREMENT attribute can be used to generate a unique identity\nfor new rows:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html\n\n','CREATE TABLE animals (\n id MEDIUMINT NOT NULL AUTO_INCREMENT,\n name CHAR(30) NOT NULL,\n PRIMARY KEY (id)\n );\n\nINSERT INTO animals (name) VALUES\n (\'dog\'),(\'cat\'),(\'penguin\'),\n (\'lax\'),(\'whale\'),(\'ostrich\');\n\nSELECT * FROM animals;\n','http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (240,34,'ISSIMPLE','IsSimple(g)\n\nCurrently, this function is a placeholder and should not be used. If\nimplemented, its behavior will be as described in the next paragraph.\n\nReturns 1 if the geometry value g has no anomalous geometric points,\nsuch as self-intersection or self-tangency. IsSimple() returns 0 if the\nargument is not simple, and -1 if it is NULL.\n\nThe description of each instantiable geometric class given earlier in\nthe chapter includes the specific conditions that cause an instance of\nthat class to be classified as not simple. (See [HELP Geometry\nhierarchy].)\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (241,4,'- BINARY','Syntax:\n-\n\nSubtraction:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','mysql> SELECT 3-5;\n -> -2\n','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (242,3,'GEOMCOLLFROMTEXT','GeomCollFromText(wkt[,srid]), GeometryCollectionFromText(wkt[,srid])\n\nConstructs a GEOMETRYCOLLECTION value using its WKT representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (243,3,'WKT DEFINITION','The Well-Known Text (WKT) representation of Geometry is designed to\nexchange geometry data in ASCII form.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/gis-wkt-format.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/gis-wkt-format.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (244,30,'CURRENT_TIME','Syntax:\nCURRENT_TIME, CURRENT_TIME()\n\nCURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (245,9,'REVOKE','Syntax:\nREVOKE\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n FROM user [, user] ...\n\nREVOKE ALL PRIVILEGES, GRANT OPTION\n FROM user [, user] ...\n\nThe REVOKE statement enables system administrators to revoke privileges\nfrom MySQL accounts. Each account is named using the same format as for\nthe GRANT statement; for example, \'jeffrey\'@\'localhost\'. If you specify\nonly the user name part of the account name, a host name part of \'%\' is\nused. For details on the levels at which privileges exist, the\nallowable priv_type and priv_level values, and the syntax for\nspecifying users and passwords, see [HELP GRANT]\n\nTo use the first REVOKE syntax, you must have the GRANT OPTION\nprivilege, and you must have the privileges that you are revoking.\n\nTo revoke all privileges, use the second syntax, which drops all\nglobal, database, table, column, and routine privileges for the named\nuser or users:\n\nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n\nTo use this REVOKE syntax, you must have the global CREATE USER\nprivilege or the UPDATE privilege for the mysql database.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/revoke.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/revoke.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (246,15,'LAST_INSERT_ID','Syntax:\nLAST_INSERT_ID(), LAST_INSERT_ID(expr)\n\nFor MySQL 5.1.12 and later, LAST_INSERT_ID() (no arguments) returns the\nfirst automatically generated value successfully inserted for an\nAUTO_INCREMENT column as a result of the most recently executed INSERT\nstatement. The value of LAST_INSERT_ID() remains unchanged if no rows\nare successfully inserted.\n\nFor example, after inserting a row that generates an AUTO_INCREMENT\nvalue, you can get the value like this:\n\nmysql> SELECT LAST_INSERT_ID();\n -> 195\n\nIn MySQL 5.1.11 and earlier, LAST_INSERT_ID() (no arguments) returns\nthe first automatically generated value if any rows were successfully\ninserted or updated. This means that the returned value could be a\nvalue that was not successfully inserted into the table. If no rows\nwere successfully inserted, LAST_INSERT_ID() returns 0.\n\nThe value of LAST_INSERT_ID() will be consistent across all versions if\nall rows in the INSERT or UPDATE statement were successful.\n\nif a table contains an AUTO_INCREMENT column and INSERT ... ON\nDUPLICATE KEY UPDATE updates (rather than inserts) a row, the value of\nLAST_INSERT_ID() is not meaningful prior to MySQL 5.1.12. For a\nworkaround, see\nhttp://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html.\n\nThe currently executing statement does not affect the value of\nLAST_INSERT_ID(). Suppose that you generate an AUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table with its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID() will remain\nstable in the second statement; its value for the second and later rows\nis not affected by the earlier row insertions. (However, if you mix\nreferences to LAST_INSERT_ID() and LAST_INSERT_ID(expr), the effect is\nundefined.)\n\nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if the\nstatement is rolled back due to an error, the value of LAST_INSERT_ID()\nis left undefined. For manual ROLLBACK, the value of LAST_INSERT_ID()\nis not restored to that before the transaction; it remains as it was at\nthe point of the ROLLBACK.\n\nWithin the body of a stored routine (procedure or function) or a\ntrigger, the value of LAST_INSERT_ID() changes the same way as for\nstatements executed outside the body of these kinds of objects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements depends on the\nkind of routine:\n\no If a stored procedure executes statements that change the value of\n LAST_INSERT_ID(), the changed value will be seen by statements that\n follow the procedure call.\n\no For stored functions and triggers that change the value, the value is\n restored when the function or trigger ends, so following statements\n will not see a changed value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (247,30,'LAST_DAY','Syntax:\nLAST_DAY(date)\n\nTakes a date or datetime value and returns the corresponding value for\nthe last day of the month. Returns NULL if the argument is invalid.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT LAST_DAY(\'2003-02-05\');\n -> \'2003-02-28\'\nmysql> SELECT LAST_DAY(\'2004-02-05\');\n -> \'2004-02-29\'\nmysql> SELECT LAST_DAY(\'2004-01-01 01:01:01\');\n -> \'2004-01-31\'\nmysql> SELECT LAST_DAY(\'2003-03-32\');\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (248,20,'MEDIUMINT','MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA medium-sized integer. The signed range is -8388608 to 8388607. The\nunsigned range is 0 to 16777215.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (249,4,'FLOOR','Syntax:\nFLOOR(X)\n\nReturns the largest integer value not greater than X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT FLOOR(1.23);\n -> 1\nmysql> SELECT FLOOR(-1.23);\n -> -2\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (250,35,'RTRIM','Syntax:\nRTRIM(str)\n\nReturns the string str with trailing space characters removed.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT RTRIM(\'barbar \');\n -> \'barbar\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (251,27,'EXPLAIN','Syntax:\nEXPLAIN tbl_name\n\nOr:\n\nEXPLAIN [EXTENDED | PARTITIONS] SELECT select_options\n\nThe EXPLAIN statement can be used either as a synonym for DESCRIBE or\nas a way to obtain information about how MySQL executes a SELECT\nstatement:\n\no EXPLAIN tbl_name is synonymous with DESCRIBE tbl_name or SHOW COLUMNS\n FROM tbl_name.\n\n For a description of the DESCRIBE and SHOW COLUMNS statements, see\n [HELP DESCRIBE], and [HELP SHOW COLUMNS].\n\no When you precede a SELECT statement with the keyword EXPLAIN, MySQL\n displays information from the optimizer about the query execution\n plan. That is, MySQL explains how it would process the SELECT,\n including information about how tables are joined and in which order.\n EXPLAIN EXTENDED can be used to provide additional information.\n\n For information regarding the use of EXPLAIN and EXPLAIN EXTENDED for\n obtaining query execution plan information, see\n http://dev.mysql.com/doc/refman/5.1/en/using-explain.html.\n\no EXPLAIN PARTITIONS is available beginning with MySQL 5.1.5. It is\n useful only when examining queries involving partitioned tables.\n\n For details, see\n http://dev.mysql.com/doc/refman/5.1/en/partitioning-info.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/explain.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/explain.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (252,4,'DEGREES','Syntax:\nDEGREES(X)\n\nReturns the argument X, converted from radians to degrees.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT DEGREES(PI());\n -> 180\nmysql> SELECT DEGREES(PI() / 2);\n -> 90\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (253,20,'VARCHAR','[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,535. The effective maximum length\nof a VARCHAR is subject to the maximum row size (65,535 bytes, which is\nshared among all columns) and the character set used. For example, utf8\ncharacters can require up to three bytes per character, so a VARCHAR\ncolumn that uses the utf8 character set can be declared to be a maximum\nof 21,844 characters.\n\nMySQL stores VARCHAR values as a one-byte or two-byte length prefix\nplus data. The length prefix indicates the number of bytes in the\nvalue. A VARCHAR column uses one length byte if values require no more\nthan 255 bytes, two length bytes if values may require more than 255\nbytes.\n\n*Note*: MySQL 5.1 follows the standard SQL specification, and does not\nremove trailing spaces from VARCHAR values.\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the\nstandard SQL way to define that a VARCHAR column should use some\npredefined character set. MySQL 4.1 and up uses utf8 as this predefined\ncharacter set.\nhttp://dev.mysql.com/doc/refman/5.1/en/charset-national.html. NVARCHAR\nis shorthand for NATIONAL VARCHAR.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (254,35,'UNHEX','Syntax:\n\nUNHEX(str)\n\nPerforms the inverse operation of HEX(str). That is, it interprets each\npair of hexadecimal digits in the argument as a number and converts it\nto the character represented by the number. The resulting characters\nare returned as a binary string.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT UNHEX(\'4D7953514C\');\n -> \'MySQL\'\nmysql> SELECT 0x4D7953514C;\n -> \'MySQL\'\nmysql> SELECT UNHEX(HEX(\'string\'));\n -> \'string\'\nmysql> SELECT HEX(UNHEX(\'1267\'));\n -> \'1267\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (255,4,'- UNARY','Syntax:\n-\n\nUnary minus. This operator changes the sign of the argument.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','mysql> SELECT - 2;\n -> -2\n','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,22,'SELECT INTO','Syntax:\nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n\nSELECT ... INTO syntax enables selected columns to be stored directly\ninto variables. The query should return a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No data), and\nthe variable values remain unchanged. If the query returns multiple\nrows, error 1172 occurs (Result consisted of more than one row). If it\nis possible that the statement may retrieve multiple rows, you can use\nLIMIT 1 to limit the result set to a single row.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select-into-statement.html\n\n','SELECT id,data INTO x,y FROM test.t1 LIMIT 1;\n','http://dev.mysql.com/doc/refman/5.1/en/select-into-statement.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (257,16,'STD','Syntax:\nSTD(expr)\n\nReturns the population standard deviation of expr. This is an extension\nto standard SQL. The standard SQL function STDDEV_POP() can be used\ninstead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (258,4,'COS','Syntax:\nCOS(X)\n\nReturns the cosine of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT COS(PI());\n -> -1\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (259,30,'DATE FUNCTION','Syntax:\nDATE(expr)\n\nExtracts the date part of the date or datetime expression expr.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DATE(\'2003-12-31 01:02:03\');\n -> \'2003-12-31\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (260,37,'DROP TRIGGER','Syntax:\nDROP TRIGGER [IF EXISTS] [schema_name.]trigger_name\n\nThis statement drops a trigger. The schema (database) name is optional.\nIf the schema is omitted, the trigger is dropped from the default\nschema. DROP TRIGGER was added in MySQL 5.0.2. Its use requires the\nTRIGGER privilege for the table associated with the trigger. (This\nstatement requires the SUPER privilege prior to MySQL 5.1.6.)\n\nUse IF EXISTS to prevent an error from occurring for a trigger that\ndoes not exist. A NOTE is generated for a nonexistent trigger when\nusing IF EXISTS. See [HELP SHOW WARNINGS]. The IF EXISTS clause was\nadded in MySQL 5.1.14.\n\nTriggers for a table are also dropped if you drop the table.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-trigger.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (261,25,'RESET MASTER','Syntax:\nRESET MASTER\n\nDeletes all binary log files listed in the index file, resets the\nbinary log index file to be empty, and creates a new binary log file.\nThis statement is intended to be used only when the master is started\nfor the first time.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/reset-master.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/reset-master.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (262,4,'TAN','Syntax:\nTAN(X)\n\nReturns the tangent of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT TAN(PI());\n -> -1.2246063538224e-16\nmysql> SELECT TAN(PI()+1);\n -> 1.5574077246549\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (263,4,'PI','Syntax:\nPI()\n\nReturns the value of π (pi). The default number of decimal places\ndisplayed is seven, but MySQL uses the full double-precision value\ninternally.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT PI();\n -> 3.141593\nmysql> SELECT PI()+0.000000000000000000;\n -> 3.141592653589793116\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (264,30,'WEEKOFYEAR','Syntax:\nWEEKOFYEAR(date)\n\nReturns the calendar week of the date as a number in the range from 1\nto 53. WEEKOFYEAR() is a compatibility function that is equivalent to\nWEEK(date,3).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT WEEKOFYEAR(\'2008-02-20\');\n -> 8\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (265,4,'/','Syntax:\n/\n\nDivision:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','mysql> SELECT 3/5;\n -> 0.60\n','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (266,25,'PURGE BINARY LOGS','Syntax:\nPURGE { BINARY | MASTER } LOGS\n { TO \'log_name\' | BEFORE datetime_expr }\n\nThe binary log is a set of files that contain information about data\nmodifications made by the MySQL server. The log consists of a set of\nbinary log files, plus an index file (see\nhttp://dev.mysql.com/doc/refman/5.1/en/binary-log.html).\n\nThe PURGE BINARY LOGS statement deletes all the binary log files listed\nin the log index file prior to the specified log file name or date.\nBINARY and MASTER are synonyms. Deleted log files also are removed from\nthe list recorded in the index file, so that the given log file becomes\nthe first in the list.\n\nThis statement has no effect if the server was not started with the\n--log-bin option to enable binary logging.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/purge-binary-logs.html\n\n','PURGE BINARY LOGS TO \'mysql-bin.010\';\nPURGE BINARY LOGS BEFORE \'2008-04-02 22:46:26\';\n','http://dev.mysql.com/doc/refman/5.1/en/purge-binary-logs.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (267,16,'STDDEV_SAMP','Syntax:\nSTDDEV_SAMP(expr)\n\nReturns the sample standard deviation of expr (the square root of\nVAR_SAMP().\n\nSTDDEV_SAMP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (268,15,'SCHEMA','Syntax:\nSCHEMA()\n\nThis function is a synonym for DATABASE().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (269,31,'MLINEFROMWKB','MLineFromWKB(wkb[,srid]), MultiLineStringFromWKB(wkb[,srid])\n\nConstructs a MULTILINESTRING value using its WKB representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (270,4,'LOG2','Syntax:\nLOG2(X)\n\nReturns the base-2 logarithm of X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT LOG2(65536);\n -> 16\nmysql> SELECT LOG2(-100);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (271,30,'SUBTIME','Syntax:\nSUBTIME(expr1,expr2)\n\nSUBTIME() returns expr1 - expr2 expressed as a value in the same format\nas expr1. expr1 is a time or datetime expression, and expr2 is a time\nexpression.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\');\n -> \'2007-12-30 22:58:58.999997\'\nmysql> SELECT SUBTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n -> \'-00:59:59.999999\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (272,11,'UNCOMPRESSED_LENGTH','Syntax:\nUNCOMPRESSED_LENGTH(compressed_string)\n\nReturns the length that the compressed string had before being\ncompressed.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','mysql> SELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30)));\n -> 30\n','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (273,37,'DROP TABLE','Syntax:\nDROP [TEMPORARY] TABLE [IF EXISTS]\n tbl_name [, tbl_name] ...\n [RESTRICT | CASCADE]\n\nDROP TABLE removes one or more tables. You must have the DROP privilege\nfor each table. All table data and the table definition are removed, so\nbe careful with this statement! If any of the tables named in the\nargument list do not exist, MySQL returns an error indicating by name\nwhich nonexisting tables it was unable to drop, but it also drops all\nof the tables in the list that do exist.\n\n*Important*: When a table is dropped, user privileges on the table are\nnot automatically dropped. See [HELP GRANT].\n\nNote that for a partitioned table, DROP TABLE permanently removes the\ntable definition, all of its partitions, and all of the data which was\nstored in those partitions. It also removes the partitioning definition\n(.par) file associated with the dropped table.\n\nUse IF EXISTS to prevent an error from occurring for tables that do not\nexist. A NOTE is generated for each nonexistent table when using IF\nEXISTS. See [HELP SHOW WARNINGS].\n\nRESTRICT and CASCADE are allowed to make porting easier. In MySQL 5.1,\nthey do nothing.\n\n*Note*: DROP TABLE automatically commits the current active\ntransaction, unless you use the TEMPORARY keyword.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (274,4,'POW','Syntax:\nPOW(X,Y)\n\nReturns the value of X raised to the power of Y.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT POW(2,2);\n -> 4\nmysql> SELECT POW(2,-2);\n -> 0.25\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (275,25,'SHOW CREATE TABLE','Syntax:\nSHOW CREATE TABLE tbl_name\n\nShows the CREATE TABLE statement that creates the given table. The\nstatement requires the SELECT privilege for the table. This statement\nalso works with views.\nSHOW CREATE TABLE quotes table and column names according to the value\nof the sql_quote_show_create option. See\nhttp://dev.mysql.com/doc/refman/5.1/en/server-session-variables.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-table.html\n\n','mysql> SHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\n Table: t\nCreate Table: CREATE TABLE t (\n id INT(11) default NULL auto_increment,\n s char(60) default NULL,\n PRIMARY KEY (id)\n) ENGINE=MyISAM\n','http://dev.mysql.com/doc/refman/5.1/en/show-create-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (276,26,'DUAL','You are allowed to specify DUAL as a dummy table name in situations\nwhere no tables are referenced:\n\nmysql> SELECT 1 + 1 FROM DUAL;\n -> 2\n\nDUAL is purely for the convenience of people who require that all\nSELECT statements should have FROM and possibly other clauses. MySQL\nmay ignore the clauses. MySQL does not require FROM DUAL if no tables\nare referenced.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/select.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (277,35,'INSTR','Syntax:\nINSTR(str,substr)\n\nReturns the position of the first occurrence of substring substr in\nstring str. This is the same as the two-argument form of LOCATE(),\nexcept that the order of the arguments is reversed.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT INSTR(\'foobarbar\', \'bar\');\n -> 4\nmysql> SELECT INSTR(\'xbar\', \'foobar\');\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (278,30,'NOW','Syntax:\nNOW()\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. The value is expressed in the\ncurrent time zone.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT NOW();\n -> \'2007-12-15 23:50:26\'\nmysql> SELECT NOW() + 0;\n -> 20071215235026.000000\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (279,25,'SHOW ENGINES','Syntax:\nSHOW [STORAGE] ENGINES\n\nSHOW ENGINES displays status information about the server\'s storage\nengines. This is particularly useful for checking whether a storage\nengine is supported, or to see what the default engine is. SHOW TABLE\nTYPES is a synonym, but is deprecated and is removed in MySQL 5.5.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-engines.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-engines.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (280,17,'>=','Syntax:\n>=\n\nGreater than or equal:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 2 >= 2;\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (281,4,'EXP','Syntax:\nEXP(X)\n\nReturns the value of e (the base of natural logarithms) raised to the\npower of X. The inverse of this function is LOG() (using a single\nargument only) or LN().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT EXP(2);\n -> 7.3890560989307\nmysql> SELECT EXP(-2);\n -> 0.13533528323661\nmysql> SELECT EXP(0);\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (282,20,'LONGBLOB','LONGBLOB\n\nA BLOB column with a maximum length of 4,294,967,295 or 4GB (232 - 1)\nbytes. The effective maximum length of LONGBLOB columns depends on the\nconfigured maximum packet size in the client/server protocol and\navailable memory. Each LONGBLOB value is stored using a four-byte\nlength prefix that indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (283,12,'POINTN','PointN(ls,N)\n\nReturns the N-th Point in the Linestring value ls. Points are numbered\nbeginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#linestring-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (284,20,'YEAR DATA TYPE','YEAR[(2|4)]\n\nA year in two-digit or four-digit format. The default is four-digit\nformat. In four-digit format, the allowable values are 1901 to 2155,\nand 0000. In two-digit format, the allowable values are 70 to 69,\nrepresenting years from 1970 to 2069. MySQL displays YEAR values in\nYYYY format, but allows you to assign values to YEAR columns using\neither strings or numbers.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (285,16,'SUM','Syntax:\nSUM([DISTINCT] expr)\n\nReturns the sum of expr. If the return set has no rows, SUM() returns\nNULL. The DISTINCT keyword can be used in MySQL 5.1 to sum only the\ndistinct values of expr.\n\nSUM() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (286,4,'OCT','Syntax:\nOCT(N)\n\nReturns a string representation of the octal value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,8). Returns\nNULL if N is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT OCT(12);\n -> \'14\'\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (287,30,'SYSDATE','Syntax:\nSYSDATE()\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context.\n\nSYSDATE() returns the time at which it executes. This differs from the\nbehavior for NOW(), which returns a constant time that indicates the\ntime at which the statement began to execute. (Within a stored function\nor trigger, NOW() returns the time at which the function or triggering\nstatement began to execute.)\n\nmysql> SELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:36 | 0 | 2006-04-12 13:47:36 |\n+---------------------+----------+---------------------+\n\nmysql> SELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:44 | 0 | 2006-04-12 13:47:46 |\n+---------------------+----------+---------------------+\n\nIn addition, the SET TIMESTAMP statement affects the value returned by\nNOW() but not by SYSDATE(). This means that timestamp settings in the\nbinary log have no effect on invocations of SYSDATE().\n\nBecause SYSDATE() can return different values even within the same\nstatement, and is not affected by SET TIMESTAMP, it is nondeterministic\nand therefore unsafe for replication if statement-based binary logging\nis used. If that is a problem, you can use row-based logging.\n\nAlternatively, you can use the --sysdate-is-now option to cause\nSYSDATE() to be an alias for NOW(). This works if the option is used on\nboth the master and the slave.\n\nThe nondeterministic nature of SYSDATE() also means that indexes cannot\nbe used for evaluating expressions that refer to it.\n\nBeginning with MySQL 5.1.42, a warning is logged if you use this\nfunction when binlog_format is set to STATEMENT. (Bug#47995\n(http://bugs.mysql.com/bug.php?id=47995))\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (288,5,'UNINSTALL PLUGIN','Syntax:\nUNINSTALL PLUGIN plugin_name\n\nThis statement removes an installed server plugin. It requires the\nDELETE privilege for the mysql.plugin table.\n\nplugin_name must be the name of some plugin that is listed in the\nmysql.plugin table. The server executes the plugin\'s deinitialization\nfunction and removes the row for the plugin from the mysql.plugin\ntable, so that subsequent server restarts will not load and initialize\nthe plugin. UNINSTALL PLUGIN does not remove the plugin\'s shared\nlibrary file.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/uninstall-plugin.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/uninstall-plugin.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (289,31,'ASBINARY','AsBinary(g), AsWKB(g)\n\nConverts a value in internal geometry format to its WKB representation\nand returns the binary result.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-to-convert-geometries-between-formats.html\n\n','SELECT AsBinary(g) FROM geom;\n','http://dev.mysql.com/doc/refman/5.1/en/functions-to-convert-geometries-between-formats.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (290,35,'REPEAT FUNCTION','Syntax:\nREPEAT(str,count)\n\nReturns a string consisting of the string str repeated count times. If\ncount is less than 1, returns an empty string. Returns NULL if str or\ncount are NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT REPEAT(\'MySQL\', 3);\n -> \'MySQLMySQLMySQL\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (291,25,'SHOW TABLES','Syntax:\nSHOW [FULL] TABLES [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TABLES lists the non-TEMPORARY tables in a given database. You can\nalso get this list using the mysqlshow db_name command. The LIKE\nclause, if present, indicates which table names to match. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in http://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nThis statement also lists any views in the database. The FULL modifier\nis supported such that SHOW FULL TABLES displays a second output\ncolumn. Values for the second column are BASE TABLE for a table and\nVIEW for a view.\n\nIf you have no privileges for a base table or view, it does not show up\nin the output from SHOW TABLES or mysqlshow db_name.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-tables.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-tables.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (292,30,'MAKEDATE','Syntax:\nMAKEDATE(year,dayofyear)\n\nReturns a date, given year and day-of-year values. dayofyear must be\ngreater than 0 or the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MAKEDATE(2011,31), MAKEDATE(2011,32);\n -> \'2011-01-31\', \'2011-02-01\'\nmysql> SELECT MAKEDATE(2011,365), MAKEDATE(2014,365);\n -> \'2011-12-31\', \'2014-12-31\'\nmysql> SELECT MAKEDATE(2011,0);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (293,35,'BINARY OPERATOR','Syntax:\nBINARY\n\nThe BINARY operator casts the string following it to a binary string.\nThis is an easy way to force a column comparison to be done byte by\nbyte rather than character by character. This causes the comparison to\nbe case sensitive even if the column isn\'t defined as BINARY or BLOB.\nBINARY also causes trailing spaces to be significant.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html\n\n','mysql> SELECT \'a\' = \'A\';\n -> 1\nmysql> SELECT BINARY \'a\' = \'A\';\n -> 0\nmysql> SELECT \'a\' = \'a \';\n -> 1\nmysql> SELECT BINARY \'a\' = \'a \';\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (294,6,'MBROVERLAPS','MBROverlaps(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 overlap. The term spatially overlaps is\nused if two geometries intersect and their intersection results in a\ngeometry of the same dimension but not equal to either of the given\ngeometries.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (295,35,'SOUNDEX','Syntax:\nSOUNDEX(str)\n\nReturns a soundex string from str. Two strings that sound almost the\nsame should have identical soundex strings. A standard soundex string\nis four characters long, but the SOUNDEX() function returns an\narbitrarily long string. You can use SUBSTRING() on the result to get a\nstandard soundex string. All nonalphabetic characters in str are\nignored. All international alphabetic characters outside the A-Z range\nare treated as vowels.\n\n*Important*: When using SOUNDEX(), you should be aware of the following\nlimitations:\n\no This function, as currently implemented, is intended to work well\n with strings that are in the English language only. Strings in other\n languages may not produce reliable results.\n\no This function is not guaranteed to provide consistent results with\n strings that use multi-byte character sets, including utf-8.\n\n We hope to remove these limitations in a future release. See\n Bug#22638 (http://bugs.mysql.com/bug.php?id=22638) for more\n information.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT SOUNDEX(\'Hello\');\n -> \'H400\'\nmysql> SELECT SOUNDEX(\'Quadratically\');\n -> \'Q36324\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (296,6,'MBRTOUCHES','MBRTouches(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 touch. Two geometries spatially touch if\nthe interiors of the geometries do not intersect, but the boundary of\none of the geometries intersects either the boundary or the interior of\nthe other.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (297,37,'DROP EVENT','Syntax:\nDROP EVENT [IF EXISTS] event_name\n\nThis statement drops the event named event_name. The event immediately\nceases being active, and is deleted completely from the server.\n\nIf the event does not exist, the error ERROR 1517 (HY000): Unknown\nevent \'event_name\' results. You can override this and cause the\nstatement to generate a warning for nonexistent events instead using IF\nEXISTS.\n\nBeginning with MySQL 5.1.12, this statement requires the EVENT\nprivilege for the schema to which the event to be dropped belongs. (In\nMySQL 5.1.11 and earlier, an event could be dropped only by its\ndefiner, or by a user having the SUPER privilege.)\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-event.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-event.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (298,26,'INSERT SELECT','Syntax:\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]\n\nWith INSERT ... SELECT, you can quickly insert many rows into a table\nfrom one or many tables. For example:\n\nINSERT INTO tbl_temp2 (fld_id)\n SELECT tbl_temp1.fld_order_id\n FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/insert-select.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/insert-select.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (299,37,'CREATE PROCEDURE','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n PROCEDURE sp_name ([proc_parameter[,...]])\n [characteristic ...] routine_body\n\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n FUNCTION sp_name ([func_parameter[,...]])\n RETURNS type\n [characteristic ...] routine_body\n\nproc_parameter:\n [ IN | OUT | INOUT ] param_name type\n\nfunc_parameter:\n param_name type\n\ntype:\n Any valid MySQL data type\n\ncharacteristic:\n LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n\nroutine_body:\n Valid SQL procedure statement\n\nThese statements create stored routines. By default, a routine is\nassociated with the default database. To associate the routine\nexplicitly with a given database, specify the name as db_name.sp_name\nwhen you create it.\n\nThe CREATE FUNCTION statement is also used in MySQL to support UDFs\n(user-defined functions). See\nhttp://dev.mysql.com/doc/refman/5.1/en/adding-functions.html. A UDF can\nbe regarded as an external stored function. However, do note that\nstored functions share their namespace with UDFs. See\nhttp://dev.mysql.com/doc/refman/5.1/en/function-resolution.html, for\nthe rules describing how the server interprets references to different\nkinds of functions.\n\nTo invoke a stored procedure, use the CALL statement (see [HELP CALL]).\nTo invoke a stored function, refer to it in an expression. The function\nreturns a value during expression evaluation.\n\nTo execute the CREATE PROCEDURE or CREATE FUNCTION statement, it is\nnecessary to have the CREATE ROUTINE privilege. By default, MySQL\nautomatically grants the ALTER ROUTINE and EXECUTE privileges to the\nroutine creator. This behavior can be changed by disabling the\nautomatic_sp_privileges system variable. See\nhttp://dev.mysql.com/doc/refman/5.1/en/stored-routines-privileges.html.\nIf binary logging is enabled, the CREATE FUNCTION statement might also\nrequire the SUPER privilege, as described in\nhttp://dev.mysql.com/doc/refman/5.1/en/stored-programs-logging.html.\nSUPER may also be required depending on the DEFINER value, as described\nlater.\n\nThe DEFINER and SQL SECURITY clauses specify the security context to be\nused when checking access privileges at routine execution time, as\ndescribed later.\n\nIf the routine name is the same as the name of a built-in SQL function,\na syntax error occurs unless you use a space between the name and the\nfollowing parenthesis when defining the routine or invoking it later.\nFor this reason, avoid using the names of existing SQL functions for\nyour own stored routines.\n\nThe IGNORE_SPACE SQL mode applies to built-in functions, not to stored\nroutines. It is always allowable to have spaces after a stored routine\nname, regardless of whether IGNORE_SPACE is enabled.\n\nThe parameter list enclosed within parentheses must always be present.\nIf there are no parameters, an empty parameter list of () should be\nused. Parameter names are not case sensitive.\n\nEach parameter is an IN parameter by default. To specify otherwise for\na parameter, use the keyword OUT or INOUT before the parameter name.\n\n*Note*: Specifying a parameter as IN, OUT, or INOUT is valid only for a\nPROCEDURE. (FUNCTION parameters are always regarded as IN parameters.)\n\nAn IN parameter passes a value into a procedure. The procedure might\nmodify the value, but the modification is not visible to the caller\nwhen the procedure returns. An OUT parameter passes a value from the\nprocedure back to the caller. Its initial value is NULL within the\nprocedure, and its value is visible to the caller when the procedure\nreturns. An INOUT parameter is initialized by the caller, can be\nmodified by the procedure, and any change made by the procedure is\nvisible to the caller when the procedure returns.\n\nFor each OUT or INOUT parameter, pass a user-defined variable in the\nCALL statement that invokes the procedure so that you can obtain its\nvalue when the procedure returns. If you are calling the procedure from\nwithin another stored procedure or function, you can also pass a\nroutine parameter or local routine variable as an IN or INOUT\nparameter.\n\nThe following example shows a simple stored procedure that uses an OUT\nparameter:\n\nmysql> delimiter //\n\nmysql> CREATE PROCEDURE simpleproc (OUT param1 INT)\n -> BEGIN\n -> SELECT COUNT(*) INTO param1 FROM t;\n -> END//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> delimiter ;\n\nmysql> CALL simpleproc(@a);\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT @a;\n+------+\n| @a |\n+------+\n| 3 |\n+------+\n1 row in set (0.00 sec)\n\nThe example uses the mysql client delimiter command to change the\nstatement delimiter from ; to // while the procedure is being defined.\nThis allows the ; delimiter used in the procedure body to be passed\nthrough to the server rather than being interpreted by mysql itself.\nSee\nhttp://dev.mysql.com/doc/refman/5.1/en/stored-programs-defining.html.\n\nThe RETURNS clause may be specified only for a FUNCTION, for which it\nis mandatory. It indicates the return type of the function, and the\nfunction body must contain a RETURN value statement. If the RETURN\nstatement returns a value of a different type, the value is coerced to\nthe proper type. For example, if a function specifies an ENUM or SET\nvalue in the RETURNS clause, but the RETURN statement returns an\ninteger, the value returned from the function is the string for the\ncorresponding ENUM member of set of SET members.\n\nThe following example function takes a parameter, performs an operation\nusing an SQL function, and returns the result. In this case, it is\nunnecessary to use delimiter because the function definition contains\nno internal ; statement delimiters:\n\nmysql> CREATE FUNCTION hello (s CHAR(20))\nmysql> RETURNS CHAR(50) DETERMINISTIC\n -> RETURN CONCAT(\'Hello, \',s,\'!\');\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT hello(\'world\');\n+----------------+\n| hello(\'world\') |\n+----------------+\n| Hello, world! |\n+----------------+\n1 row in set (0.00 sec)\n\nParameter types and function return types can be declared to use any\nvalid data type, except that the COLLATE attribute cannot be used.\n\nThe routine_body consists of a valid SQL procedure statement. This can\nbe a simple statement such as SELECT or INSERT, or it can be a compound\nstatement written using BEGIN and END. Compound statements can contain\ndeclarations, loops, and other control structure statements. The syntax\nfor these statements is described in\nhttp://dev.mysql.com/doc/refman/5.1/en/sql-syntax-compound-statements.h\ntml.\n\nMySQL allows routines to contain DDL statements, such as CREATE and\nDROP. MySQL also allows stored procedures (but not stored functions) to\ncontain SQL transaction statements such as COMMIT. Stored functions may\nnot contain statements that perform explicit or implicit commit or\nrollback. Support for these statements is not required by the SQL\nstandard, which states that each DBMS vendor may decide whether to\nallow them.\n\nStatements that return a result set can be used within a stored\nprocedcure but not within a stored function. This prohibition includes\nSELECT statements that do not have an INTO var_list clause and other\nstatements such as SHOW, EXPLAIN, and CHECK TABLE. For statements that\ncan be determined at function definition time to return a result set, a\nNot allowed to return a result set from a function error occurs\n(ER_SP_NO_RETSET). For statements that can be determined only at\nruntime to return a result set, a PROCEDURE %s can\'t return a result\nset in the given context error occurs (ER_SP_BADSELECT).\n\nUSE statements within stored routines are disallowed. When a routine is\ninvoked, an implicit USE db_name is performed (and undone when the\nroutine terminates). This causes the routine to have the given default\ndatabase while it executes. References to objects in databases other\nthan the routine default database should be qualified with the\nappropriate database name.\n\nFor additional information about statements that are not allowed in\nstored routines, see\nhttp://dev.mysql.com/doc/refman/5.1/en/stored-program-restrictions.html\n.\n\nFor information about invoking stored procedures from within programs\nwritten in a language that has a MySQL interface, see [HELP CALL].\n\nMySQL stores the sql_mode system variable setting that is in effect at\nthe time a routine is created, and always executes the routine with\nthis setting in force, regardless of the server SQL mode in effect when\nthe routine is invoked.\n\nThe switch from the SQL mode of the invoker to that of the routine\noccurs after evaluation of arguments and assignment of the resulting\nvalues to routine parameters. If you define a routine in strict SQL\nmode but invoke it in nonstrict mode, assignment of arguments to\nroutine parameters does not take place in strict mode. If you require\nthat expressions passed to a routine be assigned in strict SQL mode,\nyou should invoke the routine with strict mode in effect.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-procedure.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-procedure.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (300,20,'VARBINARY','VARBINARY(M)\n\nThe VARBINARY type is similar to the VARCHAR type, but stores binary\nbyte strings rather than nonbinary character strings. M represents the\nmaximum column length in bytes.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (301,25,'LOAD INDEX','Syntax:\nLOAD INDEX INTO CACHE\n tbl_index_list [, tbl_index_list] ...\n\ntbl_index_list:\n tbl_name\n [[INDEX|KEY] (index_name[, index_name] ...)]\n [IGNORE LEAVES]\n\nThe LOAD INDEX INTO CACHE statement preloads a table index into the key\ncache to which it has been assigned by an explicit CACHE INDEX\nstatement, or into the default key cache otherwise. LOAD INDEX INTO\nCACHE is used only for MyISAM tables. It is not supported for tables\nhaving user-defined partitioning (see\nhttp://dev.mysql.com/doc/refman/5.1/en/partitioning-limitations.html.)\n\nThe IGNORE LEAVES modifier causes only blocks for the nonleaf nodes of\nthe index to be preloaded.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/load-index.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/load-index.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (302,26,'UNION','Syntax:\nSELECT ...\nUNION [ALL | DISTINCT] SELECT ...\n[UNION [ALL | DISTINCT] SELECT ...]\n\nUNION is used to combine the result from multiple SELECT statements\ninto a single result set.\n\nThe column names from the first SELECT statement are used as the column\nnames for the results returned. Selected columns listed in\ncorresponding positions of each SELECT statement should have the same\ndata type. (For example, the first column selected by the first\nstatement should have the same type as the first column selected by the\nother statements.)\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/union.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/union.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (303,30,'TO_DAYS','Syntax:\nTO_DAYS(date)\n\nGiven a date date, returns a day number (the number of days since year\n0).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TO_DAYS(950501);\n -> 728779\nmysql> SELECT TO_DAYS(\'2007-10-07\');\n -> 733321\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (304,35,'NOT REGEXP','Syntax:\nexpr NOT REGEXP pat, expr NOT RLIKE pat\n\nThis is the same as NOT (expr REGEXP pat).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/regexp.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/regexp.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (305,25,'SHOW INDEX','Syntax:\nSHOW {INDEX | INDEXES | KEYS}\n {FROM | IN} tbl_name\n [{FROM | IN} db_name]\n\nSHOW INDEX returns table index information. The format resembles that\nof the SQLStatistics call in ODBC.\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. These two statements are equivalent:\n\nSHOW INDEX FROM mytable FROM mydb;\nSHOW INDEX FROM mydb.mytable;\n\nYou can also list a table\'s indexes with the mysqlshow -k db_name\ntbl_name command.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-index.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-index.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (306,25,'SHOW CREATE DATABASE','Syntax:\nSHOW CREATE {DATABASE | SCHEMA} db_name\n\nShows the CREATE DATABASE statement that creates the given database.\nSHOW CREATE SCHEMA is a synonym for SHOW CREATE DATABASE.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-database.html\n\n','mysql> SHOW CREATE DATABASE test\\G\n*************************** 1. row ***************************\n Database: test\nCreate Database: CREATE DATABASE `test`\n /*!40100 DEFAULT CHARACTER SET latin1 */\n\nmysql> SHOW CREATE SCHEMA test\\G\n*************************** 1. row ***************************\n Database: test\nCreate Database: CREATE DATABASE `test`\n /*!40100 DEFAULT CHARACTER SET latin1 */\n','http://dev.mysql.com/doc/refman/5.1/en/show-create-database.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (307,22,'LEAVE','Syntax:\nLEAVE label\n\nThis statement is used to exit the flow control construct that has the\ngiven label. It can be used within BEGIN ... END or loop constructs\n(LOOP, REPEAT, WHILE).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/leave-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/leave-statement.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (308,17,'NOT IN','Syntax:\nexpr NOT IN (value,...)\n\nThis is the same as NOT (expr IN (value,...)).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (309,13,'!','Syntax:\nNOT, !\n\nLogical NOT. Evaluates to 1 if the operand is 0, to 0 if the operand is\nnonzero, and NOT NULL returns NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html\n\n','mysql> SELECT NOT 10;\n -> 0\nmysql> SELECT NOT 0;\n -> 1\nmysql> SELECT NOT NULL;\n -> NULL\nmysql> SELECT ! (1+1);\n -> 0\nmysql> SELECT ! 1+1;\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (310,22,'DECLARE HANDLER','Syntax:\nDECLARE handler_type HANDLER\n FOR condition_value [, condition_value] ...\n statement\n\nhandler_type:\n CONTINUE\n | EXIT\n | UNDO\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n | SQLWARNING\n | NOT FOUND\n | SQLEXCEPTION\n | mysql_error_code\n\nThe DECLARE ... HANDLER statement specifies handlers that each may deal\nwith one or more conditions. If one of these conditions occurs, the\nspecified statement is executed. statement can be a simple statement\n(for example, SET var_name = value), or it can be a compound statement\nwritten using BEGIN and END (see [HELP BEGIN END]).\n\nFor a CONTINUE handler, execution of the current program continues\nafter execution of the handler statement. For an EXIT handler,\nexecution terminates for the BEGIN ... END compound statement in which\nthe handler is declared. (This is true even if the condition occurs in\nan inner block.) The UNDO handler type statement is not supported.\n\nIf a condition occurs for which no handler has been declared, the\ndefault action is EXIT.\n\nA condition_value for DECLARE ... HANDLER can be any of the following\nvalues:\n\no An SQLSTATE value (a 5-character string literal) or a MySQL error\n code (a number). You should not use SQLSTATE value \'00000\' or MySQL\n error code 0, because those indicate sucess rather than an error\n condition. For a list of SQLSTATE values and MySQL error codes, see\n http://dev.mysql.com/doc/refman/5.1/en/error-messages-server.html.\n\no A condition name previously specified with DECLARE ... CONDITION. See\n [HELP DECLARE CONDITION].\n\no SQLWARNING is shorthand for the class of SQLSTATE values that begin\n with \'01\'.\n\no NOT FOUND is shorthand for the class of SQLSTATE values that begin\n with \'02\'. This is relevant only the context of cursors and is used\n to control what happens when a cursor reaches the end of a data set.\n If no more rows are available, a No Data condition occurs with\n SQLSTATE value 02000. To detect this condition, you can set up a\n handler for it (or for a NOT FOUND condition). An example is shown in\n http://dev.mysql.com/doc/refman/5.1/en/cursors.html. This condition\n also occurs for SELECT ... INTO var_list statements that retrieve no\n rows.\n\no SQLEXCEPTION is shorthand for the class of SQLSTATE values that do\n not begin with \'00\', \'01\', or \'02\'.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/declare-handler.html\n\n','mysql> CREATE TABLE test.t (s1 INT, PRIMARY KEY (s1));\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> delimiter //\n\nmysql> CREATE PROCEDURE handlerdemo ()\n -> BEGIN\n -> DECLARE CONTINUE HANDLER FOR SQLSTATE \'23000\' SET @x2 = 1;\n -> SET @x = 1;\n -> INSERT INTO test.t VALUES (1);\n -> SET @x = 2;\n -> INSERT INTO test.t VALUES (1);\n -> SET @x = 3;\n -> END;\n -> //\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> CALL handlerdemo()//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT @x//\n +------+\n | @x |\n +------+\n | 3 |\n +------+\n 1 row in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.1/en/declare-handler.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (311,20,'DOUBLE','DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA normal-size (double-precision) floating-point number. Allowable\nvalues are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and\n2.2250738585072014E-308 to 1.7976931348623157E+308. These are the\ntheoretical limits, based on the IEEE standard. The actual range might\nbe slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits allowed by the hardware. A double-precision floating-point\nnumber is accurate to approximately 15 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (312,20,'TIME','TIME\n\nA time. The range is \'-838:59:59\' to \'838:59:59\'. MySQL displays TIME\nvalues in \'HH:MM:SS\' format, but allows assignment of values to TIME\ncolumns using either strings or numbers.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (313,13,'&&','Syntax:\nAND, &&\n\nLogical AND. Evaluates to 1 if all operands are nonzero and not NULL,\nto 0 if one or more operands are 0, otherwise NULL is returned.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html\n\n','mysql> SELECT 1 && 1;\n -> 1\nmysql> SELECT 1 && 0;\n -> 0\nmysql> SELECT 1 && NULL;\n -> NULL\nmysql> SELECT 0 && NULL;\n -> 0\nmysql> SELECT NULL && 0;\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (314,10,'X','X(p)\n\nReturns the X-coordinate value for the point p as a double-precision\nnumber.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#point-property-functions\n\n','mysql> SET @pt = \'Point(56.7 53.34)\';\nmysql> SELECT X(GeomFromText(@pt));\n+----------------------+\n| X(GeomFromText(@pt)) |\n+----------------------+\n| 56.7 |\n+----------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#point-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (315,15,'FOUND_ROWS','Syntax:\nFOUND_ROWS()\n\nA SELECT statement may include a LIMIT clause to restrict the number of\nrows the server returns to the client. In some cases, it is desirable\nto know how many rows the statement would have returned without the\nLIMIT, but without running the statement again. To obtain this row\ncount, include a SQL_CALC_FOUND_ROWS option in the SELECT statement,\nand then invoke FOUND_ROWS() afterward:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name\n -> WHERE id > 100 LIMIT 10;\nmysql> SELECT FOUND_ROWS();\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (316,15,'SYSTEM_USER','Syntax:\nSYSTEM_USER()\n\nSYSTEM_USER() is a synonym for USER().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (317,29,'CROSSES','Crosses(g1,g2)\n\nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon\nor a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\no The two geometries intersect\n\no Their intersection results in a geometry that has a dimension that is\n one less than the maximum dimension of the two given geometries\n\no Their intersection is not equal to either of the two given geometries\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,26,'TRUNCATE TABLE','Syntax:\nTRUNCATE [TABLE] tbl_name\n\nTRUNCATE TABLE empties a table completely. It requires the DROP\nprivilege as of MySQL 5.1.16. (Before 5.1.16, it requires the DELETE\nprivilege).\n\nLogically, TRUNCATE TABLE is equivalent to a DELETE statement that\ndeletes all rows, but there are practical differences under some\ncircumstances.\n\nFor an InnoDB table, InnoDB processes TRUNCATE TABLE by deleting rows\none by one if there are any FOREIGN KEY constraints that reference the\ntable. If there are no FOREIGN KEY constraints, InnoDB performs fast\ntruncation by dropping the original table and creating an empty one\nwith the same definition, which is much faster than deleting rows one\nby one. The AUTO_INCREMENT counter is reset to zero by TRUNCATE TABLE,\nregardless of whether there is a FOREIGN KEY constraint.\n\nIn the case that FOREIGN KEY constraints reference the table, InnoDB\ndeletes rows one by one and processes the constraints on each one. If\nthe FOREIGN KEY constraint specifies DELETE CASCADE, rows from the\nchild (referenced) table are deleted, and the truncated table becomes\nempty. If the FOREIGN KEY constraint does not specify CASCADE, the\nTRUNCATE TABLE statement deletes rows one by one and stops if it\nencounters a parent row that is referenced by the child, returning this\nerror:\n\nERROR 1451 (23000): Cannot delete or update a parent row: a foreign\nkey constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1`\nFOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))\n\nThis is the same as a DELETE statement with no WHERE clause.\n\nThe count of rows affected by TRUNCATE TABLE is accurate only when it\nis mapped to a DELETE statement.\n\nFor other storage engines, TRUNCATE TABLE differs from DELETE in the\nfollowing ways in MySQL 5.1:\n\no Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n\no Truncate operations cause an implicit commit.\n\no Truncation operations cannot be performed if the session holds an\n active table lock.\n\no Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is "0 rows affected," which should\n be interpreted as "no information."\n\no As long as the table format file tbl_name.frm is valid, the table can\n be re-created as an empty table with TRUNCATE TABLE, even if the data\n or index files have become corrupted.\n\no The table handler does not remember the last used AUTO_INCREMENT\n value, but starts counting from the beginning. This is true even for\n MyISAM and InnoDB, which normally do not reuse sequence values.\n\no When used with partitioned tables, TRUNCATE TABLE preserves the\n partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n\no Since truncation of a table does not make any use of DELETE, the\n TRUNCATE TABLE statement does not invoke ON DELETE triggers.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/truncate-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/truncate-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (319,16,'BIT_XOR','Syntax:\nBIT_XOR(expr)\n\nReturns the bitwise XOR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (320,30,'CURRENT_DATE','Syntax:\nCURRENT_DATE, CURRENT_DATE()\n\nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (321,25,'START SLAVE','Syntax:\nSTART SLAVE [thread_type [, thread_type] ... ]\nSTART SLAVE [SQL_THREAD] UNTIL\n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos\nSTART SLAVE [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos\n\nthread_type: IO_THREAD | SQL_THREAD\n\nSTART SLAVE with no thread_type options starts both of the slave\nthreads. The I/O thread reads events from the master server and stores\nthem in the relay log. The SQL thread reads events from the relay log\nand executes them. START SLAVE requires the SUPER privilege.\n\nIf START SLAVE succeeds in starting the slave threads, it returns\nwithout any error. However, even in that case, it might be that the\nslave threads start and then later stop (for example, because they do\nnot manage to connect to the master or read its binary log, or some\nother problem). START SLAVE does not warn you about this. You must\ncheck the slave\'s error log for error messages generated by the slave\nthreads, or check that they are running satisfactorily with SHOW SLAVE\nSTATUS.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/start-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/start-slave.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (322,2,'AREA','Area(poly)\n\nReturns as a double-precision number the area of the Polygon value\npoly, as measured in its spatial reference system.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly = \'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))\';\nmysql> SELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#polygon-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (323,22,'BEGIN END','Syntax:\n[begin_label:] BEGIN\n [statement_list]\nEND [end_label]\n\nBEGIN ... END syntax is used for writing compound statements, which can\nappear within stored programs. A compound statement can contain\nmultiple statements, enclosed by the BEGIN and END keywords.\nstatement_list represents a list of one or more statements, each\nterminated by a semicolon (;) statement delimiter. statement_list is\noptional, which means that the empty compound statement (BEGIN END) is\nlegal.\n\nUse of multiple statements requires that a client is able to send\nstatement strings containing the ; statement delimiter. This is handled\nin the mysql command-line client with the delimiter command. Changing\nthe ; end-of-statement delimiter (for example, to //) allows ; to be\nused in a program body. For an example, see\nhttp://dev.mysql.com/doc/refman/5.1/en/stored-programs-defining.html.\n\nA BEGIN ... END block can be labeled. Labels follow these rules:\n\no end_label cannot be given unless begin_label is also present.\n\no If both begin_label and end_label are present, they must be the same.\n\no Labels can be up to 16 characters long.\n\nLabels are also allowed for the LOOP, REPEAT, and WHILE statements.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/begin-end.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/begin-end.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (324,25,'FLUSH','Syntax:\nFLUSH [NO_WRITE_TO_BINLOG | LOCAL]\n flush_option [, flush_option] ...\n\nThe FLUSH statement clears or reloads various internal caches used by\nMySQL. One variant acquires a lock. To execute FLUSH, you must have the\nRELOAD privilege.\n\nBy default, FLUSH statements are written to the binary log so that they\nwill be replicated to replication slaves. Logging can be suppressed\nwith the optional NO_WRITE_TO_BINLOG keyword or its alias LOCAL.\n\n*Note*: FLUSH LOGS, FLUSH MASTER, FLUSH SLAVE, and FLUSH TABLES WITH\nREAD LOCK are not written to the binary log in any case because they\nwould cause problems if replicated to a slave.\n\nThe RESET statement is similar to FLUSH. See [HELP RESET], for\ninformation about using the RESET statement with replication.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/flush.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/flush.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (325,25,'SHOW PROCEDURE STATUS','Syntax:\nSHOW PROCEDURE STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement is a MySQL extension. It returns characteristics of a\nstored procedure, such as the database, name, type, creator, creation\nand modification dates, and character set information. A similar\nstatement, SHOW FUNCTION STATUS, displays information about stored\nfunctions (see [HELP SHOW FUNCTION STATUS]).\n\nThe LIKE clause, if present, indicates which procedure or function\nnames to match. The WHERE clause can be given to select rows using more\ngeneral conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-procedure-status.html\n\n','mysql> SHOW PROCEDURE STATUS LIKE \'sp1\'\\G\n*************************** 1. row ***************************\n Db: test\n Name: sp1\n Type: PROCEDURE\n Definer: testuser@localhost\n Modified: 2004-08-03 15:29:37\n Created: 2004-08-03 15:29:37\n Security_type: DEFINER\n Comment:\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.1/en/show-procedure-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (326,27,'DESCRIBE','Syntax:\n{DESCRIBE | DESC} tbl_name [col_name | wild]\n\nDESCRIBE provides information about the columns in a table. It is a\nshortcut for SHOW COLUMNS FROM. These statements also display\ninformation for views. (See [HELP SHOW COLUMNS].)\n\ncol_name can be a column name, or a string containing the SQL "%" and\n"_" wildcard characters to obtain output only for the columns with\nnames matching the string. There is no need to enclose the string\nwithin quotes unless it contains spaces or other special characters.\n\nmysql> DESCRIBE City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nThe description for SHOW COLUMNS provides more information about the\noutput columns (see [HELP SHOW COLUMNS]).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/describe.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/describe.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (327,25,'SHOW WARNINGS','Syntax:\nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW COUNT(*) WARNINGS\n\nSHOW WARNINGS shows the error, warning, and note messages that resulted\nfrom the last statement that generated messages in the current session.\nIt shows nothing if the last statement used a table and generated no\nmessages. (That is, a statement that uses a table but generates no\nmessages clears the message list.) Statements that do not use tables\nand do not generate messages have no effect on the message list.\n\nWarnings are generated for DML statements such as INSERT, UPDATE, and\nLOAD DATA INFILE as well as DDL statements such as CREATE TABLE and\nALTER TABLE.\n\nA related statement, SHOW ERRORS, shows only the errors. See [HELP SHOW\nERRORS].\n\nThe SHOW COUNT(*) WARNINGS statement displays the total number of\nerrors, warnings, and notes. You can also retrieve this number from the\nwarning_count variable:\n\nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n\nThe value of warning_count might be greater than the number of messages\ndisplayed by SHOW WARNINGS if the max_error_count system variable is\nset so low that not all messages are stored. An example shown later in\nthis section demonstrates how this can happen.\n\nThe LIMIT clause has the same syntax as for the SELECT statement. See\nhttp://dev.mysql.com/doc/refman/5.1/en/select.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-warnings.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-warnings.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (328,9,'DROP USER','Syntax:\nDROP USER user [, user] ...\n\nThe DROP USER statement removes one or more MySQL accounts. It removes\nprivilege rows for the account from all grant tables. To use this\nstatement, you must have the global CREATE USER privilege or the DELETE\nprivilege for the mysql database. Each account is named using the same\nformat as for the GRANT statement; for example, \'jeffrey\'@\'localhost\'.\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used. For additional information about specifying\naccount names, see [HELP GRANT].\n\nWith DROP USER, you can remove an account and its privileges as\nfollows:\n\nDROP USER user;\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-user.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-user.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (329,16,'STDDEV_POP','Syntax:\nSTDDEV_POP(expr)\n\nReturns the population standard deviation of expr (the square root of\nVAR_POP()). You can also use STD() or STDDEV(), which are equivalent\nbut not standard SQL.\n\nSTDDEV_POP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (330,25,'SHOW CHARACTER SET','Syntax:\nSHOW CHARACTER SET\n [LIKE \'pattern\' | WHERE expr]\n\nThe SHOW CHARACTER SET statement shows all available character sets.\nThe LIKE clause, if present, indicates which character set names to\nmatch. The WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html. For example:\n\nmysql> SHOW CHARACTER SET LIKE \'latin%\';\n+---------+-----------------------------+-------------------+--------+\n| Charset | Description | Default collation | Maxlen |\n+---------+-----------------------------+-------------------+--------+\n| latin1 | cp1252 West European | latin1_swedish_ci | 1 |\n| latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 |\n| latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 |\n| latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 |\n+---------+-----------------------------+-------------------+--------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-character-set.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-character-set.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (331,35,'SUBSTRING','Syntax:\nSUBSTRING(str,pos), SUBSTRING(str FROM pos), SUBSTRING(str,pos,len),\nSUBSTRING(str FROM pos FOR len)\n\nThe forms without a len argument return a substring from string str\nstarting at position pos. The forms with a len argument return a\nsubstring len characters long from string str, starting at position\npos. The forms that use FROM are standard SQL syntax. It is also\npossible to use a negative value for pos. In this case, the beginning\nof the substring is pos characters from the end of the string, rather\nthan the beginning. A negative value may be used for pos in any of the\nforms of this function.\n\nFor all forms of SUBSTRING(), the position of the first character in\nthe string from which the substring is to be extracted is reckoned as\n1.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT SUBSTRING(\'Quadratically\',5);\n -> \'ratically\'\nmysql> SELECT SUBSTRING(\'foobarbar\' FROM 4);\n -> \'barbar\'\nmysql> SELECT SUBSTRING(\'Quadratically\',5,6);\n -> \'ratica\'\nmysql> SELECT SUBSTRING(\'Sakila\', -3);\n -> \'ila\'\nmysql> SELECT SUBSTRING(\'Sakila\', -5, 3);\n -> \'aki\'\nmysql> SELECT SUBSTRING(\'Sakila\' FROM -4 FOR 2);\n -> \'ki\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (332,34,'ISEMPTY','IsEmpty(g)\n\nReturns 1 if the geometry value g is the empty geometry, 0 if it is not\nempty, and -1 if the argument is NULL. If the geometry is empty, it\nrepresents the empty point set.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (333,25,'SHOW FUNCTION STATUS','Syntax:\nSHOW FUNCTION STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement is similar to SHOW PROCEDURE STATUS but for stored\nfunctions. See [HELP SHOW PROCEDURE STATUS].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-function-status.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-function-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (334,35,'LTRIM','Syntax:\nLTRIM(str)\n\nReturns the string str with leading space characters removed.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT LTRIM(\' barbar\');\n -> \'barbar\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (335,29,'INTERSECTS','Intersects(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially intersects g2.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (336,26,'CALL','Syntax:\nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n\nThe CALL statement invokes a stored procedure that was defined\npreviously with CREATE PROCEDURE.\n\nAs of MySQL 5.1.13, stored procedures that take no arguments can be\ninvoked without parentheses. That is, CALL p() and CALL p are\nequivalent.\n\nCALL can pass back values to its caller using parameters that are\ndeclared as OUT or INOUT parameters. When the procedure returns, a\nclient program can also obtain the number of rows affected for the\nfinal statement executed within the routine: At the SQL level, call the\nROW_COUNT() function; from the C API, call the mysql_affected_rows()\nfunction.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/call.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/call.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (337,6,'MBRDISJOINT','MBRDisjoint(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are disjoint (do not intersect).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (338,14,'VALUES','Syntax:\nVALUES(col_name)\n\nIn an INSERT ... ON DUPLICATE KEY UPDATE statement, you can use the\nVALUES(col_name) function in the UPDATE clause to refer to column\nvalues from the INSERT portion of the statement. In other words,\nVALUES(col_name) in the UPDATE clause refers to the value of col_name\nthat would be inserted, had no duplicate-key conflict occurred. This\nfunction is especially useful in multiple-row inserts. The VALUES()\nfunction is meaningful only in INSERT ... ON DUPLICATE KEY UPDATE\nstatements and returns NULL otherwise.\nhttp://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','mysql> INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)\n -> ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (339,35,'SUBSTRING_INDEX','Syntax:\nSUBSTRING_INDEX(str,delim,count)\n\nReturns the substring from string str before count occurrences of the\ndelimiter delim. If count is positive, everything to the left of the\nfinal delimiter (counting from the left) is returned. If count is\nnegative, everything to the right of the final delimiter (counting from\nthe right) is returned. SUBSTRING_INDEX() performs a case-sensitive\nmatch when searching for delim.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT SUBSTRING_INDEX(\'www.mysql.com\', \'.\', 2);\n -> \'www.mysql\'\nmysql> SELECT SUBSTRING_INDEX(\'www.mysql.com\', \'.\', -2);\n -> \'mysql.com\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (340,11,'ENCODE','Syntax:\nENCODE(str,pass_str)\n\nEncrypt str using pass_str as the password. To decrypt the result, use\nDECODE().\n\nThe result is a binary string of the same length as str.\n\nThe strength of the encryption is based on how good the random\ngenerator is. It should suffice for short strings.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,22,'LOOP','Syntax:\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\nLOOP implements a simple loop construct, enabling repeated execution of\nthe statement list, which consists of one or more statements, each\nterminated by a semicolon (;) statement delimiter. The statements\nwithin the loop are repeated until the loop is exited; usually this is\naccomplished with a LEAVE statement.\n\nA LOOP statement can be labeled. See [HELP BEGIN END] for the rules\nregarding label use.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/loop-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/loop-statement.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,4,'TRUNCATE','Syntax:\nTRUNCATE(X,D)\n\nReturns the number X, truncated to D decimal places. If D is 0, the\nresult has no decimal point or fractional part. D can be negative to\ncause D digits left of the decimal point of the value X to become zero.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT TRUNCATE(1.223,1);\n -> 1.2\nmysql> SELECT TRUNCATE(1.999,1);\n -> 1.9\nmysql> SELECT TRUNCATE(1.999,0);\n -> 1\nmysql> SELECT TRUNCATE(-1.999,1);\n -> -1.9\nmysql> SELECT TRUNCATE(122,-2);\n -> 100\nmysql> SELECT TRUNCATE(10.28*100,0);\n -> 1028\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,30,'TIMESTAMPADD','Syntax:\nTIMESTAMPADD(unit,interval,datetime_expr)\n\nAdds the integer expression interval to the date or datetime expression\ndatetime_expr. The unit for interval is given by the unit argument,\nwhich should be one of the following values: FRAC_SECOND\n(microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or\nYEAR.\n\nBeginning with MySQL 5.1.24, it is possible to use MICROSECOND in place\nof FRAC_SECOND with this function, and FRAC_SECOND is deprecated.\nFRAC_SECOND is removed in MySQL 5.5.\n\nThe unit value may be specified using one of keywords as shown, or with\na prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMPADD(MINUTE,1,\'2003-01-02\');\n -> \'2003-01-02 00:01:00\'\nmysql> SELECT TIMESTAMPADD(WEEK,1,\'2003-01-02\');\n -> \'2003-01-09\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,25,'SHOW','SHOW has many forms that provide information about databases, tables,\ncolumns, or status information about the server. This section describes\nthose following:\n\nSHOW AUTHORS\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE FUNCTION func_name\nSHOW CREATE PROCEDURE proc_name\nSHOW CREATE TABLE tbl_name\nSHOW CREATE TRIGGER trigger_name\nSHOW CREATE VIEW view_name\nSHOW DATABASES [like_or_where]\nSHOW ENGINE engine_name {STATUS | MUTEX}\nSHOW [STORAGE] ENGINES\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW INNODB STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW SCHEDULER STATUS\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW [FULL] TABLES [FROM db_name] [like_or_where]\nSHOW TRIGGERS [FROM db_name] [like_or_where]\nSHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\nSHOW WARNINGS [LIMIT [offset,] row_count]\n\nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n\nIf the syntax for a given SHOW statement includes a LIKE \'pattern\'\npart, \'pattern\' is a string that can contain the SQL "%" and "_"\nwildcard characters. The pattern is useful for restricting statement\noutput to matching values.\n\nSeveral SHOW statements also accept a WHERE clause that provides more\nflexibility in specifying which rows to display. See\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,17,'GREATEST','Syntax:\nGREATEST(value1,value2,...)\n\nWith two or more arguments, returns the largest (maximum-valued)\nargument. The arguments are compared using the same rules as for\nLEAST().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT GREATEST(2,0);\n -> 2\nmysql> SELECT GREATEST(34.0,3.0,5.0,767.0);\n -> 767.0\nmysql> SELECT GREATEST(\'B\',\'A\',\'C\');\n -> \'C\'\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,25,'SHOW VARIABLES','Syntax:\nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW VARIABLES shows the values of MySQL system variables. This\ninformation also can be obtained using the mysqladmin variables\ncommand. The LIKE clause, if present, indicates which variable names to\nmatch. The WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html. This\nstatement does not require any privilege. It requires only the ability\nto connect to the server.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are\nused for new connections to MySQL. With SESSION, it displays the values\nthat are in effect for the current connection. If no modifier is\npresent, the default is SESSION. LOCAL is a synonym for SESSION.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern. To obtain the row for a\nspecific variable, use a LIKE clause as shown:\n\nSHOW VARIABLES LIKE \'max_join_size\';\nSHOW SESSION VARIABLES LIKE \'max_join_size\';\n\nTo get a list of variables whose name match a pattern, use the "%"\nwildcard character in a LIKE clause:\n\nSHOW VARIABLES LIKE \'%size%\';\nSHOW GLOBAL VARIABLES LIKE \'%size%\';\n\nWildcard characters can be used in any position within the pattern to\nbe matched. Strictly speaking, because "_" is a wildcard that matches\nany single character, you should escape it as "\\_" to match it\nliterally. In practice, this is rarely necessary.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-variables.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-variables.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,25,'BINLOG','Syntax:\nBINLOG \'str\'\n\nBINLOG is an internal-use statement. It is generated by the mysqlbinlog\nprogram as the printable representation of certain events in binary log\nfiles. (See http://dev.mysql.com/doc/refman/5.1/en/mysqlbinlog.html.)\nThe \'str\' value is a base 64-encoded string the that server decodes to\ndetermine the data change indicated by the corresponding event. This\nstatement requires the SUPER privilege. It was added in MySQL 5.1.5.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/binlog.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/binlog.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,16,'BIT_AND','Syntax:\nBIT_AND(expr)\n\nReturns the bitwise AND of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (349,30,'SECOND','Syntax:\nSECOND(time)\n\nReturns the second for time, in the range 0 to 59.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT SECOND(\'10:05:03\');\n -> 3\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (350,4,'ATAN2','Syntax:\nATAN(Y,X), ATAN2(Y,X)\n\nReturns the arc tangent of the two variables X and Y. It is similar to\ncalculating the arc tangent of Y / X, except that the signs of both\narguments are used to determine the quadrant of the result.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT ATAN(-2,2);\n -> -0.78539816339745\nmysql> SELECT ATAN2(PI(),0);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (351,6,'MBRCONTAINS','MBRContains(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\ncontains the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRWithin().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','mysql> SET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nmysql> SET @g2 = GeomFromText(\'Point(1 1)\');\nmysql> SELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,30,'HOUR','Syntax:\nHOUR(time)\n\nReturns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much\nlarger, so HOUR can return values greater than 23.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT HOUR(\'10:05:03\');\n -> 10\nmysql> SELECT HOUR(\'272:59:59\');\n -> 272\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,26,'SELECT','Syntax:\nSELECT\n [ALL | DISTINCT | DISTINCTROW ]\n [HIGH_PRIORITY]\n [STRAIGHT_JOIN]\n [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n select_expr [, select_expr ...]\n [FROM table_references\n [WHERE where_condition]\n [GROUP BY {col_name | expr | position}\n [ASC | DESC], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position}\n [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\'\n [CHARACTER SET charset_name]\n export_options\n | INTO DUMPFILE \'file_name\'\n | INTO var_name [, var_name]]\n [FOR UPDATE | LOCK IN SHARE MODE]]\n\nSELECT is used to retrieve rows selected from one or more tables, and\ncan include UNION statements and subqueries. See [HELP UNION], and\nhttp://dev.mysql.com/doc/refman/5.1/en/subqueries.html.\n\nThe most commonly used clauses of SELECT statements are these:\n\no Each select_expr indicates a column that you want to retrieve. There\n must be at least one select_expr.\n\no table_references indicates the table or tables from which to retrieve\n rows. Its syntax is described in [HELP JOIN].\n\no The WHERE clause, if given, indicates the condition or conditions\n that rows must satisfy to be selected. where_condition is an\n expression that evaluates to true for each row to be selected. The\n statement selects all rows if there is no WHERE clause.\n\n In the WHERE clause, you can use any of the functions and operators\n that MySQL supports, except for aggregate (summary) functions. See\n http://dev.mysql.com/doc/refman/5.1/en/functions.html.\n\nSELECT can also be used to retrieve rows computed without reference to\nany table.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/select.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,4,'COT','Syntax:\nCOT(X)\n\nReturns the cotangent of X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT COT(12);\n -> -1.5726734063977\nmysql> SELECT COT(0);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,25,'SHOW CREATE EVENT','Syntax:\nSHOW CREATE EVENT event_name\n\nThis statement displays the CREATE EVENT statement needed to re-create\na given event. For example (using the same event e_daily defined and\nthen altered in [HELP SHOW EVENTS]):\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-event.html\n\n','mysql> SHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row ***************************\n Event: e_daily\n sql_mode:\n time_zone: SYSTEM\n Create Event: CREATE EVENT `e_daily`\n ON SCHEDULE EVERY 1 DAY\n STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR\n ON COMPLETION NOT PRESERVE\n ENABLE\n COMMENT \'Saves total number of sessions then\n clears the table each day\'\n DO BEGIN\n INSERT INTO site_activity.totals (time, total)\n SELECT CURRENT_TIMESTAMP, COUNT(*)\n FROM site_activity.sessions;\n DELETE FROM site_activity.sessions;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.1/en/show-create-event.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,19,'BACKUP TABLE','Syntax:\nBACKUP TABLE tbl_name [, tbl_name] ... TO \'/path/to/backup/directory\'\n\n*Note*: This statement is deprecated and is removed in MySQL 5.5. As an\nalternative, mysqldump or mysqlhotcopy can be used instead.\n\nBACKUP TABLE copies to the backup directory the minimum number of table\nfiles needed to restore the table, after flushing any buffered changes\nto disk. The statement works only for MyISAM tables. It copies the .frm\ndefinition and .MYD data files. The .MYI index file can be rebuilt from\nthose two files. The directory should be specified as a full path name.\nTo restore the table, use RESTORE TABLE.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/backup-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/backup-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (357,35,'LOAD_FILE','Syntax:\nLOAD_FILE(file_name)\n\nReads the file and returns the file contents as a string. To use this\nfunction, the file must be located on the server host, you must specify\nthe full path name to the file, and you must have the FILE privilege.\nThe file must be readable by all and its size less than\nmax_allowed_packet bytes. If the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nIf the file does not exist or cannot be read because one of the\npreceding conditions is not satisfied, the function returns NULL.\n\nAs of MySQL 5.1.6, the character_set_filesystem system variable\ncontrols interpretation of file names that are given as literal\nstrings.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> UPDATE t\n SET blob_col=LOAD_FILE(\'/tmp/picture\')\n WHERE id=1;\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (358,25,'LOAD TABLE FROM MASTER','Syntax:\nLOAD TABLE tbl_name FROM MASTER\n\nThis feature is deprecated and should be avoided. It is subject to\nremoval in a future version of MySQL.\n\nSince the current implementation of LOAD DATA FROM MASTER and LOAD\nTABLE FROM MASTER is very limited, these statements are deprecated as\nof MySQL 4.1 and removed in MySQL 5.5.\n\nThe recommended alternative solution to using LOAD DATA FROM MASTER or\nLOAD TABLE FROM MASTER is using mysqldump or mysqlhotcopy. The latter\nrequires Perl and two Perl modules (DBI and DBD:mysql) and works for\nMyISAM and ARCHIVE tables only. With mysqldump, you can create SQL\ndumps on the master and pipe (or copy) these to a mysql client on the\nslave. This has the advantage of working for all storage engines, but\ncan be quite slow, since it works using SELECT.\n\nTransfers a copy of the table from the master to the slave. This\nstatement is implemented mainly debugging LOAD DATA FROM MASTER\noperations. To use LOAD TABLE, the account used for connecting to the\nmaster server must have the RELOAD and SUPER privileges on the master\nand the SELECT privilege for the master table to load. On the slave\nside, the user that issues LOAD TABLE FROM MASTER must have privileges\nfor dropping and creating the table.\n\nThe conditions for LOAD DATA FROM MASTER apply here as well. For\nexample, LOAD TABLE FROM MASTER works only for MyISAM tables. The\ntimeout notes for LOAD DATA FROM MASTER apply as well.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/load-table-from-master.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/load-table-from-master.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (359,3,'POINTFROMTEXT','PointFromText(wkt[,srid])\n\nConstructs a POINT value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (360,16,'GROUP_CONCAT','Syntax:\nGROUP_CONCAT(expr)\n\nThis function returns a string result with the concatenated non-NULL\nvalues from a group. It returns NULL if there are no non-NULL values.\nThe full syntax is as follows:\n\nGROUP_CONCAT([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [SEPARATOR str_val])\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT student_name,\n -> GROUP_CONCAT(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (361,30,'DATE_FORMAT','Syntax:\nDATE_FORMAT(date,format)\n\nFormats the date value according to the format string.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DATE_FORMAT(\'2009-10-04 22:23:00\', \'%W %M %Y\');\n -> \'Sunday October 2009\'\nmysql> SELECT DATE_FORMAT(\'2007-10-04 22:23:00\', \'%H:%i:%s\');\n -> \'22:23:00\'\nmysql> SELECT DATE_FORMAT(\'1900-10-04 22:23:00\',\n -> \'%D %y %a %d %m %b %j\');\n -> \'4th 00 Thu 04 10 Oct 277\'\nmysql> SELECT DATE_FORMAT(\'1997-10-04 22:23:00\',\n -> \'%H %k %I %r %T %S %w\');\n -> \'22 22 10 10:23:00 PM 22:23:00 00 6\'\nmysql> SELECT DATE_FORMAT(\'1999-01-01\', \'%X %V\');\n -> \'1998 52\'\nmysql> SELECT DATE_FORMAT(\'2006-06-00\', \'%d\');\n -> \'00\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (362,15,'BENCHMARK','Syntax:\nBENCHMARK(count,expr)\n\nThe BENCHMARK() function executes the expression expr repeatedly count\ntimes. It may be used to time how quickly MySQL processes the\nexpression. The result value is always 0. The intended use is from\nwithin the mysql client, which reports query execution times:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\'));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (4.74 sec)\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (363,30,'YEAR','Syntax:\nYEAR(date)\n\nReturns the year for date, in the range 1000 to 9999, or 0 for the\n"zero" date.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT YEAR(\'1987-01-01\');\n -> 1987\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (364,25,'SHOW ENGINE','Syntax:\nSHOW ENGINE engine_name {STATUS | MUTEX}\n\nSHOW ENGINE displays operational information about a storage engine.\nThe following statements currently are supported:\n\nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE {NDB | NDBCLUSTER} STATUS\n\nOlder (and now deprecated) synonyms are SHOW INNODB STATUS for SHOW\nENGINE INNODB STATUS and SHOW MUTEX STATUS for SHOW ENGINE INNODB\nMUTEX. SHOW INNODB STATUS and SHOW MUTEX STATUS are removed in MySQL\n5.5.\n\nIn MySQL 5.0, SHOW ENGINE INNODB MUTEX is invoked as SHOW MUTEX STATUS.\nThe latter statement displays similar information but in a somewhat\ndifferent output format.\n\nSHOW ENGINE BDB LOGS formerly displayed status information about BDB\nlog files. As of MySQL 5.1.12, the BDB storage engine is not supported,\nand this statement produces a warning.\n\nSHOW ENGINE INNODB STATUS displays extensive information from the\nstandard InnoDB Monitor about the state of the InnoDB storage engine.\nFor information about the standard monitor and other InnoDB Monitors\nthat provide information about InnoDB processing, see\nhttp://dev.mysql.com/doc/refman/5.1/en/innodb-monitors.html.\n\nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics. From MySQL\n5.1.2 to 5.1.14, the statement displays the following output fields:\n\no Type\n\n Always InnoDB.\n\no Name\n\n The mutex name and the source file where it is implemented. Example:\n &pool->mutex:mem0pool.c\n\n The mutex name indicates its purpose. For example, the log_sys mutex\n is used by the InnoDB logging subsystem and indicates how intensive\n logging activity is. The buf_pool mutex protects the InnoDB buffer\n pool.\n\no Status\n\n The mutex status. The fields contains several values:\n\n o count indicates how many times the mutex was requested.\n\n o spin_waits indicates how many times the spinlock had to run.\n\n o spin_rounds indicates the number of spinlock rounds. (spin_rounds\n divided by spin_waits provides the average round count.)\n\n o os_waits indicates the number of operating system waits. This\n occurs when the spinlock did not work (the mutex was not locked\n during the spinlock and it was necessary to yield to the operating\n system and wait).\n\n o os_yields indicates the number of times a the thread trying to lock\n a mutex gave up its timeslice and yielded to the operating system\n (on the presumption that allowing other threads to run will free\n the mutex so that it can be locked).\n\n o os_wait_times indicates the amount of time (in ms) spent in\n operating system waits, if the timed_mutexes system variable is 1\n (ON). If timed_mutexes is 0 (OFF), timing is disabled, so\n os_wait_times is 0. timed_mutexes is off by default.\n\nFrom MySQL 5.1.15 on, the statement displays the following output\nfields:\n\no Type\n\n Always InnoDB.\n\no Name\n\n The source file where the mutex is implemented, and the line number\n in the file where the mutex is created. The line number may change\n depending on your version of MySQL.\n\no Status\n\n This field displays the same values as previously described (count,\n spin_waits, spin_rounds, os_waits, os_yields, os_wait_times), but\n only if UNIV_DEBUG was defined at MySQL compilation time (for\n example, in include/univ.h in the InnoDB part of the MySQL source\n tree). If UNIV_DEBUG was not defined, the statement displays only the\n os_waits value. In the latter case (without UNIV_DEBUG), the\n information on which the output is based is insufficient to\n distinguish regular mutexes and mutexes that protect rw-locks (which\n allow multiple readers or a single writer). Consequently, the output\n may appear to contain multiple rows for the same mutex.\n\nInformation from this statement can be used to diagnose system\nproblems. For example, large values of spin_waits and spin_rounds may\nindicate scalability problems.\n\nIf the server has the NDBCLUSTER storage engine enabled, SHOW ENGINE\nNDB STATUS displays cluster status information such as the number of\nconnected data nodes, the cluster connectstring, and cluster binlog\nepochs, as well as counts of various Cluster API objects created by the\nMySQL Server when connected to the cluster. Sample output from this\nstatement is shown here:\n\nmysql> SHOW ENGINE NDB STATUS;\n+------------+-----------------------+--------------------------------------------------+\n| Type | Name | Status |\n+------------+-----------------------+--------------------------------------------------+\n| ndbcluster | connection | cluster_node_id=7,\n connected_host=192.168.0.103, connected_port=1186, number_of_data_nodes=4,\n number_of_ready_data_nodes=3, connect_count=0 |\n| ndbcluster | NdbTransaction | created=6, free=0, sizeof=212 |\n| ndbcluster | NdbOperation | created=8, free=8, sizeof=660 |\n| ndbcluster | NdbIndexScanOperation | created=1, free=1, sizeof=744 |\n| ndbcluster | NdbIndexOperation | created=0, free=0, sizeof=664 |\n| ndbcluster | NdbRecAttr | created=1285, free=1285, sizeof=60 |\n| ndbcluster | NdbApiSignal | created=16, free=16, sizeof=136 |\n| ndbcluster | NdbLabel | created=0, free=0, sizeof=196 |\n| ndbcluster | NdbBranch | created=0, free=0, sizeof=24 |\n| ndbcluster | NdbSubroutine | created=0, free=0, sizeof=68 |\n| ndbcluster | NdbCall | created=0, free=0, sizeof=16 |\n| ndbcluster | NdbBlob | created=1, free=1, sizeof=264 |\n| ndbcluster | NdbReceiver | created=4, free=0, sizeof=68 |\n| ndbcluster | binlog | latest_epoch=155467, latest_trans_epoch=148126,\n latest_received_binlog_epoch=0, latest_handled_binlog_epoch=0,\n latest_applied_binlog_epoch=0 |\n+------------+-----------------------+--------------------------------------------------+\n\nThe rows with connection and binlog in the Name column were added to\nthe output of this statement in MySQL 5.1. The Status column in each of\nthese rows provides information about the MySQL server\'s connection to\nthe cluster and about the cluster binary log\'s status, respectively.\nThe Status information is in the form of comma-delimited set of\nname/value pairs.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-engine.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-engine.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (365,14,'NAME_CONST','Syntax:\nNAME_CONST(name,value)\n\nReturns the given value. When used to produce a result set column,\nNAME_CONST() causes the column to have the given name. The arguments\nshould be constants.\n\nmysql> SELECT NAME_CONST(\'myname\', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (366,14,'RELEASE_LOCK','Syntax:\nRELEASE_LOCK(str)\n\nReleases the lock named by the string str that was obtained with\nGET_LOCK(). Returns 1 if the lock was released, 0 if the lock was not\nestablished by this thread (in which case the lock is not released),\nand NULL if the named lock did not exist. The lock does not exist if it\nwas never obtained by a call to GET_LOCK() or if it has previously been\nreleased.\n\nThe DO statement is convenient to use with RELEASE_LOCK(). See [HELP\nDO].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (367,17,'IS NULL','Syntax:\nIS NULL\n\nTests whether a value is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;\n -> 0, 0, 1\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (368,30,'CONVERT_TZ','Syntax:\nCONVERT_TZ(dt,from_tz,to_tz)\n\nCONVERT_TZ() converts a datetime value dt from the time zone given by\nfrom_tz to the time zone given by to_tz and returns the resulting\nvalue. Time zones are specified as described in\nhttp://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html. This\nfunction returns NULL if the arguments are invalid.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT CONVERT_TZ(\'2004-01-01 12:00:00\',\'GMT\',\'MET\');\n -> \'2004-01-01 13:00:00\'\nmysql> SELECT CONVERT_TZ(\'2004-01-01 12:00:00\',\'+00:00\',\'+10:00\');\n -> \'2004-01-01 22:00:00\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (369,30,'TIME_TO_SEC','Syntax:\nTIME_TO_SEC(time)\n\nReturns the time argument, converted to seconds.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIME_TO_SEC(\'22:23:00\');\n -> 80580\nmysql> SELECT TIME_TO_SEC(\'00:39:38\');\n -> 2378\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (370,30,'WEEKDAY','Syntax:\nWEEKDAY(date)\n\nReturns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 =\nSunday).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT WEEKDAY(\'2008-02-03 22:23:00\');\n -> 6\nmysql> SELECT WEEKDAY(\'2007-11-06\');\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (371,35,'EXPORT_SET','Syntax:\nEXPORT_SET(bits,on,off[,separator[,number_of_bits]])\n\nReturns a string such that for every bit set in the value bits, you get\nan on string and for every bit not set in the value, you get an off\nstring. Bits in bits are examined from right to left (from low-order to\nhigh-order bits). Strings are added to the result from left to right,\nseparated by the separator string (the default being the comma\ncharacter ","). The number of bits examined is given by number_of_bits\n(defaults to 64).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT EXPORT_SET(5,\'Y\',\'N\',\',\',4);\n -> \'Y,N,Y,N\'\nmysql> SELECT EXPORT_SET(6,\'1\',\'0\',\',\',10);\n -> \'0,1,1,0,0,0,0,0,0,0\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (372,37,'ALTER SERVER','Syntax:\nALTER SERVER server_name\n OPTIONS (option [, option] ...)\n\nAlters the server information for server_name, adjusting the specified\noptions as per the CREATE SERVER command. See [HELP CREATE SERVER]. The\ncorresponding fields in the mysql.servers table are updated\naccordingly. This statement requires the SUPER privilege.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/alter-server.html\n\n','ALTER SERVER s OPTIONS (USER \'sally\');\n','http://dev.mysql.com/doc/refman/5.1/en/alter-server.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (373,30,'TIME FUNCTION','Syntax:\nTIME(expr)\n\nExtracts the time part of the time or datetime expression expr and\nreturns it as a string.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIME(\'2003-12-31 01:02:03\');\n -> \'01:02:03\'\nmysql> SELECT TIME(\'2003-12-31 01:02:03.000123\');\n -> \'01:02:03.000123\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (374,30,'DATE_ADD','Syntax:\nDATE_ADD(date,INTERVAL expr unit), DATE_SUB(date,INTERVAL expr unit)\n\nThese functions perform date arithmetic. The date argument specifies\nthe starting date or datetime value. expr is an expression specifying\nthe interval value to be added or subtracted from the starting date.\nexpr is a string; it may start with a "-" for negative intervals. unit\nis a keyword indicating the units in which the expression should be\ninterpreted.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\n -> \'2009-01-01 00:00:00\'\nmysql> SELECT INTERVAL 1 DAY + \'2008-12-31\';\n -> \'2009-01-01\'\nmysql> SELECT \'2005-01-01\' - INTERVAL 1 SECOND;\n -> \'2004-12-31 23:59:59\'\nmysql> SELECT DATE_ADD(\'2000-12-31 23:59:59\',\n -> INTERVAL 1 SECOND);\n -> \'2001-01-01 00:00:00\'\nmysql> SELECT DATE_ADD(\'2010-12-31 23:59:59\',\n -> INTERVAL 1 DAY);\n -> \'2011-01-01 23:59:59\'\nmysql> SELECT DATE_ADD(\'2100-12-31 23:59:59\',\n -> INTERVAL \'1:1\' MINUTE_SECOND);\n -> \'2101-01-01 00:01:00\'\nmysql> SELECT DATE_SUB(\'2005-01-01 00:00:00\',\n -> INTERVAL \'1 1:1:1\' DAY_SECOND);\n -> \'2004-12-30 22:58:59\'\nmysql> SELECT DATE_ADD(\'1900-01-01 00:00:00\',\n -> INTERVAL \'-1 10\' DAY_HOUR);\n -> \'1899-12-30 14:00:00\'\nmysql> SELECT DATE_SUB(\'1998-01-02\', INTERVAL 31 DAY);\n -> \'1997-12-02\'\nmysql> SELECT DATE_ADD(\'1992-12-31 23:59:59.000002\',\n -> INTERVAL \'1.999999\' SECOND_MICROSECOND);\n -> \'1993-01-01 00:00:01.000001\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (375,35,'CAST','Syntax:\nCAST(expr AS type)\n\nThe CAST() function takes a value of one type and produce a value of\nanother type, similar to CONVERT(). See the description of CONVERT()\nfor more information.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (376,35,'SOUNDS LIKE','Syntax:\nexpr1 SOUNDS LIKE expr2\n\nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (377,30,'PERIOD_DIFF','Syntax:\nPERIOD_DIFF(P1,P2)\n\nReturns the number of months between periods P1 and P2. P1 and P2\nshould be in the format YYMM or YYYYMM. Note that the period arguments\nP1 and P2 are not date values.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT PERIOD_DIFF(200802,200703);\n -> 11\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (378,35,'LIKE','Syntax:\nexpr LIKE pat [ESCAPE \'escape_char\']\n\nPattern matching using SQL simple regular expression comparison.\nReturns 1 (TRUE) or 0 (FALSE). If either expr or pat is NULL, the\nresult is NULL.\n\nThe pattern need not be a literal string. For example, it can be\nspecified as a string expression or table column.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html\n\n','mysql> SELECT \'David!\' LIKE \'David_\';\n -> 1\nmysql> SELECT \'David!\' LIKE \'%D%v%\';\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (379,23,'MULTIPOINT','MultiPoint(pt1,pt2,...)\n\nConstructs a MultiPoint value using Point or WKB Point arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (380,18,'>>','Syntax:\n>>\n\nShifts a longlong (BIGINT) number to the right.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html\n\n','mysql> SELECT 4 >> 2;\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (381,22,'FETCH','Syntax:\nFETCH cursor_name INTO var_name [, var_name] ...\n\nThis statement fetches the next row (if a row exists) using the\nspecified open cursor, and advances the cursor pointer.\n\nIf no more rows are available, a No Data condition occurs with SQLSTATE\nvalue 02000. To detect this condition, you can set up a handler for it\n(or for a NOT FOUND condition). An example is shown in\nhttp://dev.mysql.com/doc/refman/5.1/en/cursors.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/fetch.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/fetch.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (382,16,'AVG','Syntax:\nAVG([DISTINCT] expr)\n\nReturns the average value of expr. The DISTINCT option can be used to\nreturn the average of the distinct values of expr.\n\nAVG() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT student_name, AVG(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (383,28,'TRUE FALSE','The constants TRUE and FALSE evaluate to 1 and 0, respectively. The\nconstant names can be written in any lettercase.\n\nmysql> SELECT TRUE, true, FALSE, false;\n -> 1, 1, 0, 0\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/boolean-values.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/boolean-values.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (384,6,'MBRWITHIN','MBRWithin(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\nis within the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRContains().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','mysql> SET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nmysql> SET @g2 = GeomFromText(\'Polygon((0 0,0 5,5 5,5 0,0 0))\');\nmysql> SELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (385,17,'IN','Syntax:\nexpr IN (value,...)\n\nReturns 1 if expr is equal to any of the values in the IN list, else\nreturns 0. If all values are constants, they are evaluated according to\nthe type of expr and sorted. The search for the item then is done using\na binary search. This means IN is very quick if the IN value list\nconsists entirely of constants. Otherwise, type conversion takes place\naccording to the rules described in\nhttp://dev.mysql.com/doc/refman/5.1/en/type-conversion.html, but\napplied to all the arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 2 IN (0,3,5,7);\n -> 0\nmysql> SELECT \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\');\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (386,35,'QUOTE','Syntax:\nQUOTE(str)\n\nQuotes a string to produce a result that can be used as a properly\nescaped data value in an SQL statement. The string is returned enclosed\nby single quotes and with each instance of single quote ("\'"),\nbackslash ("\\"), ASCII NUL, and Control-Z preceded by a backslash. If\nthe argument is NULL, the return value is the word "NULL" without\nenclosing single quotes.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT QUOTE(\'Don\\\'t!\');\n -> \'Don\\\'t!\'\nmysql> SELECT QUOTE(NULL);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (387,15,'SESSION_USER','Syntax:\nSESSION_USER()\n\nSESSION_USER() is a synonym for USER().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (388,25,'HELP COMMAND','Syntax:\nmysql> help search_string\n\nIf you provide an argument to the help command, mysql uses it as a\nsearch string to access server-side help from the contents of the MySQL\nReference Manual. The proper operation of this command requires that\nthe help tables in the mysql database be initialized with help topic\ninformation (see\nhttp://dev.mysql.com/doc/refman/5.1/en/server-side-help-support.html).\n\nIf there is no match for the search string, the search fails:\n\nmysql> help me\n\nNothing found\nPlease try to run \'help contents\' for a list of all accessible topics\n\nUse help contents to see a list of the help categories:\n\nmysql> help contents\nYou asked for help about help category: "Contents"\nFor more information, type \'help <item>\', where <item> is one of the\nfollowing categories:\n Account Management\n Administration\n Data Definition\n Data Manipulation\n Data Types\n Functions\n Functions and Modifiers for Use with GROUP BY\n Geographic Features\n Language Structure\n Plugins\n Storage Engines\n Stored Routines\n Table Maintenance\n Transactions\n Triggers\n\nIf the search string matches multiple items, mysql shows a list of\nmatching topics:\n\nmysql> help logs\nMany help items for your request exist.\nTo make a more specific request, please type \'help <item>\',\nwhere <item> is one of the following topics:\n SHOW\n SHOW BINARY LOGS\n SHOW ENGINE\n SHOW LOGS\n\nUse a topic as the search string to see the help entry for that topic:\n\nmysql> help show binary logs\nName: \'SHOW BINARY LOGS\'\nDescription:\nSyntax:\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nLists the binary log files on the server. This statement is used as\npart of the procedure described in [purge-binary-logs], that shows how\nto determine which logs can be purged.\n\nmysql> SHOW BINARY LOGS;\n+---------------+-----------+\n| Log_name | File_size |\n+---------------+-----------+\n| binlog.000015 | 724935 |\n| binlog.000016 | 733481 |\n+---------------+-----------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mysql-server-side-help.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/mysql-server-side-help.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (389,30,'QUARTER','Syntax:\nQUARTER(date)\n\nReturns the quarter of the year for date, in the range 1 to 4.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT QUARTER(\'2008-04-01\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (390,35,'POSITION','Syntax:\nPOSITION(substr IN str)\n\nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (391,25,'SHOW CREATE FUNCTION','Syntax:\nSHOW CREATE FUNCTION func_name\n\nThis statement is similar to SHOW CREATE PROCEDURE but for stored\nfunctions. See [HELP SHOW CREATE PROCEDURE].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-function.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-create-function.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (392,14,'IS_USED_LOCK','Syntax:\nIS_USED_LOCK(str)\n\nChecks whether the lock named str is in use (that is, locked). If so,\nit returns the connection identifier of the client that holds the lock.\nOtherwise, it returns NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (393,3,'POLYFROMTEXT','PolyFromText(wkt[,srid]), PolygonFromText(wkt[,srid])\n\nConstructs a POLYGON value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (394,11,'DES_ENCRYPT','Syntax:\nDES_ENCRYPT(str[,{key_num|key_str}])\n\nEncrypts the string with the given key using the Triple-DES algorithm.\n\nThis function works only if MySQL has been configured with SSL support.\nSee http://dev.mysql.com/doc/refman/5.1/en/secure-connections.html.\n\nThe encryption key to use is chosen based on the second argument to\nDES_ENCRYPT(), if one was given. With no argument, the first key from\nthe DES key file is used. With a key_num argument, the given key number\n(0-9) from the DES key file is used. With a key_str argument, the given\nkey string is used to encrypt str.\n\nThe key file can be specified with the --des-key-file server option.\n\nThe return string is a binary string where the first character is\nCHAR(128 | key_num). If an error occurs, DES_ENCRYPT() returns NULL.\n\nThe 128 is added to make it easier to recognize an encrypted key. If\nyou use a string key, key_num is 127.\n\nThe string length for the result is given by this formula:\n\nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n\nEach line in the DES key file has the following format:\n\nkey_num des_key_str\n\nEach key_num value must be a number in the range from 0 to 9. Lines in\nthe file may be in any order. des_key_str is the string that is used to\nencrypt the message. There should be at least one space between the\nnumber and the key. The first key is the default key that is used if\nyou do not specify any key argument to DES_ENCRYPT().\n\nYou can tell MySQL to read new key values from the key file with the\nFLUSH DES_KEY_FILE statement. This requires the RELOAD privilege.\n\nOne benefit of having a set of default keys is that it gives\napplications a way to check for the existence of encrypted column\nvalues, without giving the end user the right to decrypt those values.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','mysql> SELECT customer_address FROM customer_table \n > WHERE crypted_credit_card = DES_ENCRYPT(\'credit_card_number\');\n','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (395,4,'CEIL','Syntax:\nCEIL(X)\n\nCEIL() is a synonym for CEILING().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (396,35,'LENGTH','Syntax:\nLENGTH(str)\n\nReturns the length of the string str, measured in bytes. A multi-byte\ncharacter counts as multiple bytes. This means that for a string\ncontaining five two-byte characters, LENGTH() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT LENGTH(\'text\');\n -> 4\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (397,30,'STR_TO_DATE','Syntax:\nSTR_TO_DATE(str,format)\n\nThis is the inverse of the DATE_FORMAT() function. It takes a string\nstr and a format string format. STR_TO_DATE() returns a DATETIME value\nif the format string contains both date and time parts, or a DATE or\nTIME value if the string contains only date or time parts. If the date,\ntime, or datetime value extracted from str is illegal, STR_TO_DATE()\nreturns NULL and produces a warning.\n\nThe server scans str attempting to match format to it. The format\nstring can contain literal characters and format specifiers beginning\nwith %. Literal characters in format must match literally in str.\nFormat specifiers in format must match a date or time part in str. For\nthe specifiers that can be used in format, see the DATE_FORMAT()\nfunction description.\n\nmysql> SELECT STR_TO_DATE(\'01,5,2013\',\'%d,%m,%Y\');\n -> \'2013-05-01\'\nmysql> SELECT STR_TO_DATE(\'May 1, 2013\',\'%M %d,%Y\');\n -> \'2013-05-01\'\n\nScanning starts at the beginning of str and fails if format is found\nnot to match. Extra characters at the end of str are ignored.\n\nmysql> SELECT STR_TO_DATE(\'a09:30:17\',\'a%h:%i:%s\');\n -> \'09:30:17\'\nmysql> SELECT STR_TO_DATE(\'a09:30:17\',\'%h:%i:%s\');\n -> NULL\nmysql> SELECT STR_TO_DATE(\'09:30:17a\',\'%h:%i:%s\');\n -> \'09:30:17\'\n\nUnspecified date or time parts have a value of 0, so incompletely\nspecified values in str produce a result with some or all parts set to\n0:\n\nmysql> SELECT STR_TO_DATE(\'abc\',\'abc\');\n -> \'0000-00-00\'\nmysql> SELECT STR_TO_DATE(\'9\',\'%m\');\n -> \'0000-09-00\'\nmysql> SELECT STR_TO_DATE(\'9\',\'%s\');\n -> \'00:00:09\'\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (398,10,'Y','Y(p)\n\nReturns the Y-coordinate value for the point p as a double-precision\nnumber.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#point-property-functions\n\n','mysql> SET @pt = \'Point(56.7 53.34)\';\nmysql> SELECT Y(GeomFromText(@pt));\n+----------------------+\n| Y(GeomFromText(@pt)) |\n+----------------------+\n| 53.34 |\n+----------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#point-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (399,25,'SHOW INNODB STATUS','Syntax:\nSHOW INNODB STATUS\n\nIn MySQL 5.1, this is a deprecated synonym for SHOW ENGINE INNODB\nSTATUS. See [HELP SHOW ENGINE]. SHOW INNODB STATUS is removed in MySQL\n5.5.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-innodb-status.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-innodb-status.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (400,19,'CHECKSUM TABLE','Syntax:\nCHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]\n\nCHECKSUM TABLE reports a table checksum.\n\nWith QUICK, the live table checksum is reported if it is available, or\nNULL otherwise. This is very fast. A live checksum is enabled by\nspecifying the CHECKSUM=1 table option when you create the table;\ncurrently, this is supported only for MyISAM tables. See [HELP CREATE\nTABLE].\n\nWith EXTENDED, the entire table is read row by row and the checksum is\ncalculated. This can be very slow for large tables.\n\nIf neither QUICK nor EXTENDED is specified, MySQL returns a live\nchecksum if the table storage engine supports it and scans the table\notherwise.\n\nFor a nonexistent table, CHECKSUM TABLE returns NULL and generates a\nwarning.\n\nThe checksum value depends on the table row format. If the row format\nchanges, the checksum also changes. For example, the storage format for\nVARCHAR changed between MySQL 4.1 and 5.0, so if a 4.1 table is\nupgraded to MySQL 5.0, the checksum value may change.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/checksum-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/checksum-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (401,2,'NUMINTERIORRINGS','NumInteriorRings(poly)\n\nReturns the number of interior rings in the Polygon value poly.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nmysql> SELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#polygon-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (402,2,'INTERIORRINGN','InteriorRingN(poly,N)\n\nReturns the N-th interior ring for the Polygon value poly as a\nLineString. Rings are numbered beginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nmysql> SELECT AsText(InteriorRingN(GeomFromText(@poly),1));\n+----------------------------------------------+\n| AsText(InteriorRingN(GeomFromText(@poly),1)) |\n+----------------------------------------------+\n| LINESTRING(1 1,1 2,2 2,2 1,1 1) |\n+----------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#polygon-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (403,30,'UTC_TIME','Syntax:\nUTC_TIME, UTC_TIME()\n\nReturns the current UTC time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_TIME(), UTC_TIME() + 0;\n -> \'18:07:53\', 180753.000000\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (404,37,'DROP FUNCTION','The DROP FUNCTION statement is used to drop stored functions and\nuser-defined functions (UDFs):\n\no For information about dropping stored functions, see [HELP DROP\n PROCEDURE].\n\no For information about dropping user-defined functions, see [HELP DROP\n FUNCTION UDF].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-function.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-function.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (405,37,'ALTER EVENT','Syntax:\nALTER\n [DEFINER = { user | CURRENT_USER }]\n EVENT event_name\n [ON SCHEDULE schedule]\n [ON COMPLETION [NOT] PRESERVE]\n [RENAME TO new_event_name]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n [DO sql_statement]\n\nThe ALTER EVENT statement is used to change one or more of the\ncharacteristics of an existing event without the need to drop and\nrecreate it. The syntax for each of the DEFINER, ON SCHEDULE, ON\nCOMPLETION, COMMENT, ENABLE / DISABLE, and DO clauses is exactly the\nsame as when used with CREATE EVENT. (See [HELP CREATE EVENT].)\n\nSupport for the DEFINER clause was added in MySQL 5.1.17.\n\nBeginning with MySQL 5.1.12, this statement requires the EVENT\nprivilege. When a user executes a successful ALTER EVENT statement,\nthat user becomes the definer for the affected event.\n\n(In MySQL 5.1.11 and earlier, an event could be altered only by its\ndefiner, or by a user having the SUPER privilege.)\n\nALTER EVENT works only with an existing event:\n\nmysql> ALTER EVENT no_such_event \n > ON SCHEDULE \n > EVERY \'2:3\' DAY_HOUR;\nERROR 1517 (HY000): Unknown event \'no_such_event\'\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/alter-event.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/alter-event.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (406,16,'STDDEV','Syntax:\nSTDDEV(expr)\n\nReturns the population standard deviation of expr. This function is\nprovided for compatibility with Oracle. The standard SQL function\nSTDDEV_POP() can be used instead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (407,30,'DATE_SUB','Syntax:\nDATE_SUB(date,INTERVAL expr unit)\n\nSee the description for DATE_ADD().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (408,30,'PERIOD_ADD','Syntax:\nPERIOD_ADD(P,N)\n\nAdds N months to period P (in the format YYMM or YYYYMM). Returns a\nvalue in the format YYYYMM. Note that the period argument P is not a\ndate value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT PERIOD_ADD(200801,2);\n -> 200803\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (409,18,'|','Syntax:\n|\n\nBitwise OR:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html\n\n','mysql> SELECT 29 | 15;\n -> 31\n','http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (410,3,'GEOMFROMTEXT','GeomFromText(wkt[,srid]), GeometryFromText(wkt[,srid])\n\nConstructs a geometry value of any type using its WKT representation\nand SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (411,14,'UUID_SHORT','Syntax:\nUUID_SHORT()\n\nReturns a "short" universal identifier as a 64-bit unsigned integer\n(rather than a string-form 128-bit identifier as returned by the UUID()\nfunction).\n\nThe value of UUID_SHORT() is guaranteed to be unique if the following\nconditions hold:\n\no The server_id of the current host is unique among your set of master\n and slave servers\n\no server_id is between 0 and 255\n\no You don\'t set back your system time for your server between mysqld\n restarts\n\no You do not invoke UUID_SHORT() on average more than 16 million times\n per second between mysqld restarts\n\nThe UUID_SHORT() return value is constructed this way:\n\n (server_id & 255) << 56\n+ (server_startup_time_in_seconds << 24)\n+ incremented_variable++;\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','mysql> SELECT UUID_SHORT();\n -> 92395783831158784\n','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (412,35,'RIGHT','Syntax:\nRIGHT(str,len)\n\nReturns the rightmost len characters from the string str, or NULL if\nany argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT RIGHT(\'foobarbar\', 4);\n -> \'rbar\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (413,30,'DATEDIFF','Syntax:\nDATEDIFF(expr1,expr2)\n\nDATEDIFF() returns expr1 - expr2 expressed as a value in days from one\ndate to the other. expr1 and expr2 are date or date-and-time\nexpressions. Only the date parts of the values are used in the\ncalculation.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DATEDIFF(\'2007-12-31 23:59:59\',\'2007-12-30\');\n -> 1\nmysql> SELECT DATEDIFF(\'2010-11-30 23:59:59\',\'2010-12-31\');\n -> -31\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (414,37,'DROP TABLESPACE','Syntax:\nDROP TABLESPACE tablespace_name\n ENGINE [=] engine_name\n\nThis statement drops a tablespace that was previously created using\nCREATE TABLESPACE (see [HELP CREATE TABLESPACE]).\n\n*Important*: The tablespace to be dropped must not contain any data\nfiles; in other words, before you can drop a tablespace, you must first\ndrop each of its data files using ALTER TABLESPACE ... DROP DATAFILE\n(see [HELP ALTER TABLESPACE]).\n\nThe ENGINE clause (required) specifies the storage engine used by the\ntablespace. In MySQL 5.1, the only accepted values for engine_name are\nNDB and NDBCLUSTER.\n\nDROP TABLESPACE was added in MySQL 5.1.6. In MySQL 5.1, it is useful\nonly with Disk Data storage for MySQL Cluster. See\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-disk-data.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-tablespace.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-tablespace.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (415,37,'DROP PROCEDURE','Syntax:\nDROP {PROCEDURE | FUNCTION} [IF EXISTS] sp_name\n\nThis statement is used to drop a stored procedure or function. That is,\nthe specified routine is removed from the server. You must have the\nALTER ROUTINE privilege for the routine. (If the\nautomatic_sp_privileges system variable is enabled, that privilege and\nEXECUTE are granted automatically to the routine creator when the\nroutine is created and dropped from the creator when the routine is\ndropped. See\nhttp://dev.mysql.com/doc/refman/5.1/en/stored-routines-privileges.html.\n)\n\nThe IF EXISTS clause is a MySQL extension. It prevents an error from\noccurring if the procedure or function does not exist. A warning is\nproduced that can be viewed with SHOW WARNINGS.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-procedure.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-procedure.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (416,19,'CHECK TABLE','Syntax:\nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n\noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}\n\nCHECK TABLE checks a table or tables for errors. CHECK TABLE works for\nMyISAM, InnoDB, and ARCHIVE tables. Starting with MySQL 5.1.9, CHECK\nTABLE is also valid for CSV tables, see\nhttp://dev.mysql.com/doc/refman/5.1/en/csv-storage-engine.html. For\nMyISAM tables, the key statistics are updated as well.\n\nCHECK TABLE can also check views for problems, such as tables that are\nreferenced in the view definition that no longer exist.\n\nBeginning with MySQL 5.1.27, CHECK TABLE is also supported for\npartitioned tables. Also beginning with MySQL 5.1.27, you can use ALTER\nTABLE ... CHECK PARTITION to check one or more partitions; for more\ninformation, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.1/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/check-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/check-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (417,35,'BIN','Syntax:\nBIN(N)\n\nReturns a string representation of the binary value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,2). Returns\nNULL if N is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT BIN(12);\n -> \'1100\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (418,5,'INSTALL PLUGIN','Syntax:\nINSTALL PLUGIN plugin_name SONAME \'shared_library_name\'\n\nThis statement installs a server plugin. It requires the INSERT\nprivilege for the mysql.plugin table.\n\nplugin_name is the name of the plugin as defined in the plugin\ndescriptor structure contained in the library file (see\nhttp://dev.mysql.com/doc/refman/5.1/en/plugin-data-structures.html).\nPlugin names are not case sensitive. For maximal compatibility, plugin\nnames should be limited to ASCII letters, digits, and underscore\nbecause they are used in C source files, shell command lines, M4 and\nBourne shell scripts, and SQL environments.\n\nshared_library_name is the name of the shared library that contains the\nplugin code. The name includes the file name extension (for example,\nlibmyplugin.so, libmyplugin.dll, or libmyplugin.dylib).\n\nThe shared library must be located in the plugin directory (the\ndirectory named by the plugin_dir system variable). The library must be\nin the plugin directory itself, not in a subdirectory. By default,\nplugin_dir is the plugin directory under the directory named by the\npkglibdir configuration variable, but it can be changed by setting the\nvalue of plugin_dir at server startup. For example, set its value in a\nmy.cnf file:\n\n[mysqld]\nplugin_dir=/path/to/plugin/directory\n\nIf the value of plugin_dir is a relative path name, it is taken to be\nrelative to the MySQL base directory (the value of the basedir system\nvariable).\n\nINSTALL PLUGIN loads and initializes the plugin code to make the plugin\navailable for use. A plugin is initialized by executing its\ninitialization function, which handles any setup that the plugin must\nperform before it can be used. When the server shuts down, it executes\nthe deinitialization function for each plugin that is loaded so that\nthe plugin has a change to perform any final cleanup.\n\nINSTALL PLUGIN also registers the plugin by adding a line that\nindicates the plugin name and library file name to the mysql.plugin\ntable. At server startup, the server loads and initializes any plugin\nthat is listed in the mysql.plugin table. This means that a plugin is\ninstalled with INSTALL PLUGIN only once, not every time the server\nstarts. Plugin loading at startup does not occur if the server is\nstarted with the --skip-grant-tables option.\n\nA plugin library can contain multiple plugins. For each of them to be\ninstalled, use a separate INSTALL PLUGIN statement. Each statement\nnames a different plugin, but all of them specify the same library\nname.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/install-plugin.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/install-plugin.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,22,'DECLARE CURSOR','Syntax:\nDECLARE cursor_name CURSOR FOR select_statement\n\nThis statement declares a cursor. Multiple cursors may be declared in a\nstored program, but each cursor in a given block must have a unique\nname.\n\nThe SELECT statement cannot have an INTO clause.\n\nFor information available through SHOW statements, it is possible in\nmany cases to obtain equivalent information by using a cursor with an\nINFORMATION_SCHEMA table.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/declare-cursor.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/declare-cursor.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,26,'LOAD DATA','Syntax:\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD DATA INFILE statement reads rows from a text file into a table\nat a very high speed. The file name must be given as a literal string.\n\nLOAD DATA INFILE is the complement of SELECT ... INTO OUTFILE. (See\nhttp://dev.mysql.com/doc/refman/5.1/en/select.html.) To write data from\na table to a file, use SELECT ... INTO OUTFILE. To read the file back\ninto a table, use LOAD DATA INFILE. The syntax of the FIELDS and LINES\nclauses is the same for both statements. Both clauses are optional, but\nFIELDS must precede LINES if both are specified.\n\nFor more information about the efficiency of INSERT versus LOAD DATA\nINFILE and speeding up LOAD DATA INFILE, see\nhttp://dev.mysql.com/doc/refman/5.1/en/insert-speed.html.\n\nThe character set indicated by the character_set_database system\nvariable is used to interpret the information in the file. SET NAMES\nand the setting of character_set_client do not affect interpretation of\ninput. If the contents of the input file use a character set that\ndiffers from the default, it is usually preferable to specify the\ncharacter set of the file by using the CHARACTER SET clause, which is\navailable as of MySQL 5.1.17. A character set of binary specifies "no\nconversion."\n\nLOAD DATA INFILE interprets all fields in the file as having the same\ncharacter set, regardless of the data types of the columns into which\nfield values are loaded. For proper interpretation of file contents,\nyou must ensure that it was written with the correct character set. For\nexample, if you write a data file with mysqldump -T or by issuing a\nSELECT ... INTO OUTFILE statement in mysql, be sure to use a\n--default-character-set option with mysqldump or mysql so that output\nis written in the character set to be used when the file is loaded with\nLOAD DATA INFILE.\n\nNote that it is currently not possible to load data files that use the\nucs2 character set.\n\nAs of MySQL 5.1.6, the character_set_filesystem system variable\ncontrols the interpretation of the file name.\n\nYou can also load data files by using the mysqlimport utility; it\noperates by sending a LOAD DATA INFILE statement to the server. The\n--local option causes mysqlimport to read data files from the client\nhost. You can specify the --compress option to get better performance\nover slow networks if the client and server support the compressed\nprotocol. See http://dev.mysql.com/doc/refman/5.1/en/mysqlimport.html.\n\nIf you use LOW_PRIORITY, execution of the LOAD DATA statement is\ndelayed until no other clients are reading from the table. This affects\nonly storage engines that use only table-level locking (such as MyISAM,\nMEMORY, and MERGE).\n\nIf you specify CONCURRENT with a MyISAM table that satisfies the\ncondition for concurrent inserts (that is, it contains no free blocks\nin the middle), other threads can retrieve data from the table while\nLOAD DATA is executing. Using this option affects the performance of\nLOAD DATA a bit, even if no other thread is using the table at the same\ntime.\n\nPrior to MySQL 5.1.43, CONCURRENT was not replicated when using\nstatement-based replication (see Bug#34628\n(http://bugs.mysql.com/bug.php?id=34628)). However, it is replicated\nwhen using row-based replication, regardless of the version. See\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-features-load-data.h\ntml, for more information.\n\n*Note*: Prior to MySQL 5.1.23, LOAD DATA performed very poorly when\nimporting into partitioned tables. The statement now uses buffering to\nimprove performance; however, the buffer uses 130KB memory per\npartition to achieve this. (Bug#26527\n(http://bugs.mysql.com/bug.php?id=26527))\n\nThe LOCAL keyword, if specified, is interpreted with respect to the\nclient end of the connection:\n\no If LOCAL is specified, the file is read by the client program on the\n client host and sent to the server. The file can be given as a full\n path name to specify its exact location. If given as a relative path\n name, the name is interpreted relative to the directory in which the\n client program was started.\n\no If LOCAL is not specified, the file must be located on the server\n host and is read directly by the server. The server uses the\n following rules to locate the file:\n\n o If the file name is an absolute path name, the server uses it as\n given.\n\n o If the file name is a relative path name with one or more leading\n components, the server searches for the file relative to the\n server\'s data directory.\n\n o If a file name with no leading components is given, the server\n looks for the file in the database directory of the default\n database.\n\nNote that, in the non-LOCAL case, these rules mean that a file named as\n./myfile.txt is read from the server\'s data directory, whereas the file\nnamed as myfile.txt is read from the database directory of the default\ndatabase. For example, if db1 is the default database, the following\nLOAD DATA statement reads the file data.txt from the database directory\nfor db1, even though the statement explicitly loads the file into a\ntable in the db2 database:\n\nLOAD DATA INFILE \'data.txt\' INTO TABLE db2.my_table;\n\nWindows path names are specified using forward slashes rather than\nbackslashes. If you do use backslashes, you must double them.\n\n*Note*: A regression in MySQL 5.1.40 caused the database referenced in\na fully qualified table name to be ignored by LOAD DATA when using\nreplication with either STATEMENT or MIXED as the binary logging\nformat; this could lead to problems if the table was not in the current\ndatabase. As a workaround, you can specify the correct database with\nthe USE statement prior to executing LOAD DATA. If necessary, you can\nreset the default database with a second USE statement following the\nLOAD DATA statement. This issue was fixed in MySQL 5.1.41. (Bug#48297\n(http://bugs.mysql.com/bug.php?id=48297))\n\nFor security reasons, when reading text files located on the server,\nthe files must either reside in the database directory or be readable\nby all. Also, to use LOAD DATA INFILE on server files, you must have\nthe FILE privilege. See\nhttp://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html. For\nnon-LOCAL load operations, if the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/load-data.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/load-data.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,23,'MULTILINESTRING','MultiLineString(ls1,ls2,...)\n\nConstructs a MultiLineString value using LineString or WKB LineString\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mysql-specific-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,30,'LOCALTIME','Syntax:\nLOCALTIME, LOCALTIME()\n\nLOCALTIME and LOCALTIME() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,3,'MPOINTFROMTEXT','MPointFromText(wkt[,srid]), MultiPointFromText(wkt[,srid])\n\nConstructs a MULTIPOINT value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (424,20,'BLOB','BLOB[(M)]\n\nA BLOB column with a maximum length of 65,535 (216 - 1) bytes. Each\nBLOB value is stored using a two-byte length prefix that indicates the\nnumber of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest BLOB type large enough to hold\nvalues M bytes long.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (425,11,'SHA1','Syntax:\nSHA1(str), SHA(str)\n\nCalculates an SHA-1 160-bit checksum for the string, as described in\nRFC 3174 (Secure Hash Algorithm). The value is returned as a binary\nstring of 40 hex digits, or NULL if the argument was NULL. One of the\npossible uses for this function is as a hash key. You can also use it\nas a cryptographic function for storing passwords. SHA() is synonymous\nwith SHA1().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','mysql> SELECT SHA1(\'abc\');\n -> \'a9993e364706816aba3e25717850c26c9cd0d89d\'\n','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (426,35,'SUBSTR','Syntax:\nSUBSTR(str,pos), SUBSTR(str FROM pos), SUBSTR(str,pos,len), SUBSTR(str\nFROM pos FOR len)\n\nSUBSTR() is a synonym for SUBSTRING().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (427,11,'PASSWORD','Syntax:\nPASSWORD(str)\n\nCalculates and returns a password string from the plaintext password\nstr and returns a binary string, or NULL if the argument was NULL. This\nis the function that is used for encrypting MySQL passwords for storage\nin the Password column of the user grant table.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','mysql> SELECT PASSWORD(\'badpwd\');\n -> \'*AAB3E285149C0135D51A520E1940DD3263DC008C\'\n','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,20,'CHAR','[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA fixed-length string that is always right-padded with spaces to the\nspecified length when stored. M represents the column length in\ncharacters. The range of M is 0 to 255. If M is omitted, the length is\n1.\n\n*Note*: Trailing spaces are removed when CHAR values are retrieved\nunless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (429,30,'UTC_DATE','Syntax:\nUTC_DATE, UTC_DATE()\n\nReturns the current UTC date as a value in \'YYYY-MM-DD\' or YYYYMMDD\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_DATE(), UTC_DATE() + 0;\n -> \'2003-08-14\', 20030814\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,34,'DIMENSION','Dimension(g)\n\nReturns the inherent dimension of the geometry value g. The result can\nbe -1, 0, 1, or 2. The meaning of these values is given in\nhttp://dev.mysql.com/doc/refman/5.1/en/gis-class-geometry.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,16,'COUNT DISTINCT','Syntax:\nCOUNT(DISTINCT expr,[expr...])\n\nReturns a count of the number of rows with different non-NULL expr\nvalues.\n\nCOUNT(DISTINCT) returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT COUNT(DISTINCT results) FROM student;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (432,20,'BIT','BIT[(M)]\n\nA bit-field type. M indicates the number of bits per value, from 1 to\n64. The default is 1 if M is omitted.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (433,29,'EQUALS','Equals(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relationships-between-geometries.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (434,25,'SHOW CREATE VIEW','Syntax:\nSHOW CREATE VIEW view_name\n\nThis statement shows a CREATE VIEW statement that creates the given\nview.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-view.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-create-view.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (435,17,'INTERVAL','Syntax:\nINTERVAL(N,N1,N2,N3,...)\n\nReturns 0 if N < N1, 1 if N < N2 and so on or -1 if N is NULL. All\narguments are treated as integers. It is required that N1 < N2 < N3 <\n... < Nn for this function to work correctly. This is because a binary\nsearch is used (very fast).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT INTERVAL(23, 1, 15, 17, 30, 44, 200);\n -> 3\nmysql> SELECT INTERVAL(10, 1, 10, 100, 1000);\n -> 2\nmysql> SELECT INTERVAL(22, 23, 30, 44, 200);\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (436,30,'FROM_DAYS','Syntax:\nFROM_DAYS(N)\n\nGiven a day number N, returns a DATE value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT FROM_DAYS(730669);\n -> \'2007-07-03\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (437,37,'ALTER PROCEDURE','Syntax:\nALTER PROCEDURE proc_name [characteristic ...]\n\ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n\nThis statement can be used to change the characteristics of a stored\nprocedure. More than one change may be specified in an ALTER PROCEDURE\nstatement. However, you cannot change the parameters or body of a\nstored procedure using this statement; to make such changes, you must\ndrop and re-create the procedure using DROP PROCEDURE and CREATE\nPROCEDURE.\n\nYou must have the ALTER ROUTINE privilege for the procedure. (That\nprivilege is granted automatically to the procedure creator.)\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/alter-procedure.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/alter-procedure.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (438,18,'BIT_COUNT','Syntax:\nBIT_COUNT(N)\n\nReturns the number of bits that are set in the argument N.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html\n\n','mysql> SELECT BIT_COUNT(29), BIT_COUNT(b\'101010\');\n -> 4, 3\n','http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (439,35,'OCTET_LENGTH','Syntax:\nOCTET_LENGTH(str)\n\nOCTET_LENGTH() is a synonym for LENGTH().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (440,30,'UTC_TIMESTAMP','Syntax:\nUTC_TIMESTAMP, UTC_TIMESTAMP()\n\nReturns the current UTC date and time as a value in \'YYYY-MM-DD\nHH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is used in a string or numeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\n -> \'2003-08-14 18:08:04\', 20030814180804.000000\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (441,11,'AES_ENCRYPT','Syntax:\nAES_ENCRYPT(str,key_str)\n\nAES_ENCRYPT() and AES_DECRYPT() allow encryption and decryption of data\nusing the official AES (Advanced Encryption Standard) algorithm,\npreviously known as "Rijndael." Encoding with a 128-bit key length is\nused, but you can extend it up to 256 bits by modifying the source. We\nchose 128 bits because it is much faster and it is secure enough for\nmost purposes.\n\nAES_ENCRYPT() encrypts a string and returns a binary string.\nAES_DECRYPT() decrypts the encrypted string and returns the original\nstring. The input arguments may be any length. If either argument is\nNULL, the result of this function is also NULL.\n\nBecause AES is a block-level algorithm, padding is used to encode\nuneven length strings and so the result string length may be calculated\nusing this formula:\n\n16 x (trunc(string_length / 16) + 1)\n\nIf AES_DECRYPT() detects invalid data or incorrect padding, it returns\nNULL. However, it is possible for AES_DECRYPT() to return a non-NULL\nvalue (possibly garbage) if the input data or the key is invalid.\n\nYou can use the AES functions to store data in an encrypted form by\nmodifying your queries:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','INSERT INTO t VALUES (1,AES_ENCRYPT(\'text\',\'password\'));\n','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (442,4,'+','Syntax:\n+\n\nAddition:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','mysql> SELECT 3+5;\n -> 8\n','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (443,14,'INET_NTOA','Syntax:\nINET_NTOA(expr)\n\nGiven a numeric network address in network byte order (4 or 8 byte),\nreturns the dotted-quad representation of the address as a string.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html\n\n','mysql> SELECT INET_NTOA(3520061480);\n -> \'209.207.224.40\'\n','http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (444,4,'ACOS','Syntax:\nACOS(X)\n\nReturns the arc cosine of X, that is, the value whose cosine is X.\nReturns NULL if X is not in the range -1 to 1.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT ACOS(1);\n -> 0\nmysql> SELECT ACOS(1.0001);\n -> NULL\nmysql> SELECT ACOS(0);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (445,8,'ISOLATION','Syntax:\nSET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL\n {\n READ UNCOMMITTED\n | READ COMMITTED\n | REPEATABLE READ\n | SERIALIZABLE\n }\n\nThis statement sets the transaction isolation level globally, for the\ncurrent session, or for the next transaction:\n\no With the GLOBAL keyword, the statement sets the default transaction\n level globally for all subsequent sessions. Existing sessions are\n unaffected.\n\no With the SESSION keyword, the statement sets the default transaction\n level for all subsequent transactions performed within the current\n session.\n\no Without any SESSION or GLOBAL keyword, the statement sets the\n isolation level for the next (not started) transaction performed\n within the current session.\n\nA change to the global default isolation level requires the SUPER\nprivilege. Any session is free to change its session isolation level\n(even in the middle of a transaction), or the isolation level for its\nnext transaction.\n\nTo set the global default isolation level at server startup, use the\n--transaction-isolation=level option to mysqld on the command line or\nin an option file. Values of level for this option use dashes rather\nthan spaces, so the allowable values are READ-UNCOMMITTED,\nREAD-COMMITTED, REPEATABLE-READ, or SERIALIZABLE. For example, to set\nthe default isolation level to REPEATABLE READ, use these lines in the\n[mysqld] section of an option file:\n\n[mysqld]\ntransaction-isolation = REPEATABLE-READ\n\nTo determine the global and session transaction isolation levels at\nruntime, check the value of the tx_isolation system variable:\n\nSELECT @@GLOBAL.tx_isolation, @@tx_isolation;\n\nInnoDB supports each of the translation isolation levels described here\nusing different locking strategies. The default level is REPEATABLE\nREAD. For additional information about InnoDB record-level locks and\nhow it uses them to execute various types of statements, see\nhttp://dev.mysql.com/doc/refman/5.1/en/innodb-record-level-locks.html,\nand http://dev.mysql.com/doc/refman/5.1/en/innodb-locks-set.html.\n\nThe following list describes how MySQL supports the different\ntransaction levels:\n\no READ UNCOMMITTED\n\n SELECT statements are performed in a nonlocking fashion, but a\n possible earlier version of a row might be used. Thus, using this\n isolation level, such reads are not consistent. This is also called a\n "dirty read." Otherwise, this isolation level works like READ\n COMMITTED.\n\no READ COMMITTED\n\n A somewhat Oracle-like isolation level with respect to consistent\n (nonlocking) reads: Each consistent read, even within the same\n transaction, sets and reads its own fresh snapshot. See\n http://dev.mysql.com/doc/refman/5.1/en/innodb-consistent-read.html.\n\n For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE),\n InnoDB locks only index records, not the gaps before them, and thus\n allows the free insertion of new records next to locked records. For\n UPDATE and DELETE statements, locking depends on whether the\n statement uses a unique index with a unique search condition (such as\n WHERE id = 100), or a range-type search condition (such as WHERE id >\n 100). For a unique index with a unique search condition, InnoDB locks\n only the index record found, not the gap before it. For range-type\n searches, InnoDB locks the index range scanned, using gap locks or\n next-key (gap plus index-record) locks to block insertions by other\n sessions into the gaps covered by the range. This is necessary\n because "phantom rows" must be blocked for MySQL replication and\n recovery to work.\n\n *Note*: In MySQL 5.1, if the READ COMMITTED isolation level is used\n or the innodb_locks_unsafe_for_binlog system variable is enabled,\n there is no InnoDB gap locking except for foreign-key constraint\n checking and duplicate-key checking. Also, record locks for\n nonmatching rows are released after MySQL has evaluated the WHERE\n condition. As of MySQL 5.1, if you use READ COMMITTED or enable\n innodb_locks_unsafe_for_binlog, you must use row-based binary\n logging.\n\no REPEATABLE READ\n\n This is the default isolation level for InnoDB. For consistent reads,\n there is an important difference from the READ COMMITTED isolation\n level: All consistent reads within the same transaction read the\n snapshot established by the first read. This convention means that if\n you issue several plain (nonlocking) SELECT statements within the\n same transaction, these SELECT statements are consistent also with\n respect to each other. See\n http://dev.mysql.com/doc/refman/5.1/en/innodb-consistent-read.html.\n\n For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE),\n UPDATE, and DELETE statements, locking depends on whether the\n statement uses a unique index with a unique search condition, or a\n range-type search condition. For a unique index with a unique search\n condition, InnoDB locks only the index record found, not the gap\n before it. For other search conditions, InnoDB locks the index range\n scanned, using gap locks or next-key (gap plus index-record) locks to\n block insertions by other sessions into the gaps covered by the\n range.\n\no SERIALIZABLE\n\n This level is like REPEATABLE READ, but InnoDB implicitly converts\n all plain SELECT statements to SELECT ... LOCK IN SHARE MODE if\n autocommit is disabled. If autocommit is enabled, the SELECT is its\n own transaction. It therefore is known to be read only and can be\n serialized if performed as a consistent (nonlocking) read and need\n not block for other transactions. (This means that to force a plain\n SELECT to block if other transactions have modified the selected\n rows, you should disable autocommit.)\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/set-transaction.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/set-transaction.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (446,4,'CEILING','Syntax:\nCEILING(X)\n\nReturns the smallest integer value not less than X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT CEILING(1.23);\n -> 2\nmysql> SELECT CEILING(-1.23);\n -> -1\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (447,4,'SIN','Syntax:\nSIN(X)\n\nReturns the sine of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT SIN(PI());\n -> 1.2246063538224e-16\nmysql> SELECT ROUND(SIN(PI()));\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (448,30,'DAYOFWEEK','Syntax:\nDAYOFWEEK(date)\n\nReturns the weekday index for date (1 = Sunday, 2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC standard.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFWEEK(\'2007-02-03\');\n -> 7\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (449,25,'SHOW PROCESSLIST','Syntax:\nSHOW [FULL] PROCESSLIST\n\nSHOW PROCESSLIST shows you which threads are running. You can also get\nthis information from the INFORMATION_SCHEMA PROCESSLIST table or the\nmysqladmin processlist command. If you have the PROCESS privilege, you\ncan see all threads. Otherwise, you can see only your own threads (that\nis, threads associated with the MySQL account that you are using). If\nyou do not use the FULL keyword, only the first 100 characters of each\nstatement are shown in the Info field.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-processlist.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-processlist.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (450,31,'LINEFROMWKB','LineFromWKB(wkb[,srid]), LineStringFromWKB(wkb[,srid])\n\nConstructs a LINESTRING value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (451,34,'GEOMETRYTYPE','GeometryType(g)\n\nReturns as a string the name of the geometry type of which the geometry\ninstance g is a member. The name corresponds to one of the instantiable\nGeometry subclasses.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT GeometryType(GeomFromText(\'POINT(1 1)\'));\n+------------------------------------------+\n| GeometryType(GeomFromText(\'POINT(1 1)\')) |\n+------------------------------------------+\n| POINT |\n+------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#general-geometry-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (452,37,'CREATE VIEW','Syntax:\nCREATE\n [OR REPLACE]\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n\nThe CREATE VIEW statement creates a new view, or replaces an existing\none if the OR REPLACE clause is given. If the view does not exist,\nCREATE OR REPLACE VIEW is the same as CREATE VIEW. If the view does\nexist, CREATE OR REPLACE VIEW is the same as ALTER VIEW.\n\nThe select_statement is a SELECT statement that provides the definition\nof the view. (When you select from the view, you select in effect using\nthe SELECT statement.) select_statement can select from base tables or\nother views.\n\nThe view definition is "frozen" at creation time, so changes to the\nunderlying tables afterward do not affect the view definition. For\nexample, if a view is defined as SELECT * on a table, new columns added\nto the table later do not become part of the view.\n\nThe ALGORITHM clause affects how MySQL processes the view. The DEFINER\nand SQL SECURITY clauses specify the security context to be used when\nchecking access privileges at view invocation time. The WITH CHECK\nOPTION clause can be given to constrain inserts or updates to rows in\ntables referenced by the view. These clauses are described later in\nthis section.\n\nThe CREATE VIEW statement requires the CREATE VIEW privilege for the\nview, and some privilege for each column selected by the SELECT\nstatement. For columns used elsewhere in the SELECT statement you must\nhave the SELECT privilege. If the OR REPLACE clause is present, you\nmust also have the DROP privilege for the view.\n\nA view belongs to a database. By default, a new view is created in the\ndefault database. To create the view explicitly in a given database,\nspecify the name as db_name.view_name when you create it.\n\nmysql> CREATE VIEW test.v AS SELECT * FROM t;\n\nBase tables and views share the same namespace within a database, so a\ndatabase cannot contain a base table and a view that have the same\nname.\n\nViews must have unique column names with no duplicates, just like base\ntables. By default, the names of the columns retrieved by the SELECT\nstatement are used for the view column names. To define explicit names\nfor the view columns, the optional column_list clause can be given as a\nlist of comma-separated identifiers. The number of names in column_list\nmust be the same as the number of columns retrieved by the SELECT\nstatement.\n\n*Note*: Prior to MySQL 5.1.29, when you modify an existing view, the\ncurrent view definition is backed up and saved. It is stored in that\ntable\'s database directory, in a subdirectory named arc. The backup\nfile for a view v is named v.frm-00001. If you alter the view again,\nthe next backup is named v.frm-00002. The three latest view backup\ndefinitions are stored. Backed up view definitions are not preserved by\nmysqldump, or any other such programs, but you can retain them using a\nfile copy operation. However, they are not needed for anything but to\nprovide you with a backup of your previous view definition. It is safe\nto remove these backup definitions, but only while mysqld is not\nrunning. If you delete the arc subdirectory or its files while mysqld\nis running, you will receive an error the next time you try to alter\nthe view: mysql> ALTER VIEW v AS SELECT * FROM t; ERROR 6 (HY000):\nError on delete of \'.\\test\\arc/v.frm-0004\' (Errcode: 2)\n\nColumns retrieved by the SELECT statement can be simple references to\ntable columns. They can also be expressions that use functions,\nconstant values, operators, and so forth.\n\nUnqualified table or view names in the SELECT statement are interpreted\nwith respect to the default database. A view can refer to tables or\nviews in other databases by qualifying the table or view name with the\nproper database name.\n\nA view can be created from many kinds of SELECT statements. It can\nrefer to base tables or other views. It can use joins, UNION, and\nsubqueries. The SELECT need not even refer to any tables. The following\nexample defines a view that selects two columns from another table, as\nwell as an expression calculated from those columns:\n\nmysql> CREATE TABLE t (qty INT, price INT);\nmysql> INSERT INTO t VALUES(3, 50);\nmysql> CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;\nmysql> SELECT * FROM v;\n+------+-------+-------+\n| qty | price | value |\n+------+-------+-------+\n| 3 | 50 | 150 |\n+------+-------+-------+\n\nA view definition is subject to the following restrictions:\n\no The SELECT statement cannot contain a subquery in the FROM clause.\n\no The SELECT statement cannot refer to system or user variables.\n\no Within a stored program, the definition cannot refer to program\n parameters or local variables.\n\no The SELECT statement cannot refer to prepared statement parameters.\n\no Any table or view referred to in the definition must exist. However,\n after a view has been created, it is possible to drop a table or view\n that the definition refers to. In this case, use of the view results\n in an error. To check a view definition for problems of this kind,\n use the CHECK TABLE statement.\n\no The definition cannot refer to a TEMPORARY table, and you cannot\n create a TEMPORARY view.\n\no Any tables named in the view definition must exist at definition\n time.\n\no You cannot associate a trigger with a view.\n\no As of MySQL 5.1.23, aliases for column names in the SELECT statement\n are checked against the maximum column length of 64 characters (not\n the maximum alias length of 256 characters).\n\nORDER BY is allowed in a view definition, but it is ignored if you\nselect from a view using a statement that has its own ORDER BY.\n\nFor other options or clauses in the definition, they are added to the\noptions or clauses of the statement that references the view, but the\neffect is undefined. For example, if a view definition includes a LIMIT\nclause, and you select from the view using a statement that has its own\nLIMIT clause, it is undefined which limit applies. This same principle\napplies to options such as ALL, DISTINCT, or SQL_SMALL_RESULT that\nfollow the SELECT keyword, and to clauses such as INTO, FOR UPDATE,\nLOCK IN SHARE MODE, and PROCEDURE.\n\nIf you create a view and then change the query processing environment\nby changing system variables, that may affect the results that you get\nfrom the view:\n\nmysql> CREATE VIEW v (mycol) AS SELECT \'abc\';\nQuery OK, 0 rows affected (0.01 sec)\n\nmysql> SET sql_mode = \'\';\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT "mycol" FROM v;\n+-------+\n| mycol |\n+-------+\n| mycol |\n+-------+\n1 row in set (0.01 sec)\n\nmysql> SET sql_mode = \'ANSI_QUOTES\';\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT "mycol" FROM v;\n+-------+\n| mycol |\n+-------+\n| abc |\n+-------+\n1 row in set (0.00 sec)\n\nThe DEFINER and SQL SECURITY clauses determine which MySQL account to\nuse when checking access privileges for the view when a statement is\nexecuted that references the view. They were addded in MySQL 5.1.2. The\nlegal SQL SECURITY characteristic values are DEFINER and INVOKER. These\nindicate that the required privileges must be held by the user who\ndefined or invoked the view, respectively. The default SQL SECURITY\nvalue is DEFINER.\n\nIf a user value is given for the DEFINER clause, it should be a MySQL\naccount in \'user_name\'@\'host_name\' format (the same format used in the\nGRANT statement). The user_name and host_name values both are required.\nThe definer can also be given as CURRENT_USER or CURRENT_USER(). The\ndefault DEFINER value is the user who executes the CREATE VIEW\nstatement. This is the same as specifying DEFINER = CURRENT_USER\nexplicitly.\n\nIf you specify the DEFINER clause, these rules determine the legal\nDEFINER user values:\n\no If you do not have the SUPER privilege, the only legal user value is\n your own account, either specified literally or by using\n CURRENT_USER. You cannot set the definer to some other account.\n\no If you have the SUPER privilege, you can specify any syntactically\n legal account name. If the account does not actually exist, a warning\n is generated.\n\no If the SQL SECURITY value is DEFINER but the definer account does not\n exist when the view is referenced, an error occurs.\n\nWithin a view definition, CURRENT_USER returns the view\'s DEFINER value\nby default as of MySQL 5.1.12. For older versions, and for views\ndefined with the SQL SECURITY INVOKER characteristic, CURRENT_USER\nreturns the account for the view\'s invoker. For information about user\nauditing within views, see\nhttp://dev.mysql.com/doc/refman/5.1/en/account-activity-auditing.html.\n\nWithin a stored routine that is defined with the SQL SECURITY DEFINER\ncharacteristic, CURRENT_USER returns the routine\'s DEFINER value. This\nalso affects a view defined within such a program, if the view\ndefinition contains a DEFINER value of CURRENT_USER.\n\nAs of MySQL 5.1.2 (when the DEFINER and SQL SECURITY clauses were\nimplemented), view privileges are checked like this:\n\no At view definition time, the view creator must have the privileges\n needed to use the top-level objects accessed by the view. For\n example, if the view definition refers to table columns, the creator\n must have privileges for the columns, as described previously. If the\n definition refers to a stored function, only the privileges needed to\n invoke the function can be checked. The privileges required when the\n function runs can be checked only as it executes: For different\n invocations of the function, different execution paths within the\n function might be taken.\n\no When a view is referenced, privileges for objects accessed by the\n view are checked against the privileges held by the view creator or\n invoker, depending on whether the SQL SECURITY characteristic is\n DEFINER or INVOKER, respectively.\n\no If reference to a view causes execution of a stored function,\n privilege checking for statements executed within the function depend\n on whether the function is defined with a SQL SECURITY characteristic\n of DEFINER or INVOKER. If the security characteristic is DEFINER, the\n function runs with the privileges of its creator. If the\n characteristic is INVOKER, the function runs with the privileges\n determined by the view\'s SQL SECURITY characteristic.\n\nPrior to MySQL 5.1.2 (before the DEFINER and SQL SECURITY clauses were\nimplemented), privileges required for objects used in a view are\nchecked at view creation time.\n\nExample: A view might depend on a stored function, and that function\nmight invoke other stored routines. For example, the following view\ninvokes a stored function f():\n\nCREATE VIEW v AS SELECT * FROM t WHERE t.id = f(t.name);\n\nSuppose that f() contains a statement such as this:\n\nIF name IS NULL then\n CALL p1();\nELSE\n CALL p2();\nEND IF;\n\nThe privileges required for executing statements within f() need to be\nchecked when f() executes. This might mean that privileges are needed\nfor p1() or p2(), depending on the execution path within f(). Those\nprivileges must be checked at runtime, and the user who must possess\nthe privileges is determined by the SQL SECURITY values of the view v\nand the function f().\n\nThe DEFINER and SQL SECURITY clauses for views are extensions to\nstandard SQL. In standard SQL, views are handled using the rules for\nSQL SECURITY INVOKER.\n\nIf you invoke a view that was created before MySQL 5.1.2, it is treated\nas though it was created with a SQL SECURITY DEFINER clause and with a\nDEFINER value that is the same as your account. However, because the\nactual definer is unknown, MySQL issues a warning. To make the warning\ngo away, it is sufficient to re-create the view so that the view\ndefinition includes a DEFINER clause.\n\nThe optional ALGORITHM clause is a MySQL extension to standard SQL. It\naffects how MySQL processes the view. ALGORITHM takes three values:\nMERGE, TEMPTABLE, or UNDEFINED. The default algorithm is UNDEFINED if\nno ALGORITHM clause is present. For more information, see\nhttp://dev.mysql.com/doc/refman/5.1/en/view-algorithms.html.\n\nSome views are updatable. That is, you can use them in statements such\nas UPDATE, DELETE, or INSERT to update the contents of the underlying\ntable. For a view to be updatable, there must be a one-to-one\nrelationship between the rows in the view and the rows in the\nunderlying table. There are also certain other constructs that make a\nview nonupdatable.\n\nThe WITH CHECK OPTION clause can be given for an updatable view to\nprevent inserts or updates to rows except those for which the WHERE\nclause in the select_statement is true.\n\nIn a WITH CHECK OPTION clause for an updatable view, the LOCAL and\nCASCADED keywords determine the scope of check testing when the view is\ndefined in terms of another view. The LOCAL keyword restricts the CHECK\nOPTION only to the view being defined. CASCADED causes the checks for\nunderlying views to be evaluated as well. When neither keyword is\ngiven, the default is CASCADED.\n\nFor more information about updatable views and the WITH CHECK OPTION\nclause, see\nhttp://dev.mysql.com/doc/refman/5.1/en/view-updatability.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-view.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-view.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (453,35,'TRIM','Syntax:\nTRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr\nFROM] str)\n\nReturns the string str with all remstr prefixes or suffixes removed. If\nnone of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is\nassumed. remstr is optional and, if not specified, spaces are removed.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT TRIM(\' bar \');\n -> \'bar\'\nmysql> SELECT TRIM(LEADING \'x\' FROM \'xxxbarxxx\');\n -> \'barxxx\'\nmysql> SELECT TRIM(BOTH \'x\' FROM \'xxxbarxxx\');\n -> \'bar\'\nmysql> SELECT TRIM(TRAILING \'xyz\' FROM \'barxxyz\');\n -> \'barx\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (454,17,'IS','Syntax:\nIS boolean_value\n\nTests a value against a boolean value, where boolean_value can be TRUE,\nFALSE, or UNKNOWN.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;\n -> 1, 1, 1\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (455,30,'GET_FORMAT','Syntax:\nGET_FORMAT({DATE|TIME|DATETIME}, {\'EUR\'|\'USA\'|\'JIS\'|\'ISO\'|\'INTERNAL\'})\n\nReturns a format string. This function is useful in combination with\nthe DATE_FORMAT() and the STR_TO_DATE() functions.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DATE_FORMAT(\'2003-10-03\',GET_FORMAT(DATE,\'EUR\'));\n -> \'03.10.2003\'\nmysql> SELECT STR_TO_DATE(\'10.31.2003\',GET_FORMAT(DATE,\'USA\'));\n -> \'2003-10-31\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (456,20,'TINYBLOB','TINYBLOB\n\nA BLOB column with a maximum length of 255 (28 - 1) bytes. Each\nTINYBLOB value is stored using a one-byte length prefix that indicates\nthe number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (457,8,'SAVEPOINT','Syntax:\nSAVEPOINT identifier\nROLLBACK [WORK] TO [SAVEPOINT] identifier\nRELEASE SAVEPOINT identifier\n\nInnoDB supports the SQL statements SAVEPOINT, ROLLBACK TO SAVEPOINT,\nRELEASE SAVEPOINT and the optional WORK keyword for ROLLBACK.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/savepoint.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/savepoint.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (458,15,'USER','Syntax:\nUSER()\n\nReturns the current MySQL user name and host name as a string in the\nutf8 character set.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT USER();\n -> \'davida@localhost\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (459,37,'ALTER TABLE','Syntax:\nALTER [ONLINE | OFFLINE] [IGNORE] TABLE tbl_name\n {table_options | partitioning_specification}\n\ntable_options:\n table_option [, table_option] ...\n\ntable_option:\n ADD [COLUMN] col_name column_definition\n [FIRST | AFTER col_name ]\n | ADD [COLUMN] (col_name column_definition,...)\n | ADD {INDEX|KEY} [index_name]\n [index_type] (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]] PRIMARY KEY\n [index_type] (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]]\n UNIQUE [INDEX|KEY] [index_name]\n [index_type] (index_col_name,...) [index_option] ...\n | ADD FULLTEXT [INDEX|KEY] [index_name]\n (index_col_name,...) [index_option] ...\n | ADD SPATIAL [INDEX|KEY] [index_name]\n (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]]\n FOREIGN KEY [index_name] (index_col_name,...)\n reference_definition\n | ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}\n | CHANGE [COLUMN] old_col_name new_col_name column_definition\n [FIRST|AFTER col_name]\n | MODIFY [COLUMN] col_name column_definition\n [FIRST | AFTER col_name]\n | DROP [COLUMN] col_name\n | DROP PRIMARY KEY\n | DROP {INDEX|KEY} index_name\n | DROP FOREIGN KEY fk_symbol\n | DISABLE KEYS\n | ENABLE KEYS\n | RENAME [TO] new_tbl_name\n | ORDER BY col_name [, col_name] ...\n | CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]\n | [DEFAULT] CHARACTER SET [=] charset_name [COLLATE [=] collation_name]\n | DISCARD TABLESPACE\n | IMPORT TABLESPACE\n\npartitioning_specification:\n ADD PARTITION (partition_definition)\n | DROP PARTITION partition_names\n | COALESCE PARTITION number\n | REORGANIZE PARTITION [partition_names INTO (partition_definitions)]\n | ANALYZE PARTITION {partition_names | ALL }\n | CHECK PARTITION {partition_names | ALL }\n | OPTIMIZE PARTITION {partition_names | ALL }\n | REBUILD PARTITION {partition_names | ALL }\n | REPAIR PARTITION {partition_names | ALL }\n | PARTITION BY partitioning_expression\n | REMOVE PARTITIONING\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH | RTREE}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n\ntable_options:\n table_option [[,] table_option] ... (see CREATE TABLE options)\n\nALTER TABLE enables you to change the structure of an existing table.\nFor example, you can add or delete columns, create or destroy indexes,\nchange the type of existing columns, or rename columns or the table\nitself. You can also change the comment for the table and type of the\ntable.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/alter-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/alter-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (460,31,'MPOINTFROMWKB','MPointFromWKB(wkb[,srid]), MultiPointFromWKB(wkb[,srid])\n\nConstructs a MULTIPOINT value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (461,20,'CHAR BYTE','The CHAR BYTE data type is an alias for the BINARY data type. This is a\ncompatibility feature.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (462,19,'REPAIR TABLE','Syntax:\nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [QUICK] [EXTENDED] [USE_FRM]\n\nREPAIR TABLE repairs a possibly corrupted table. By default, it has the\nsame effect as myisamchk --recover tbl_name. REPAIR TABLE works for\nMyISAM and for ARCHIVE tables. Starting with MySQL 5.1.9, REPAIR is\nalso valid for CSV tables. See\nhttp://dev.mysql.com/doc/refman/5.1/en/myisam-storage-engine.html, and\nhttp://dev.mysql.com/doc/refman/5.1/en/archive-storage-engine.html, and\nhttp://dev.mysql.com/doc/refman/5.1/en/csv-storage-engine.html\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBeginning with MySQL 5.1.27, REPAIR TABLE is also supported for\npartitioned tables. However, the USE_FRM option cannot be used with\nthis statement on a partitioned table.\n\nAlso beginning with MySQL 5.1.27, you can use ALTER TABLE ... REPAIR\nPARTITION to repair one or more partitions; for more information, see\n[HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.1/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/repair-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/repair-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,37,'MERGE','The MERGE storage engine, also known as the MRG_MyISAM engine, is a\ncollection of identical MyISAM tables that can be used as one.\n"Identical" means that all tables have identical column and index\ninformation. You cannot merge MyISAM tables in which the columns are\nlisted in a different order, do not have exactly the same columns, or\nhave the indexes in different order. However, any or all of the MyISAM\ntables can be compressed with myisampack. See\nhttp://dev.mysql.com/doc/refman/5.1/en/myisampack.html. Differences in\ntable options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS do not\nmatter.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/merge-storage-engine.html\n\n','mysql> CREATE TABLE t1 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nmysql> CREATE TABLE t2 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nmysql> INSERT INTO t1 (message) VALUES (\'Testing\'),(\'table\'),(\'t1\');\nmysql> INSERT INTO t2 (message) VALUES (\'Testing\'),(\'table\'),(\'t2\');\nmysql> CREATE TABLE total (\n -> a INT NOT NULL AUTO_INCREMENT,\n -> message CHAR(20), INDEX(a))\n -> ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;\n','http://dev.mysql.com/doc/refman/5.1/en/merge-storage-engine.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,37,'CREATE TABLE','Syntax:\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n (create_definition,...)\n [table_options]\n [partition_options]\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n [(create_definition,...)]\n [table_options]\n [partition_options]\n select_statement\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n { LIKE old_tbl_name | (LIKE old_tbl_name) }\n\ncreate_definition:\n col_name column_definition\n | [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)\n [index_option] ...\n | {INDEX|KEY} [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY]\n [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name,...) reference_definition\n | CHECK (expr)\n\ncolumn_definition:\n data_type [NOT NULL | NULL] [DEFAULT default_value]\n [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY]\n [COMMENT \'string\']\n [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]\n [STORAGE {DISK|MEMORY|DEFAULT}]\n [reference_definition]\n\ndata_type:\n BIT[(length)]\n | TINYINT[(length)] [UNSIGNED] [ZEROFILL]\n | SMALLINT[(length)] [UNSIGNED] [ZEROFILL]\n | MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]\n | INT[(length)] [UNSIGNED] [ZEROFILL]\n | INTEGER[(length)] [UNSIGNED] [ZEROFILL]\n | BIGINT[(length)] [UNSIGNED] [ZEROFILL]\n | REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DECIMAL[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | NUMERIC[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | DATE\n | TIME\n | TIMESTAMP\n | DATETIME\n | YEAR\n | CHAR[(length)]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | VARCHAR(length)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | BINARY[(length)]\n | VARBINARY(length)\n | TINYBLOB\n | BLOB\n | MEDIUMBLOB\n | LONGBLOB\n | TINYTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | TEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | MEDIUMTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | LONGTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | ENUM(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | SET(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | spatial_type\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH | RTREE}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n\nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\ntable_options:\n table_option [[,] table_option] ...\n\ntable_option:\n ENGINE [=] engine_name\n | AUTO_INCREMENT [=] value\n | AVG_ROW_LENGTH [=] value\n | [DEFAULT] CHARACTER SET [=] charset_name\n | CHECKSUM [=] {0 | 1}\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'string\'\n | CONNECTION [=] \'connect_string\'\n | DATA DIRECTORY [=] \'absolute path to directory\'\n | DELAY_KEY_WRITE [=] {0 | 1}\n | INDEX DIRECTORY [=] \'absolute path to directory\'\n | INSERT_METHOD [=] { NO | FIRST | LAST }\n | KEY_BLOCK_SIZE [=] value\n | MAX_ROWS [=] value\n | MIN_ROWS [=] value\n | PACK_KEYS [=] {0 | 1 | DEFAULT}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT}\n | TABLESPACE tablespace_name [STORAGE {DISK|MEMORY|DEFAULT}]\n | UNION [=] (tbl_name[,tbl_name]...)\n\npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE(expr)\n | LIST(expr) }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\n\npartition_definition:\n PARTITION partition_name\n [VALUES {LESS THAN {(expr) | MAXVALUE} | IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\n\nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n\nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some legal select statement)\n\nCREATE TABLE creates a table with the given name. You must have the\nCREATE privilege for the table.\n\nRules for allowable table names are given in\nhttp://dev.mysql.com/doc/refman/5.1/en/identifiers.html. By default,\nthe table is created in the default database. An error occurs if the\ntable exists, if there is no default database, or if the database does\nnot exist.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (465,17,'>','Syntax:\n>\n\nGreater than:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 2 > 2;\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,19,'ANALYZE TABLE','Syntax:\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nANALYZE TABLE analyzes and stores the key distribution for a table.\nDuring the analysis, the table is locked with a read lock for MyISAM.\nFor InnoDB the table is locked with a write lock. This statement works\nwith MyISAM and InnoDB tables. For MyISAM tables, this statement is\nequivalent to using myisamchk --analyze.\n\nFor more information on how the analysis works within InnoDB, see\nhttp://dev.mysql.com/doc/refman/5.1/en/innodb-restrictions.html.\n\nMySQL uses the stored key distribution to decide the order in which\ntables should be joined when you perform a join on something other than\na constant. In addition, key distributions can be used when deciding\nwhich indexes to use for a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBeginning with MySQL 5.1.27, ANALYZE TABLE is also supported for\npartitioned tables. Also beginning with MySQL 5.1.27, you can use ALTER\nTABLE ... ANALYZE PARTITION to analyze one or more partitions; for more\ninformation, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.1/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (467,30,'MICROSECOND','Syntax:\nMICROSECOND(expr)\n\nReturns the microseconds from the time or datetime expression expr as a\nnumber in the range from 0 to 999999.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MICROSECOND(\'12:00:00.123456\');\n -> 123456\nmysql> SELECT MICROSECOND(\'2009-12-31 23:59:59.000010\');\n -> 10\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,37,'CONSTRAINT','InnoDB supports foreign key constraints. The syntax for a foreign key\nconstraint definition in InnoDB looks like this:\n\n[CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name, ...)\n REFERENCES tbl_name (index_col_name,...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\n\n','CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\nCREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,\n product_category INT NOT NULL,\n product_id INT NOT NULL,\n customer_id INT NOT NULL,\n PRIMARY KEY(no),\n INDEX (product_category, product_id),\n FOREIGN KEY (product_category, product_id)\n REFERENCES product(category, id)\n ON UPDATE CASCADE ON DELETE RESTRICT,\n INDEX (customer_id),\n FOREIGN KEY (customer_id)\n REFERENCES customer(id)) ENGINE=INNODB;\n','http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (469,37,'CREATE SERVER','Syntax:\nCREATE SERVER server_name\n FOREIGN DATA WRAPPER wrapper_name\n OPTIONS (option [, option] ...)\n\noption:\n { HOST character-literal\n | DATABASE character-literal\n | USER character-literal\n | PASSWORD character-literal\n | SOCKET character-literal\n | OWNER character-literal\n | PORT numeric-literal }\n\nThis statement creates the definition of a server for use with the\nFEDERATED storage engine. The CREATE SERVER statement creates a new row\nwithin the servers table within the mysql database. This statement\nrequires the SUPER privilege.\n\nThe server_name should be a unique reference to the server. Server\ndefinitions are global within the scope of the server, it is not\npossible to qualify the server definition to a specific database.\nserver_name has a maximum length of 64 characters (names longer than 64\ncharacters are silently truncated), and is case insensitive. You may\nspecify the name as a quoted string.\n\nThe wrapper_name should be mysql, and may be quoted with single quotes.\nOther values for wrapper_name are not currently supported.\n\nFor each option you must specify either a character literal or numeric\nliteral. Character literals are UTF-8, support a maximum length of 64\ncharacters and default to a blank (empty) string. String literals are\nsilently truncated to 64 characters. Numeric literals must be a number\nbetween 0 and 9999, default value is 0.\n\n*Note*: Note that the OWNER option is currently not applied, and has no\neffect on the ownership or operation of the server connection that is\ncreated.\n\nThe CREATE SERVER statement creates an entry in the mysql.servers table\nthat can later be used with the CREATE TABLE statement when creating a\nFEDERATED table. The options that you specify will be used to populate\nthe columns in the mysql.servers table. The table columns are\nServer_name, Host, Db, Username, Password, Port and Socket.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-server.html\n\n','CREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE \'test\');\n','http://dev.mysql.com/doc/refman/5.1/en/create-server.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (470,35,'FIELD','Syntax:\nFIELD(str,str1,str2,str3,...)\n\nReturns the index (position) of str in the str1, str2, str3, ... list.\nReturns 0 if str is not found.\n\nIf all arguments to FIELD() are strings, all arguments are compared as\nstrings. If all arguments are numbers, they are compared as numbers.\nOtherwise, the arguments are compared as double.\n\nIf str is NULL, the return value is 0 because NULL fails equality\ncomparison with any value. FIELD() is the complement of ELT().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT FIELD(\'ej\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\');\n -> 2\nmysql> SELECT FIELD(\'fo\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\');\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (471,30,'MAKETIME','Syntax:\nMAKETIME(hour,minute,second)\n\nReturns a time value calculated from the hour, minute, and second\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MAKETIME(12,15,30);\n -> \'12:15:30\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (472,30,'CURDATE','Syntax:\nCURDATE()\n\nReturns the current date as a value in \'YYYY-MM-DD\' or YYYYMMDD format,\ndepending on whether the function is used in a string or numeric\ncontext.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT CURDATE();\n -> \'2008-06-13\'\nmysql> SELECT CURDATE() + 0;\n -> 20080613\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (473,9,'SET PASSWORD','Syntax:\nSET PASSWORD [FOR user] =\n {\n PASSWORD(\'some password\')\n | OLD_PASSWORD(\'some password\')\n | \'encrypted password\'\n }\n\nThe SET PASSWORD statement assigns a password to an existing MySQL user\naccount.\n\nIf the password is specified using the PASSWORD() or OLD_PASSWORD()\nfunction, the literal text of the password should be given. If the\npassword is specified without using either function, the password\nshould be the already-encrypted password value as returned by\nPASSWORD().\n\nWith no FOR clause, this statement sets the password for the current\nuser. Any client that has connected to the server using a nonanonymous\naccount can change the password for that account.\n\nWith a FOR clause, this statement sets the password for a specific\naccount on the current server host. Only clients that have the UPDATE\nprivilege for the mysql database can do this. The user value should be\ngiven in user_name@host_name format, where user_name and host_name are\nexactly as they are listed in the User and Host columns of the\nmysql.user table entry. For example, if you had an entry with User and\nHost column values of \'bob\' and \'%.loc.gov\', you would write the\nstatement like this:\n\nSET PASSWORD FOR \'bob\'@\'%.loc.gov\' = PASSWORD(\'newpass\');\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/set-password.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/set-password.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (474,37,'ALTER TABLESPACE','Syntax:\nALTER TABLESPACE tablespace_name\n {ADD|DROP} DATAFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n\nThis statement can be used either to add a new data file, or to drop a\ndata file from a tablespace.\n\nThe ADD DATAFILE variant allows you to specify an initial size using an\nINITIAL_SIZE clause, where size is measured in bytes; the default value\nis 128M (128 megabytes). You may optionally follow this integer value\nwith a one-letter abbreviation for an order of magnitude, similar to\nthose used in my.cnf. Generally, this is one of the letters M (for\nmegabytes) or G (for gigabytes).\n\n*Note*: All MySQL Cluster Disk Data objects share the same namespace.\nThis means that each Disk Data object must be uniquely named (and not\nmerely each Disk Data object of a given type). For example, you cannot\nhave a tablespace and an data file with the same name, or an undo log\nfile and a with the same name.\n\nPrior to MySQL Cluster NDB 6.2.17, 6.3.23, and 6.4.3, path and file\nnames for data files could not be longer than 128 characters.\n(Bug#31770 (http://bugs.mysql.com/bug.php?id=31770))\n\nOn 32-bit systems, the maximum supported value for INITIAL_SIZE is 4G.\n(Bug#29186 (http://bugs.mysql.com/bug.php?id=29186))\n\nINITIAL_SIZE is rounded as for CREATE TABLESPACE. Beginning with MySQL\nCluster NDB 6.2.19, MySQL Cluster NDB 6.3.32, MySQL Cluster NDB 7.0.13,\nand MySQL Cluster NDB 7.1.2, this rounding is done explicitly (also as\nwith CREATE TABLESPACE).\n\nOnce a data file has been created, its size cannot be changed; however,\nyou can add more data files to the tablespace using additional ALTER\nTABLESPACE ... ADD DATAFILE statements.\n\nUsing DROP DATAFILE with ALTER TABLESPACE drops the data file\n\'file_name\' from the tablespace. This file must already have been added\nto the tablespace using CREATE TABLESPACE or ALTER TABLESPACE;\notherwise an error will result.\n\nBoth ALTER TABLESPACE ... ADD DATAFILE and ALTER TABLESPACE ... DROP\nDATAFILE require an ENGINE clause which specifies the storage engine\nused by the tablespace. In MySQL 5.1, the only accepted values for\nengine_name are NDB and NDBCLUSTER.\n\nWAIT is parsed but otherwise ignored, and so has no effect in MySQL\n5.1. It is intended for future expansion.\n\nWhen ALTER TABLESPACE ... ADD DATAFILE is used with ENGINE = NDB, a\ndata file is created on each Cluster data node. You can verify that the\ndata files were created and obtain information about them by querying\nthe INFORMATION_SCHEMA.FILES table. For example, the following query\nshows all data files belonging to the tablespace named newts:\n\nmysql> SELECT LOGFILE_GROUP_NAME, FILE_NAME, EXTRA\n -> FROM INFORMATION_SCHEMA.FILES\n -> WHERE TABLESPACE_NAME = \'newts\' AND FILE_TYPE = \'DATAFILE\';\n+--------------------+--------------+----------------+\n| LOGFILE_GROUP_NAME | FILE_NAME | EXTRA |\n+--------------------+--------------+----------------+\n| lg_3 | newdata.dat | CLUSTER_NODE=3 |\n| lg_3 | newdata.dat | CLUSTER_NODE=4 |\n| lg_3 | newdata2.dat | CLUSTER_NODE=3 |\n| lg_3 | newdata2.dat | CLUSTER_NODE=4 |\n+--------------------+--------------+----------------+\n2 rows in set (0.03 sec)\n\nSee http://dev.mysql.com/doc/refman/5.1/en/files-table.html.\n\nALTER TABLESPACE was added in MySQL 5.1.6. In MySQL 5.1, it is useful\nonly with Disk Data storage for MySQL Cluster. See\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-disk-data.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/alter-tablespace.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/alter-tablespace.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,20,'ENUM','ENUM(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nAn enumeration. A string object that can have only one value, chosen\nfrom the list of values \'value1\', \'value2\', ..., NULL or the special \'\'\nerror value. An ENUM column can have a maximum of 65,535 distinct\nvalues. ENUM values are represented internally as integers.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (476,7,'IF FUNCTION','Syntax:\nIF(expr1,expr2,expr3)\n\nIf expr1 is TRUE (expr1 <> 0 and expr1 <> NULL) then IF() returns\nexpr2; otherwise it returns expr3. IF() returns a numeric or string\nvalue, depending on the context in which it is used.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html\n\n','mysql> SELECT IF(1>2,2,3);\n -> 3\nmysql> SELECT IF(1<2,\'yes\',\'no\');\n -> \'yes\'\nmysql> SELECT IF(STRCMP(\'test\',\'test1\'),\'no\',\'yes\');\n -> \'no\'\n','http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (477,15,'DATABASE','Syntax:\nDATABASE()\n\nReturns the default (current) database name as a string in the utf8\ncharacter set. If there is no default database, DATABASE() returns\nNULL. Within a stored routine, the default database is the database\nthat the routine is associated with, which is not necessarily the same\nas the database that is the default in the calling context.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT DATABASE();\n -> \'test\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (478,31,'POINTFROMWKB','PointFromWKB(wkb[,srid])\n\nConstructs a POINT value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (479,4,'POWER','Syntax:\nPOWER(X,Y)\n\nThis is a synonym for POW().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (480,4,'ATAN','Syntax:\nATAN(X)\n\nReturns the arc tangent of X, that is, the value whose tangent is X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT ATAN(2);\n -> 1.1071487177941\nmysql> SELECT ATAN(-2);\n -> -1.1071487177941\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (481,35,'STRCMP','Syntax:\nSTRCMP(expr1,expr2)\n\nSTRCMP() returns 0 if the strings are the same, -1 if the first\nargument is smaller than the second according to the current sort\norder, and 1 otherwise.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html\n\n','mysql> SELECT STRCMP(\'text\', \'text2\');\n -> -1\nmysql> SELECT STRCMP(\'text2\', \'text\');\n -> 1\nmysql> SELECT STRCMP(\'text\', \'text\');\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (482,26,'INSERT DELAYED','Syntax:\nINSERT DELAYED ...\n\nThe DELAYED option for the INSERT statement is a MySQL extension to\nstandard SQL that is very useful if you have clients that cannot or\nneed not wait for the INSERT to complete. This is a common situation\nwhen you use MySQL for logging and you also periodically run SELECT and\nUPDATE statements that take a long time to complete.\n\nWhen a client uses INSERT DELAYED, it gets an okay from the server at\nonce, and the row is queued to be inserted when the table is not in use\nby any other thread.\n\nAnother major benefit of using INSERT DELAYED is that inserts from many\nclients are bundled together and written in one block. This is much\nfaster than performing many separate inserts.\n\nNote that INSERT DELAYED is slower than a normal INSERT if the table is\nnot otherwise in use. There is also the additional overhead for the\nserver to handle a separate thread for each table for which there are\ndelayed rows. This means that you should use INSERT DELAYED only when\nyou are really sure that you need it.\n\nThe queued rows are held only in memory until they are inserted into\nthe table. This means that if you terminate mysqld forcibly (for\nexample, with kill -9) or if mysqld dies unexpectedly, any queued rows\nthat have not been written to disk are lost.\n\nThere are some constraints on the use of DELAYED:\n\no INSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE, and (as of\n MySQL 5.1.19) BLACKHOLE tables. For engines that do not support\n DELAYED, an error occurs.\n\no An error occurs for INSERT DELAYED if used with a table that has been\n locked with LOCK TABLES because the insert must be handled by a\n separate thread, not by the session that holds the lock.\n\no For MyISAM tables, if there are no free blocks in the middle of the\n data file, concurrent SELECT and INSERT statements are supported.\n Under these circumstances, you very seldom need to use INSERT DELAYED\n with MyISAM.\n\no INSERT DELAYED should be used only for INSERT statements that specify\n value lists. The server ignores DELAYED for INSERT ... SELECT or\n INSERT ... ON DUPLICATE KEY UPDATE statements.\n\no Because the INSERT DELAYED statement returns immediately, before the\n rows are inserted, you cannot use LAST_INSERT_ID() to get the\n AUTO_INCREMENT value that the statement might generate.\n\no DELAYED rows are not visible to SELECT statements until they actually\n have been inserted.\n\no INSERT DELAYED is treated as a normal INSERT if the statement inserts\n multiple rows and binary logging is enabled and the global logging\n format is to use statement-based logging (binlog_format is set to\n STATEMENT). This restriction does not apply to row-based binary\n logging.\n\no DELAYED is ignored on slave replication servers, so that INSERT\n DELAYED is treated as a normal INSERT on slaves. This is because\n DELAYED could cause the slave to have different data than the master.\n\no Pending INSERT DELAYED statements are lost if a table is write locked\n and ALTER TABLE is used to modify the table structure.\n\no INSERT DELAYED is not supported for views.\n\no INSERT DELAYED is not supported for partitioned tables.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/insert-delayed.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/insert-delayed.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (483,25,'SHOW PROFILE','Syntax:\nSHOW PROFILES\n\nThe SHOW PROFILE statement display profiling information that indicates\nresource usage for statements executed during the course of the current\nsession. It is used together with SHOW PROFILES; see [HELP SHOW\nPROFILES].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-profile.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-profile.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (484,25,'SHOW PROCEDURE CODE','Syntax:\nSHOW PROCEDURE CODE proc_name\n\nThis statement is a MySQL extension that is available only for servers\nthat have been built with debugging support. It displays a\nrepresentation of the internal implementation of the named stored\nprocedure. A similar statement, SHOW FUNCTION CODE, displays\ninformation about stored functions (see [HELP SHOW FUNCTION CODE]).\n\nBoth statements require that you be the owner of the routine or have\nSELECT access to the mysql.proc table.\n\nIf the named routine is available, each statement produces a result\nset. Each row in the result set corresponds to one "instruction" in the\nroutine. The first column is Pos, which is an ordinal number beginning\nwith 0. The second column is Instruction, which contains an SQL\nstatement (usually changed from the original source), or a directive\nwhich has meaning only to the stored-routine handler.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-procedure-code.html\n\n','mysql> DELIMITER //\nmysql> CREATE PROCEDURE p1 ()\n -> BEGIN\n -> DECLARE fanta INT DEFAULT 55;\n -> DROP TABLE t2;\n -> LOOP\n -> INSERT INTO t3 VALUES (fanta);\n -> END LOOP;\n -> END//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SHOW PROCEDURE CODE p1//\n+-----+----------------------------------------+\n| Pos | Instruction |\n+-----+----------------------------------------+\n| 0 | set fanta@0 55 |\n| 1 | stmt 9 "DROP TABLE t2" |\n| 2 | stmt 5 "INSERT INTO t3 VALUES (fanta)" |\n| 3 | jump 2 |\n+-----+----------------------------------------+\n4 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.1/en/show-procedure-code.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (485,20,'MEDIUMTEXT','MEDIUMTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 16,777,215 (224 - 1) characters.\nThe effective maximum length is less if the value contains multi-byte\ncharacters. Each MEDIUMTEXT value is stored using a three-byte length\nprefix that indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (486,4,'LN','Syntax:\nLN(X)\n\nReturns the natural logarithm of X; that is, the base-e logarithm of X.\nIf X is less than or equal to 0, then NULL is returned.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT LN(2);\n -> 0.69314718055995\nmysql> SELECT LN(-2);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (487,22,'RETURN','Syntax:\nRETURN expr\n\nThe RETURN statement terminates execution of a stored function and\nreturns the value expr to the function caller. There must be at least\none RETURN statement in a stored function. There may be more than one\nif the function has multiple exit points.\n\nThis statement is not used in stored procedures, triggers, or events.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/return.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/return.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (488,25,'SHOW COLLATION','Syntax:\nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement lists collations supported by the server. By default,\nthe output from SHOW COLLATION includes all available collations. The\nLIKE clause, if present, indicates which collation names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html. For example:\n\nmysql> SHOW COLLATION LIKE \'latin1%\';\n+-------------------+---------+----+---------+----------+---------+\n| Collation | Charset | Id | Default | Compiled | Sortlen |\n+-------------------+---------+----+---------+----------+---------+\n| latin1_german1_ci | latin1 | 5 | | | 0 |\n| latin1_swedish_ci | latin1 | 8 | Yes | Yes | 0 |\n| latin1_danish_ci | latin1 | 15 | | | 0 |\n| latin1_german2_ci | latin1 | 31 | | Yes | 2 |\n| latin1_bin | latin1 | 47 | | Yes | 0 |\n| latin1_general_ci | latin1 | 48 | | | 0 |\n| latin1_general_cs | latin1 | 49 | | | 0 |\n| latin1_spanish_ci | latin1 | 94 | | | 0 |\n+-------------------+---------+----+---------+----------+---------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-collation.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-collation.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (489,4,'LOG','Syntax:\nLOG(X), LOG(B,X)\n\nIf called with one parameter, this function returns the natural\nlogarithm of X. If X is less than or equal to 0, then NULL is returned.\n\nThe inverse of this function (when called with a single argument) is\nthe EXP() function.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT LOG(2);\n -> 0.69314718055995\nmysql> SELECT LOG(-2);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (490,25,'SET SQL_LOG_BIN','Syntax:\nSET sql_log_bin = {0|1}\n\nDisables or enables binary logging for the current session (sql_log_bin\nis a session variable) if the client has the SUPER privilege. The\nstatement fails with an error if the client does not have that\nprivilege.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/set-sql-log-bin.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/set-sql-log-bin.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (491,17,'!=','Syntax:\n<>, !=\n\nNot equal:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT \'.01\' <> \'0.01\';\n -> 1\nmysql> SELECT .01 <> \'0.01\';\n -> 0\nmysql> SELECT \'zapp\' <> \'zappp\';\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (492,22,'WHILE','Syntax:\n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n\nThe statement list within a WHILE statement is repeated as long as the\nsearch_condition is true. statement_list consists of one or more\nstatements.\n\nA WHILE statement can be labeled. See [HELP BEGIN END] for the rules\nregarding label use.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/while-statement.html\n\n','CREATE PROCEDURE dowhile()\nBEGIN\n DECLARE v1 INT DEFAULT 5;\n\n WHILE v1 > 0 DO\n ...\n SET v1 = v1 - 1;\n END WHILE;\nEND\n','http://dev.mysql.com/doc/refman/5.1/en/while-statement.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (493,11,'AES_DECRYPT','Syntax:\nAES_DECRYPT(crypt_str,key_str)\n\nThis function allows decryption of data using the official AES\n(Advanced Encryption Standard) algorithm. For more information, see the\ndescription of AES_ENCRYPT().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (494,30,'DAYNAME','Syntax:\nDAYNAME(date)\n\nReturns the name of the weekday for date. As of MySQL 5.1.12, the\nlanguage used for the name is controlled by the value of the\nlc_time_names system variable\n(http://dev.mysql.com/doc/refman/5.1/en/locale-support.html).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DAYNAME(\'2007-02-03\');\n -> \'Saturday\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (495,15,'COERCIBILITY','Syntax:\nCOERCIBILITY(str)\n\nReturns the collation coercibility value of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci);\n -> 0\nmysql> SELECT COERCIBILITY(USER());\n -> 3\nmysql> SELECT COERCIBILITY(\'abc\');\n -> 4\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (496,20,'INT','INT[(M)] [UNSIGNED] [ZEROFILL]\n\nA normal-size integer. The signed range is -2147483648 to 2147483647.\nThe unsigned range is 0 to 4294967295.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (497,12,'GLENGTH','GLength(ls)\n\nReturns as a double-precision number the length of the LineString value\nls in its associated spatial reference.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.8284271247462 |\n+----------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#linestring-property-functions');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (498,4,'RADIANS','Syntax:\nRADIANS(X)\n\nReturns the argument X, converted from degrees to radians. (Note that\nπ radians equals 180 degrees.)\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT RADIANS(90);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (499,15,'COLLATION','Syntax:\nCOLLATION(str)\n\nReturns the collation of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT COLLATION(\'abc\');\n -> \'latin1_swedish_ci\'\nmysql> SELECT COLLATION(_utf8\'abc\');\n -> \'utf8_general_ci\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (500,17,'COALESCE','Syntax:\nCOALESCE(value,...)\n\nReturns the first non-NULL value in the list, or NULL if there are no\nnon-NULL values.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT COALESCE(NULL,1);\n -> 1\nmysql> SELECT COALESCE(NULL,NULL,NULL);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,15,'VERSION','Syntax:\nVERSION()\n\nReturns a string that indicates the MySQL server version. The string\nuses the utf8 character set.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT VERSION();\n -> \'5.1.46-standard\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (502,35,'MAKE_SET','Syntax:\nMAKE_SET(bits,str1,str2,...)\n\nReturns a set value (a string containing substrings separated by ","\ncharacters) consisting of the strings that have the corresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL\nvalues in str1, str2, ... are not appended to the result.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT MAKE_SET(1,\'a\',\'b\',\'c\');\n -> \'a\'\nmysql> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\');\n -> \'hello,world\'\nmysql> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\');\n -> \'hello\'\nmysql> SELECT MAKE_SET(0,\'a\',\'b\',\'c\');\n -> \'\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (503,35,'FIND_IN_SET','Syntax:\nFIND_IN_SET(str,strlist)\n\nReturns a value in the range of 1 to N if the string str is in the\nstring list strlist consisting of N substrings. A string list is a\nstring composed of substrings separated by "," characters. If the first\nargument is a constant string and the second is a column of type SET,\nthe FIND_IN_SET() function is optimized to use bit arithmetic. Returns\n0 if str is not in strlist or if strlist is the empty string. Returns\nNULL if either argument is NULL. This function does not work properly\nif the first argument contains a comma (",") character.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT FIND_IN_SET(\'b\',\'a,b,c,d\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (0,16,'MIN','Syntax:\nMIN([DISTINCT] expr)\n\nReturns the minimum value of expr. MIN() may take a string argument; in\nsuch cases, it returns the minimum string value. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-indexes.html. The DISTINCT\nkeyword can be used to find the minimum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMIN() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,27,'JOIN','MySQL supports the following JOIN syntaxes for the table_references\npart of SELECT statements and multiple-table DELETE and UPDATE\nstatements:\n\ntable_references:\n table_reference [, table_reference] ...\n\ntable_reference:\n table_factor\n | join_table\n\ntable_factor:\n tbl_name [[AS] alias] [index_hint_list]\n | table_subquery [AS] alias\n | ( table_references )\n | { OJ table_reference LEFT OUTER JOIN table_reference\n ON conditional_expr }\n\njoin_table:\n table_reference [INNER | CROSS] JOIN table_factor [join_condition]\n | table_reference STRAIGHT_JOIN table_factor\n | table_reference STRAIGHT_JOIN table_factor ON conditional_expr\n | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition\n | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor\n\njoin_condition:\n ON conditional_expr\n | USING (column_list)\n\nindex_hint_list:\n index_hint [, index_hint] ...\n\nindex_hint:\n USE {INDEX|KEY}\n [FOR {JOIN|ORDER BY|GROUP BY}] ([index_list])\n | IGNORE {INDEX|KEY}\n [FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n | FORCE {INDEX|KEY}\n [FOR {JOIN|ORDER BY|GROUP BY}] (index_list)\n\nindex_list:\n index_name [, index_name] ...\n\nA table reference is also known as a join expression.\n\nThe syntax of table_factor is extended in comparison with the SQL\nStandard. The latter accepts only table_reference, not a list of them\ninside a pair of parentheses.\n\nThis is a conservative extension if we consider each comma in a list of\ntable_reference items as equivalent to an inner join. For example:\n\nSELECT * FROM t1 LEFT JOIN (t2, t3, t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nis equivalent to:\n\nSELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nIn MySQL, JOIN, CROSS JOIN, and INNER JOIN are syntactic equivalents\n(they can replace each other). In standard SQL, they are not\nequivalent. INNER JOIN is used with an ON clause, CROSS JOIN is used\notherwise.\n\nIn general, parentheses can be ignored in join expressions containing\nonly inner join operations. MySQL also supports nested joins (see\nhttp://dev.mysql.com/doc/refman/5.5/en/nested-join-optimization.html).\n\nIndex hints can be specified to affect how the MySQL optimizer makes\nuse of indexes. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/index-hints.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/join.html\n\n','SELECT left_tbl.*\n FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id\n WHERE right_tbl.id IS NULL;\n','http://dev.mysql.com/doc/refman/5.5/en/join.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,37,'HEX','Syntax:\nHEX(str), HEX(N)\n\nFor a string argument str, HEX() returns a hexadecimal string\nrepresentation of str where each character in str is converted to two\nhexadecimal digits. The inverse of this operation is performed by the\nUNHEX() function.\n\nFor a numeric argument N, HEX() returns a hexadecimal string\nrepresentation of the value of N treated as a longlong (BIGINT) number.\nThis is equivalent to CONV(N,10,16). The inverse of this operation is\nperformed by CONV(HEX(N),16,10).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT 0x616263, HEX(\'abc\'), UNHEX(HEX(\'abc\'));\n -> \'abc\', 616263, \'abc\'\nmysql> SELECT HEX(255), CONV(HEX(255),16,10);\n -> \'FF\', 255\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (3,27,'REPLACE','Syntax:\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [(col_name,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name\n SET col_name={expr | DEFAULT}, ...\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n\nREPLACE works exactly like INSERT, except that if an old row in the\ntable has the same value as a new row for a PRIMARY KEY or a UNIQUE\nindex, the old row is deleted before the new row is inserted. See [HELP\nINSERT].\n\nREPLACE is a MySQL extension to the SQL standard. It either inserts, or\ndeletes and inserts. For another MySQL extension to standard SQL---that\neither inserts or updates---see\nhttp://dev.mysql.com/doc/refman/5.5/en/insert-on-duplicate.html.\n\nNote that unless the table has a PRIMARY KEY or UNIQUE index, using a\nREPLACE statement makes no sense. It becomes equivalent to INSERT,\nbecause there is no index to be used to determine whether a new row\nduplicates another.\n\nValues for all columns are taken from the values specified in the\nREPLACE statement. Any missing columns are set to their default values,\njust as happens for INSERT. You cannot refer to values from the current\nrow and use them in the new row. If you use an assignment such as SET\ncol_name = col_name + 1, the reference to the column name on the right\nhand side is treated as DEFAULT(col_name), so the assignment is\nequivalent to SET col_name = DEFAULT(col_name) + 1.\n\nTo use REPLACE, you must have both the INSERT and DELETE privileges for\nthe table.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/replace.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/replace.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (4,30,'CONTAINS','Contains(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 completely contains g2. This\ntests the opposite relationship as Within().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (5,36,'SRID','SRID(g)\n\nReturns an integer indicating the Spatial Reference System ID for the\ngeometry value g.\n\nIn MySQL, the SRID value is just an integer associated with the\ngeometry value. All calculations are done assuming Euclidean (planar)\ngeometry.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT SRID(GeomFromText(\'LineString(1 1,2 2)\',101));\n+-----------------------------------------------+\n| SRID(GeomFromText(\'LineString(1 1,2 2)\',101)) |\n+-----------------------------------------------+\n| 101 |\n+-----------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (6,31,'CURRENT_TIMESTAMP','Syntax:\nCURRENT_TIMESTAMP, CURRENT_TIMESTAMP()\n\nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (7,26,'SHOW CONTRIBUTORS','Syntax:\nSHOW CONTRIBUTORS\n\nThe SHOW CONTRIBUTORS statement displays information about the people\nwho contribute to MySQL source or to causes that we support. For each\ncontributor, it displays Name, Location, and Comment values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-contributors.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-contributors.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (8,16,'VARIANCE','Syntax:\nVARIANCE(expr)\n\nReturns the population standard variance of expr. This is an extension\nto standard SQL. The standard SQL function VAR_POP() can be used\ninstead.\n\nVARIANCE() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (9,39,'DROP SERVER','Syntax:\nDROP SERVER [ IF EXISTS ] server_name\n\nDrops the server definition for the server named server_name. The\ncorresponding row within the mysql.servers table will be deleted. This\nstatement requires the SUPER privilege.\n\nDropping a server for a table does not affect any FEDERATED tables that\nused this connection information when they were created. See [HELP\nCREATE SERVER].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-server.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-server.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (10,26,'SHOW AUTHORS','Syntax:\nSHOW AUTHORS\n\nThe SHOW AUTHORS statement displays information about the people who\nwork on MySQL. For each author, it displays Name, Location, and Comment\nvalues.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-authors.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-authors.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (11,16,'VAR_SAMP','Syntax:\nVAR_SAMP(expr)\n\nReturns the sample variance of expr. That is, the denominator is the\nnumber of rows minus one.\n\nVAR_SAMP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (12,37,'CONCAT','Syntax:\nCONCAT(str1,str2,...)\n\nReturns the string that results from concatenating the arguments. May\nhave one or more arguments. If all arguments are nonbinary strings, the\nresult is a nonbinary string. If the arguments include any binary\nstrings, the result is a binary string. A numeric argument is converted\nto its equivalent string form. This is a nonbinary string as of MySQL\n5.5.3. Before 5.5.3, it is a binary string; to to avoid that and\nproduce a nonbinary string, you can use an explicit type cast, as in\nthis example:\n\nSELECT CONCAT(CAST(int_col AS CHAR), char_col);\n\nCONCAT() returns NULL if any argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT CONCAT(\'My\', \'S\', \'QL\');\n -> \'MySQL\'\nmysql> SELECT CONCAT(\'My\', NULL, \'QL\');\n -> NULL\nmysql> SELECT CONCAT(14.3);\n -> \'14.3\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (13,34,'GEOMETRY HIERARCHY','Geometry is the base class. It is an abstract class. The instantiable\nsubclasses of Geometry are restricted to zero-, one-, and\ntwo-dimensional geometric objects that exist in two-dimensional\ncoordinate space. All instantiable geometry classes are defined so that\nvalid instances of a geometry class are topologically closed (that is,\nall defined geometries include their boundary).\n\nThe base Geometry class has subclasses for Point, Curve, Surface, and\nGeometryCollection:\n\no Point represents zero-dimensional objects.\n\no Curve represents one-dimensional objects, and has subclass\n LineString, with sub-subclasses Line and LinearRing.\n\no Surface is designed for two-dimensional objects and has subclass\n Polygon.\n\no GeometryCollection has specialized zero-, one-, and two-dimensional\n collection classes named MultiPoint, MultiLineString, and\n MultiPolygon for modeling geometries corresponding to collections of\n Points, LineStrings, and Polygons, respectively. MultiCurve and\n MultiSurface are introduced as abstract superclasses that generalize\n the collection interfaces to handle Curves and Surfaces.\n\nGeometry, Curve, Surface, MultiCurve, and MultiSurface are defined as\nnoninstantiable classes. They define a common set of methods for their\nsubclasses and are included for extensibility.\n\nPoint, LineString, Polygon, GeometryCollection, MultiPoint,\nMultiLineString, and MultiPolygon are instantiable classes.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/gis-geometry-class-hierarchy.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/gis-geometry-class-hierarchy.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (14,37,'CHAR FUNCTION','Syntax:\nCHAR(N,... [USING charset_name])\n\nCHAR() interprets each argument N as an integer and returns a string\nconsisting of the characters given by the code values of those\nintegers. NULL values are skipped.\nBy default, CHAR() returns a binary string. To produce a string in a\ngiven character set, use the optional USING clause:\n\nmysql> SELECT CHARSET(CHAR(0x65)), CHARSET(CHAR(0x65 USING utf8));\n+---------------------+--------------------------------+\n| CHARSET(CHAR(0x65)) | CHARSET(CHAR(0x65 USING utf8)) |\n+---------------------+--------------------------------+\n| binary | utf8 |\n+---------------------+--------------------------------+\n\nIf USING is given and the result string is illegal for the given\ncharacter set, a warning is issued. Also, if strict SQL mode is\nenabled, the result from CHAR() becomes NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT CHAR(77,121,83,81,\'76\');\n -> \'MySQL\'\nmysql> SELECT CHAR(77,77.3,\'77.3\');\n -> \'MMM\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (15,22,'DATETIME','DATETIME\n\nA date and time combination. The supported range is \'1000-01-01\n00:00:00\' to \'9999-12-31 23:59:59\'. MySQL displays DATETIME values in\n\'YYYY-MM-DD HH:MM:SS\' format, but permits assignment of values to\nDATETIME columns using either strings or numbers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (16,26,'SHOW CREATE TRIGGER','Syntax:\nSHOW CREATE TRIGGER trigger_name\n\nThis statement shows a CREATE TRIGGER statement that creates the given\ntrigger.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-create-trigger.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (17,26,'SHOW CREATE PROCEDURE','Syntax:\nSHOW CREATE PROCEDURE proc_name\n\nThis statement is a MySQL extension. It returns the exact string that\ncan be used to re-create the named stored procedure. A similar\nstatement, SHOW CREATE FUNCTION, displays information about stored\nfunctions (see [HELP SHOW CREATE FUNCTION]).\n\nBoth statements require that you be the owner of the routine or have\nSELECT access to the mysql.proc table. If you do not have privileges\nfor the routine itself, the value displayed for the Create Procedure or\nCreate Function field will be NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-procedure.html\n\n','mysql> SHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row ***************************\n Procedure: simpleproc\n sql_mode:\n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nmysql> SHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row ***************************\n Function: hello\n sql_mode:\n Create Function: CREATE FUNCTION `hello`(s CHAR(20))\n RETURNS CHAR(50)\n RETURN CONCAT(\'Hello, \',s,\'!\')\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.5/en/show-create-procedure.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (18,23,'OPEN','Syntax:\nOPEN cursor_name\n\nThis statement opens a previously declared cursor. For an example, see\nhttp://dev.mysql.com/doc/refman/5.5/en/cursors.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/open.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/open.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (19,22,'INTEGER','INTEGER[(M)] [UNSIGNED] [ZEROFILL]\n\nThis type is a synonym for INT.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (20,37,'LOWER','Syntax:\nLOWER(str)\n\nReturns the string str with all characters changed to lowercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nmysql> SELECT LOWER(\'QUADRATICALLY\');\n -> \'quadratically\'\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings\n(BINARY, VARBINARY, BLOB). To perform lettercase conversion, convert\nthe string to a nonbinary string:\n\nmysql> SET @str = BINARY \'New York\';\nmysql> SELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+-------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+-------------+-----------------------------------+\n| New York | new york |\n+-------------+-----------------------------------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,26,'SHOW COLUMNS','Syntax:\nSHOW [FULL] COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW COLUMNS displays information about the columns in a given table.\nIt also works for views. The LIKE clause, if present, indicates which\ncolumn names to match. The WHERE clause can be given to select rows\nusing more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nSHOW COLUMNS displays information only for those columns for which you\nhave some privilege.\n\nmysql> SHOW COLUMNS FROM City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nIf the data types differ from what you expect them to be based on a\nCREATE TABLE statement, note that MySQL sometimes changes data types\nwhen you create or alter a table. The conditions under which this\noccurs are described in\nhttp://dev.mysql.com/doc/refman/5.5/en/silent-column-changes.html.\n\nThe FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. In other words, these two statements are equivalent:\n\nmysql> SHOW COLUMNS FROM mytable FROM mydb;\nmysql> SHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for nonbinary string columns, or NULL\nfor other columns. This value is displayed only if you use the FULL\nkeyword.\n\nThe Null field contains YES if NULL values can be stored in the column,\nNO if not.\n\nThe Key field indicates whether the column is indexed:\n\no If Key is empty, the column either is not indexed or is indexed only\n as a secondary column in a multiple-column, nonunique index.\n\no If Key is PRI, the column is a PRIMARY KEY or is one of the columns\n in a multiple-column PRIMARY KEY.\n\no If Key is UNI, the column is the first column of a UNIQUE index. (A\n UNIQUE index permits multiple NULL values, but you can tell whether\n the column permits NULL by checking the Null field.)\n\no If Key is MUL, the column is the first column of a nonunique index in\n which multiple occurrences of a given value are permitted within the\n column.\n\nIf more than one of the Key values applies to a given column of a\ntable, Key displays the one with the highest priority, in the order\nPRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values\nand there is no PRIMARY KEY in the table. A UNIQUE index may display as\nMUL if several columns form a composite UNIQUE index; although the\ncombination of the columns is unique, each column can still hold\nmultiple occurrences of a given value.\n\nThe Default field indicates the default value that is assigned to the\ncolumn. This is NULL if the column has an explicit default of NULL, or\nif the column definition has no DEFAULT clause.\n\nThe Extra field contains any additional information that is available\nabout a given column. The value is nonempty in these cases:\nauto_increment for columns that have the AUTO_INCREMENT attribute; on\nupdate CURRENT_TIMESTAMP for TIMESTAMP columns that have the ON UPDATE\nCURRENT_TIMESTAMP attribute.\n\nPrivileges indicates the privileges you have for the column. This value\nis displayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed\nonly if you use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. You can also list a table\'s\ncolumns with the mysqlshow db_name tbl_name command.\n\nThe DESCRIBE statement provides information similar to SHOW COLUMNS.\nSee [HELP DESCRIBE].\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements\nalso provide information about tables. See [HELP SHOW].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-columns.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-columns.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (22,39,'CREATE TRIGGER','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n TRIGGER trigger_name trigger_time trigger_event\n ON tbl_name FOR EACH ROW trigger_body\n\nThis statement creates a new trigger. A trigger is a named database\nobject that is associated with a table, and that activates when a\nparticular event occurs for the table. The trigger becomes associated\nwith the table named tbl_name, which must refer to a permanent table.\nYou cannot associate a trigger with a TEMPORARY table or a view.\n\nCREATE TRIGGER requires the TRIGGER privilege for the table associated\nwith the trigger. The statement might also require the SUPER privilege,\ndepending on the DEFINER value, as described later in this section. If\nbinary logging is enabled, CREATE TRIGGER might require the SUPER\nprivilege, as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-logging.html.\n\nThe DEFINER clause determines the security context to be used when\nchecking access privileges at trigger activation time. See later in\nthis section for more information.\n\ntrigger_time is the trigger action time. It can be BEFORE or AFTER to\nindicate that the trigger activates before or after each row to be\nmodified.\n\ntrigger_event indicates the kind of statement that activates the\ntrigger. The trigger_event can be one of the following:\n\no INSERT: The trigger is activated whenever a new row is inserted into\n the table; for example, through INSERT, LOAD DATA, and REPLACE\n statements.\n\no UPDATE: The trigger is activated whenever a row is modified; for\n example, through UPDATE statements.\n\no DELETE: The trigger is activated whenever a row is deleted from the\n table; for example, through DELETE and REPLACE statements. However,\n DROP TABLE and TRUNCATE TABLE statements on the table do not activate\n this trigger, because they do not use DELETE. Dropping a partition\n does not activate DELETE triggers, either. See [HELP TRUNCATE TABLE].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-trigger.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (23,31,'MONTH','Syntax:\nMONTH(date)\n\nReturns the month for date, in the range 1 to 12 for January to\nDecember, or 0 for dates such as \'0000-00-00\' or \'2008-00-00\' that have\na zero month part.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MONTH(\'2008-02-03\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (24,22,'TINYINT','TINYINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA very small integer. The signed range is -128 to 127. The unsigned\nrange is 0 to 255.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (25,26,'SHOW TRIGGERS','Syntax:\nSHOW TRIGGERS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TRIGGERS lists the triggers currently defined for tables in a\ndatabase (the default database unless a FROM clause is given). This\nstatement returns results only for databases and tables for which you\nhave the TRIGGER privilege. The LIKE clause, if present, indicates\nwhich table names to match and causes the statement to display triggers\nfor those tables. The WHERE clause can be given to select rows using\nmore general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nFor the trigger ins_sum as defined in\nhttp://dev.mysql.com/doc/refman/5.5/en/triggers.html, the output of\nthis statement is as shown here:\n\nmysql> SHOW TRIGGERS LIKE \'acc%\'\\G\n*************************** 1. row ***************************\n Trigger: ins_sum\n Event: INSERT\n Table: account\n Statement: SET @sum = @sum + NEW.amount\n Timing: BEFORE\n Created: NULL\n sql_mode:\n Definer: myname@localhost\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\ncharacter_set_client is the session value of the character_set_client\nsystem variable when the trigger was created. collation_connection is\nthe session value of the collation_connection system variable when the\ntrigger was created. Database Collation is the collation of the\ndatabase with which the trigger is associated.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-triggers.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-triggers.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (26,14,'MASTER_POS_WAIT','Syntax:\nMASTER_POS_WAIT(log_name,log_pos[,timeout])\n\nThis function is useful for control of master/slave synchronization. It\nblocks until the slave has read and applied all updates up to the\nspecified position in the master log. The return value is the number of\nlog events the slave had to wait for to advance to the specified\nposition. The function returns NULL if the slave SQL thread is not\nstarted, the slave\'s master information is not initialized, the\narguments are incorrect, or an error occurs. It returns -1 if the\ntimeout has been exceeded. If the slave SQL thread stops while\nMASTER_POS_WAIT() is waiting, the function returns NULL. If the slave\nis past the specified position, the function returns immediately.\n\nIf a timeout value is specified, MASTER_POS_WAIT() stops waiting when\ntimeout seconds have elapsed. timeout must be greater than 0; a zero or\nnegative timeout means no timeout.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (27,37,'REGEXP','Syntax:\nexpr REGEXP pat, expr RLIKE pat\n\nPerforms a pattern match of a string expression expr against a pattern\npat. The pattern can be an extended regular expression. The syntax for\nregular expressions is discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/regexp.html. Returns 1 if expr\nmatches pat; otherwise it returns 0. If either expr or pat is NULL, the\nresult is NULL. RLIKE is a synonym for REGEXP, provided for mSQL\ncompatibility.\n\nThe pattern need not be a literal string. For example, it can be\nspecified as a string expression or table column.\n\n*Note*: Because MySQL uses the C escape syntax in strings (for example,\n"\\n" to represent the newline character), you must double any "\\" that\nyou use in your REGEXP strings.\n\nREGEXP is not case sensitive, except when used with binary strings.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/regexp.html\n\n','mysql> SELECT \'Monty!\' REGEXP \'.*\';\n -> 1\nmysql> SELECT \'new*\\n*line\' REGEXP \'new\\\\*.\\\\*line\';\n -> 1\nmysql> SELECT \'a\' REGEXP \'A\', \'a\' REGEXP BINARY \'A\';\n -> 1 0\nmysql> SELECT \'a\' REGEXP \'^[a-d]\';\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/regexp.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (28,23,'IF STATEMENT','Syntax:\nIF search_condition THEN statement_list\n [ELSEIF search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND IF\n\nThe IF statement for stored programs implements a basic conditional\nconstruct.\n\n*Note*: There is also an IF() function, which differs from the IF\nstatement described here. See\nhttp://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html. The\nIF statement can have THEN, ELSE, and ELSEIF clauses, and it is\nterminated with END IF.\n\nIf the search_condition evaluates to true, the corresponding THEN or\nELSEIF clause statement_list executes. If no search_condition matches,\nthe ELSE clause statement_list executes.\n\nEach statement_list consists of one or more SQL statements; an empty\nstatement_list is not permitted.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/if.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/if.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (29,19,'^','Syntax:\n^\n\nBitwise XOR:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 1 ^ 1;\n -> 0\nmysql> SELECT 1 ^ 0;\n -> 1\nmysql> SELECT 11 ^ 3;\n -> 8\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (30,39,'DROP VIEW','Syntax:\nDROP VIEW [IF EXISTS]\n view_name [, view_name] ...\n [RESTRICT | CASCADE]\n\nDROP VIEW removes one or more views. You must have the DROP privilege\nfor each view. If any of the views named in the argument list do not\nexist, MySQL returns an error indicating by name which nonexisting\nviews it was unable to drop, but it also drops all of the views in the\nlist that do exist.\n\nThe IF EXISTS clause prevents an error from occurring for views that\ndon\'t exist. When this clause is given, a NOTE is generated for each\nnonexistent view. See [HELP SHOW WARNINGS].\n\nRESTRICT and CASCADE, if given, are parsed and ignored.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-view.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-view.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (31,30,'WITHIN','Within(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially within g2. This\ntests the opposite relationship as Contains().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (32,31,'WEEK','Syntax:\nWEEK(date[,mode])\n\nThis function returns the week number for date. The two-argument form\nof WEEK() enables you to specify whether the week starts on Sunday or\nMonday and whether the return value should be in the range from 0 to 53\nor from 1 to 53. If the mode argument is omitted, the value of the\ndefault_week_format system variable is used. See\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT WEEK(\'2008-02-20\');\n -> 7\nmysql> SELECT WEEK(\'2008-02-20\',0);\n -> 7\nmysql> SELECT WEEK(\'2008-02-20\',1);\n -> 8\nmysql> SELECT WEEK(\'2008-12-31\',1);\n -> 53\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (33,26,'SHOW PLUGINS','Syntax:\nSHOW PLUGINS\n\nSHOW PLUGINS displays information about server plugins. Plugin\ninformation is also available in the INFORMATION_SCHEMA.PLUGINS table.\nSee http://dev.mysql.com/doc/refman/5.5/en/plugins-table.html.\n\nExample of SHOW PLUGINS output:\n\nmysql> SHOW PLUGINS\\G\n*************************** 1. row ***************************\n Name: binlog\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 2. row ***************************\n Name: CSV\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 3. row ***************************\n Name: MEMORY\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n*************************** 4. row ***************************\n Name: MyISAM\n Status: ACTIVE\n Type: STORAGE ENGINE\nLibrary: NULL\nLicense: GPL\n...\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-plugins.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-plugins.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (34,21,'DROP FUNCTION UDF','Syntax:\nDROP FUNCTION function_name\n\nThis statement drops the user-defined function (UDF) named\nfunction_name.\n\nTo drop a function, you must have the DELETE privilege for the mysql\ndatabase. This is because DROP FUNCTION removes a row from the\nmysql.func system table that records the function\'s name, type, and\nshared library name.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-function-udf.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-function-udf.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (35,8,'PREPARE','Syntax:\nPREPARE stmt_name FROM preparable_stmt\n\nThe PREPARE statement prepares a statement and assigns it a name,\nstmt_name, by which to refer to the statement later. Statement names\nare not case sensitive. preparable_stmt is either a string literal or a\nuser variable that contains the text of the statement. The text must\nrepresent a single SQL statement, not multiple statements. Within the\nstatement, "?" characters can be used as parameter markers to indicate\nwhere data values are to be bound to the query later when you execute\nit. The "?" characters should not be enclosed within quotation marks,\neven if you intend to bind them to string values. Parameter markers can\nbe used only where data values should appear, not for SQL keywords,\nidentifiers, and so forth.\n\nIf a prepared statement with the given name already exists, it is\ndeallocated implicitly before the new statement is prepared. This means\nthat if the new statement contains an error and cannot be prepared, an\nerror is returned and no statement with the given name exists.\n\nA prepared statement is executed with EXECUTE and released with\nDEALLOCATE PREPARE.\n\nThe scope of a prepared statement is the session within which it is\ncreated. Other sessions cannot see it.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/prepare.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/prepare.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (36,8,'LOCK','Syntax:\nLOCK TABLES\n tbl_name [[AS] alias] lock_type\n [, tbl_name [[AS] alias] lock_type] ...\n\nlock_type:\n READ [LOCAL]\n | [LOW_PRIORITY] WRITE\n\nUNLOCK TABLES\n\nMySQL enables client sessions to acquire table locks explicitly for the\npurpose of cooperating with other sessions for access to tables, or to\nprevent other sessions from modifying tables during periods when a\nsession requires exclusive access to them. A session can acquire or\nrelease locks only for itself. One session cannot acquire locks for\nanother session or release locks held by another session.\n\nLocks may be used to emulate transactions or to get more speed when\nupdating tables. This is explained in more detail later in this\nsection.\n\nLOCK TABLES explicitly acquires table locks for the current client\nsession. Table locks can be acquired for base tables or views. You must\nhave the LOCK TABLES privilege, and the SELECT privilege for each\nobject to be locked.\n\nFor view locking, LOCK TABLES adds all base tables used in the view to\nthe set of tables to be locked and locks them automatically. If you\nlock a table explicitly with LOCK TABLES, any tables used in triggers\nare also locked implicitly, as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/lock-tables-and-triggers.html.\n\nUNLOCK TABLES explicitly releases any table locks held by the current\nsession. LOCK TABLES implicitly releases any table locks held by the\ncurrent session before acquiring new locks.\n\nAnother use for UNLOCK TABLES is to release the global read lock\nacquired with the FLUSH TABLES WITH READ LOCK statement, which enables\nyou to lock all tables in all databases. See [HELP FLUSH]. (This is a\nvery convenient way to get backups if you have a file system such as\nVeritas that can take snapshots in time.)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/lock-tables.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/lock-tables.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (37,37,'UPDATEXML','Syntax:\nUpdateXML(xml_target, xpath_expr, new_xml)\n\nThis function replaces a single portion of a given fragment of XML\nmarkup xml_target with a new XML fragment new_xml, and then returns the\nchanged XML. The portion of xml_target that is replaced matches an\nXPath expression xpath_expr supplied by the user. In MySQL 5.5, the\nXPath expression can contain at most 127 characters. (This limitation\nis lifted in MySQL 5.6.)\n\nIf no expression matching xpath_expr is found, or if multiple matches\nare found, the function returns the original xml_target XML fragment.\nAll three arguments should be strings.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/xml-functions.html\n\n','mysql> SELECT\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a\', \'<e>fff</e>\') AS val1,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/b\', \'<e>fff</e>\') AS val2,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'//b\', \'<e>fff</e>\') AS val3,\n -> UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val4,\n -> UpdateXML(\'<a><d></d><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val5\n -> \\G\n\n*************************** 1. row ***************************\nval1: <e>fff</e>\nval2: <a><b>ccc</b><d></d></a>\nval3: <a><e>fff</e><d></d></a>\nval4: <a><b>ccc</b><e>fff</e></a>\nval5: <a><d></d><b>ccc</b><d></d></a>\n','http://dev.mysql.com/doc/refman/5.5/en/xml-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (38,8,'RESET SLAVE','Syntax:\nRESET SLAVE [ALL]\n\nRESET SLAVE makes the slave forget its replication position in the\nmaster\'s binary log. This statement is meant to be used for a clean\nstart: It deletes the master.info and relay-log.info files, all the\nrelay log files, and starts a new relay log file. To use RESET SLAVE,\nthe slave replication threads must be stopped (use STOP SLAVE if\nnecessary).\n\n*Note*: All relay log files are deleted, even if they have not been\ncompletely executed by the slave SQL thread. (This is a condition\nlikely to exist on a replication slave if you have issued a STOP SLAVE\nstatement or if the slave is highly loaded.)\n\nIn MySQL 5.5 (unlike the case in MySQL 5.1 and earlier), RESET SLAVE\ndoes not change any replication connection parameters such as master\nhost, master port, master user, or master password, which are retained\nin memory. This means that START SLAVE can be issued without requiring\na CHANGE MASTER TO statement following RESET SLAVE.\n\nIn MySQL 5.5.16 and later, you can use RESET SLAVE ALL to reset these\nconnection parameters (Bug #11809016). Connection parameters are also\nreset if the slave mysqld is shut down.\n\nIf the slave SQL thread was in the middle of replicating temporary\ntables when it was stopped, and RESET SLAVE is issued, these replicated\ntemporary tables are deleted on the slave.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/reset-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/reset-slave.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (39,26,'SHOW BINARY LOGS','Syntax:\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nLists the binary log files on the server. This statement is used as\npart of the procedure described in [HELP PURGE BINARY LOGS], that shows\nhow to determine which logs can be purged.\n\nmysql> SHOW BINARY LOGS;\n+---------------+-----------+\n| Log_name | File_size |\n+---------------+-----------+\n| binlog.000015 | 724935 |\n| binlog.000016 | 733481 |\n+---------------+-----------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-binary-logs.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-binary-logs.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (40,24,'POLYGON','Polygon(ls1,ls2,...)\n\nConstructs a Polygon value from a number of LineString or WKB\nLineString arguments. If any argument does not represent a LinearRing\n(that is, not a closed and simple LineString), the return value is\nNULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (41,31,'MINUTE','Syntax:\nMINUTE(time)\n\nReturns the minute for time, in the range 0 to 59.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MINUTE(\'2008-02-03 10:05:03\');\n -> 5\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (42,31,'DAY','Syntax:\nDAY(date)\n\nDAY() is a synonym for DAYOFMONTH().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (43,37,'MID','Syntax:\nMID(str,pos,len)\n\nMID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (44,14,'UUID','Syntax:\nUUID()\n\nReturns a Universal Unique Identifier (UUID) generated according to\n"DCE 1.1: Remote Procedure Call" (Appendix A) CAE (Common Applications\nEnvironment) Specifications published by The Open Group in October 1997\n(Document Number C706,\nhttp://www.opengroup.org/public/pubs/catalog/c706.htm).\n\nA UUID is designed as a number that is globally unique in space and\ntime. Two calls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate computers\nthat are not connected to each other.\n\nA UUID is a 128-bit number represented by a utf8 string of five\nhexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:\n\no The first three numbers are generated from a timestamp.\n\no The fourth number preserves temporal uniqueness in case the timestamp\n value loses monotonicity (for example, due to daylight saving time).\n\no The fifth number is an IEEE 802 node number that provides spatial\n uniqueness. A random number is substituted if the latter is not\n available (for example, because the host computer has no Ethernet\n card, or we do not know how to find the hardware address of an\n interface on your operating system). In this case, spatial uniqueness\n cannot be guaranteed. Nevertheless, a collision should have very low\n probability.\n\n Currently, the MAC address of an interface is taken into account only\n on FreeBSD and Linux. On other operating systems, MySQL uses a\n randomly generated 48-bit number.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> SELECT UUID();\n -> \'6ccd780c-baba-1026-9564-0040f4311e29\'\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (45,24,'LINESTRING','LineString(pt1,pt2,...)\n\nConstructs a LineString value from a number of Point or WKB Point\narguments. If the number of arguments is less than two, the return\nvalue is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (46,14,'SLEEP','Syntax:\nSLEEP(duration)\n\nSleeps (pauses) for the number of seconds given by the duration\nargument, then returns 0. If SLEEP() is interrupted, it returns 1. The\nduration may have a fractional part given in microseconds.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (47,17,'CONNECTION_ID','Syntax:\nCONNECTION_ID()\n\nReturns the connection ID (thread ID) for the connection. Every\nconnection has an ID that is unique among the set of currently\nconnected clients.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT CONNECTION_ID();\n -> 23786\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (48,27,'DELETE','Syntax:\nSingle-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n\nMultiple-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE]\n tbl_name[.*] [, tbl_name[.*]] ...\n FROM table_references\n [WHERE where_condition]\n\nOr:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE]\n FROM tbl_name[.*] [, tbl_name[.*]] ...\n USING table_references\n [WHERE where_condition]\n\nFor the single-table syntax, the DELETE statement deletes rows from\ntbl_name and returns a count of the number of deleted rows. This count\ncan be obtained by calling the ROW_COUNT() function (see\nhttp://dev.mysql.com/doc/refman/5.5/en/information-functions.html). The\nWHERE clause, if given, specifies the conditions that identify which\nrows to delete. With no WHERE clause, all rows are deleted. If the\nORDER BY clause is specified, the rows are deleted in the order that is\nspecified. The LIMIT clause places a limit on the number of rows that\ncan be deleted.\n\nFor the multiple-table syntax, DELETE deletes from each tbl_name the\nrows that satisfy the conditions. In this case, ORDER BY and LIMIT\ncannot be used.\n\nwhere_condition is an expression that evaluates to true for each row to\nbe deleted. It is specified as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/select.html.\n\nCurrently, you cannot delete from a table and select from the same\ntable in a subquery.\n\nYou need the DELETE privilege on a table to delete rows from it. You\nneed only the SELECT privilege for any columns that are only read, such\nas those named in the WHERE clause.\n\nAs stated, a DELETE statement with no WHERE clause deletes all rows. A\nfaster way to do this, when you do not need to know the number of\ndeleted rows, is to use TRUNCATE TABLE. However, within a transaction\nor if you have a lock on the table, TRUNCATE TABLE cannot be used\nwhereas DELETE can. See [HELP TRUNCATE TABLE], and [HELP LOCK].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/delete.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/delete.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (49,4,'ROUND','Syntax:\nROUND(X), ROUND(X,D)\n\nRounds the argument X to D decimal places. The rounding algorithm\ndepends on the data type of X. D defaults to 0 if not specified. D can\nbe negative to cause D digits left of the decimal point of the value X\nto become zero.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ROUND(-1.23);\n -> -1\nmysql> SELECT ROUND(-1.58);\n -> -2\nmysql> SELECT ROUND(1.58);\n -> 2\nmysql> SELECT ROUND(1.298, 1);\n -> 1.3\nmysql> SELECT ROUND(1.298, 0);\n -> 1\nmysql> SELECT ROUND(23.298, -1);\n -> 20\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (50,7,'NULLIF','Syntax:\nNULLIF(expr1,expr2)\n\nReturns NULL if expr1 = expr2 is true, otherwise returns expr1. This is\nthe same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html\n\n','mysql> SELECT NULLIF(1,1);\n -> NULL\nmysql> SELECT NULLIF(1,2);\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (51,23,'CLOSE','Syntax:\nCLOSE cursor_name\n\nThis statement closes a previously opened cursor. For an example, see\nhttp://dev.mysql.com/doc/refman/5.5/en/cursors.html.\n\nAn error occurs if the cursor is not open.\n\nIf not closed explicitly, a cursor is closed at the end of the BEGIN\n... END block in which it was declared.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/close.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/close.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (52,8,'STOP SLAVE','Syntax:\nSTOP SLAVE [thread_types]\n\nthread_types:\n [thread_type [, thread_type] ... ]\n\nthread_type: IO_THREAD | SQL_THREAD\n\nStops the slave threads. STOP SLAVE requires the SUPER privilege.\nRecommended best practice is to execute STOP SLAVE on the slave before\nstopping the slave server (see\nhttp://dev.mysql.com/doc/refman/5.5/en/server-shutdown.html, for more\ninformation).\n\nWhen using the row-based logging format: You should execute STOP SLAVE\non the slave prior to shutting down the slave server if you are\nreplicating any tables that use a nontransactional storage engine (see\nthe Note later in this section). In MySQL 5.5.9 and later, you can also\nuse STOP SLAVE SQL_THREAD for this purpose.\n\nLike START SLAVE, this statement may be used with the IO_THREAD and\nSQL_THREAD options to name the thread or threads to be stopped.\n\n*Note*: In MySQL 5.5, STOP SLAVE waits until the current replication\nevent group affecting one or more non-transactional tables has finished\nexecuting (if there is any such replication group), or until the user\nissues a KILL QUERY or KILL CONNECTION statement. (Bug #319, Bug\n#38205)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/stop-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/stop-slave.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (53,31,'TIMEDIFF','Syntax:\nTIMEDIFF(expr1,expr2)\n\nTIMEDIFF() returns expr1 - expr2 expressed as a time value. expr1 and\nexpr2 are time or date-and-time expressions, but both must be of the\nsame type.\n\nThe result returned by TIMEDIFF() is limited to the range allowed for\nTIME values. Alternatively, you can use either of the functions\nTIMESTAMPDIFF() and UNIX_TIMESTAMP(), both of which return integers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIMEDIFF(\'2000:01:01 00:00:00\',\n -> \'2000:01:01 00:00:00.000001\');\n -> \'-00:00:00.000001\'\nmysql> SELECT TIMEDIFF(\'2008-12-31 23:59:59.000001\',\n -> \'2008-12-30 01:01:01.000002\');\n -> \'46:58:57.999999\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (54,37,'REPLACE FUNCTION','Syntax:\nREPLACE(str,from_str,to_str)\n\nReturns the string str with all occurrences of the string from_str\nreplaced by the string to_str. REPLACE() performs a case-sensitive\nmatch when searching for from_str.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT REPLACE(\'www.mysql.com\', \'w\', \'Ww\');\n -> \'WwWwWw.mysql.com\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (55,28,'USE','Syntax:\nUSE db_name\n\nThe USE db_name statement tells MySQL to use the db_name database as\nthe default (current) database for subsequent statements. The database\nremains the default until the end of the session or another USE\nstatement is issued:\n\nUSE db1;\nSELECT COUNT(*) FROM mytable; # selects from db1.mytable\nUSE db2;\nSELECT COUNT(*) FROM mytable; # selects from db2.mytable\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/use.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/use.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (56,3,'LINEFROMTEXT','LineFromText(wkt[,srid]), LineStringFromText(wkt[,srid])\n\nConstructs a LINESTRING value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (57,7,'CASE OPERATOR','Syntax:\nCASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN\nresult ...] [ELSE result] END\n\nCASE WHEN [condition] THEN result [WHEN [condition] THEN result ...]\n[ELSE result] END\n\nThe first version returns the result where value=compare_value. The\nsecond version returns the result for the first condition that is true.\nIf there was no matching result value, the result after ELSE is\nreturned, or NULL if there is no ELSE part.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html\n\n','mysql> SELECT CASE 1 WHEN 1 THEN \'one\'\n -> WHEN 2 THEN \'two\' ELSE \'more\' END;\n -> \'one\'\nmysql> SELECT CASE WHEN 1>0 THEN \'true\' ELSE \'false\' END;\n -> \'true\'\nmysql> SELECT CASE BINARY \'B\'\n -> WHEN \'a\' THEN 1 WHEN \'b\' THEN 2 END;\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (58,26,'SHOW MASTER STATUS','Syntax:\nSHOW MASTER STATUS\n\nThis statement provides status information about the binary log files\nof the master. It requires either the SUPER or REPLICATION CLIENT\nprivilege.\n\nExample:\n\nmysql> SHOW MASTER STATUS;\n+---------------+----------+--------------+------------------+\n| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |\n+---------------+----------+--------------+------------------+\n| mysql-bin.003 | 73 | test | manual,mysql |\n+---------------+----------+--------------+------------------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-master-status.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-master-status.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (59,31,'ADDTIME','Syntax:\nADDTIME(expr1,expr2)\n\nADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time\nor datetime expression, and expr2 is a time expression.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT ADDTIME(\'2007-12-31 23:59:59.999999\', \'1 1:1:1.000002\');\n -> \'2008-01-02 01:01:01.000001\'\nmysql> SELECT ADDTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n -> \'03:00:01.999997\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (60,34,'SPATIAL','For MyISAM tables, MySQL can create spatial indexes using syntax\nsimilar to that for creating regular indexes, but extended with the\nSPATIAL keyword. Currently, columns in spatial indexes must be declared\nNOT NULL. The following examples demonstrate how to create spatial\nindexes:\n\no With CREATE TABLE:\n\nCREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g)) ENGINE=MyISAM;\n\no With ALTER TABLE:\n\nALTER TABLE geom ADD SPATIAL INDEX(g);\n\no With CREATE INDEX:\n\nCREATE SPATIAL INDEX sp_index ON geom (g);\n\nFor MyISAM tables, SPATIAL INDEX creates an R-tree index. For storage\nengines that support nonspatial indexing of spatial columns, the engine\ncreates a B-tree index. A B-tree index on spatial values will be useful\nfor exact-value lookups, but not for range scans.\n\nFor more information on indexing spatial columns, see [HELP CREATE\nINDEX].\n\nTo drop spatial indexes, use ALTER TABLE or DROP INDEX:\n\no With ALTER TABLE:\n\nALTER TABLE geom DROP INDEX g;\n\no With DROP INDEX:\n\nDROP INDEX sp_index ON geom;\n\nExample: Suppose that a table geom contains more than 32,000\ngeometries, which are stored in the column g of type GEOMETRY. The\ntable also has an AUTO_INCREMENT column fid for storing object ID\nvalues.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-indexes.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-indexes.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (61,31,'TO_SECONDS','Syntax:\nTO_SECONDS(expr)\n\nGiven a date or datetime expr, returns a the number of seconds since\nthe year 0. If expr is not a valid date or datetime value, returns\nNULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TO_SECONDS(950501);\n -> 62966505600\nmysql> SELECT TO_SECONDS(\'2009-11-29\');\n -> 63426672000\nmysql> SELECT TO_SECONDS(\'2009-11-29 13:43:32\');\n -> 63426721412\nmysql> SELECT TO_SECONDS( NOW() );\n -> 63426721458\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (62,31,'TIMESTAMPDIFF','Syntax:\nTIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)\n\nReturns datetime_expr2 - datetime_expr1, where datetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One expression may be\na date and the other a datetime; a date value is treated as a datetime\nhaving the time part \'00:00:00\' where necessary. The unit for the\nresult (an integer) is given by the unit argument. The legal values for\nunit are the same as those listed in the description of the\nTIMESTAMPADD() function.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMPDIFF(MONTH,\'2003-02-01\',\'2003-05-01\');\n -> 3\nmysql> SELECT TIMESTAMPDIFF(YEAR,\'2002-05-01\',\'2001-01-01\');\n -> -1\nmysql> SELECT TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01 12:05:55\');\n -> 128885\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (63,37,'UPPER','Syntax:\nUPPER(str)\n\nReturns the string str with all characters changed to uppercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nmysql> SELECT UPPER(\'Hej\');\n -> \'HEJ\'\n\nSee the description of LOWER() for information that also applies to\nUPPER(), such as information about how to perform lettercase conversion\nof binary strings (BINARY, VARBINARY, BLOB) for which these functions\nare ineffective.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (64,31,'FROM_UNIXTIME','Syntax:\nFROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)\n\nReturns a representation of the unix_timestamp argument as a value in\n\'YYYY-MM-DD HH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on\nwhether the function is used in a string or numeric context. The value\nis expressed in the current time zone. unix_timestamp is an internal\ntimestamp value such as is produced by the UNIX_TIMESTAMP() function.\n\nIf format is given, the result is formatted according to the format\nstring, which is used the same way as listed in the entry for the\nDATE_FORMAT() function.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT FROM_UNIXTIME(1196440219);\n -> \'2007-11-30 10:30:19\'\nmysql> SELECT FROM_UNIXTIME(1196440219) + 0;\n -> 20071130103019.000000\nmysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),\n -> \'%Y %D %M %h:%i:%s %x\');\n -> \'2007 30th November 10:30:59 2007\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (65,22,'MEDIUMBLOB','MEDIUMBLOB\n\nA BLOB column with a maximum length of 16,777,215 (224 - 1) bytes. Each\nMEDIUMBLOB value is stored using a 3-byte length prefix that indicates\nthe number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (66,12,'SHA2','Syntax:\nSHA2(str, hash_length)\n\nCalculates the SHA-2 family of hash functions (SHA-224, SHA-256,\nSHA-384, and SHA-512). The first argument is the cleartext string to be\nhashed. The second argument indicates the desired bit length of the\nresult, which must have a value of 224, 256, 384, 512, or 0 (which is\nequivalent to 256). If either argument is NULL or the hash length is\nnot one of the permitted values, the return value is NULL. Otherwise,\nthe function result is a hash value containing the desired number of\nbits. See the notes at the beginning of this section about storing hash\nvalues efficiently.\n\nAs of MySQL 5.5.6, the return value is a nonbinary string in the\nconnection character set. Before 5.5.6, the return value is a binary\nstring; see the notes at the beginning of this section about using the\nvalue as a nonbinary string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT SHA2(\'abc\', 224);\n -> \'23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7\'\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (67,7,'IFNULL','Syntax:\nIFNULL(expr1,expr2)\n\nIf expr1 is not NULL, IFNULL() returns expr1; otherwise it returns\nexpr2. IFNULL() returns a numeric or string value, depending on the\ncontext in which it is used.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html\n\n','mysql> SELECT IFNULL(1,0);\n -> 1\nmysql> SELECT IFNULL(NULL,10);\n -> 10\nmysql> SELECT IFNULL(1/0,10);\n -> 10\nmysql> SELECT IFNULL(1/0,\'yes\');\n -> \'yes\'\n','http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (68,26,'SHOW FUNCTION CODE','Syntax:\nSHOW FUNCTION CODE func_name\n\nThis statement is similar to SHOW PROCEDURE CODE but for stored\nfunctions. See [HELP SHOW PROCEDURE CODE].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-function-code.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-function-code.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (69,26,'SHOW ERRORS','Syntax:\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW COUNT(*) ERRORS\n\nThis statement is similar to SHOW WARNINGS, except that it displays\ninformation only for errors, rather than for errors, warnings, and\nnotes.\n\nThe LIMIT clause has the same syntax as for the SELECT statement. See\nhttp://dev.mysql.com/doc/refman/5.5/en/select.html.\n\nThe SHOW COUNT(*) ERRORS statement displays the number of errors. You\ncan also retrieve this number from the error_count variable:\n\nSHOW COUNT(*) ERRORS;\nSELECT @@error_count;\n\nSHOW ERRORS and error_count apply only to errors, not warnings or\nnotes. In other respects, they are similar to SHOW WARNINGS and\nwarning_count. In particular, SHOW ERRORS cannot display information\nfor more than max_error_count messages, and error_count can exceed the\nvalue of max_error_count if the number of errors exceeds\nmax_error_count.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-errors.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-errors.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (70,18,'LEAST','Syntax:\nLEAST(value1,value2,...)\n\nWith two or more arguments, returns the smallest (minimum-valued)\nargument. The arguments are compared using the following rules:\n\no If any argument is NULL, the result is NULL. No comparison is needed.\n\no If the return value is used in an INTEGER context or all arguments\n are integer-valued, they are compared as integers.\n\no If the return value is used in a REAL context or all arguments are\n real-valued, they are compared as reals.\n\no If the arguments comprise a mix of numbers and strings, they are\n compared as numbers.\n\no If any argument is a nonbinary (character) string, the arguments are\n compared as nonbinary strings.\n\no In all other cases, the arguments are compared as binary strings.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT LEAST(2,0);\n -> 0\nmysql> SELECT LEAST(34.0,3.0,5.0,767.0);\n -> 3.0\nmysql> SELECT LEAST(\'B\',\'A\',\'C\');\n -> \'A\'\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (71,18,'=','=\n\nEqual:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 = 0;\n -> 0\nmysql> SELECT \'0\' = 0;\n -> 1\nmysql> SELECT \'0.0\' = 0;\n -> 1\nmysql> SELECT \'0.01\' = 0;\n -> 0\nmysql> SELECT \'.01\' = 0.01;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (72,37,'REVERSE','Syntax:\nREVERSE(str)\n\nReturns the string str with the order of the characters reversed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT REVERSE(\'abc\');\n -> \'cba\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (73,18,'ISNULL','Syntax:\nISNULL(expr)\n\nIf expr is NULL, ISNULL() returns 1, otherwise it returns 0.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT ISNULL(1+1);\n -> 0\nmysql> SELECT ISNULL(1/0);\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (74,22,'BINARY','BINARY(M)\n\nThe BINARY type is similar to the CHAR type, but stores binary byte\nstrings rather than nonbinary character strings. M represents the\ncolumn length in bytes.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (75,22,'BLOB DATA TYPE','A BLOB is a binary large object that can hold a variable amount of\ndata. The four BLOB types are TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB.\nThese differ only in the maximum length of the values they can hold.\nThe four TEXT types are TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. These\ncorrespond to the four BLOB types and have the same maximum lengths and\nstorage requirements. See\nhttp://dev.mysql.com/doc/refman/5.5/en/storage-requirements.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/blob.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/blob.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (76,36,'BOUNDARY','Boundary(g)\n\nReturns a geometry that is the closure of the combinatorial boundary of\nthe geometry value g.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (77,10,'CREATE USER','Syntax:\nCREATE USER user_specification\n [, user_specification] ...\n\nuser_specification:\n user\n [\n IDENTIFIED BY [PASSWORD] \'password\'\n | IDENTIFIED WITH auth_plugin [AS \'auth_string\']\n ]\n\nThe CREATE USER statement creates new MySQL accounts. To use it, you\nmust have the global CREATE USER privilege or the INSERT privilege for\nthe mysql database. For each account, CREATE USER creates a new row in\nthe mysql.user table and assigns the account no privileges. An error\noccurs if the account already exists.\n\nEach account name uses the format described in\nhttp://dev.mysql.com/doc/refman/5.5/en/account-names.html. For example:\n\nCREATE USER \'jeffrey\'@\'localhost\' IDENTIFIED BY \'mypass\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nThe user specification may indicate how the user should authenticate\nwhen connecting to the server:\n\no To enable the user to connect with no password (which is insecure),\n include no IDENTIFIED BY clause:\n\nCREATE USER \'jeffrey\'@\'localhost\';\n\n In this case, the account uses built-in authentication and clients\n must provide no password.\n\no To assign a password, use IDENTIFIED BY with the literal plaintext\n password value:\n\nCREATE USER \'jeffrey\'@\'localhost\' IDENTIFIED BY \'mypass\';\n\n The account uses built-in authentication and clients must match the\n given password.\n\no To avoid specifying the plaintext password if you know its hash value\n (the value that PASSWORD() would return for the password), specify\n the hash value preceded by the keyword PASSWORD:\n\nCREATE USER \'jeffrey\'@\'localhost\'\nIDENTIFIED BY PASSWORD \'*90E462C37378CED12064BB3388827D2BA3A9B689\';\n\n The account uses built-in authentication and clients must match the\n given password.\n\no To authenticate the account using a specific authentication plugin,\n use IDENTIFIED WITH, where auth_plugin is the plugin name. It can be\n an unquoted name or a quoted string literal. \'auth_string\' is an\n optional quoted string literal to pass to the plugin. The plugin\n interprets the meaning of the string, so its format is plugin\n specific. Consult the documentation for a given plugin for\n information about the authentication string values it accepts.\n\nCREATE USER \'jeffrey\'@\'localhost\'\nIDENTIFIED WITH my_auth_plugin;\n\n For connections that use this account, the server invokes the named\n plugin and clients must provide credentials as required for the\n authentication method that the plugin implements. If the server\n cannot find the plugin, either at account-creation time or connect\n time, an error occurs. IDENTIFIED WITH can be used as of MySQL 5.5.7.\n\nThe IDENTIFIED BY and IDENTIFIED WITH clauses are mutually exclusive,\nso at most one of them can be specified for a given user.\n\nFor additional information about setting passwords, see\nhttp://dev.mysql.com/doc/refman/5.5/en/assigning-passwords.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-user.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-user.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (78,24,'POINT','Point(x,y)\n\nConstructs a Point using its coordinates.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (79,17,'CURRENT_USER','Syntax:\nCURRENT_USER, CURRENT_USER()\n\nReturns the user name and host name combination for the MySQL account\nthat the server used to authenticate the current client. This account\ndetermines your access privileges. The return value is a string in the\nutf8 character set.\n\nThe value of CURRENT_USER() can differ from the value of USER().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT USER();\n -> \'davida@localhost\'\nmysql> SELECT * FROM mysql.user;\nERROR 1044: Access denied for user \'\'@\'localhost\' to\ndatabase \'mysql\'\nmysql> SELECT CURRENT_USER();\n -> \'@localhost\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (80,37,'LCASE','Syntax:\nLCASE(str)\n\nLCASE() is a synonym for LOWER().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (81,18,'<=','Syntax:\n<=\n\nLess than or equal:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 0.1 <= 2;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (82,26,'SHOW PROFILES','Syntax:\nSHOW PROFILES\n\nThe SHOW PROFILES statement, together with SHOW PROFILE, displays\nprofiling information that indicates resource usage for statements\nexecuted during the course of the current session. For more\ninformation, see [HELP SHOW PROFILE].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-profiles.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-profiles.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (83,27,'UPDATE','Syntax:\nSingle-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_reference\n SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n [ORDER BY ...]\n [LIMIT row_count]\n\nMultiple-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_references\n SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...\n [WHERE where_condition]\n\nFor the single-table syntax, the UPDATE statement updates columns of\nexisting rows in the named table with new values. The SET clause\nindicates which columns to modify and the values they should be given.\nEach value can be given as an expression, or the keyword DEFAULT to set\na column explicitly to its default value. The WHERE clause, if given,\nspecifies the conditions that identify which rows to update. With no\nWHERE clause, all rows are updated. If the ORDER BY clause is\nspecified, the rows are updated in the order that is specified. The\nLIMIT clause places a limit on the number of rows that can be updated.\n\nFor the multiple-table syntax, UPDATE updates rows in each table named\nin table_references that satisfy the conditions. In this case, ORDER BY\nand LIMIT cannot be used.\n\nwhere_condition is an expression that evaluates to true for each row to\nbe updated. For expression syntax, see\nhttp://dev.mysql.com/doc/refman/5.5/en/expressions.html.\n\ntable_references and where_condition are is specified as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/select.html.\n\nYou need the UPDATE privilege only for columns referenced in an UPDATE\nthat are actually updated. You need only the SELECT privilege for any\ncolumns that are read but not modified.\n\nThe UPDATE statement supports the following modifiers:\n\no With the LOW_PRIORITY keyword, execution of the UPDATE is delayed\n until no other clients are reading from the table. This affects only\n storage engines that use only table-level locking (such as MyISAM,\n MEMORY, and MERGE).\n\no With the IGNORE keyword, the update statement does not abort even if\n errors occur during the update. Rows for which duplicate-key\n conflicts occur are not updated. Rows for which columns are updated\n to values that would cause data conversion errors are updated to the\n closest valid values instead.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/update.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/update.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (84,18,'IS NOT NULL','Syntax:\nIS NOT NULL\n\nTests whether a value is not NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;\n -> 1, 1, 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (85,23,'CASE STATEMENT','Syntax:\nCASE case_value\n WHEN when_value THEN statement_list\n [WHEN when_value THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n\nOr:\n\nCASE\n WHEN search_condition THEN statement_list\n [WHEN search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND CASE\n\nThe CASE statement for stored programs implements a complex conditional\nconstruct.\n\n*Note*: There is also a CASE expression, which differs from the CASE\nstatement described here. See\nhttp://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html. The\nCASE statement cannot have an ELSE NULL clause, and it is terminated\nwith END CASE instead of END.\n\nFor the first syntax, case_value is an expression. This value is\ncompared to the when_value expression in each WHEN clause until one of\nthem is equal. When an equal when_value is found, the corresponding\nTHEN clause statement_list executes. If no when_value is equal, the\nELSE clause statement_list executes, if there is one.\n\nThis syntax cannot be used to test for equality with NULL because NULL\n= NULL is false. See\nhttp://dev.mysql.com/doc/refman/5.5/en/working-with-null.html.\n\nFor the second syntax, each WHEN clause search_condition expression is\nevaluated until one is true, at which point its corresponding THEN\nclause statement_list executes. If no search_condition is equal, the\nELSE clause statement_list executes, if there is one.\n\nIf no when_value or search_condition matches the value tested and the\nCASE statement contains no ELSE clause, a Case not found for CASE\nstatement error results.\n\nEach statement_list consists of one or more SQL statements; an empty\nstatement_list is not permitted.\n\nTo handle situations where no value is matched by any WHEN clause, use\nan ELSE containing an empty BEGIN ... END block, as shown in this\nexample. (The indentation used here in the ELSE clause is for purposes\nof clarity only, and is not otherwise significant.)\n\nDELIMITER |\n\nCREATE PROCEDURE p()\n BEGIN\n DECLARE v INT DEFAULT 1;\n\n CASE v\n WHEN 2 THEN SELECT v;\n WHEN 3 THEN SELECT 0;\n ELSE\n BEGIN\n END;\n END CASE;\n END;\n |\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/case.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/case.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (86,8,'EXECUTE STATEMENT','Syntax:\nEXECUTE stmt_name\n [USING @var_name [, @var_name] ...]\n\nAfter preparing a statement with PREPARE, you execute it with an\nEXECUTE statement that refers to the prepared statement name. If the\nprepared statement contains any parameter markers, you must supply a\nUSING clause that lists user variables containing the values to be\nbound to the parameters. Parameter values can be supplied only by user\nvariables, and the USING clause must name exactly as many variables as\nthe number of parameter markers in the statement.\n\nYou can execute a given prepared statement multiple times, passing\ndifferent variables to it or setting the variables to different values\nbefore each execution.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/execute.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/execute.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,39,'DROP INDEX','Syntax:\nDROP [ONLINE|OFFLINE] INDEX index_name ON tbl_name\n\nDROP INDEX drops the index named index_name from the table tbl_name.\nThis statement is mapped to an ALTER TABLE statement to drop the index.\nSee [HELP ALTER TABLE].\n\nTo drop a primary key, the index name is always PRIMARY, which must be\nspecified as a quoted identifier because PRIMARY is a reserved word:\n\nDROP INDEX `PRIMARY` ON t;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-index.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-index.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (88,37,'MATCH AGAINST','Syntax:\nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n\nMySQL has support for full-text indexing and searching:\n\no A full-text index in MySQL is an index of type FULLTEXT.\n\no Full-text indexes can be used only with MyISAM tables, and can be\n created only for CHAR, VARCHAR, or TEXT columns.\n\no A FULLTEXT index definition can be given in the CREATE TABLE\n statement when a table is created, or added later using ALTER TABLE\n or CREATE INDEX.\n\no For large data sets, it is much faster to load your data into a table\n that has no FULLTEXT index and then create the index after that, than\n to load data into a table that has an existing FULLTEXT index.\n\nFull-text searching is performed using MATCH() ... AGAINST syntax.\nMATCH() takes a comma-separated list that names the columns to be\nsearched. AGAINST takes a string to search for, and an optional\nmodifier that indicates what type of search to perform. The search\nstring must be a literal string, not a variable or a column name. There\nare three types of full-text searches:\n\no A natural language search interprets the search string as a phrase in\n natural human language (a phrase in free text). There are no special\n operators. The stopword list applies. In addition, words that are\n present in 50% or more of the rows are considered common and do not\n match.\n\n Full-text searches are natural language searches if the IN NATURAL\n LANGUAGE MODE modifier is given or if no modifier is given. For more\n information, see\n http://dev.mysql.com/doc/refman/5.5/en/fulltext-natural-language.html\n .\n\no A boolean search interprets the search string using the rules of a\n special query language. The string contains the words to search for.\n It can also contain operators that specify requirements such that a\n word must be present or absent in matching rows, or that it should be\n weighted higher or lower than usual. Common words such as "some" or\n "then" are stopwords and do not match if present in the search\n string. The IN BOOLEAN MODE modifier specifies a boolean search. For\n more information, see\n http://dev.mysql.com/doc/refman/5.5/en/fulltext-boolean.html.\n\no A query expansion search is a modification of a natural language\n search. The search string is used to perform a natural language\n search. Then words from the most relevant rows returned by the search\n are added to the search string and the search is done again. The\n query returns the rows from the second search. The IN NATURAL\n LANGUAGE MODE WITH QUERY EXPANSION or WITH QUERY EXPANSION modifier\n specifies a query expansion search. For more information, see\n http://dev.mysql.com/doc/refman/5.5/en/fulltext-query-expansion.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html\n\n','mysql> SELECT id, body, MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE) AS score\n -> FROM articles WHERE MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE);\n+----+-------------------------------------+-----------------+\n| id | body | score |\n+----+-------------------------------------+-----------------+\n| 4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014 |\n| 6 | When configured properly, MySQL ... | 1.3114095926285 |\n+----+-------------------------------------+-----------------+\n2 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (89,39,'CREATE EVENT','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n EVENT\n [IF NOT EXISTS]\n event_name\n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO event_body;\n\nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval\n [STARTS timestamp [+ INTERVAL interval] ...]\n [ENDS timestamp [+ INTERVAL interval] ...]\n\ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n\nThis statement creates and schedules a new event. The event will not\nrun unless the Event Scheduler is enabled. For information about\nchecking Event Scheduler status and enabling it if necessary, see\nhttp://dev.mysql.com/doc/refman/5.5/en/events-configuration.html.\n\nCREATE EVENT requires the EVENT privilege for the schema in which the\nevent is to be created. It might also require the SUPER privilege,\ndepending on the DEFINER value, as described later in this section.\n\nThe minimum requirements for a valid CREATE EVENT statement are as\nfollows:\n\no The keywords CREATE EVENT plus an event name, which uniquely\n identifies the event in a database schema.\n\no An ON SCHEDULE clause, which determines when and how often the event\n executes.\n\no A DO clause, which contains the SQL statement to be executed by an\n event.\n\nThis is an example of a minimal CREATE EVENT statement:\n\nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n\nThe previous statement creates an event named myevent. This event\nexecutes once---one hour following its creation---by running an SQL\nstatement that increments the value of the myschema.mytable table\'s\nmycol column by 1.\n\nThe event_name must be a valid MySQL identifier with a maximum length\nof 64 characters. Event names are not case sensitive, so you cannot\nhave two events named myevent and MyEvent in the same schema. In\ngeneral, the rules governing event names are the same as those for\nnames of stored routines. See\nhttp://dev.mysql.com/doc/refman/5.5/en/identifiers.html.\n\nAn event is associated with a schema. If no schema is indicated as part\nof event_name, the default (current) schema is assumed. To create an\nevent in a specific schema, qualify the event name with a schema using\nschema_name.event_name syntax.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-event.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-event.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (90,4,'ABS','Syntax:\nABS(X)\n\nReturns the absolute value of X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ABS(2);\n -> 2\nmysql> SELECT ABS(-32);\n -> 32\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (91,32,'POLYFROMWKB','PolyFromWKB(wkb[,srid]), PolygonFromWKB(wkb[,srid])\n\nConstructs a POLYGON value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (92,37,'NOT LIKE','Syntax:\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n\nThis is the same as NOT (expr LIKE pat [ESCAPE \'escape_char\']).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (93,37,'SPACE','Syntax:\nSPACE(N)\n\nReturns a string consisting of N space characters.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT SPACE(6);\n -> \' \'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (94,6,'MBR DEFINITION','Its MBR (Minimum Bounding Rectangle), or Envelope. This is the bounding\ngeometry, formed by the minimum and maximum (X,Y) coordinates:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/gis-class-geometry.html\n\n','((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n','http://dev.mysql.com/doc/refman/5.5/en/gis-class-geometry.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (95,24,'GEOMETRYCOLLECTION','GeometryCollection(g1,g2,...)\n\nConstructs a GeometryCollection.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (96,16,'MAX','Syntax:\nMAX([DISTINCT] expr)\n\nReturns the maximum value of expr. MAX() may take a string argument; in\nsuch cases, it returns the maximum string value. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-indexes.html. The DISTINCT\nkeyword can be used to find the maximum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMAX() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,21,'CREATE FUNCTION UDF','Syntax:\nCREATE [AGGREGATE] FUNCTION function_name RETURNS {STRING|INTEGER|REAL|DECIMAL}\n SONAME shared_library_name\n\nA user-defined function (UDF) is a way to extend MySQL with a new\nfunction that works like a native (built-in) MySQL function such as\nABS() or CONCAT().\n\nfunction_name is the name that should be used in SQL statements to\ninvoke the function. The RETURNS clause indicates the type of the\nfunction\'s return value. DECIMAL is a legal value after RETURNS, but\ncurrently DECIMAL functions return string values and should be written\nlike STRING functions.\n\nshared_library_name is the basename of the shared object file that\ncontains the code that implements the function. The file must be\nlocated in the plugin directory. This directory is given by the value\nof the plugin_dir system variable. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/udf-compiling.html.\n\nTo create a function, you must have the INSERT privilege for the mysql\ndatabase. This is necessary because CREATE FUNCTION adds a row to the\nmysql.func system table that records the function\'s name, type, and\nshared library name. If you do not have this table, you should run the\nmysql_upgrade command to create it. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-upgrade.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-function-udf.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-function-udf.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (98,4,'*','Syntax:\n*\n\nMultiplication:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT 3*5;\n -> 15\nmysql> SELECT 18014398509481984*18014398509481984.0;\n -> 324518553658426726783156020576256.0\nmysql> SELECT 18014398509481984*18014398509481984;\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (99,22,'TIMESTAMP','TIMESTAMP\n\nA timestamp. The range is \'1970-01-01 00:00:01\' UTC to \'2038-01-19\n03:14:07\' UTC. TIMESTAMP values are stored as the number of seconds\nsince the epoch (\'1970-01-01 00:00:00\' UTC). A TIMESTAMP cannot\nrepresent the value \'1970-01-01 00:00:00\' because that is equivalent to\n0 seconds from the epoch and the value 0 is reserved for representing\n\'0000-00-00 00:00:00\', the "zero" TIMESTAMP value.\n\nUnless specified otherwise, the first TIMESTAMP column in a table is\ndefined to be automatically set to the date and time of the most recent\nmodification if not explicitly assigned a value. This makes TIMESTAMP\nuseful for recording the timestamp of an INSERT or UPDATE operation.\nYou can also set any TIMESTAMP column to the current date and time by\nassigning it a NULL value, unless it has been defined with the NULL\nattribute to permit NULL values. The automatic initialization and\nupdating to the current date and time can be specified using DEFAULT\nCURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses, as described\nin\nhttp://dev.mysql.com/doc/refman/5.5/en/timestamp-initialization.html.\n\n*Note*: The TIMESTAMP format that was used prior to MySQL 4.1 is not\nsupported in MySQL 5.5; see MySQL 3.23, 4.0, 4.1 Reference Manual for\ninformation regarding the old format.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (100,12,'DES_DECRYPT','Syntax:\nDES_DECRYPT(crypt_str[,key_str])\n\nDecrypts a string encrypted with DES_ENCRYPT(). If an error occurs,\nthis function returns NULL.\n\nThis function works only if MySQL has been configured with SSL support.\nSee http://dev.mysql.com/doc/refman/5.5/en/ssl-connections.html.\n\nIf no key_str argument is given, DES_DECRYPT() examines the first byte\nof the encrypted string to determine the DES key number that was used\nto encrypt the original string, and then reads the key from the DES key\nfile to decrypt the message. For this to work, the user must have the\nSUPER privilege. The key file can be specified with the --des-key-file\nserver option.\n\nIf you pass this function a key_str argument, that string is used as\nthe key for decrypting the message.\n\nIf the crypt_str argument does not appear to be an encrypted string,\nMySQL returns the given crypt_str.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (101,26,'CACHE INDEX','Syntax:\nCACHE INDEX\n tbl_index_list [, tbl_index_list] ...\n [PARTITION (partition_list | ALL)]\n IN key_cache_name\n\ntbl_index_list:\n tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]\n\npartition_list:\n partition_name[, partition_name][, ...]\n\nThe CACHE INDEX statement assigns table indexes to a specific key\ncache. It is used only for MyISAM tables. After the indexes have been\nassigned, they can be preloaded into the cache if desired with LOAD\nINDEX INTO CACHE.\n\nThe following statement assigns indexes from the tables t1, t2, and t3\nto the key cache named hot_cache:\n\nmysql> CACHE INDEX t1, t2, t3 IN hot_cache;\n+---------+--------------------+----------+----------+\n| Table | Op | Msg_type | Msg_text |\n+---------+--------------------+----------+----------+\n| test.t1 | assign_to_keycache | status | OK |\n| test.t2 | assign_to_keycache | status | OK |\n| test.t3 | assign_to_keycache | status | OK |\n+---------+--------------------+----------+----------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/cache-index.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/cache-index.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (102,13,'ENDPOINT','EndPoint(ls)\n\nReturns the Point that is the endpoint of the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (103,12,'COMPRESS','Syntax:\nCOMPRESS(string_to_compress)\n\nCompresses a string and returns the result as a binary string. This\nfunction requires MySQL to have been compiled with a compression\nlibrary such as zlib. Otherwise, the return value is always NULL. The\ncompressed string can be uncompressed with UNCOMPRESS().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT LENGTH(COMPRESS(REPEAT(\'a\',1000)));\n -> 21\nmysql> SELECT LENGTH(COMPRESS(\'\'));\n -> 0\nmysql> SELECT LENGTH(COMPRESS(\'a\'));\n -> 13\nmysql> SELECT LENGTH(COMPRESS(REPEAT(\'a\',16)));\n -> 15\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (104,27,'INSERT','Syntax:\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nOr:\n\nINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name\n SET col_name={expr | DEFAULT}, ...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nOr:\n\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE\n col_name=expr\n [, col_name=expr] ... ]\n\nINSERT inserts new rows into an existing table. The INSERT ... VALUES\nand INSERT ... SET forms of the statement insert rows based on\nexplicitly specified values. The INSERT ... SELECT form inserts rows\nselected from another table or tables. INSERT ... SELECT is discussed\nfurther in [HELP INSERT SELECT].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/insert.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/insert.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (105,16,'COUNT','Syntax:\nCOUNT(expr)\n\nReturns a count of the number of non-NULL values of expr in the rows\nretrieved by a SELECT statement. The result is a BIGINT value.\n\nCOUNT() returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT student.student_name,COUNT(*)\n -> FROM student,course\n -> WHERE student.student_id=course.student_id\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (106,27,'HANDLER','Syntax:\nHANDLER tbl_name OPEN [ [AS] alias]\n\nHANDLER tbl_name READ index_name { = | <= | >= | < | > } (value1,value2,...)\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ { FIRST | NEXT }\n [ WHERE where_condition ] [LIMIT ... ]\n\nHANDLER tbl_name CLOSE\n\nThe HANDLER statement provides direct access to table storage engine\ninterfaces. It is available for MyISAM and InnoDB tables.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/handler.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/handler.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (107,3,'MLINEFROMTEXT','MLineFromText(wkt[,srid]), MultiLineStringFromText(wkt[,srid])\n\nConstructs a MULTILINESTRING value using its WKT representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (108,32,'GEOMCOLLFROMWKB','GeomCollFromWKB(wkb[,srid]), GeometryCollectionFromWKB(wkb[,srid])\n\nConstructs a GEOMETRYCOLLECTION value using its WKB representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (109,9,'HELP_DATE','This help information was generated from the MySQL 5.5 Reference Manual\non: 2012-08-25\n','','');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (110,39,'RENAME TABLE','Syntax:\nRENAME TABLE tbl_name TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n\nThis statement renames one or more tables.\n\nThe rename operation is done atomically, which means that no other\nsession can access any of the tables while the rename is running. For\nexample, if you have an existing table old_table, you can create\nanother table new_table that has the same structure but is empty, and\nthen replace the existing table with the empty one as follows (assuming\nthat backup_table does not already exist):\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/rename-table.html\n\n','CREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO old_table;\n','http://dev.mysql.com/doc/refman/5.5/en/rename-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (111,22,'BOOLEAN','BOOL, BOOLEAN\n\nThese types are synonyms for TINYINT(1). A value of zero is considered\nfalse. Nonzero values are considered true:\n\nmysql> SELECT IF(0, \'true\', \'false\');\n+------------------------+\n| IF(0, \'true\', \'false\') |\n+------------------------+\n| false |\n+------------------------+\n\nmysql> SELECT IF(1, \'true\', \'false\');\n+------------------------+\n| IF(1, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n\nmysql> SELECT IF(2, \'true\', \'false\');\n+------------------------+\n| IF(2, \'true\', \'false\') |\n+------------------------+\n| true |\n+------------------------+\n\nHowever, the values TRUE and FALSE are merely aliases for 1 and 0,\nrespectively, as shown here:\n\nmysql> SELECT IF(0 = FALSE, \'true\', \'false\');\n+--------------------------------+\n| IF(0 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| true |\n+--------------------------------+\n\nmysql> SELECT IF(1 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(1 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| true |\n+-------------------------------+\n\nmysql> SELECT IF(2 = TRUE, \'true\', \'false\');\n+-------------------------------+\n| IF(2 = TRUE, \'true\', \'false\') |\n+-------------------------------+\n| false |\n+-------------------------------+\n\nmysql> SELECT IF(2 = FALSE, \'true\', \'false\');\n+--------------------------------+\n| IF(2 = FALSE, \'true\', \'false\') |\n+--------------------------------+\n| false |\n+--------------------------------+\n\nThe last two statements display the results shown because 2 is equal to\nneither 1 nor 0.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (112,14,'DEFAULT','Syntax:\nDEFAULT(col_name)\n\nReturns the default value for a table column. An error results if the\ncolumn has no default value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> UPDATE t SET i = DEFAULT(i)+1 WHERE id < 100;\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (113,4,'MOD','Syntax:\nMOD(N,M), N % M, N MOD M\n\nModulo operation. Returns the remainder of N divided by M.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT MOD(234, 10);\n -> 4\nmysql> SELECT 253 % 7;\n -> 1\nmysql> SELECT MOD(29,9);\n -> 2\nmysql> SELECT 29 MOD 9;\n -> 2\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (114,22,'TINYTEXT','TINYTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 255 (28 - 1) characters. The\neffective maximum length is less if the value contains multi-byte\ncharacters. Each TINYTEXT value is stored using a 1-byte length prefix\nthat indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (115,20,'OPTIMIZE TABLE','Syntax:\nOPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nOPTIMIZE TABLE should be used if you have deleted a large part of a\ntable or if you have made many changes to a table with variable-length\nrows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT columns).\nDeleted rows are maintained in a linked list and subsequent INSERT\noperations reuse old row positions. You can use OPTIMIZE TABLE to\nreclaim the unused space and to defragment the data file. After\nextensive changes to a table, this statement may also improve\nperformance of statements that use the table, sometimes significantly.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nOPTIMIZE TABLE is supported for partitioned tables, and you can use\nALTER TABLE ... OPTIMIZE PARTITION to optimize one or more partitions;\nfor more information, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/optimize-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/optimize-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (116,12,'DECODE','Syntax:\nDECODE(crypt_str,pass_str)\n\nDecrypts the encrypted string crypt_str using pass_str as the password.\ncrypt_str should be a string returned from ENCODE().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (117,18,'<=>','Syntax:\n<=>\n\nNULL-safe equal. This operator performs an equality comparison like the\n= operator, but returns 1 rather than NULL if both operands are NULL,\nand 0 rather than NULL if one operand is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;\n -> 1, 1, 0\nmysql> SELECT 1 = 1, NULL = NULL, 1 = NULL;\n -> 1, NULL, NULL\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (118,28,'HELP STATEMENT','Syntax:\nHELP \'search_string\'\n\nThe HELP statement returns online information from the MySQL Reference\nmanual. Its proper operation requires that the help tables in the mysql\ndatabase be initialized with help topic information (see\nhttp://dev.mysql.com/doc/refman/5.5/en/server-side-help-support.html).\n\nThe HELP statement searches the help tables for the given search string\nand displays the result of the search. The search string is not case\nsensitive.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/help.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/help.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (119,26,'RESET','Syntax:\nRESET reset_option [, reset_option] ...\n\nThe RESET statement is used to clear the state of various server\noperations. You must have the RELOAD privilege to execute RESET.\n\nRESET acts as a stronger version of the FLUSH statement. See [HELP\nFLUSH].\n\nThe RESET statement causes an implicit commit. See\nhttp://dev.mysql.com/doc/refman/5.5/en/implicit-commit.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/reset.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/reset.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (120,14,'GET_LOCK','Syntax:\nGET_LOCK(str,timeout)\n\nTries to obtain a lock with a name given by the string str, using a\ntimeout of timeout seconds. Returns 1 if the lock was obtained\nsuccessfully, 0 if the attempt timed out (for example, because another\nclient has previously locked the name), or NULL if an error occurred\n(such as running out of memory or the thread was killed with mysqladmin\nkill). If you have a lock obtained with GET_LOCK(), it is released when\nyou execute RELEASE_LOCK(), execute a new GET_LOCK(), or your\nconnection terminates (either normally or abnormally). Locks obtained\nwith GET_LOCK() do not interact with transactions. That is, committing\na transaction does not release any such locks obtained during the\ntransaction.\n\nThis function can be used to implement application locks or to simulate\nrecord locks. Names are locked on a server-wide basis. If a name has\nbeen locked by one client, GET_LOCK() blocks any request by another\nclient for a lock with the same name. This enables clients that agree\non a given lock name to use the name to perform cooperative advisory\nlocking. But be aware that it also enables a client that is not among\nthe set of cooperating clients to lock a name, either inadvertently or\ndeliberately, and thus prevent any of the cooperating clients from\nlocking that name. One way to reduce the likelihood of this is to use\nlock names that are database-specific or application-specific. For\nexample, use lock names of the form db_name.str or app_name.str.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> SELECT GET_LOCK(\'lock1\',10);\n -> 1\nmysql> SELECT IS_FREE_LOCK(\'lock2\');\n -> 1\nmysql> SELECT GET_LOCK(\'lock2\',10);\n -> 1\nmysql> SELECT RELEASE_LOCK(\'lock2\');\n -> 1\nmysql> SELECT RELEASE_LOCK(\'lock1\');\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (121,37,'UCASE','Syntax:\nUCASE(str)\n\nUCASE() is a synonym for UPPER().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (122,26,'SHOW BINLOG EVENTS','Syntax:\nSHOW BINLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n\nShows the events in the binary log. If you do not specify \'log_name\',\nthe first binary log is displayed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-binlog-events.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-binlog-events.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (123,32,'MPOLYFROMWKB','MPolyFromWKB(wkb[,srid]), MultiPolygonFromWKB(wkb[,srid])\n\nConstructs a MULTIPOLYGON value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (124,23,'ITERATE','Syntax:\nITERATE label\n\nITERATE can appear only within LOOP, REPEAT, and WHILE statements.\nITERATE means "start the loop again."\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/iterate.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/iterate.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (125,27,'DO','Syntax:\nDO expr [, expr] ...\n\nDO executes the expressions but does not return any results. In most\nrespects, DO is shorthand for SELECT expr, ..., but has the advantage\nthat it is slightly faster when you do not care about the result.\n\nDO is useful primarily with functions that have side effects, such as\nRELEASE_LOCK().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/do.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/do.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (126,31,'CURTIME','Syntax:\nCURTIME()\n\nReturns the current time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu\nformat, depending on whether the function is used in a string or\nnumeric context. The value is expressed in the current time zone.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT CURTIME();\n -> \'23:50:26\'\nmysql> SELECT CURTIME() + 0;\n -> 235026.000000\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (127,37,'CHAR_LENGTH','Syntax:\nCHAR_LENGTH(str)\n\nReturns the length of the string str, measured in characters. A\nmulti-byte character counts as a single character. This means that for\na string containing five 2-byte characters, LENGTH() returns 10,\nwhereas CHAR_LENGTH() returns 5.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (128,22,'BIGINT','BIGINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to 18446744073709551615.\n\nSERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (129,26,'SET','Syntax:\nSET variable_assignment [, variable_assignment] ...\n\nvariable_assignment:\n user_var_name = expr\n | [GLOBAL | SESSION] system_var_name = expr\n | [@@global. | @@session. | @@]system_var_name = expr\n\nThe SET statement assigns values to different types of variables that\naffect the operation of the server or your client. Older versions of\nMySQL employed SET OPTION, but this syntax is deprecated in favor of\nSET without OPTION.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/set-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/set-statement.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (130,27,'LOAD XML','Syntax:\nLOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE [db_name.]tbl_name\n [CHARACTER SET charset_name]\n [ROWS IDENTIFIED BY \'<tagname>\']\n [IGNORE number {LINES | ROWS}]\n [(column_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD XML statement reads data from an XML file into a table. The\nfile_name must be given as a literal string. The tagname in the\noptional ROWS IDENTIFIED BY clause must also be given as a literal\nstring, and must be surrounded by angle brackets (< and >).\n\nLOAD XML acts as the complement of running the mysql client in XML\noutput mode (that is, starting the client with the --xml option). To\nwrite data from a table to an XML file, use a command such as the\nfollowing one from the system shell:\n\nshell> mysql --xml -e \'SELECT * FROM mytable\' > file.xml\n\nTo read the file back into a table, use LOAD XML INFILE. By default,\nthe <row> element is considered to be the equivalent of a database\ntable row; this can be changed using the ROWS IDENTIFIED BY clause.\n\nThis statement supports three different XML formats:\n\no Column names as attributes and column values as attribute values:\n\n<row column1="value1" column2="value2" .../>\n\no Column names as tags and column values as the content of these tags:\n\n<row>\n <column1>value1</column1>\n <column2>value2</column2>\n</row>\n\no Column names are the name attributes of <field> tags, and values are\n the contents of these tags:\n\n<row>\n <field name=\'column1\'>value1</field>\n <field name=\'column2\'>value2</field>\n</row>\n\n This is the format used by other MySQL tools, such as mysqldump.\n\nAll 3 formats can be used in the same XML file; the import routine\nautomatically detects the format for each row and interprets it\ncorrectly. Tags are matched based on the tag or attribute name and the\ncolumn name.\n\nThe following clauses work essentially the same way for LOAD XML as\nthey do for LOAD DATA:\n\no LOW_PRIORITY or CONCURRENT\n\no LOCAL\n\no REPLACE or IGNORE\n\no CHARACTER SET\n\no (column_or_user_var,...)\n\no SET\n\nSee [HELP LOAD DATA], for more information about these clauses.\n\nThe IGNORE number LINES or IGNORE number ROWS clause causes the first\nnumber rows in the XML file to be skipped. It is analogous to the LOAD\nDATA statement\'s IGNORE ... LINES clause.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/load-xml.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/load-xml.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (131,4,'CONV','Syntax:\nCONV(N,from_base,to_base)\n\nConverts numbers between different number bases. Returns a string\nrepresentation of the number N, converted from base from_base to base\nto_base. Returns NULL if any argument is NULL. The argument N is\ninterpreted as an integer, but may be specified as an integer or a\nstring. The minimum base is 2 and the maximum base is 36. If to_base is\na negative number, N is regarded as a signed number. Otherwise, N is\ntreated as unsigned. CONV() works with 64-bit precision.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT CONV(\'a\',16,2);\n -> \'1010\'\nmysql> SELECT CONV(\'6E\',18,8);\n -> \'172\'\nmysql> SELECT CONV(-17,10,-18);\n -> \'-H\'\nmysql> SELECT CONV(10+\'10\'+\'10\'+0xa,10,10);\n -> \'40\'\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (132,22,'DATE','DATE\n\nA date. The supported range is \'1000-01-01\' to \'9999-12-31\'. MySQL\ndisplays DATE values in \'YYYY-MM-DD\' format, but permits assignment of\nvalues to DATE columns using either strings or numbers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (133,15,'ASSIGN-VALUE','Syntax:\n:=\n\nAssignment operator. Causes the user variable on the left hand side of\nthe operator to take on the value to its right. The value on the right\nhand side may be a literal value, another variable storing a value, or\nany legal expression that yields a scalar value, including the result\nof a query (provided that this value is a scalar value). You can\nperform multiple assignments in the same SET statement. You can perform\nmultiple assignments in the same statement-\n\nUnlike =, the := operator is never interpreted as a comparison\noperator. This means you can use := in any valid SQL statement (not\njust in SET statements) to assign a value to a variable.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/assignment-operators.html\n\n','mysql> SELECT @var1, @var2;\n -> NULL, NULL\nmysql> SELECT @var1 := 1, @var2;\n -> 1, NULL\nmysql> SELECT @var1, @var2;\n -> 1, NULL\nmysql> SELECT @var1, @var2 := @var1;\n -> 1, 1\nmysql> SELECT @var1, @var2;\n -> 1, 1\n\nmysql> SELECT @var1:=COUNT(*) FROM t1;\n -> 4\nmysql> SELECT @var1;\n -> 4\n','http://dev.mysql.com/doc/refman/5.5/en/assignment-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (134,26,'SHOW OPEN TABLES','Syntax:\nSHOW OPEN TABLES [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW OPEN TABLES lists the non-TEMPORARY tables that are currently open\nin the table cache. See\nhttp://dev.mysql.com/doc/refman/5.5/en/table-cache.html. The FROM\nclause, if present, restricts the tables shown to those present in the\ndb_name database. The LIKE clause, if present, indicates which table\nnames to match. The WHERE clause can be given to select rows using more\ngeneral conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-open-tables.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-open-tables.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (135,31,'EXTRACT','Syntax:\nEXTRACT(unit FROM date)\n\nThe EXTRACT() function uses the same kinds of unit specifiers as\nDATE_ADD() or DATE_SUB(), but extracts parts from the date rather than\nperforming date arithmetic.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT EXTRACT(YEAR FROM \'2009-07-02\');\n -> 2009\nmysql> SELECT EXTRACT(YEAR_MONTH FROM \'2009-07-02 01:02:03\');\n -> 200907\nmysql> SELECT EXTRACT(DAY_MINUTE FROM \'2009-07-02 01:02:03\');\n -> 20102\nmysql> SELECT EXTRACT(MICROSECOND\n -> FROM \'2003-01-02 10:30:00.000123\');\n -> 123\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,12,'ENCRYPT','Syntax:\nENCRYPT(str[,salt])\n\nEncrypts str using the Unix crypt() system call and returns a binary\nstring. The salt argument must be a string with at least two characters\nor the result will be NULL. If no salt argument is given, a random\nvalue is used.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT ENCRYPT(\'hello\');\n -> \'VxuFAJXVARROc\'\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,26,'SHOW STATUS','Syntax:\nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW STATUS provides server status information. This information also\ncan be obtained using the mysqladmin extended-status command. The LIKE\nclause, if present, indicates which variable names to match. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in http://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\nThis statement does not require any privilege. It requires only the\nability to connect to the server.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern:\n\nmysql> SHOW STATUS LIKE \'Key%\';\n+--------------------+----------+\n| Variable_name | Value |\n+--------------------+----------+\n| Key_blocks_used | 14955 |\n| Key_read_requests | 96854827 |\n| Key_reads | 162040 |\n| Key_write_requests | 7589728 |\n| Key_writes | 3813196 |\n+--------------------+----------+\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for\nall connections to MySQL. With SESSION, it displays the status values\nfor the current connection. If no modifier is present, the default is\nSESSION. LOCAL is a synonym for SESSION.\n\nSome status variables have only a global value. For these, you get the\nsame value for both GLOBAL and SESSION. The scope for each status\nvariable is listed at\nhttp://dev.mysql.com/doc/refman/5.5/en/server-status-variables.html.\n\nEach invocation of the SHOW STATUS statement uses an internal temporary\ntable and increments the global Created_tmp_tables value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-status.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-status.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,37,'EXTRACTVALUE','Syntax:\nExtractValue(xml_frag, xpath_expr)\n\nExtractValue() takes two string arguments, a fragment of XML markup\nxml_frag and an XPath expression xpath_expr (also known as a locator);\nit returns the text (CDATA) of the first text node which is a child of\nthe elements or elements matched by the XPath expression. In MySQL 5.5,\nthe XPath expression can contain at most 127 characters. (This\nlimitation is lifted in MySQL 5.6.)\n\nUsing this function is the equivalent of performing a match using the\nxpath_expr after appending /text(). In other words,\nExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b\') and\nExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b/text()\') produce the same\nresult.\n\nIf multiple matches are found, the content of the first child text node\nof each matching element is returned (in the order matched) as a\nsingle, space-delimited string.\n\nIf no matching text node is found for the expression (including the\nimplicit /text())---for whatever reason, as long as xpath_expr is\nvalid, and xml_frag consists of elements which are properly nested and\nclosed---an empty string is returned. No distinction is made between a\nmatch on an empty element and no match at all. This is by design.\n\nIf you need to determine whether no matching element was found in\nxml_frag or such an element was found but contained no child text\nnodes, you should test the result of an expression that uses the XPath\ncount() function. For example, both of these statements return an empty\nstring, as shown here:\n\nmysql> SELECT ExtractValue(\'<a><b/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue(\'<a><c/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nHowever, you can determine whether there was actually a matching\nelement using the following:\n\nmysql> SELECT ExtractValue(\'<a><b/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 1 |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue(\'<a><c/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 0 |\n+-------------------------------------+\n1 row in set (0.01 sec)\n\n*Important*: ExtractValue() returns only CDATA, and does not return any\ntags that might be contained within a matching tag, nor any of their\ncontent (see the result returned as val1 in the following example).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/xml-functions.html\n\n','mysql> SELECT\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a\') AS val1,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a/b\') AS val2,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'//b\') AS val3,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/b\') AS val4,\n -> ExtractValue(\'<a>ccc<b>ddd</b><b>eee</b></a>\', \'//b\') AS val5;\n\n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\n+------+------+------+------+---------+\n','http://dev.mysql.com/doc/refman/5.5/en/xml-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (139,12,'OLD_PASSWORD','Syntax:\nOLD_PASSWORD(str)\n\nOLD_PASSWORD() was added when the implementation of PASSWORD() was\nchanged in MySQL 4.1 to improve security. OLD_PASSWORD() returns the\nvalue of the pre-4.1 implementation of PASSWORD() as a string, and is\nintended to permit you to reset passwords for any pre-4.1 clients that\nneed to connect to your version 5.5 MySQL server without locking them\nout. See http://dev.mysql.com/doc/refman/5.5/en/password-hashing.html.\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (140,37,'FORMAT','Syntax:\nFORMAT(X,D[,locale])\n\nFormats the number X to a format like \'#,###,###.##\', rounded to D\ndecimal places, and returns the result as a string. If D is 0, the\nresult has no decimal point or fractional part.\n\nThe optional third parameter enables a locale to be specified to be\nused for the result number\'s decimal point, thousands separator, and\ngrouping between separators. Permissible locale values are the same as\nthe legal values for the lc_time_names system variable (see\nhttp://dev.mysql.com/doc/refman/5.5/en/locale-support.html). If no\nlocale is specified, the default is \'en_US\'.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT FORMAT(12332.123456, 4);\n -> \'12,332.1235\'\nmysql> SELECT FORMAT(12332.1,4);\n -> \'12,332.1000\'\nmysql> SELECT FORMAT(12332.2,0);\n -> \'12,332\'\nmysql> SELECT FORMAT(12332.2,2,\'de_DE\');\n -> \'12.332,20\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (141,15,'||','Syntax:\nOR, ||\n\nLogical OR. When both operands are non-NULL, the result is 1 if any\noperand is nonzero, and 0 otherwise. With a NULL operand, the result is\n1 if the other operand is nonzero, and NULL otherwise. If both operands\nare NULL, the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html\n\n','mysql> SELECT 1 || 1;\n -> 1\nmysql> SELECT 1 || 0;\n -> 1\nmysql> SELECT 0 || 0;\n -> 0\nmysql> SELECT 0 || NULL;\n -> NULL\nmysql> SELECT 1 || NULL;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (142,37,'BIT_LENGTH','Syntax:\nBIT_LENGTH(str)\n\nReturns the length of the string str in bits.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT BIT_LENGTH(\'text\');\n -> 32\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (143,2,'EXTERIORRING','ExteriorRing(poly)\n\nReturns the exterior ring of the Polygon value poly as a LineString.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nmysql> SELECT AsText(ExteriorRing(GeomFromText(@poly)));\n+-------------------------------------------+\n| AsText(ExteriorRing(GeomFromText(@poly))) |\n+-------------------------------------------+\n| LINESTRING(0 0,0 3,3 3,3 0,0 0) |\n+-------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (144,32,'GEOMFROMWKB','GeomFromWKB(wkb[,srid]), GeometryFromWKB(wkb[,srid])\n\nConstructs a geometry value of any type using its WKB representation\nand SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (145,26,'SHOW SLAVE HOSTS','Syntax:\nSHOW SLAVE HOSTS\n\nDisplays a list of replication slaves currently registered with the\nmaster. (Before MySQL 5.5.3, only slaves started with the\n--report-host=host_name option are visible in this list.)\n\nThe list is displayed on any server (not just the master server). The\noutput looks like this:\n\nmysql> SHOW SLAVE HOSTS;\n+------------+-----------+------+-----------+\n| Server_id | Host | Port | Master_id |\n+------------+-----------+------+-----------+\n| 192168010 | iconnect2 | 3306 | 192168011 |\n| 1921680101 | athena | 3306 | 192168011 |\n+------------+-----------+------+-----------+\n\no Server_id: The unique server ID of the slave server, as configured in\n the server\'s option file, or on the command line with\n --server-id=value.\n\no Host: The host name of the slave server, as configured in the\n server\'s option file, or on the command line with\n --report-host=host_name. Note that this can differ from the machine\n name as configured in the operating system.\n\no Port: The port the slave server is listening on.\n\n In MySQL 5.5.23 and later, a zero in this column means that the slave\n port (--report-port) was not set. Prior to MySQL 5.5.23, 3306 was\n used as the default in such cases (Bug #13333431).\n\no Master_id: The unique server ID of the master server that the slave\n server is replicating from.\n\nSome MySQL versions report another variable, Rpl_recovery_rank. This\nvariable was never used, and was removed in MySQL 5.5.3. (Bug #13963)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-slave-hosts.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-slave-hosts.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (146,8,'START TRANSACTION','Syntax:\nSTART TRANSACTION [WITH CONSISTENT SNAPSHOT]\nBEGIN [WORK]\nCOMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]\nSET autocommit = {0 | 1}\n\nThese statements provide control over use of transactions:\n\no START TRANSACTION or BEGIN start a new transaction.\n\no COMMIT commits the current transaction, making its changes permanent.\n\no ROLLBACK rolls back the current transaction, canceling its changes.\n\no SET autocommit disables or enables the default autocommit mode for\n the current session.\n\nBy default, MySQL runs with autocommit mode enabled. This means that as\nsoon as you execute a statement that updates (modifies) a table, MySQL\nstores the update on disk to make it permanent. The change cannot be\nrolled back.\n\nTo disable autocommit mode implicitly for a single series of\nstatements, use the START TRANSACTION statement:\n\nSTART TRANSACTION;\nSELECT @A:=SUM(salary) FROM table1 WHERE type=1;\nUPDATE table2 SET summary=@A WHERE type=1;\nCOMMIT;\n\nWith START TRANSACTION, autocommit remains disabled until you end the\ntransaction with COMMIT or ROLLBACK. The autocommit mode then reverts\nto its previous state.\n\nYou can also begin a transaction like this:\n\nSTART TRANSACTION WITH CONSISTENT SNAPSHOT;\n\nThe WITH CONSISTENT SNAPSHOT option starts a consistent read for\nstorage engines that are capable of it. This applies only to InnoDB.\nThe effect is the same as issuing a START TRANSACTION followed by a\nSELECT from any InnoDB table. See\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-consistent-read.html. The\nWITH CONSISTENT SNAPSHOT option does not change the current transaction\nisolation level, so it provides a consistent snapshot only if the\ncurrent isolation level is one that permits consistent read (REPEATABLE\nREAD or SERIALIZABLE).\n\n*Important*: Many APIs used for writing MySQL client applications (such\nas JDBC) provide their own methods for starting transactions that can\n(and sometimes should) be used instead of sending a START TRANSACTION\nstatement from the client. See\nhttp://dev.mysql.com/doc/refman/5.5/en/connectors-apis.html, or the\ndocumentation for your API, for more information.\n\nTo disable autocommit mode explicitly, use the following statement:\n\nSET autocommit=0;\n\nAfter disabling autocommit mode by setting the autocommit variable to\nzero, changes to transaction-safe tables (such as those for InnoDB or\nNDBCLUSTER) are not made permanent immediately. You must use COMMIT to\nstore your changes to disk or ROLLBACK to ignore the changes.\n\nautocommit is a session variable and must be set for each session. To\ndisable autocommit mode for each new connection, see the description of\nthe autocommit system variable at\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nBEGIN and BEGIN WORK are supported as aliases of START TRANSACTION for\ninitiating a transaction. START TRANSACTION is standard SQL syntax and\nis the recommended way to start an ad-hoc transaction.\n\nThe BEGIN statement differs from the use of the BEGIN keyword that\nstarts a BEGIN ... END compound statement. The latter does not begin a\ntransaction. See [HELP BEGIN END].\n\n*Note*: Within all stored programs (stored procedures and functions,\ntriggers, and events), the parser treats BEGIN [WORK] as the beginning\nof a BEGIN ... END block. Begin a transaction in this context with\nSTART TRANSACTION instead.\n\nThe optional WORK keyword is supported for COMMIT and ROLLBACK, as are\nthe CHAIN and RELEASE clauses. CHAIN and RELEASE can be used for\nadditional control over transaction completion. The value of the\ncompletion_type system variable determines the default completion\nbehavior. See\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nThe AND CHAIN clause causes a new transaction to begin as soon as the\ncurrent one ends, and the new transaction has the same isolation level\nas the just-terminated transaction. The RELEASE clause causes the\nserver to disconnect the current client session after terminating the\ncurrent transaction. Including the NO keyword suppresses CHAIN or\nRELEASE completion, which can be useful if the completion_type system\nvariable is set to cause chaining or release completion by default.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/commit.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/commit.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (147,18,'BETWEEN AND','Syntax:\nexpr BETWEEN min AND max\n\nIf expr is greater than or equal to min and expr is less than or equal\nto max, BETWEEN returns 1, otherwise it returns 0. This is equivalent\nto the expression (min <= expr AND expr <= max) if all the arguments\nare of the same type. Otherwise type conversion takes place according\nto the rules described in\nhttp://dev.mysql.com/doc/refman/5.5/en/type-conversion.html, but\napplied to all the three arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 2 BETWEEN 1 AND 3, 2 BETWEEN 3 and 1;\n -> 1, 0\nmysql> SELECT 1 BETWEEN 2 AND 3;\n -> 0\nmysql> SELECT \'b\' BETWEEN \'a\' AND \'c\';\n -> 1\nmysql> SELECT 2 BETWEEN 2 AND \'3\';\n -> 1\nmysql> SELECT 2 BETWEEN 2 AND \'x-3\';\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (148,24,'MULTIPOLYGON','MultiPolygon(poly1,poly2,...)\n\nConstructs a MultiPolygon value from a set of Polygon or WKB Polygon\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (149,31,'TIME_FORMAT','Syntax:\nTIME_FORMAT(time,format)\n\nThis is used like the DATE_FORMAT() function, but the format string may\ncontain format specifiers only for hours, minutes, seconds, and\nmicroseconds. Other specifiers produce a NULL value or 0.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIME_FORMAT(\'100:00:00\', \'%H %k %h %I %l\');\n -> \'100 100 04 04 4\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (150,37,'LEFT','Syntax:\nLEFT(str,len)\n\nReturns the leftmost len characters from the string str, or NULL if any\nargument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT LEFT(\'foobarbar\', 5);\n -> \'fooba\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (151,26,'FLUSH QUERY CACHE','You can defragment the query cache to better utilize its memory with\nthe FLUSH QUERY CACHE statement. The statement does not remove any\nqueries from the cache.\n\nThe RESET QUERY CACHE statement removes all query results from the\nquery cache. The FLUSH TABLES statement also does this.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/query-cache-status-and-maintenance.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/query-cache-status-and-maintenance.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (152,22,'SET DATA TYPE','SET(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA set. A string object that can have zero or more values, each of which\nmust be chosen from the list of values \'value1\', \'value2\', ... A SET\ncolumn can have a maximum of 64 members. SET values are represented\ninternally as integers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (153,4,'RAND','Syntax:\nRAND(), RAND(N)\n\nReturns a random floating-point value v in the range 0 <= v < 1.0. If a\nconstant integer argument N is specified, it is used as the seed value,\nwhich produces a repeatable sequence of column values. In the following\nexample, note that the sequences of values produced by RAND(3) is the\nsame both places where it occurs.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> CREATE TABLE t (i INT);\nQuery OK, 0 rows affected (0.42 sec)\n\nmysql> INSERT INTO t VALUES(1),(2),(3);\nQuery OK, 3 rows affected (0.00 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n\nmysql> SELECT i, RAND() FROM t;\n+------+------------------+\n| i | RAND() |\n+------+------------------+\n| 1 | 0.61914388706828 |\n| 2 | 0.93845168309142 |\n| 3 | 0.83482678498591 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nmysql> SELECT i, RAND(3) FROM t;\n+------+------------------+\n| i | RAND(3) |\n+------+------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.37307905813035 |\n| 3 | 0.14808605345719 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nmysql> SELECT i, RAND() FROM t;\n+------+------------------+\n| i | RAND() |\n+------+------------------+\n| 1 | 0.35877890638893 |\n| 2 | 0.28941420772058 |\n| 3 | 0.37073435016976 |\n+------+------------------+\n3 rows in set (0.00 sec)\n\nmysql> SELECT i, RAND(3) FROM t;\n+------+------------------+\n| i | RAND(3) |\n+------+------------------+\n| 1 | 0.90576975597606 |\n| 2 | 0.37307905813035 |\n| 3 | 0.14808605345719 |\n+------+------------------+\n3 rows in set (0.01 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (154,37,'RPAD','Syntax:\nRPAD(str,len,padstr)\n\nReturns the string str, right-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT RPAD(\'hi\',5,\'?\');\n -> \'hi???\'\nmysql> SELECT RPAD(\'hi\',1,\'?\');\n -> \'h\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (155,39,'CREATE DATABASE','Syntax:\nCREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n [create_specification] ...\n\ncreate_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n\nCREATE DATABASE creates a database with the given name. To use this\nstatement, you need the CREATE privilege for the database. CREATE\nSCHEMA is a synonym for CREATE DATABASE.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-database.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-database.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (156,22,'DEC','DEC[(M[,D])] [UNSIGNED] [ZEROFILL], NUMERIC[(M[,D])] [UNSIGNED]\n[ZEROFILL], FIXED[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nThese types are synonyms for DECIMAL. The FIXED synonym is available\nfor compatibility with other database systems.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (157,16,'VAR_POP','Syntax:\nVAR_POP(expr)\n\nReturns the population standard variance of expr. It considers rows as\nthe whole population, not as a sample, so it has the number of rows as\nthe denominator. You can also use VARIANCE(), which is equivalent but\nis not standard SQL.\n\nVAR_POP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (158,37,'ELT','Syntax:\nELT(N,str1,str2,str3,...)\n\nReturns str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is\nless than 1 or greater than the number of arguments. ELT() is the\ncomplement of FIELD().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT ELT(1, \'ej\', \'Heja\', \'hej\', \'foo\');\n -> \'ej\'\nmysql> SELECT ELT(4, \'ej\', \'Heja\', \'hej\', \'foo\');\n -> \'foo\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (159,39,'ALTER VIEW','Syntax:\nALTER\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n\nThis statement changes the definition of a view, which must exist. The\nsyntax is similar to that for CREATE VIEW and the effect is the same as\nfor CREATE OR REPLACE VIEW. See [HELP CREATE VIEW]. This statement\nrequires the CREATE VIEW and DROP privileges for the view, and some\nprivilege for each column referred to in the SELECT statement. ALTER\nVIEW is permitted only to the definer or users with the SUPER\nprivilege.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-view.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-view.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (160,26,'SHOW DATABASES','Syntax:\nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW DATABASES lists the databases on the MySQL server host. SHOW\nSCHEMAS is a synonym for SHOW DATABASES. The LIKE clause, if present,\nindicates which database names to match. The WHERE clause can be given\nto select rows using more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nYou see only those databases for which you have some kind of privilege,\nunless you have the global SHOW DATABASES privilege. You can also get\nthis list using the mysqlshow command.\n\nIf the server was started with the --skip-show-database option, you\ncannot use this statement at all unless you have the SHOW DATABASES\nprivilege.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-databases.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-databases.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (161,19,'~','Syntax:\n~\n\nInvert all bits.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 5 & ~1;\n -> 4\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (162,22,'TEXT','TEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 65,535 (216 - 1) characters. The\neffective maximum length is less if the value contains multi-byte\ncharacters. Each TEXT value is stored using a 2-byte length prefix that\nindicates the number of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest TEXT type large enough to hold\nvalues M characters long.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (163,37,'CONCAT_WS','Syntax:\nCONCAT_WS(separator,str1,str2,...)\n\nCONCAT_WS() stands for Concatenate With Separator and is a special form\nof CONCAT(). The first argument is the separator for the rest of the\narguments. The separator is added between the strings to be\nconcatenated. The separator can be a string, as can the rest of the\narguments. If the separator is NULL, the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last Name\');\n -> \'First name,Second name,Last Name\'\nmysql> SELECT CONCAT_WS(\',\',\'First name\',NULL,\'Last Name\');\n -> \'First name,Last Name\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (164,17,'ROW_COUNT','Syntax:\nROW_COUNT()\n\nBefore MySQL 5.5.5, ROW_COUNT() returns the number of rows changed,\ndeleted, or inserted by the last statement if it was an UPDATE, DELETE,\nor INSERT. For other statements, the value may not be meaningful.\n\nAs of MySQL 5.5.5, ROW_COUNT() returns a value as follows:\n\no DDL statements: 0. This applies to statements such as CREATE TABLE or\n DROP TABLE.\n\no DML statements other than SELECT: The number of affected rows. This\n applies to statements such as UPDATE, INSERT, or DELETE (as before),\n but now also to statements such as ALTER TABLE and LOAD DATA INFILE.\n\no SELECT: -1 if the statement returns a result set, or the number of\n rows "affected" if it does not. For example, for SELECT * FROM t1,\n ROW_COUNT() returns -1. For SELECT * FROM t1 INTO OUTFILE\n \'file_name\', ROW_COUNT() returns the number of rows written to the\n file.\n\no SIGNAL statements: 0.\n\nFor UPDATE statements, the affected-rows value by default is the number\nof rows actually changed. If you specify the CLIENT_FOUND_ROWS flag to\nmysql_real_connect() when connecting to mysqld, the affected-rows value\nis the number of rows "found"; that is, matched by the WHERE clause.\n\nFor REPLACE statements, the affected-rows value is 2 if the new row\nreplaced an old row, because in this case, one row was inserted after\nthe duplicate was deleted.\n\nFor INSERT ... ON DUPLICATE KEY UPDATE statements, the affected-rows\nvalue is 1 if the row is inserted as a new row and 2 if an existing row\nis updated.\n\nThe ROW_COUNT() value is similar to the value from the\nmysql_affected_rows() C API function and the row count that the mysql\nclient displays following statement execution.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> INSERT INTO t VALUES(1),(2),(3);\nQuery OK, 3 rows affected (0.00 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n\nmysql> SELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n1 row in set (0.00 sec)\n\nmysql> DELETE FROM t WHERE i IN(1,2);\nQuery OK, 2 rows affected (0.00 sec)\n\nmysql> SELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 2 |\n+-------------+\n1 row in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (165,4,'ASIN','Syntax:\nASIN(X)\n\nReturns the arc sine of X, that is, the value whose sine is X. Returns\nNULL if X is not in the range -1 to 1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ASIN(0.2);\n -> 0.20135792079033\nmysql> SELECT ASIN(\'foo\');\n\n+-------------+\n| ASIN(\'foo\') |\n+-------------+\n| 0 |\n+-------------+\n1 row in set, 1 warning (0.00 sec)\n\nmysql> SHOW WARNINGS;\n+---------+------+-----------------------------------------+\n| Level | Code | Message |\n+---------+------+-----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: \'foo\' |\n+---------+------+-----------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (166,4,'SIGN','Syntax:\nSIGN(X)\n\nReturns the sign of the argument as -1, 0, or 1, depending on whether X\nis negative, zero, or positive.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT SIGN(-32);\n -> -1\nmysql> SELECT SIGN(0);\n -> 0\nmysql> SELECT SIGN(234);\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,31,'SEC_TO_TIME','Syntax:\nSEC_TO_TIME(seconds)\n\nReturns the seconds argument, converted to hours, minutes, and seconds,\nas a TIME value. The range of the result is constrained to that of the\nTIME data type. A warning occurs if the argument corresponds to a value\noutside that range.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT SEC_TO_TIME(2378);\n -> \'00:39:38\'\nmysql> SELECT SEC_TO_TIME(2378) + 0;\n -> 3938\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (168,22,'FLOAT','FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA small (single-precision) floating-point number. Permissible values\nare -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to\n3.402823466E+38. These are the theoretical limits, based on the IEEE\nstandard. The actual range might be slightly smaller depending on your\nhardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits permitted by the hardware. A single-precision floating-point\nnumber is accurate to approximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all\ncalculations in MySQL are done with double precision. See\nhttp://dev.mysql.com/doc/refman/5.5/en/no-matching-rows.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (169,37,'LOCATE','Syntax:\nLOCATE(substr,str), LOCATE(substr,str,pos)\n\nThe first syntax returns the position of the first occurrence of\nsubstring substr in string str. The second syntax returns the position\nof the first occurrence of substring substr in string str, starting at\nposition pos. Returns 0 if substr is not in str.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT LOCATE(\'bar\', \'foobarbar\');\n -> 4\nmysql> SELECT LOCATE(\'xbar\', \'foobar\');\n -> 0\nmysql> SELECT LOCATE(\'bar\', \'foobarbar\', 5);\n -> 7\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (170,26,'SHOW EVENTS','Syntax:\nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement displays information about Event Manager events. It\nrequires the EVENT privilege for the database from which the events are\nto be shown.\n\nIn its simplest form, SHOW EVENTS lists all of the events in the\ncurrent schema:\n\nmysql> SELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n1 row in set (0.00 sec)\n\nmysql> SHOW EVENTS\\G\n*************************** 1. row ***************************\n Db: myschema\n Name: e_daily\n Definer: jon@ghidora\n Time zone: SYSTEM\n Type: RECURRING\n Execute at: NULL\n Interval value: 10\n Interval field: SECOND\n Starts: 2006-02-09 10:41:23\n Ends: NULL\n Status: ENABLED\n Originator: 0\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nTo see events for a specific schema, use the FROM clause. For example,\nto see events for the test schema, use the following statement:\n\nSHOW EVENTS FROM test;\n\nThe LIKE clause, if present, indicates which event names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-events.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-events.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (171,17,'CHARSET','Syntax:\nCHARSET(str)\n\nReturns the character set of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT CHARSET(\'abc\');\n -> \'latin1\'\nmysql> SELECT CHARSET(CONVERT(\'abc\' USING utf8));\n -> \'utf8\'\nmysql> SELECT CHARSET(USER());\n -> \'utf8\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (172,31,'SUBDATE','Syntax:\nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument, SUBDATE()\nis a synonym for DATE_SUB(). For information on the INTERVAL unit\nargument, see the discussion for DATE_ADD().\n\nmysql> SELECT DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\nmysql> SELECT SUBDATE(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\n\nThe second form enables the use of an integer value for days. In such\ncases, it is interpreted as the number of days to be subtracted from\nthe date or datetime expression expr.\n\nmysql> SELECT SUBDATE(\'2008-01-02 12:00:00\', 31);\n -> \'2007-12-02 12:00:00\'\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (173,31,'DAYOFYEAR','Syntax:\nDAYOFYEAR(date)\n\nReturns the day of the year for date, in the range 1 to 366.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFYEAR(\'2007-02-03\');\n -> 34\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (174,4,'%','Syntax:\nN % M, N MOD M\n\nModulo operation. Returns the remainder of N divided by M. For more\ninformation, see the description for the MOD() function in\nhttp://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (175,22,'LONGTEXT','LONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 4,294,967,295 or 4GB (232 - 1)\ncharacters. The effective maximum length is less if the value contains\nmulti-byte characters. The effective maximum length of LONGTEXT columns\nalso depends on the configured maximum packet size in the client/server\nprotocol and available memory. Each LONGTEXT value is stored using a\n4-byte length prefix that indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (176,26,'KILL','Syntax:\nKILL [CONNECTION | QUERY] thread_id\n\nEach connection to mysqld runs in a separate thread. You can see which\nthreads are running with the SHOW PROCESSLIST statement and kill a\nthread with the KILL thread_id statement.\n\nKILL permits an optional CONNECTION or QUERY modifier:\n\no KILL CONNECTION is the same as KILL with no modifier: It terminates\n the connection associated with the given thread_id.\n\no KILL QUERY terminates the statement that the connection is currently\n executing, but leaves the connection itself intact.\n\nIf you have the PROCESS privilege, you can see all threads. If you have\nthe SUPER privilege, you can kill all threads and statements.\nOtherwise, you can see and kill only your own threads and statements.\n\nYou can also use the mysqladmin processlist and mysqladmin kill\ncommands to examine and kill threads.\n\n*Note*: You cannot use KILL with the Embedded MySQL Server library\nbecause the embedded server merely runs inside the threads of the host\napplication. It does not create any connection threads of its own.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/kill.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/kill.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (177,30,'DISJOINT','Disjoint(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially disjoint from (does\nnot intersect) g2.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (178,3,'ASTEXT','AsText(g), AsWKT(g)\n\nConverts a value in internal geometry format to its WKT representation\nand returns the string result.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-to-convert-geometries-between-formats.html\n\n','mysql> SET @g = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(GeomFromText(@g));\n+--------------------------+\n| AsText(GeomFromText(@g)) |\n+--------------------------+\n| LINESTRING(1 1,2 2,3 3) |\n+--------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/functions-to-convert-geometries-between-formats.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (179,37,'LPAD','Syntax:\nLPAD(str,len,padstr)\n\nReturns the string str, left-padded with the string padstr to a length\nof len characters. If str is longer than len, the return value is\nshortened to len characters.\n\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT LPAD(\'hi\',4,\'??\');\n -> \'??hi\'\nmysql> SELECT LPAD(\'hi\',1,\'??\');\n -> \'h\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (180,23,'DECLARE CONDITION','Syntax:\nDECLARE condition_name CONDITION FOR condition_value\n\ncondition_value:\n mysql_error_code\n | SQLSTATE [VALUE] sqlstate_value\n\nThe DECLARE ... CONDITION statement declares a named error condition,\nassociating a name with a condition that needs specific handling. The\nname can be referred to in a subsequent DECLARE ... HANDLER statement\n(see [HELP DECLARE HANDLER]).\n\nCondition declarations must appear before cursor or handler\ndeclarations.\n\nThe condition_value for DECLARE ... CONDITION can be a MySQL error code\n(a number) or an SQLSTATE value (a 5-character string literal). You\nshould not use MySQL error code 0 or SQLSTATE values that begin with\n\'00\', because those indicate success rather than an error condition.\nFor a list of MySQL error codes and SQLSTATE values, see\nhttp://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/declare-condition.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/declare-condition.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (181,30,'OVERLAPS','Overlaps(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially overlaps g2. The term\nspatially overlaps is used if two geometries intersect and their\nintersection results in a geometry of the same dimension but not equal\nto either of the given geometries.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (182,8,'SET GLOBAL SQL_SLAVE_SKIP_COUNTER','Syntax:\nSET GLOBAL sql_slave_skip_counter = N\n\nThis statement skips the next N events from the master. This is useful\nfor recovering from replication stops caused by a statement.\n\nThis statement is valid only when the slave threads are not running.\nOtherwise, it produces an error.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/set-global-sql-slave-skip-counter.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/set-global-sql-slave-skip-counter.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (183,25,'NUMGEOMETRIES','NumGeometries(gc)\n\nReturns the number of geometries in the GeometryCollection value gc.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#geometrycollection-property-functions\n\n','mysql> SET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\nmysql> SELECT NumGeometries(GeomFromText(@gc));\n+----------------------------------+\n| NumGeometries(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#geometrycollection-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,31,'MONTHNAME','Syntax:\nMONTHNAME(date)\n\nReturns the full name of the month for date. The language used for the\nname is controlled by the value of the lc_time_names system variable\n(http://dev.mysql.com/doc/refman/5.5/en/locale-support.html).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MONTHNAME(\'2008-02-03\');\n -> \'February\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (185,8,'CHANGE MASTER TO','Syntax:\nCHANGE MASTER TO option [, option] ...\n\noption:\n MASTER_BIND = \'interface_name\'\n | MASTER_HOST = \'host_name\'\n | MASTER_USER = \'user_name\'\n | MASTER_PASSWORD = \'password\'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = interval\n | MASTER_HEARTBEAT_PERIOD = interval\n | MASTER_LOG_FILE = \'master_log_name\'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = \'relay_log_name\'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = \'ca_file_name\'\n | MASTER_SSL_CAPATH = \'ca_directory_name\'\n | MASTER_SSL_CERT = \'cert_file_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n | IGNORE_SERVER_IDS = (server_id_list)\n\nserver_id_list:\n [server_id [, server_id] ... ]\n\nCHANGE MASTER TO changes the parameters that the slave server uses for\nconnecting to the master server, for reading the master binary log, and\nreading the slave relay log. It also updates the contents of the\nmaster.info and relay-log.info files. To use CHANGE MASTER TO, the\nslave replication threads must be stopped (use STOP SLAVE if\nnecessary).\n\nOptions not specified retain their value, except as indicated in the\nfollowing discussion. Thus, in most cases, there is no need to specify\noptions that do not change. For example, if the password to connect to\nyour MySQL master has changed, you just need to issue these statements\nto tell the slave about the new password:\n\nSTOP SLAVE; -- if replication was running\nCHANGE MASTER TO MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE; -- if you want to restart replication\n\nMASTER_HOST, MASTER_USER, MASTER_PASSWORD, and MASTER_PORT provide\ninformation to the slave about how to connect to its master:\n\no MASTER_HOST and MASTER_PORT are the host name (or IP address) of the\n master host and its TCP/IP port.\n\n *Note*: Replication cannot use Unix socket files. You must be able to\n connect to the master MySQL server using TCP/IP.\n\n If you specify the MASTER_HOST or MASTER_PORT option, the slave\n assumes that the master server is different from before (even if the\n option value is the same as its current value.) In this case, the old\n values for the master binary log file name and position are\n considered no longer applicable, so if you do not specify\n MASTER_LOG_FILE and MASTER_LOG_POS in the statement,\n MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4 are silently appended to it.\n\n Setting MASTER_HOST=\'\' (that is, setting its value explicitly to an\n empty string) is not the same as not setting MASTER_HOST at all.\n Beginning with MySQL 5.5, trying to set MASTER_HOST to an empty\n string fails with an error. Previously, setting MASTER_HOST to an\n empty string caused START SLAVE subsequently to fail. (Bug #28796)\n\no MASTER_USER and MASTER_PASSWORD are the user name and password of the\n account to use for connecting to the master.\n\n In MySQL 5.5.20 and later, MASTER_USER cannot be made empty; setting\n MASTER_USER = \'\' or leaving it unset when setting a value for for\n MASTER_PASSWORD causes an error (Bug #13427949).\n\n Currently, a password used for a replication slave account is\n effectively limited to 32 characters in length; the password can be\n longer, but any excess characters are truncated. This is not due to\n any limit imposed by the MySQL Server generally, but rather is an\n issue specific to MySQL Replication. (For more information, see Bug\n #43439.)\n\n The text of a running CHANGE MASTER TO statement, including values\n for MASTER_USER and MASTER_PASSWORD, can be seen in the output of a\n concurrent SHOW PROCESSLIST statement.\n\nThe MASTER_SSL_xxx options provide information about using SSL for the\nconnection. They correspond to the --ssl-xxx options described in\nhttp://dev.mysql.com/doc/refman/5.5/en/ssl-options.html, and\nhttp://dev.mysql.com/doc/refman/5.5/en/replication-solutions-ssl.html.\nThese options can be changed even on slaves that are compiled without\nSSL support. They are saved to the master.info file, but are ignored if\nthe slave does not have SSL support enabled.\n\nMASTER_CONNECT_RETRY specifies how many seconds to wait between connect\nretries. The default is 60. The number of reconnection attempts is\nlimited by the --master-retry-count server option; for more\ninformation, see\nhttp://dev.mysql.com/doc/refman/5.5/en/replication-options.html.\n\nThe MASTER_BIND option is available in MySQL Cluster NDB 7.2 and later,\nbut is not supported in mainline MySQL 5.5.\n\nMASTER_BIND is for use on replication slaves having multiple network\ninterfaces, and determines which of the slave\'s network interfaces is\nchosen for connecting to the master.\n\nMASTER_HEARTBEAT_PERIOD sets the interval in seconds between\nreplication heartbeats. Whenever the master\'s binary log is updated\nwith an event, the waiting period for the next heartbeat is reset.\ninterval is a decimal value having the range 0 to 4294967 seconds and a\nresolution in milliseconds; the smallest nonzero value is 0.001.\nHeartbeats are sent by the master only if there are no unsent events in\nthe binary log file for a period longer than interval.\n\nSetting interval to 0 disables heartbeats altogether. The default value\nfor interval is equal to the value of slave_net_timeout divided by 2.\n\nSetting @@global.slave_net_timeout to a value less than that of the\ncurrent heartbeat interval results in a warning being issued. The\neffect of issuing RESET SLAVE on the heartbeat interval is to reset it\nto the default value.\n\nMASTER_LOG_FILE and MASTER_LOG_POS are the coordinates at which the\nslave I/O thread should begin reading from the master the next time the\nthread starts. RELAY_LOG_FILE and RELAY_LOG_POS are the coordinates at\nwhich the slave SQL thread should begin reading from the relay log the\nnext time the thread starts. If you specify either of MASTER_LOG_FILE\nor MASTER_LOG_POS, you cannot specify RELAY_LOG_FILE or RELAY_LOG_POS.\nIf neither of MASTER_LOG_FILE or MASTER_LOG_POS is specified, the slave\nuses the last coordinates of the slave SQL thread before CHANGE MASTER\nTO was issued. This ensures that there is no discontinuity in\nreplication, even if the slave SQL thread was late compared to the\nslave I/O thread, when you merely want to change, say, the password to\nuse.\n\nCHANGE MASTER TO deletes all relay log files and starts a new one,\nunless you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay\nlog files are kept; the relay_log_purge global variable is set silently\nto 0.\n\nPrior to MySQL 5.5, RELAY_LOG_FILE required an absolute path. In MySQL\n5.5, the path can be relative, in which case the path is assumed to be\nrelative to the slave\'s data directory. (Bug #12190)\n\nIGNORE_SERVER_IDS was added in MySQL 5.5. This option takes a\ncomma-separated list of 0 or more server IDs. Events originating from\nthe corresponding servers are ignored, with the exception of log\nrotation and deletion events, which are still recorded in the relay\nlog.\n\nIn circular replication, the originating server normally acts as the\nterminator of its own events, so that they are not applied more than\nonce. Thus, this option is useful in circular replication when one of\nthe servers in the circle is removed. Suppose that you have a circular\nreplication setup with 4 servers, having server IDs 1, 2, 3, and 4, and\nserver 3 fails. When bridging the gap by starting replication from\nserver 2 to server 4, you can include IGNORE_SERVER_IDS = (3) in the\nCHANGE MASTER TO statement that you issue on server 4 to tell it to use\nserver 2 as its master instead of server 3. Doing so causes it to\nignore and not to propagate any statements that originated with the\nserver that is no longer in use.\n\nIf a CHANGE MASTER TO statement is issued without any IGNORE_SERVER_IDS\noption, any existing list is preserved; RESET SLAVE also has no effect\non the server ID list. To clear the list of ignored servers, it is\nnecessary to use the option with an empty list:\n\nCHANGE MASTER TO IGNORE_SERVER_IDS = ();\n\nIf IGNORE_SERVER_IDS contains the server\'s own ID and the server was\nstarted with the --replicate-same-server-id option enabled, an error\nresults.\n\nAlso beginning with MySQL 5.5, the master.info file and the output of\nSHOW SLAVE STATUS are extended to provide the list of servers that are\ncurrently ignored. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/slave-logs-status.html, and\n[HELP SHOW SLAVE STATUS].\n\nBeginning with MySQL 5.5.5, invoking CHANGE MASTER TO causes the\nprevious values for MASTER_HOST, MASTER_PORT, MASTER_LOG_FILE, and\nMASTER_LOG_POS to be written to the error log, along with other\ninformation about the slave\'s state prior to execution.\n\nCHANGE MASTER TO is useful for setting up a slave when you have the\nsnapshot of the master and have recorded the master binary log\ncoordinates corresponding to the time of the snapshot. After loading\nthe snapshot into the slave to synchronize it to the slave, you can run\nCHANGE MASTER TO MASTER_LOG_FILE=\'log_name\', MASTER_LOG_POS=log_pos on\nthe slave to specify the coordinates at which the slave should begin\nreading the master binary log.\n\nThe following example changes the master server the slave uses and\nestablishes the master binary log coordinates from which the slave\nbegins reading. This is used when you want to set up the slave to\nreplicate the master:\n\nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\n\nThe next example shows an operation that is less frequently employed.\nIt is used when the slave has relay log files that you want it to\nexecute again for some reason. To do this, the master need not be\nreachable. You need only use CHANGE MASTER TO and start the SQL thread\n(START SLAVE SQL_THREAD):\n\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/change-master-to.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/change-master-to.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (186,39,'DROP DATABASE','Syntax:\nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n\nDROP DATABASE drops all tables in the database and deletes the\ndatabase. Be very careful with this statement! To use DROP DATABASE,\nyou need the DROP privilege on the database. DROP SCHEMA is a synonym\nfor DROP DATABASE.\n\n*Important*: When a database is dropped, user privileges on the\ndatabase are not automatically dropped. See [HELP GRANT].\n\nIF EXISTS is used to prevent an error from occurring if the database\ndoes not exist.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-database.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-database.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (187,6,'MBREQUAL','MBREqual(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are the same.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (188,31,'TIMESTAMP FUNCTION','Syntax:\nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n\nWith a single argument, this function returns the date or datetime\nexpression expr as a datetime value. With two arguments, it adds the\ntime expression expr2 to the date or datetime expression expr1 and\nreturns the result as a datetime value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMP(\'2003-12-31\');\n -> \'2003-12-31 00:00:00\'\nmysql> SELECT TIMESTAMP(\'2003-12-31 12:00:00\',\'12:00:00\');\n -> \'2004-01-01 00:00:00\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (189,33,'PROCEDURE ANALYSE','Syntax:\nANALYSE([max_elements[,max_memory]])\n\nANALYSE() examines the result from a query and returns an analysis of\nthe results that suggests optimal data types for each column that may\nhelp reduce table sizes. To obtain this analysis, append PROCEDURE\nANALYSE to the end of a SELECT statement:\n\nSELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,[max_memory]])\n\nFor example:\n\nSELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);\n\nThe results show some statistics for the values returned by the query,\nand propose an optimal data type for the columns. This can be helpful\nfor checking your existing tables, or after importing new data. You may\nneed to try different settings for the arguments so that PROCEDURE\nANALYSE() does not suggest the ENUM data type when it is not\nappropriate.\n\nThe arguments are optional and are used as follows:\n\no max_elements (default 256) is the maximum number of distinct values\n that ANALYSE() notices per column. This is used by ANALYSE() to check\n whether the optimal data type should be of type ENUM; if there are\n more than max_elements distinct values, then ENUM is not a suggested\n type.\n\no max_memory (default 8192) is the maximum amount of memory that\n ANALYSE() should allocate per column while trying to find all\n distinct values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/procedure-analyse.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/procedure-analyse.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (190,9,'HELP_VERSION','This help information was generated from the MySQL 5.5 Reference Manual\non: 2012-08-25 (revision: 31914)\n\nThis information applies to MySQL 5.5 through 5.5.29.\n','','');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (191,37,'CHARACTER_LENGTH','Syntax:\nCHARACTER_LENGTH(str)\n\nCHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (192,26,'SHOW GRANTS','Syntax:\nSHOW GRANTS [FOR user]\n\nThis statement lists the GRANT statement or statements that must be\nissued to duplicate the privileges that are granted to a MySQL user\naccount. The account is named using the same format as for the GRANT\nstatement; for example, \'jeffrey\'@\'localhost\'. If you specify only the\nuser name part of the account name, a host name part of \'%\' is used.\nFor additional information about specifying account names, see [HELP\nGRANT].\n\nmysql> SHOW GRANTS FOR \'root\'@\'localhost\';\n+---------------------------------------------------------------------+\n| Grants for root@localhost |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION |\n+---------------------------------------------------------------------+\n\nTo list the privileges granted to the account that you are using to\nconnect to the server, you can use any of the following statements:\n\nSHOW GRANTS;\nSHOW GRANTS FOR CURRENT_USER;\nSHOW GRANTS FOR CURRENT_USER();\n\nIf SHOW GRANTS FOR CURRENT_USER (or any of the equivalent syntaxes) is\nused in DEFINER context, such as within a stored procedure that is\ndefined with SQL SECURITY DEFINER), the grants displayed are those of\nthe definer and not the invoker.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-grants.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-grants.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (193,26,'SHOW PRIVILEGES','Syntax:\nSHOW PRIVILEGES\n\nSHOW PRIVILEGES shows the list of system privileges that the MySQL\nserver supports. The exact list of privileges depends on the version of\nyour server.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-privileges.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-privileges.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (194,39,'CREATE TABLESPACE','Syntax:\nCREATE TABLESPACE tablespace_name\n ADD DATAFILE \'file_name\'\n USE LOGFILE GROUP logfile_group\n [EXTENT_SIZE [=] extent_size]\n [INITIAL_SIZE [=] initial_size]\n [AUTOEXTEND_SIZE [=] autoextend_size]\n [MAX_SIZE [=] max_size]\n [NODEGROUP [=] nodegroup_id]\n [WAIT]\n [COMMENT [=] comment_text]\n ENGINE [=] engine_name\n\nThis statement is used to create a tablespace, which can contain one or\nmore data files, providing storage space for tables. One data file is\ncreated and added to the tablespace using this statement. Additional\ndata files may be added to the tablespace by using the ALTER TABLESPACE\nstatement (see [HELP ALTER TABLESPACE]). For rules covering the naming\nof tablespaces, see\nhttp://dev.mysql.com/doc/refman/5.5/en/identifiers.html.\n\n*Note*: All MySQL Cluster Disk Data objects share the same namespace.\nThis means that each Disk Data object must be uniquely named (and not\nmerely each Disk Data object of a given type). For example, you cannot\nhave a tablespace and a log file group with the same name, or a\ntablespace and a data file with the same name.\n\nA log file group of one or more UNDO log files must be assigned to the\ntablespace to be created with the USE LOGFILE GROUP clause.\nlogfile_group must be an existing log file group created with CREATE\nLOGFILE GROUP (see\nhttp://dev.mysql.com/doc/refman/5.5/en/create-logfile-group.html).\nMultiple tablespaces may use the same log file group for UNDO logging.\n\nThe EXTENT_SIZE sets the size, in bytes, of the extents used by any\nfiles belonging to the tablespace. The default value is 1M. The minimum\nsize is 32K, and theoretical maximum is 2G, although the practical\nmaximum size depends on a number of factors. In most cases, changing\nthe extent size does not have any measurable effect on performance, and\nthe default value is recommended for all but the most unusual\nsituations.\n\nAn extent is a unit of disk space allocation. One extent is filled with\nas much data as that extent can contain before another extent is used.\nIn theory, up to 65,535 (64K) extents may used per data file; however,\nthe recommended maximum is 32,768 (32K). The recommended maximum size\nfor a single data file is 32G---that is, 32K extents x 1 MB per extent.\nIn addition, once an extent is allocated to a given partition, it\ncannot be used to store data from a different partition; an extent\ncannot store data from more than one partition. This means, for example\nthat a tablespace having a single datafile whose INITIAL_SIZE is 256 MB\nand whose EXTENT_SIZE is 128M has just two extents, and so can be used\nto store data from at most two different disk data table partitions.\n\nYou can see how many extents remain free in a given data file by\nquerying the INFORMATION_SCHEMA.FILES table, and so derive an estimate\nfor how much space remains free in the file. For further discussion and\nexamples, see http://dev.mysql.com/doc/refman/5.5/en/files-table.html.\n\nThe INITIAL_SIZE parameter sets the data file\'s total size in bytes.\nOnce the file has been created, its size cannot be changed; however,\nyou can add more data files to the tablespace using ALTER TABLESPACE\n... ADD DATAFILE. See [HELP ALTER TABLESPACE].\n\nINITIAL_SIZE is optional; its default value is 128M.\n\nOn 32-bit systems, the maximum supported value for INITIAL_SIZE is 4G.\n(Bug #29186)\n\nWhen setting EXTENT_SIZE or INITIAL_SIZE (either or both), you may\noptionally follow the number with a one-letter abbreviation for an\norder of magnitude, similar to those used in my.cnf. Generally, this is\none of the letters M (for megabytes) or G (for gigabytes).\n\nINITIAL_SIZE, EXTENT_SIZE, and UNDO_BUFFER_SIZE are subject to rounding\nas follows:\n\no EXTENT_SIZE and UNDO_BUFFER_SIZE are each rounded up to the nearest\n whole multiple of 32K.\n\no INITIAL_SIZE is rounded down to the nearest whole multiple of 32K.\n\n For data files, INITIAL_SIZE is subject to further rounding; the\n result just obtained is rounded up to the nearest whole multiple of\n EXTENT_SIZE (after any rounding).\n\nThe rounding just described is done explicitly, and a warning is issued\nby the MySQL Server when any such rounding is performed. The rounded\nvalues are also used by the NDB kernel for calculating\nINFORMATION_SCHEMA.FILES column values and other purposes. However, to\navoid an unexpected result, we suggest that you always use whole\nmultiples of 32K in specifying these options.\n\nAUTOEXTEND_SIZE, MAX_SIZE, NODEGROUP, WAIT, and COMMENT are parsed but\nignored, and so currently have no effect. These options are intended\nfor future expansion.\n\nThe ENGINE parameter determines the storage engine which uses this\ntablespace, with engine_name being the name of the storage engine.\nCurrently, engine_name must be one of the values NDB or NDBCLUSTER.\n\nWhen CREATE TABLESPACE is used with ENGINE = NDB, a tablespace and\nassociated data file are created on each Cluster data node. You can\nverify that the data files were created and obtain information about\nthem by querying the INFORMATION_SCHEMA.FILES table. For example:\n\nmysql> SELECT LOGFILE_GROUP_NAME, FILE_NAME, EXTRA\n -> FROM INFORMATION_SCHEMA.FILES\n -> WHERE TABLESPACE_NAME = \'newts\' AND FILE_TYPE = \'DATAFILE\';\n+--------------------+-------------+----------------+\n| LOGFILE_GROUP_NAME | FILE_NAME | EXTRA |\n+--------------------+-------------+----------------+\n| lg_3 | newdata.dat | CLUSTER_NODE=3 |\n| lg_3 | newdata.dat | CLUSTER_NODE=4 |\n+--------------------+-------------+----------------+\n2 rows in set (0.01 sec)\n\n(See http://dev.mysql.com/doc/refman/5.5/en/files-table.html.)\n\nCREATE TABLESPACE is useful only with Disk Data storage for MySQL\nCluster. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-disk-data.html.\n\nTo drop a primary key, the index name is always PRIMARY, which must be\nspecified as a quoted identifier because PRIMARY is a reserved word:\n\nDROP INDEX `PRIMARY` ON t;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-tablespace.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-tablespace.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (195,37,'INSERT FUNCTION','Syntax:\nINSERT(str,pos,len,newstr)\n\nReturns the string str, with the substring beginning at position pos\nand len characters long replaced by the string newstr. Returns the\noriginal string if pos is not within the length of the string. Replaces\nthe rest of the string from position pos if len is not within the\nlength of the rest of the string. Returns NULL if any argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT INSERT(\'Quadratic\', 3, 4, \'What\');\n -> \'QuWhattic\'\nmysql> SELECT INSERT(\'Quadratic\', -1, 4, \'What\');\n -> \'Quadratic\'\nmysql> SELECT INSERT(\'Quadratic\', 3, 100, \'What\');\n -> \'QuWhat\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (196,4,'CRC32','Syntax:\nCRC32(expr)\n\nComputes a cyclic redundancy check value and returns a 32-bit unsigned\nvalue. The result is NULL if the argument is NULL. The argument is\nexpected to be a string and (if possible) is treated as one if it is\nnot.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT CRC32(\'MySQL\');\n -> 3259397556\nmysql> SELECT CRC32(\'mysql\');\n -> 2501908538\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (197,15,'XOR','Syntax:\nXOR\n\nLogical XOR. Returns NULL if either operand is NULL. For non-NULL\noperands, evaluates to 1 if an odd number of operands is nonzero,\notherwise 0 is returned.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html\n\n','mysql> SELECT 1 XOR 1;\n -> 0\nmysql> SELECT 1 XOR 0;\n -> 1\nmysql> SELECT 1 XOR NULL;\n -> NULL\nmysql> SELECT 1 XOR 1 XOR 1;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (198,13,'STARTPOINT','StartPoint(ls)\n\nReturns the Point that is the start point of the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(StartPoint(GeomFromText(@ls)));\n+---------------------------------------+\n| AsText(StartPoint(GeomFromText(@ls))) |\n+---------------------------------------+\n| POINT(1 1) |\n+---------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (199,10,'GRANT','Syntax:\nGRANT\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n TO user_specification [, user_specification] ...\n [REQUIRE {NONE | ssl_option [[AND] ssl_option] ...}]\n [WITH with_option ...]\n\nGRANT PROXY ON user_specification\n TO user_specification [, user_specification] ...\n [WITH GRANT OPTION]\n\nobject_type:\n TABLE\n | FUNCTION\n | PROCEDURE\n\npriv_level:\n *\n | *.*\n | db_name.*\n | db_name.tbl_name\n | tbl_name\n | db_name.routine_name\n\nuser_specification:\n user\n [\n IDENTIFIED BY [PASSWORD] \'password\'\n | IDENTIFIED WITH auth_plugin [AS \'auth_string\']\n ]\n\nssl_option:\n SSL\n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n\nwith_option:\n GRANT OPTION\n | MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n\nThe GRANT statement grants privileges to MySQL user accounts. GRANT\nalso serves to specify other account characteristics such as use of\nsecure connections and limits on access to server resources. To use\nGRANT, you must have the GRANT OPTION privilege, and you must have the\nprivileges that you are granting.\n\nNormally, a database administrator first uses CREATE USER to create an\naccount, then GRANT to define its privileges and characteristics. For\nexample:\n\nCREATE USER \'jeffrey\'@\'localhost\' IDENTIFIED BY \'mypass\';\nGRANT ALL ON db1.* TO \'jeffrey\'@\'localhost\';\nGRANT SELECT ON db2.invoice TO \'jeffrey\'@\'localhost\';\nGRANT USAGE ON *.* TO \'jeffrey\'@\'localhost\' WITH MAX_QUERIES_PER_HOUR 90;\n\nHowever, if an account named in a GRANT statement does not already\nexist, GRANT may create it under the conditions described later in the\ndiscussion of the NO_AUTO_CREATE_USER SQL mode.\n\nThe REVOKE statement is related to GRANT and enables administrators to\nremove account privileges. See [HELP REVOKE].\n\nWhen successfully executed from the mysql program, GRANT responds with\nQuery OK, 0 rows affected. To determine what privileges result from the\noperation, use SHOW GRANTS. See [HELP SHOW GRANTS].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/grant.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/grant.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (200,23,'DECLARE VARIABLE','Syntax:\nDECLARE var_name [, var_name] ... type [DEFAULT value]\n\nThis statement declares local variables within stored programs. To\nprovide a default value for a variable, include a DEFAULT clause. The\nvalue can be specified as an expression; it need not be a constant. If\nthe DEFAULT clause is missing, the initial value is NULL.\n\nLocal variables are treated like stored routine parameters with respect\nto data type and overflow checking. See [HELP CREATE PROCEDURE].\n\nVariable declarations must appear before cursor or handler\ndeclarations.\n\nLocal variable names are not case sensitive. Permissible characters and\nquoting rules are the same as for other identifiers, as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/identifiers.html.\n\nThe scope of a local variable is the BEGIN ... END block within which\nit is declared. The variable can be referred to in blocks nested within\nthe declaring block, except those blocks that declare a variable with\nthe same name.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/declare-local-variable.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/declare-local-variable.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (201,3,'MPOLYFROMTEXT','MPolyFromText(wkt[,srid]), MultiPolygonFromText(wkt[,srid])\n\nConstructs a MULTIPOLYGON value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (202,6,'MBRINTERSECTS','MBRIntersects(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 intersect.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (203,16,'BIT_OR','Syntax:\nBIT_OR(expr)\n\nReturns the bitwise OR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (204,31,'YEARWEEK','Syntax:\nYEARWEEK(date), YEARWEEK(date,mode)\n\nReturns year and week for a date. The mode argument works exactly like\nthe mode argument to WEEK(). The year in the result may be different\nfrom the year in the date argument for the first and the last week of\nthe year.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT YEARWEEK(\'1987-01-01\');\n -> 198653\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (205,18,'NOT BETWEEN','Syntax:\nexpr NOT BETWEEN min AND max\n\nThis is the same as NOT (expr BETWEEN min AND max).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (206,18,'IS NOT','Syntax:\nIS NOT boolean_value\n\nTests a value against a boolean value, where boolean_value can be TRUE,\nFALSE, or UNKNOWN.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT UNKNOWN;\n -> 1, 1, 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (207,4,'LOG10','Syntax:\nLOG10(X)\n\nReturns the base-10 logarithm of X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT LOG10(2);\n -> 0.30102999566398\nmysql> SELECT LOG10(100);\n -> 2\nmysql> SELECT LOG10(-100);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (208,4,'SQRT','Syntax:\nSQRT(X)\n\nReturns the square root of a nonnegative number X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT SQRT(4);\n -> 2\nmysql> SELECT SQRT(20);\n -> 4.4721359549996\nmysql> SELECT SQRT(-16);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (209,22,'DECIMAL','DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nA packed "exact" fixed-point number. M is the total number of digits\n(the precision) and D is the number of digits after the decimal point\n(the scale). The decimal point and (for negative numbers) the "-" sign\nare not counted in M. If D is 0, values have no decimal point or\nfractional part. The maximum number of digits (M) for DECIMAL is 65.\nThe maximum number of supported decimals (D) is 30. If D is omitted,\nthe default is 0. If M is omitted, the default is 10.\n\nUNSIGNED, if specified, disallows negative values.\n\nAll basic calculations (+, -, *, /) with DECIMAL columns are done with\na precision of 65 digits.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (210,39,'CREATE INDEX','Syntax:\nCREATE [ONLINE|OFFLINE] [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name\n [index_type]\n ON tbl_name (index_col_name,...)\n [index_option] ...\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n\nCREATE INDEX is mapped to an ALTER TABLE statement to create indexes.\nSee [HELP ALTER TABLE]. CREATE INDEX cannot be used to create a PRIMARY\nKEY; use ALTER TABLE instead. For more information about indexes, see\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-indexes.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-index.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-index.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (211,39,'CREATE FUNCTION','The CREATE FUNCTION statement is used to create stored functions and\nuser-defined functions (UDFs):\n\no For information about creating stored functions, see [HELP CREATE\n PROCEDURE].\n\no For information about creating user-defined functions, see [HELP\n CREATE FUNCTION UDF].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-function.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-function.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (212,39,'ALTER DATABASE','Syntax:\nALTER {DATABASE | SCHEMA} [db_name]\n alter_specification ...\nALTER {DATABASE | SCHEMA} db_name\n UPGRADE DATA DIRECTORY NAME\n\nalter_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n\nALTER DATABASE enables you to change the overall characteristics of a\ndatabase. These characteristics are stored in the db.opt file in the\ndatabase directory. To use ALTER DATABASE, you need the ALTER privilege\non the database. ALTER SCHEMA is a synonym for ALTER DATABASE.\n\nThe database name can be omitted from the first syntax, in which case\nthe statement applies to the default database.\n\nNational Language Characteristics\n\nThe CHARACTER SET clause changes the default database character set.\nThe COLLATE clause changes the default database collation.\nhttp://dev.mysql.com/doc/refman/5.5/en/charset.html, discusses\ncharacter set and collation names.\n\nYou can see what character sets and collations are available using,\nrespectively, the SHOW CHARACTER SET and SHOW COLLATION statements. See\n[HELP SHOW CHARACTER SET], and [HELP SHOW COLLATION], for more\ninformation.\n\nIf you change the default character set or collation for a database,\nstored routines that use the database defaults must be dropped and\nrecreated so that they use the new defaults. (In a stored routine,\nvariables with character data types use the database defaults if the\ncharacter set or collation are not specified explicitly. See [HELP\nCREATE PROCEDURE].)\n\nUpgrading from Versions Older than MySQL 5.1\n\nThe syntax that includes the UPGRADE DATA DIRECTORY NAME clause updates\nthe name of the directory associated with the database to use the\nencoding implemented in MySQL 5.1 for mapping database names to\ndatabase directory names (see\nhttp://dev.mysql.com/doc/refman/5.5/en/identifier-mapping.html). This\nclause is for use under these conditions:\n\no It is intended when upgrading MySQL to 5.1 or later from older\n versions.\n\no It is intended to update a database directory name to the current\n encoding format if the name contains special characters that need\n encoding.\n\no The statement is used by mysqlcheck (as invoked by mysql_upgrade).\n\nFor example, if a database in MySQL 5.0 has the name a-b-c, the name\ncontains instances of the - (dash) character. In MySQL 5.0, the\ndatabase directory is also named a-b-c, which is not necessarily safe\nfor all file systems. In MySQL 5.1 and later, the same database name is\nencoded as a@002db@002dc to produce a file system-neutral directory\nname.\n\nWhen a MySQL installation is upgraded to MySQL 5.1 or later from an\nolder version,the server displays a name such as a-b-c (which is in the\nold format) as #mysql50#a-b-c, and you must refer to the name using the\n#mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME in this case to\nexplicitly tell the server to re-encode the database directory name to\nthe current encoding format:\n\nALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;\n\nAfter executing this statement, you can refer to the database as a-b-c\nwithout the special #mysql50# prefix.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-database.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-database.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (213,25,'GEOMETRYN','GeometryN(gc,N)\n\nReturns the N-th geometry in the GeometryCollection value gc.\nGeometries are numbered beginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#geometrycollection-property-functions\n\n','mysql> SET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\nmysql> SELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\n+----------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#geometrycollection-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (214,19,'<<','Syntax:\n<<\n\nShifts a longlong (BIGINT) number to the left.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 1 << 2;\n -> 4\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (215,26,'SHOW TABLE STATUS','Syntax:\nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TABLE STATUS works likes SHOW TABLES, but provides a lot of\ninformation about each non-TEMPORARY table. You can also get this list\nusing the mysqlshow --status db_name command. The LIKE clause, if\npresent, indicates which table names to match. The WHERE clause can be\ngiven to select rows using more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-table-status.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-table-status.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (216,12,'MD5','Syntax:\nMD5(str)\n\nCalculates an MD5 128-bit checksum for the string. The value is\nreturned as a string of 32 hex digits, or NULL if the argument was\nNULL. The return value can, for example, be used as a hash key. See the\nnotes at the beginning of this section about storing hash values\nefficiently.\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring; see the notes at the beginning of this section about using the\nvalue as a nonbinary string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT MD5(\'testing\');\n -> \'ae2b1fca515949e5d54fb22b8ed95575\'\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (217,18,'<','Syntax:\n<\n\nLess than:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 2 < 2;\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (218,31,'UNIX_TIMESTAMP','Syntax:\nUNIX_TIMESTAMP(), UNIX_TIMESTAMP(date)\n\nIf called with no argument, returns a Unix timestamp (seconds since\n\'1970-01-01 00:00:00\' UTC) as an unsigned integer. If UNIX_TIMESTAMP()\nis called with a date argument, it returns the value of the argument as\nseconds since \'1970-01-01 00:00:00\' UTC. date may be a DATE string, a\nDATETIME string, a TIMESTAMP, or a number in the format YYMMDD or\nYYYYMMDD. The server interprets date as a value in the current time\nzone and converts it to an internal value in UTC. Clients can set their\ntime zone as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT UNIX_TIMESTAMP();\n -> 1196440210\nmysql> SELECT UNIX_TIMESTAMP(\'2007-11-30 10:30:19\');\n -> 1196440219\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (219,31,'DAYOFMONTH','Syntax:\nDAYOFMONTH(date)\n\nReturns the day of the month for date, in the range 1 to 31, or 0 for\ndates such as \'0000-00-00\' or \'2008-00-00\' that have a zero day part.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFMONTH(\'2007-02-03\');\n -> 3\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (220,37,'ASCII','Syntax:\nASCII(str)\n\nReturns the numeric value of the leftmost character of the string str.\nReturns 0 if str is the empty string. Returns NULL if str is NULL.\nASCII() works for 8-bit characters.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT ASCII(\'2\');\n -> 50\nmysql> SELECT ASCII(2);\n -> 50\nmysql> SELECT ASCII(\'dx\');\n -> 100\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (221,4,'DIV','Syntax:\nDIV\n\nInteger division. Similar to FLOOR(), but is safe with BIGINT values.\n\nAs of MySQL 5.5.3, if either operand has a noninteger type, the\noperands are converted to DECIMAL and divided using DECIMAL arithmetic\nbefore converting the result to BIGINT. If the result exceeds BIGINT\nrange, an error occurs. Before MySQL 5.5.3, incorrect results may occur\nfor noninteger operands that exceed BIGINT range.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT 5 DIV 2;\n -> 2\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (222,10,'RENAME USER','Syntax:\nRENAME USER old_user TO new_user\n [, old_user TO new_user] ...\n\nThe RENAME USER statement renames existing MySQL accounts. To use it,\nyou must have the global CREATE USER privilege or the UPDATE privilege\nfor the mysql database. An error occurs if any old account does not\nexist or any new account exists. Each account name uses the format\ndescribed in http://dev.mysql.com/doc/refman/5.5/en/account-names.html.\nFor example:\n\nRENAME USER \'jeffrey\'@\'localhost\' TO \'jeff\'@\'127.0.0.1\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nRENAME USER causes the privileges held by the old user to be those held\nby the new user. However, RENAME USER does not automatically drop or\ninvalidate databases or objects within them that the old user created.\nThis includes stored programs or views for which the DEFINER attribute\nnames the old user. Attempts to access such objects may produce an\nerror if they execute in definer security context. (For information\nabout security context, see\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-security.html.)\n\nThe privilege changes take effect as indicated in\nhttp://dev.mysql.com/doc/refman/5.5/en/privilege-changes.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/rename-user.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/rename-user.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (223,26,'SHOW SLAVE STATUS','Syntax:\nSHOW SLAVE STATUS\n\nThis statement provides status information on essential parameters of\nthe slave threads. It requires either the SUPER or REPLICATION CLIENT\nprivilege.\n\nIf you issue this statement using the mysql client, you can use a \\G\nstatement terminator rather than a semicolon to obtain a more readable\nvertical layout:\n\nmysql> SHOW SLAVE STATUS\\G\n*************************** 1. row ***************************\n Slave_IO_State: Waiting for master to send event\n Master_Host: localhost\n Master_User: root\n Master_Port: 3306\n Connect_Retry: 3\n Master_Log_File: gbichot-bin.005\n Read_Master_Log_Pos: 79\n Relay_Log_File: gbichot-relay-bin.005\n Relay_Log_Pos: 548\n Relay_Master_Log_File: gbichot-bin.005\n Slave_IO_Running: Yes\n Slave_SQL_Running: Yes\n Replicate_Do_DB:\n Replicate_Ignore_DB:\n Replicate_Do_Table:\n Replicate_Ignore_Table:\n Replicate_Wild_Do_Table:\n Replicate_Wild_Ignore_Table:\n Last_Errno: 0\n Last_Error:\n Skip_Counter: 0\n Exec_Master_Log_Pos: 79\n Relay_Log_Space: 552\n Until_Condition: None\n Until_Log_File:\n Until_Log_Pos: 0\n Master_SSL_Allowed: No\n Master_SSL_CA_File:\n Master_SSL_CA_Path:\n Master_SSL_Cert:\n Master_SSL_Cipher:\n Master_SSL_Key:\n Seconds_Behind_Master: 8\nMaster_SSL_Verify_Server_Cert: No\n Last_IO_Errno: 0\n Last_IO_Error:\n Last_SQL_Errno: 0\n Last_SQL_Error:\n Replicate_Ignore_Server_Ids: 0\n Master_Server_Id: 1\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-slave-status.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-slave-status.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (224,34,'GEOMETRY','MySQL provides a standard way of creating spatial columns for geometry\ntypes, for example, with CREATE TABLE or ALTER TABLE. Currently,\nspatial columns are supported for MyISAM, InnoDB, NDB, and ARCHIVE\ntables. See also the annotations about spatial indexes under [HELP\nSPATIAL].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-columns.html\n\n','CREATE TABLE geom (g GEOMETRY);\n','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-columns.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (225,13,'NUMPOINTS','NumPoints(ls)\n\nReturns the number of Point objects in the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (226,39,'ALTER LOGFILE GROUP','Syntax:\nALTER LOGFILE GROUP logfile_group\n ADD UNDOFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n\nThis statement adds an UNDO file named \'file_name\' to an existing log\nfile group logfile_group. An ALTER LOGFILE GROUP statement has one and\nonly one ADD UNDOFILE clause. No DROP UNDOFILE clause is currently\nsupported.\n\n*Note*: All MySQL Cluster Disk Data objects share the same namespace.\nThis means that each Disk Data object must be uniquely named (and not\nmerely each Disk Data object of a given type). For example, you cannot\nhave a tablespace and an undo log file with the same name, or an undo\nlog file and a data file with the same name.\n\nThe optional INITIAL_SIZE parameter sets the UNDO file\'s initial size\nin bytes; if not specified, the initial size default to 128M (128\nmegabytes). You may optionally follow size with a one-letter\nabbreviation for an order of magnitude, similar to those used in\nmy.cnf. Generally, this is one of the letters M (for megabytes) or G\n(for gigabytes).\n\nOn 32-bit systems, the maximum supported value for INITIAL_SIZE is 4G.\n(Bug #29186)\n\nThe minimum permitted value for INITIAL_SIZE is 1M. (Bug #29574)\n\n*Note*: WAIT is parsed but otherwise ignored. This keyword currently\nhas no effect, and is intended for future expansion.\n\nThe ENGINE parameter (required) determines the storage engine which is\nused by this log file group, with engine_name being the name of the\nstorage engine. Currently, the only accepted values for engine_name are\n"NDBCLUSTER" and "NDB". The two values are equivalent.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-logfile-group.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-logfile-group.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (227,19,'&','Syntax:\n&\n\nBitwise AND:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 29 & 15;\n -> 13\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (228,31,'LOCALTIMESTAMP','Syntax:\nLOCALTIMESTAMP, LOCALTIMESTAMP()\n\nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (229,15,'ASSIGN-EQUAL','Syntax:\n=\n\nThis operator is used to perform value assignments in two cases,\ndescribed in the next two paragraphs.\n\nWithin a SET statement, = is treated as an assignment operator that\ncauses the user variable on the left hand side of the operator to take\non the value to its right. (In other words, when used in a SET\nstatement, = is treated identically to :=.) The value on the right hand\nside may be a literal value, another variable storing a value, or any\nlegal expression that yields a scalar value, including the result of a\nquery (provided that this value is a scalar value). You can perform\nmultiple assignments in the same SET statement.\n\nIn the SET clause of an UPDATE statement, = also acts as an assignment\noperator; in this case, however, it causes the column named on the left\nhand side of the operator to assume the value given to the right,\nprovided any WHERE conditions that are part of the UPDATE are met. You\ncan make multiple assignments in the same SET clause of an UPDATE\nstatement.\n\nIn any other context, = is treated as a comparison operator.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/assignment-operators.html\n\n','mysql> SELECT @var1, @var2;\n -> NULL, NULL\nmysql> SELECT @var1 := 1, @var2;\n -> 1, NULL\nmysql> SELECT @var1, @var2;\n -> 1, NULL\nmysql> SELECT @var1, @var2 := @var1;\n -> 1, 1\nmysql> SELECT @var1, @var2;\n -> 1, 1\n','http://dev.mysql.com/doc/refman/5.5/en/assignment-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (230,37,'CONVERT','Syntax:\nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n\nThe CONVERT() and CAST() functions take an expression of any type and\nproduce a result value of a specified type.\n\nThe type for the result can be one of the following values:\n\no BINARY[(N)]\n\no CHAR[(N)]\n\no DATE\n\no DATETIME\n\no DECIMAL[(M[,D])]\n\no SIGNED [INTEGER]\n\no TIME\n\no UNSIGNED [INTEGER]\n\nBINARY produces a string with the BINARY data type. See\nhttp://dev.mysql.com/doc/refman/5.5/en/binary-varbinary.html for a\ndescription of how this affects comparisons. If the optional length N\nis given, BINARY(N) causes the cast to use no more than N bytes of the\nargument. Values shorter than N bytes are padded with 0x00 bytes to a\nlength of N.\n\nCHAR(N) causes the cast to use no more than N characters of the\nargument.\n\nCAST() and CONVERT(... USING ...) are standard SQL syntax. The\nnon-USING form of CONVERT() is ODBC syntax.\n\nCONVERT() with USING is used to convert data between different\ncharacter sets. In MySQL, transcoding names are the same as the\ncorresponding character set names. For example, this statement converts\nthe string \'abc\' in the default character set to the corresponding\nstring in the utf8 character set:\n\nSELECT CONVERT(\'abc\' USING utf8);\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html\n\n','SELECT enum_col FROM tbl_name ORDER BY CAST(enum_col AS CHAR);\n','http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (231,31,'ADDDATE','Syntax:\nADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument, ADDDATE()\nis a synonym for DATE_ADD(). The related function SUBDATE() is a\nsynonym for DATE_SUB(). For information on the INTERVAL unit argument,\nsee the discussion for DATE_ADD().\n\nmysql> SELECT DATE_ADD(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2008-02-02\'\nmysql> SELECT ADDDATE(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2008-02-02\'\n\nWhen invoked with the days form of the second argument, MySQL treats it\nas an integer number of days to be added to expr.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT ADDDATE(\'2008-01-02\', 31);\n -> \'2008-02-02\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (232,23,'REPEAT LOOP','Syntax:\n[begin_label:] REPEAT\n statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n\nThe statement list within a REPEAT statement is repeated until the\nsearch_condition expression is true. Thus, a REPEAT always enters the\nloop at least once. statement_list consists of one or more statements,\neach terminated by a semicolon (;) statement delimiter.\n\nA REPEAT statement can be labeled. For the rules regarding label use,\nsee [HELP labels].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/repeat.html\n\n','mysql> delimiter //\n\nmysql> CREATE PROCEDURE dorepeat(p1 INT)\n -> BEGIN\n -> SET @x = 0;\n -> REPEAT\n -> SET @x = @x + 1;\n -> UNTIL @x > p1 END REPEAT;\n -> END\n -> //\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> CALL dorepeat(1000)//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\n+------+\n1 row in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/repeat.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (233,39,'ALTER FUNCTION','Syntax:\nALTER FUNCTION func_name [characteristic ...]\n\ncharacteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nThis statement can be used to change the characteristics of a stored\nfunction. More than one change may be specified in an ALTER FUNCTION\nstatement. However, you cannot change the parameters or body of a\nstored function using this statement; to make such changes, you must\ndrop and re-create the function using DROP FUNCTION and CREATE\nFUNCTION.\n\nYou must have the ALTER ROUTINE privilege for the function. (That\nprivilege is granted automatically to the function creator.) If binary\nlogging is enabled, the ALTER FUNCTION statement might also require the\nSUPER privilege, as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-logging.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-function.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-function.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (234,22,'SMALLINT','SMALLINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA small integer. The signed range is -32768 to 32767. The unsigned\nrange is 0 to 65535.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (235,22,'DOUBLE PRECISION','DOUBLE PRECISION[(M,D)] [UNSIGNED] [ZEROFILL], REAL[(M,D)] [UNSIGNED]\n[ZEROFILL]\n\nThese types are synonyms for DOUBLE. Exception: If the REAL_AS_FLOAT\nSQL mode is enabled, REAL is a synonym for FLOAT rather than DOUBLE.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (236,37,'ORD','Syntax:\nORD(str)\n\nIf the leftmost character of the string str is a multi-byte character,\nreturns the code for that character, calculated from the numeric values\nof its constituent bytes using this formula:\n\n (1st byte code)\n+ (2nd byte code * 256)\n+ (3rd byte code * 2562) ...\n\nIf the leftmost character is not a multi-byte character, ORD() returns\nthe same value as the ASCII() function.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT ORD(\'2\');\n -> 50\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (237,8,'DEALLOCATE PREPARE','Syntax:\n{DEALLOCATE | DROP} PREPARE stmt_name\n\nTo deallocate a prepared statement produced with PREPARE, use a\nDEALLOCATE PREPARE statement that refers to the prepared statement\nname. Attempting to execute a prepared statement after deallocating it\nresults in an error.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/deallocate-prepare.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/deallocate-prepare.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (238,36,'ENVELOPE','Envelope(g)\n\nReturns the Minimum Bounding Rectangle (MBR) for the geometry value g.\nThe result is returned as a Polygon value.\n\nThe polygon is defined by the corner points of the bounding box:\n\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT AsText(Envelope(GeomFromText(\'LineString(1 1,2 2)\')));\n+-------------------------------------------------------+\n| AsText(Envelope(GeomFromText(\'LineString(1 1,2 2)\'))) |\n+-------------------------------------------------------+\n| POLYGON((1 1,2 1,2 2,1 2,1 1)) |\n+-------------------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (239,14,'IS_FREE_LOCK','Syntax:\nIS_FREE_LOCK(str)\n\nChecks whether the lock named str is free to use (that is, not locked).\nReturns 1 if the lock is free (no one is using the lock), 0 if the lock\nis in use, and NULL if an error occurs (such as an incorrect argument).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (240,30,'TOUCHES','Touches(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially touches g2. Two\ngeometries spatially touch if the interiors of the geometries do not\nintersect, but the boundary of one of the geometries intersects either\nthe boundary or the interior of the other.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (241,14,'INET_ATON','Syntax:\nINET_ATON(expr)\n\nGiven the dotted-quad representation of an IPv4 network address as a\nstring, returns an integer that represents the numeric value of the\naddress in network byte order (big endian). INET_ATON() returns NULL if\nit does not understand its argument.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> SELECT INET_ATON(\'10.0.5.9\');\n -> 167773449\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (242,12,'UNCOMPRESS','Syntax:\nUNCOMPRESS(string_to_uncompress)\n\nUncompresses a string compressed by the COMPRESS() function. If the\nargument is not a compressed value, the result is NULL. This function\nrequires MySQL to have been compiled with a compression library such as\nzlib. Otherwise, the return value is always NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT UNCOMPRESS(COMPRESS(\'any string\'));\n -> \'any string\'\nmysql> SELECT UNCOMPRESS(\'any string\');\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (243,22,'AUTO_INCREMENT','The AUTO_INCREMENT attribute can be used to generate a unique identity\nfor new rows:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/example-auto-increment.html\n\n','CREATE TABLE animals (\n id MEDIUMINT NOT NULL AUTO_INCREMENT,\n name CHAR(30) NOT NULL,\n PRIMARY KEY (id)\n);\n\nINSERT INTO animals (name) VALUES\n (\'dog\'),(\'cat\'),(\'penguin\'),\n (\'lax\'),(\'whale\'),(\'ostrich\');\n\nSELECT * FROM animals;\n','http://dev.mysql.com/doc/refman/5.5/en/example-auto-increment.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (244,36,'ISSIMPLE','IsSimple(g)\n\nCurrently, this function is a placeholder and should not be used. If\nimplemented, its behavior will be as described in the next paragraph.\n\nReturns 1 if the geometry value g has no anomalous geometric points,\nsuch as self-intersection or self-tangency. IsSimple() returns 0 if the\nargument is not simple, and -1 if it is NULL.\n\nThe description of each instantiable geometric class given earlier in\nthe chapter includes the specific conditions that cause an instance of\nthat class to be classified as not simple. (See [HELP Geometry\nhierarchy].)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (245,4,'- BINARY','Syntax:\n-\n\nSubtraction:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT 3-5;\n -> -2\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (246,3,'GEOMCOLLFROMTEXT','GeomCollFromText(wkt[,srid]), GeometryCollectionFromText(wkt[,srid])\n\nConstructs a GEOMETRYCOLLECTION value using its WKT representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (247,3,'WKT DEFINITION','The Well-Known Text (WKT) representation of Geometry is designed to\nexchange geometry data in ASCII form. For a Backus-Naur grammar that\nspecifies the formal production rules for writing WKT values, see the\nOpenGIS specification document referenced in\nhttp://dev.mysql.com/doc/refman/5.5/en/spatial-extensions.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/gis-wkt-format.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/gis-wkt-format.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (248,31,'CURRENT_TIME','Syntax:\nCURRENT_TIME, CURRENT_TIME()\n\nCURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (249,10,'REVOKE','Syntax:\nREVOKE\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n FROM user [, user] ...\n\nREVOKE ALL PRIVILEGES, GRANT OPTION\n FROM user [, user] ...\n\nREVOKE PROXY ON user\n FROM user [, user] ...\n\nThe REVOKE statement enables system administrators to revoke privileges\nfrom MySQL accounts. Each account name uses the format described in\nhttp://dev.mysql.com/doc/refman/5.5/en/account-names.html. For example:\n\nREVOKE INSERT ON *.* FROM \'jeffrey\'@\'localhost\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nFor details on the levels at which privileges exist, the permissible\npriv_type and priv_level values, and the syntax for specifying users\nand passwords, see [HELP GRANT]\n\nTo use the first REVOKE syntax, you must have the GRANT OPTION\nprivilege, and you must have the privileges that you are revoking.\n\nTo revoke all privileges, use the second syntax, which drops all\nglobal, database, table, column, and routine privileges for the named\nuser or users:\n\nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n\nTo use this REVOKE syntax, you must have the global CREATE USER\nprivilege or the UPDATE privilege for the mysql database.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/revoke.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/revoke.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (250,17,'LAST_INSERT_ID','Syntax:\nLAST_INSERT_ID(), LAST_INSERT_ID(expr)\n\nLAST_INSERT_ID() (with no argument) returns a BIGINT (64-bit) value\nrepresenting the first automatically generated value successfully\ninserted for an AUTO_INCREMENT column as a result of the most recently\nexecuted INSERT statement. The value of LAST_INSERT_ID() remains\nunchanged if no rows are successfully inserted.\n\nFor example, after inserting a row that generates an AUTO_INCREMENT\nvalue, you can get the value like this:\n\nmysql> SELECT LAST_INSERT_ID();\n -> 195\n\nThe currently executing statement does not affect the value of\nLAST_INSERT_ID(). Suppose that you generate an AUTO_INCREMENT value\nwith one statement, and then refer to LAST_INSERT_ID() in a\nmultiple-row INSERT statement that inserts rows into a table with its\nown AUTO_INCREMENT column. The value of LAST_INSERT_ID() will remain\nstable in the second statement; its value for the second and later rows\nis not affected by the earlier row insertions. (However, if you mix\nreferences to LAST_INSERT_ID() and LAST_INSERT_ID(expr), the effect is\nundefined.)\n\nIf the previous statement returned an error, the value of\nLAST_INSERT_ID() is undefined. For transactional tables, if the\nstatement is rolled back due to an error, the value of LAST_INSERT_ID()\nis left undefined. For manual ROLLBACK, the value of LAST_INSERT_ID()\nis not restored to that before the transaction; it remains as it was at\nthe point of the ROLLBACK.\n\nWithin the body of a stored routine (procedure or function) or a\ntrigger, the value of LAST_INSERT_ID() changes the same way as for\nstatements executed outside the body of these kinds of objects. The\neffect of a stored routine or trigger upon the value of\nLAST_INSERT_ID() that is seen by following statements depends on the\nkind of routine:\n\no If a stored procedure executes statements that change the value of\n LAST_INSERT_ID(), the changed value is seen by statements that follow\n the procedure call.\n\no For stored functions and triggers that change the value, the value is\n restored when the function or trigger ends, so following statements\n will not see a changed value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (251,31,'LAST_DAY','Syntax:\nLAST_DAY(date)\n\nTakes a date or datetime value and returns the corresponding value for\nthe last day of the month. Returns NULL if the argument is invalid.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT LAST_DAY(\'2003-02-05\');\n -> \'2003-02-28\'\nmysql> SELECT LAST_DAY(\'2004-02-05\');\n -> \'2004-02-29\'\nmysql> SELECT LAST_DAY(\'2004-01-01 01:01:01\');\n -> \'2004-01-31\'\nmysql> SELECT LAST_DAY(\'2003-03-32\');\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (252,22,'MEDIUMINT','MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA medium-sized integer. The signed range is -8388608 to 8388607. The\nunsigned range is 0 to 16777215.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (253,4,'FLOOR','Syntax:\nFLOOR(X)\n\nReturns the largest integer value not greater than X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT FLOOR(1.23);\n -> 1\nmysql> SELECT FLOOR(-1.23);\n -> -2\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (254,37,'RTRIM','Syntax:\nRTRIM(str)\n\nReturns the string str with trailing space characters removed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT RTRIM(\'barbar \');\n -> \'barbar\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (255,28,'EXPLAIN','Syntax:\nEXPLAIN [explain_type] SELECT select_options\n\nexplain_type:\n EXTENDED\n | PARTITIONS\n\nOr:\n\nEXPLAIN tbl_name\n\nThe EXPLAIN statement can be used either as a way to obtain information\nabout how MySQL executes a statement, or as a synonym for DESCRIBE:\n\no When you precede a SELECT statement with the keyword EXPLAIN, MySQL\n displays information from the optimizer about the query execution\n plan. That is, MySQL explains how it would process the statement,\n including information about how tables are joined and in which order.\n EXPLAIN EXTENDED can be used to obtain additional information.\n\n For information about using EXPLAIN and EXPLAIN EXTENDED to obtain\n query execution plan information, see\n http://dev.mysql.com/doc/refman/5.5/en/using-explain.html.\n\no EXPLAIN PARTITIONS is useful only when examining queries involving\n partitioned tables. For details, see\n http://dev.mysql.com/doc/refman/5.5/en/partitioning-info.html.\n\no EXPLAIN tbl_name is synonymous with DESCRIBE tbl_name or SHOW COLUMNS\n FROM tbl_name. For information about DESCRIBE and SHOW COLUMNS, see\n [HELP DESCRIBE], and [HELP SHOW COLUMNS].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/explain.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/explain.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,4,'DEGREES','Syntax:\nDEGREES(X)\n\nReturns the argument X, converted from radians to degrees.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT DEGREES(PI());\n -> 180\nmysql> SELECT DEGREES(PI() / 2);\n -> 90\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (257,22,'VARCHAR','[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,535. The effective maximum length\nof a VARCHAR is subject to the maximum row size (65,535 bytes, which is\nshared among all columns) and the character set used. For example, utf8\ncharacters can require up to three bytes per character, so a VARCHAR\ncolumn that uses the utf8 character set can be declared to be a maximum\nof 21,844 characters. See\nhttp://dev.mysql.com/doc/refman/5.5/en/column-count-limit.html.\n\nMySQL stores VARCHAR values as a 1-byte or 2-byte length prefix plus\ndata. The length prefix indicates the number of bytes in the value. A\nVARCHAR column uses one length byte if values require no more than 255\nbytes, two length bytes if values may require more than 255 bytes.\n\n*Note*: MySQL 5.5 follows the standard SQL specification, and does not\nremove trailing spaces from VARCHAR values.\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the\nstandard SQL way to define that a VARCHAR column should use some\npredefined character set. MySQL 4.1 and up uses utf8 as this predefined\ncharacter set.\nhttp://dev.mysql.com/doc/refman/5.5/en/charset-national.html. NVARCHAR\nis shorthand for NATIONAL VARCHAR.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (258,37,'UNHEX','Syntax:\n\nUNHEX(str)\n\nFor a string argument str, UNHEX(str) performs the inverse operation of\nHEX(str). That is, it interprets each pair of characters in the\nargument as a hexadecimal number and converts it to the character\nrepresented by the number. The return value is a binary string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT UNHEX(\'4D7953514C\');\n -> \'MySQL\'\nmysql> SELECT 0x4D7953514C;\n -> \'MySQL\'\nmysql> SELECT UNHEX(HEX(\'string\'));\n -> \'string\'\nmysql> SELECT HEX(UNHEX(\'1267\'));\n -> \'1267\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (259,4,'- UNARY','Syntax:\n-\n\nUnary minus. This operator changes the sign of the operand.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT - 2;\n -> -2\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (260,16,'STD','Syntax:\nSTD(expr)\n\nReturns the population standard deviation of expr. This is an extension\nto standard SQL. The standard SQL function STDDEV_POP() can be used\ninstead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (261,4,'COS','Syntax:\nCOS(X)\n\nReturns the cosine of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT COS(PI());\n -> -1\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (262,31,'DATE FUNCTION','Syntax:\nDATE(expr)\n\nExtracts the date part of the date or datetime expression expr.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DATE(\'2003-12-31 01:02:03\');\n -> \'2003-12-31\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (263,39,'DROP TRIGGER','Syntax:\nDROP TRIGGER [IF EXISTS] [schema_name.]trigger_name\n\nThis statement drops a trigger. The schema (database) name is optional.\nIf the schema is omitted, the trigger is dropped from the default\nschema. DROP TRIGGER requires the TRIGGER privilege for the table\nassociated with the trigger.\n\nUse IF EXISTS to prevent an error from occurring for a trigger that\ndoes not exist. A NOTE is generated for a nonexistent trigger when\nusing IF EXISTS. See [HELP SHOW WARNINGS].\n\nTriggers for a table are also dropped if you drop the table.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-trigger.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (264,8,'RESET MASTER','Syntax:\nRESET MASTER\n\nDeletes all binary log files listed in the index file, resets the\nbinary log index file to be empty, and creates a new binary log file.\nThis statement is intended to be used only when the master is started\nfor the first time.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/reset-master.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/reset-master.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (265,4,'TAN','Syntax:\nTAN(X)\n\nReturns the tangent of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT TAN(PI());\n -> -1.2246063538224e-16\nmysql> SELECT TAN(PI()+1);\n -> 1.5574077246549\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (266,4,'PI','Syntax:\nPI()\n\nReturns the value of π (pi). The default number of decimal places\ndisplayed is seven, but MySQL uses the full double-precision value\ninternally.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT PI();\n -> 3.141593\nmysql> SELECT PI()+0.000000000000000000;\n -> 3.141592653589793116\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (267,31,'WEEKOFYEAR','Syntax:\nWEEKOFYEAR(date)\n\nReturns the calendar week of the date as a number in the range from 1\nto 53. WEEKOFYEAR() is a compatibility function that is equivalent to\nWEEK(date,3).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT WEEKOFYEAR(\'2008-02-20\');\n -> 8\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (268,4,'/','Syntax:\n/\n\nDivision:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT 3/5;\n -> 0.60\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (269,8,'PURGE BINARY LOGS','Syntax:\nPURGE { BINARY | MASTER } LOGS\n { TO \'log_name\' | BEFORE datetime_expr }\n\nThe binary log is a set of files that contain information about data\nmodifications made by the MySQL server. The log consists of a set of\nbinary log files, plus an index file (see\nhttp://dev.mysql.com/doc/refman/5.5/en/binary-log.html).\n\nThe PURGE BINARY LOGS statement deletes all the binary log files listed\nin the log index file prior to the specified log file name or date.\nBINARY and MASTER are synonyms. Deleted log files also are removed from\nthe list recorded in the index file, so that the given log file becomes\nthe first in the list.\n\nThis statement has no effect if the server was not started with the\n--log-bin option to enable binary logging.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/purge-binary-logs.html\n\n','PURGE BINARY LOGS TO \'mysql-bin.010\';\nPURGE BINARY LOGS BEFORE \'2008-04-02 22:46:26\';\n','http://dev.mysql.com/doc/refman/5.5/en/purge-binary-logs.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (270,16,'STDDEV_SAMP','Syntax:\nSTDDEV_SAMP(expr)\n\nReturns the sample standard deviation of expr (the square root of\nVAR_SAMP().\n\nSTDDEV_SAMP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (271,17,'SCHEMA','Syntax:\nSCHEMA()\n\nThis function is a synonym for DATABASE().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (272,32,'MLINEFROMWKB','MLineFromWKB(wkb[,srid]), MultiLineStringFromWKB(wkb[,srid])\n\nConstructs a MULTILINESTRING value using its WKB representation and\nSRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (273,4,'LOG2','Syntax:\nLOG2(X)\n\nReturns the base-2 logarithm of X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT LOG2(65536);\n -> 16\nmysql> SELECT LOG2(-100);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (274,31,'SUBTIME','Syntax:\nSUBTIME(expr1,expr2)\n\nSUBTIME() returns expr1 - expr2 expressed as a value in the same format\nas expr1. expr1 is a time or datetime expression, and expr2 is a time\nexpression.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\');\n -> \'2007-12-30 22:58:58.999997\'\nmysql> SELECT SUBTIME(\'01:00:00.999999\', \'02:00:00.999998\');\n -> \'-00:59:59.999999\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (275,12,'UNCOMPRESSED_LENGTH','Syntax:\nUNCOMPRESSED_LENGTH(compressed_string)\n\nReturns the length that the compressed string had before being\ncompressed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30)));\n -> 30\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (276,39,'DROP TABLE','Syntax:\nDROP [TEMPORARY] TABLE [IF EXISTS]\n tbl_name [, tbl_name] ...\n [RESTRICT | CASCADE]\n\nDROP TABLE removes one or more tables. You must have the DROP privilege\nfor each table. All table data and the table definition are removed, so\nbe careful with this statement! If any of the tables named in the\nargument list do not exist, MySQL returns an error indicating by name\nwhich nonexisting tables it was unable to drop, but it also drops all\nof the tables in the list that do exist.\n\n*Important*: When a table is dropped, user privileges on the table are\nnot automatically dropped. See [HELP GRANT].\n\nNote that for a partitioned table, DROP TABLE permanently removes the\ntable definition, all of its partitions, and all of the data which was\nstored in those partitions. It also removes the partitioning definition\n(.par) file associated with the dropped table.\n\nUse IF EXISTS to prevent an error from occurring for tables that do not\nexist. A NOTE is generated for each nonexistent table when using IF\nEXISTS. See [HELP SHOW WARNINGS].\n\nRESTRICT and CASCADE are permitted to make porting easier. In MySQL\n5.5, they do nothing.\n\n*Note*: DROP TABLE automatically commits the current active\ntransaction, unless you use the TEMPORARY keyword.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (277,4,'POW','Syntax:\nPOW(X,Y)\n\nReturns the value of X raised to the power of Y.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT POW(2,2);\n -> 4\nmysql> SELECT POW(2,-2);\n -> 0.25\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (278,26,'SHOW CREATE TABLE','Syntax:\nSHOW CREATE TABLE tbl_name\n\nShows the CREATE TABLE statement that creates the given table. To use\nthis statement, you must have some privilege for the table. This\nstatement also works with views.\nSHOW CREATE TABLE quotes table and column names according to the value\nof the sql_quote_show_create option. See\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-table.html\n\n','mysql> SHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\n Table: t\nCreate Table: CREATE TABLE t (\n id INT(11) default NULL auto_increment,\n s char(60) default NULL,\n PRIMARY KEY (id)\n) ENGINE=MyISAM\n','http://dev.mysql.com/doc/refman/5.5/en/show-create-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (279,27,'DUAL','You are permitted to specify DUAL as a dummy table name in situations\nwhere no tables are referenced:\n\nmysql> SELECT 1 + 1 FROM DUAL;\n -> 2\n\nDUAL is purely for the convenience of people who require that all\nSELECT statements should have FROM and possibly other clauses. MySQL\nmay ignore the clauses. MySQL does not require FROM DUAL if no tables\nare referenced.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/select.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/select.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (280,37,'INSTR','Syntax:\nINSTR(str,substr)\n\nReturns the position of the first occurrence of substring substr in\nstring str. This is the same as the two-argument form of LOCATE(),\nexcept that the order of the arguments is reversed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT INSTR(\'foobarbar\', \'bar\');\n -> 4\nmysql> SELECT INSTR(\'xbar\', \'foobar\');\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (281,31,'NOW','Syntax:\nNOW()\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context. The value is expressed in the\ncurrent time zone.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT NOW();\n -> \'2007-12-15 23:50:26\'\nmysql> SELECT NOW() + 0;\n -> 20071215235026.000000\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (282,26,'SHOW ENGINES','Syntax:\nSHOW [STORAGE] ENGINES\n\nSHOW ENGINES displays status information about the server\'s storage\nengines. This is particularly useful for checking whether a storage\nengine is supported, or to see what the default engine is.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-engines.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-engines.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (283,18,'>=','Syntax:\n>=\n\nGreater than or equal:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 2 >= 2;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (284,4,'EXP','Syntax:\nEXP(X)\n\nReturns the value of e (the base of natural logarithms) raised to the\npower of X. The inverse of this function is LOG() (using a single\nargument only) or LN().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT EXP(2);\n -> 7.3890560989307\nmysql> SELECT EXP(-2);\n -> 0.13533528323661\nmysql> SELECT EXP(0);\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (285,22,'LONGBLOB','LONGBLOB\n\nA BLOB column with a maximum length of 4,294,967,295 or 4GB (232 - 1)\nbytes. The effective maximum length of LONGBLOB columns depends on the\nconfigured maximum packet size in the client/server protocol and\navailable memory. Each LONGBLOB value is stored using a 4-byte length\nprefix that indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (286,13,'POINTN','PointN(ls,N)\n\nReturns the N-th Point in the Linestring value ls. Points are numbered\nbeginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (287,22,'YEAR DATA TYPE','YEAR[(2|4)]\n\nA year in two-digit or four-digit format. The default is four-digit\nformat. YEAR(2) or YEAR(4) differ in display format, but have the same\nrange of values. In four-digit format, values display as 1901 to 2155,\nand 0000. In two-digit format, values display as 70 to 69, representing\nyears from 1970 to 2069. MySQL displays YEAR values in YYYY or\nYYformat, but permits assignment of values to YEAR columns using either\nstrings or numbers.\n\n*Note*: The YEAR(2) data type has certain issues that you should\nconsider before choosing to use it. As of MySQL 5.5.27, YEAR(2) is\ndeprecated. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/migrating-to-year4.html.\n\nFor additional information about YEAR display format and inerpretation\nof input values, see http://dev.mysql.com/doc/refman/5.5/en/year.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (288,16,'SUM','Syntax:\nSUM([DISTINCT] expr)\n\nReturns the sum of expr. If the return set has no rows, SUM() returns\nNULL. The DISTINCT keyword can be used to sum only the distinct values\nof expr.\n\nSUM() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (289,37,'OCT','Syntax:\nOCT(N)\n\nReturns a string representation of the octal value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,8). Returns\nNULL if N is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT OCT(12);\n -> \'14\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (290,31,'SYSDATE','Syntax:\nSYSDATE()\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\'\nor YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is\nused in a string or numeric context.\n\nSYSDATE() returns the time at which it executes. This differs from the\nbehavior for NOW(), which returns a constant time that indicates the\ntime at which the statement began to execute. (Within a stored function\nor trigger, NOW() returns the time at which the function or triggering\nstatement began to execute.)\n\nmysql> SELECT NOW(), SLEEP(2), NOW();\n+---------------------+----------+---------------------+\n| NOW() | SLEEP(2) | NOW() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:36 | 0 | 2006-04-12 13:47:36 |\n+---------------------+----------+---------------------+\n\nmysql> SELECT SYSDATE(), SLEEP(2), SYSDATE();\n+---------------------+----------+---------------------+\n| SYSDATE() | SLEEP(2) | SYSDATE() |\n+---------------------+----------+---------------------+\n| 2006-04-12 13:47:44 | 0 | 2006-04-12 13:47:46 |\n+---------------------+----------+---------------------+\n\nIn addition, the SET TIMESTAMP statement affects the value returned by\nNOW() but not by SYSDATE(). This means that timestamp settings in the\nbinary log have no effect on invocations of SYSDATE().\n\nBecause SYSDATE() can return different values even within the same\nstatement, and is not affected by SET TIMESTAMP, it is nondeterministic\nand therefore unsafe for replication if statement-based binary logging\nis used. If that is a problem, you can use row-based logging.\n\nAlternatively, you can use the --sysdate-is-now option to cause\nSYSDATE() to be an alias for NOW(). This works if the option is used on\nboth the master and the slave.\n\nThe nondeterministic nature of SYSDATE() also means that indexes cannot\nbe used for evaluating expressions that refer to it.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (291,5,'UNINSTALL PLUGIN','Syntax:\nUNINSTALL PLUGIN plugin_name\n\nThis statement removes an installed server plugin. It requires the\nDELETE privilege for the mysql.plugin table.\n\nplugin_name must be the name of some plugin that is listed in the\nmysql.plugin table. The server executes the plugin\'s deinitialization\nfunction and removes the row for the plugin from the mysql.plugin\ntable, so that subsequent server restarts will not load and initialize\nthe plugin. UNINSTALL PLUGIN does not remove the plugin\'s shared\nlibrary file.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/uninstall-plugin.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/uninstall-plugin.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (292,32,'ASBINARY','AsBinary(g), AsWKB(g)\n\nConverts a value in internal geometry format to its WKB representation\nand returns the binary result.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-to-convert-geometries-between-formats.html\n\n','SELECT AsBinary(g) FROM geom;\n','http://dev.mysql.com/doc/refman/5.5/en/functions-to-convert-geometries-between-formats.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (293,37,'REPEAT FUNCTION','Syntax:\nREPEAT(str,count)\n\nReturns a string consisting of the string str repeated count times. If\ncount is less than 1, returns an empty string. Returns NULL if str or\ncount are NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT REPEAT(\'MySQL\', 3);\n -> \'MySQLMySQLMySQL\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (294,26,'SHOW TABLES','Syntax:\nSHOW [FULL] TABLES [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW TABLES lists the non-TEMPORARY tables in a given database. You can\nalso get this list using the mysqlshow db_name command. The LIKE\nclause, if present, indicates which table names to match. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in http://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nThis statement also lists any views in the database. The FULL modifier\nis supported such that SHOW FULL TABLES displays a second output\ncolumn. Values for the second column are BASE TABLE for a table and\nVIEW for a view.\n\nIf you have no privileges for a base table or view, it does not show up\nin the output from SHOW TABLES or mysqlshow db_name.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-tables.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-tables.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (295,31,'MAKEDATE','Syntax:\nMAKEDATE(year,dayofyear)\n\nReturns a date, given year and day-of-year values. dayofyear must be\ngreater than 0 or the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MAKEDATE(2011,31), MAKEDATE(2011,32);\n -> \'2011-01-31\', \'2011-02-01\'\nmysql> SELECT MAKEDATE(2011,365), MAKEDATE(2014,365);\n -> \'2011-12-31\', \'2014-12-31\'\nmysql> SELECT MAKEDATE(2011,0);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (296,37,'BINARY OPERATOR','Syntax:\nBINARY\n\nThe BINARY operator casts the string following it to a binary string.\nThis is an easy way to force a column comparison to be done byte by\nbyte rather than character by character. This causes the comparison to\nbe case sensitive even if the column is not defined as BINARY or BLOB.\nBINARY also causes trailing spaces to be significant.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html\n\n','mysql> SELECT \'a\' = \'A\';\n -> 1\nmysql> SELECT BINARY \'a\' = \'A\';\n -> 0\nmysql> SELECT \'a\' = \'a \';\n -> 1\nmysql> SELECT BINARY \'a\' = \'a \';\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (297,6,'MBROVERLAPS','MBROverlaps(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 overlap. The term spatially overlaps is\nused if two geometries intersect and their intersection results in a\ngeometry of the same dimension but not equal to either of the given\ngeometries.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (298,37,'SOUNDEX','Syntax:\nSOUNDEX(str)\n\nReturns a soundex string from str. Two strings that sound almost the\nsame should have identical soundex strings. A standard soundex string\nis four characters long, but the SOUNDEX() function returns an\narbitrarily long string. You can use SUBSTRING() on the result to get a\nstandard soundex string. All nonalphabetic characters in str are\nignored. All international alphabetic characters outside the A-Z range\nare treated as vowels.\n\n*Important*: When using SOUNDEX(), you should be aware of the following\nlimitations:\n\no This function, as currently implemented, is intended to work well\n with strings that are in the English language only. Strings in other\n languages may not produce reliable results.\n\no This function is not guaranteed to provide consistent results with\n strings that use multi-byte character sets, including utf-8.\n\n We hope to remove these limitations in a future release. See Bug\n #22638 for more information.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT SOUNDEX(\'Hello\');\n -> \'H400\'\nmysql> SELECT SOUNDEX(\'Quadratically\');\n -> \'Q36324\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (299,6,'MBRTOUCHES','MBRTouches(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 touch. Two geometries spatially touch if\nthe interiors of the geometries do not intersect, but the boundary of\none of the geometries intersects either the boundary or the interior of\nthe other.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (300,39,'DROP EVENT','Syntax:\nDROP EVENT [IF EXISTS] event_name\n\nThis statement drops the event named event_name. The event immediately\nceases being active, and is deleted completely from the server.\n\nIf the event does not exist, the error ERROR 1517 (HY000): Unknown\nevent \'event_name\' results. You can override this and cause the\nstatement to generate a warning for nonexistent events instead using IF\nEXISTS.\n\nThis statement requires the EVENT privilege for the schema to which the\nevent to be dropped belongs.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-event.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-event.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (301,27,'INSERT SELECT','Syntax:\nINSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]\n\nWith INSERT ... SELECT, you can quickly insert many rows into a table\nfrom one or many tables. For example:\n\nINSERT INTO tbl_temp2 (fld_id)\n SELECT tbl_temp1.fld_order_id\n FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/insert-select.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/insert-select.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (302,39,'CREATE PROCEDURE','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n PROCEDURE sp_name ([proc_parameter[,...]])\n [characteristic ...] routine_body\n\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n FUNCTION sp_name ([func_parameter[,...]])\n RETURNS type\n [characteristic ...] routine_body\n\nproc_parameter:\n [ IN | OUT | INOUT ] param_name type\n\nfunc_parameter:\n param_name type\n\ntype:\n Any valid MySQL data type\n\ncharacteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nroutine_body:\n Valid SQL routine statement\n\nThese statements create stored routines. By default, a routine is\nassociated with the default database. To associate the routine\nexplicitly with a given database, specify the name as db_name.sp_name\nwhen you create it.\n\nThe CREATE FUNCTION statement is also used in MySQL to support UDFs\n(user-defined functions). See\nhttp://dev.mysql.com/doc/refman/5.5/en/adding-functions.html. A UDF can\nbe regarded as an external stored function. Stored functions share\ntheir namespace with UDFs. See\nhttp://dev.mysql.com/doc/refman/5.5/en/function-resolution.html, for\nthe rules describing how the server interprets references to different\nkinds of functions.\n\nTo invoke a stored procedure, use the CALL statement (see [HELP CALL]).\nTo invoke a stored function, refer to it in an expression. The function\nreturns a value during expression evaluation.\n\nCREATE PROCEDURE and CREATE FUNCTION require the CREATE ROUTINE\nprivilege. They might also require the SUPER privilege, depending on\nthe DEFINER value, as described later in this section. If binary\nlogging is enabled, CREATE FUNCTION might require the SUPER privilege,\nas described in\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-logging.html.\n\nBy default, MySQL automatically grants the ALTER ROUTINE and EXECUTE\nprivileges to the routine creator. This behavior can be changed by\ndisabling the automatic_sp_privileges system variable. See\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-routines-privileges.html.\n\nThe DEFINER and SQL SECURITY clauses specify the security context to be\nused when checking access privileges at routine execution time, as\ndescribed later in this section.\n\nIf the routine name is the same as the name of a built-in SQL function,\na syntax error occurs unless you use a space between the name and the\nfollowing parenthesis when defining the routine or invoking it later.\nFor this reason, avoid using the names of existing SQL functions for\nyour own stored routines.\n\nThe IGNORE_SPACE SQL mode applies to built-in functions, not to stored\nroutines. It is always permissible to have spaces after a stored\nroutine name, regardless of whether IGNORE_SPACE is enabled.\n\nThe parameter list enclosed within parentheses must always be present.\nIf there are no parameters, an empty parameter list of () should be\nused. Parameter names are not case sensitive.\n\nEach parameter is an IN parameter by default. To specify otherwise for\na parameter, use the keyword OUT or INOUT before the parameter name.\n\n*Note*: Specifying a parameter as IN, OUT, or INOUT is valid only for a\nPROCEDURE. For a FUNCTION, parameters are always regarded as IN\nparameters.\n\nAn IN parameter passes a value into a procedure. The procedure might\nmodify the value, but the modification is not visible to the caller\nwhen the procedure returns. An OUT parameter passes a value from the\nprocedure back to the caller. Its initial value is NULL within the\nprocedure, and its value is visible to the caller when the procedure\nreturns. An INOUT parameter is initialized by the caller, can be\nmodified by the procedure, and any change made by the procedure is\nvisible to the caller when the procedure returns.\n\nFor each OUT or INOUT parameter, pass a user-defined variable in the\nCALL statement that invokes the procedure so that you can obtain its\nvalue when the procedure returns. If you are calling the procedure from\nwithin another stored procedure or function, you can also pass a\nroutine parameter or local routine variable as an IN or INOUT\nparameter.\n\nThe following example shows a simple stored procedure that uses an OUT\nparameter:\n\nmysql> delimiter //\n\nmysql> CREATE PROCEDURE simpleproc (OUT param1 INT)\n -> BEGIN\n -> SELECT COUNT(*) INTO param1 FROM t;\n -> END//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> delimiter ;\n\nmysql> CALL simpleproc(@a);\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT @a;\n+------+\n| @a |\n+------+\n| 3 |\n+------+\n1 row in set (0.00 sec)\n\nThe example uses the mysql client delimiter command to change the\nstatement delimiter from ; to // while the procedure is being defined.\nThis enables the ; delimiter used in the procedure body to be passed\nthrough to the server rather than being interpreted by mysql itself.\nSee\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-defining.html.\n\nThe RETURNS clause may be specified only for a FUNCTION, for which it\nis mandatory. It indicates the return type of the function, and the\nfunction body must contain a RETURN value statement. If the RETURN\nstatement returns a value of a different type, the value is coerced to\nthe proper type. For example, if a function specifies an ENUM or SET\nvalue in the RETURNS clause, but the RETURN statement returns an\ninteger, the value returned from the function is the string for the\ncorresponding ENUM member of set of SET members.\n\nThe following example function takes a parameter, performs an operation\nusing an SQL function, and returns the result. In this case, it is\nunnecessary to use delimiter because the function definition contains\nno internal ; statement delimiters:\n\nmysql> CREATE FUNCTION hello (s CHAR(20))\nmysql> RETURNS CHAR(50) DETERMINISTIC\n -> RETURN CONCAT(\'Hello, \',s,\'!\');\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT hello(\'world\');\n+----------------+\n| hello(\'world\') |\n+----------------+\n| Hello, world! |\n+----------------+\n1 row in set (0.00 sec)\n\nParameter types and function return types can be declared to use any\nvalid data type, except that the COLLATE attribute cannot be used prior\nto MySQL 5.5.3. As of 5.5.3, COLLATE can be used if preceded by the\nCHARACTER SET attribute.\n\nThe routine_body consists of a valid SQL routine statement. This can be\na simple statement such as SELECT or INSERT, or a compound statement\nwritten using BEGIN and END. Compound statements can contain\ndeclarations, loops, and other control structure statements. The syntax\nfor these statements is described in\nhttp://dev.mysql.com/doc/refman/5.5/en/sql-syntax-compound-statements.h\ntml.\n\nMySQL permits routines to contain DDL statements, such as CREATE and\nDROP. MySQL also permits stored procedures (but not stored functions)\nto contain SQL transaction statements such as COMMIT. Stored functions\nmay not contain statements that perform explicit or implicit commit or\nrollback. Support for these statements is not required by the SQL\nstandard, which states that each DBMS vendor may decide whether to\npermit them.\n\nStatements that return a result set can be used within a stored\nprocedure but not within a stored function. This prohibition includes\nSELECT statements that do not have an INTO var_list clause and other\nstatements such as SHOW, EXPLAIN, and CHECK TABLE. For statements that\ncan be determined at function definition time to return a result set, a\nNot allowed to return a result set from a function error occurs\n(ER_SP_NO_RETSET). For statements that can be determined only at\nruntime to return a result set, a PROCEDURE %s can\'t return a result\nset in the given context error occurs (ER_SP_BADSELECT).\n\nUSE statements within stored routines are not permitted. When a routine\nis invoked, an implicit USE db_name is performed (and undone when the\nroutine terminates). The causes the routine to have the given default\ndatabase while it executes. References to objects in databases other\nthan the routine default database should be qualified with the\nappropriate database name.\n\nFor additional information about statements that are not permitted in\nstored routines, see\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-program-restrictions.html\n.\n\nFor information about invoking stored procedures from within programs\nwritten in a language that has a MySQL interface, see [HELP CALL].\n\nMySQL stores the sql_mode system variable setting that is in effect at\nthe time a routine is created, and always executes the routine with\nthis setting in force, regardless of the server SQL mode in effect when\nthe routine is invoked.\n\nThe switch from the SQL mode of the invoker to that of the routine\noccurs after evaluation of arguments and assignment of the resulting\nvalues to routine parameters. If you define a routine in strict SQL\nmode but invoke it in nonstrict mode, assignment of arguments to\nroutine parameters does not take place in strict mode. If you require\nthat expressions passed to a routine be assigned in strict SQL mode,\nyou should invoke the routine with strict mode in effect.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-procedure.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-procedure.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (303,22,'VARBINARY','VARBINARY(M)\n\nThe VARBINARY type is similar to the VARCHAR type, but stores binary\nbyte strings rather than nonbinary character strings. M represents the\nmaximum column length in bytes.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (304,26,'LOAD INDEX','Syntax:\nLOAD INDEX INTO CACHE\n tbl_index_list [, tbl_index_list] ...\n\ntbl_index_list:\n tbl_name\n [PARTITION (partition_list | ALL)]\n [[INDEX|KEY] (index_name[, index_name] ...)]\n [IGNORE LEAVES]\n\npartition_list:\n partition_name[, partition_name][, ...]\n\nThe LOAD INDEX INTO CACHE statement preloads a table index into the key\ncache to which it has been assigned by an explicit CACHE INDEX\nstatement, or into the default key cache otherwise.\n\nLOAD INDEX INTO CACHE is used only for MyISAM tables. In MySQL 5.5, it\nis also supported for partitioned MyISAM tables; in addition, indexes\non partitioned tables can be preloaded for one, several, or all\npartitions.\n\nThe IGNORE LEAVES modifier causes only blocks for the nonleaf nodes of\nthe index to be preloaded.\n\nIGNORE LEAVES is also supported for partitioned MyISAM tables.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/load-index.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/load-index.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (305,27,'UNION','Syntax:\nSELECT ...\nUNION [ALL | DISTINCT] SELECT ...\n[UNION [ALL | DISTINCT] SELECT ...]\n\nUNION is used to combine the result from multiple SELECT statements\ninto a single result set.\n\nThe column names from the first SELECT statement are used as the column\nnames for the results returned. Selected columns listed in\ncorresponding positions of each SELECT statement should have the same\ndata type. (For example, the first column selected by the first\nstatement should have the same type as the first column selected by the\nother statements.)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/union.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/union.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (306,31,'TO_DAYS','Syntax:\nTO_DAYS(date)\n\nGiven a date date, returns a day number (the number of days since year\n0).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TO_DAYS(950501);\n -> 728779\nmysql> SELECT TO_DAYS(\'2007-10-07\');\n -> 733321\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (307,37,'NOT REGEXP','Syntax:\nexpr NOT REGEXP pat, expr NOT RLIKE pat\n\nThis is the same as NOT (expr REGEXP pat).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/regexp.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/regexp.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (308,26,'SHOW INDEX','Syntax:\nSHOW {INDEX | INDEXES | KEYS}\n {FROM | IN} tbl_name\n [{FROM | IN} db_name]\n [WHERE expr]\n\nSHOW INDEX returns table index information. The format resembles that\nof the SQLStatistics call in ODBC. This statement requires some\nprivilege for any column in the table.\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. These two statements are equivalent:\n\nSHOW INDEX FROM mytable FROM mydb;\nSHOW INDEX FROM mydb.mytable;\n\nThe WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nYou can also list a table\'s indexes with the mysqlshow -k db_name\ntbl_name command.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-index.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-index.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (309,26,'SHOW CREATE DATABASE','Syntax:\nSHOW CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n\nShows the CREATE DATABASE statement that creates the given database. If\nthe SHOW statement includes an IF NOT EXISTS clause, the output too\nincludes such a clause. SHOW CREATE SCHEMA is a synonym for SHOW CREATE\nDATABASE.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-database.html\n\n','mysql> SHOW CREATE DATABASE test\\G\n*************************** 1. row ***************************\n Database: test\nCreate Database: CREATE DATABASE `test`\n /*!40100 DEFAULT CHARACTER SET latin1 */\n\nmysql> SHOW CREATE SCHEMA test\\G\n*************************** 1. row ***************************\n Database: test\nCreate Database: CREATE DATABASE `test`\n /*!40100 DEFAULT CHARACTER SET latin1 */\n','http://dev.mysql.com/doc/refman/5.5/en/show-create-database.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (310,23,'LEAVE','Syntax:\nLEAVE label\n\nThis statement is used to exit the flow control construct that has the\ngiven label. If the label is for the outermost stored program block,\nLEAVE exits the program.\n\nLEAVE can be used within BEGIN ... END or loop constructs (LOOP,\nREPEAT, WHILE).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/leave.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/leave.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (311,18,'NOT IN','Syntax:\nexpr NOT IN (value,...)\n\nThis is the same as NOT (expr IN (value,...)).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (312,15,'!','Syntax:\nNOT, !\n\nLogical NOT. Evaluates to 1 if the operand is 0, to 0 if the operand is\nnonzero, and NOT NULL returns NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html\n\n','mysql> SELECT NOT 10;\n -> 0\nmysql> SELECT NOT 0;\n -> 1\nmysql> SELECT NOT NULL;\n -> NULL\nmysql> SELECT ! (1+1);\n -> 0\nmysql> SELECT ! 1+1;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (313,23,'DECLARE HANDLER','Syntax:\nDECLARE handler_action HANDLER\n FOR condition_value [, condition_value] ...\n statement\n\nhandler_action:\n CONTINUE\n | EXIT\n | UNDO\n\ncondition_value:\n mysql_error_code\n | SQLSTATE [VALUE] sqlstate_value\n | condition_name\n | SQLWARNING\n | NOT FOUND\n | SQLEXCEPTION\n\nThe DECLARE ... HANDLER statement specifies a handler that deals with\none or more conditions. If one of these conditions occurs, the\nspecified statement executes. statement can be a simple statement such\nas SET var_name = value, or a compound statement written using BEGIN\nand END (see [HELP BEGIN END]).\n\nHandler declarations must appear after variable or condition\ndeclarations.\n\nThe handler_action value indicates what action the handler takes after\nexecution of the handler statement:\n\no CONTINUE: Execution of the current program continues.\n\no EXIT: Execution terminates for the BEGIN ... END compound statement\n in which the handler is declared. This is true even if the condition\n occurs in an inner block.\n\no UNDO: Not supported.\n\nThe condition_value for DECLARE ... HANDLER indicates the specific\ncondition or class of conditions that activates the handler:\n\no A MySQL error code (a number) or an SQLSTATE value (a 5-character\n string literal). You should not use MySQL error code 0 or SQLSTATE\n values that begin with \'00\', because those indicate success rather\n than an error condition. For a list of MySQL error codes and SQLSTATE\n values, see\n http://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html.\n\no A condition name previously specified with DECLARE ... CONDITION. A\n condition name can be associated with a MySQL error code or SQLSTATE\n value. See [HELP DECLARE CONDITION].\n\no SQLWARNING is shorthand for the class of SQLSTATE values that begin\n with \'01\'.\n\no NOT FOUND is shorthand for the class of SQLSTATE values that begin\n with \'02\'. This is relevant within the context of cursors and is used\n to control what happens when a cursor reaches the end of a data set.\n If no more rows are available, a No Data condition occurs with\n SQLSTATE value \'02000\'. To detect this condition, you can set up a\n handler for it (or for a NOT FOUND condition). For an example, see\n http://dev.mysql.com/doc/refman/5.5/en/cursors.html. This condition\n also occurs for SELECT ... INTO var_list statements that retrieve no\n rows.\n\no SQLEXCEPTION is shorthand for the class of SQLSTATE values that do\n not begin with \'00\', \'01\', or \'02\'.\n\nIf a condition occurs for which no handler has been declared, the\naction taken depends on the condition class:\n\no For SQLEXCEPTION conditions, the stored program terminates at the\n statement that raised the condition, as if there were an EXIT\n handler. If the program was called by another stored program, the\n calling program handles the condition using the handler selection\n rules applied to its own handlers.\n\no For SQLWARNING conditions, the program continues executing, as if\n there were a CONTINUE handler.\n\no For NOT FOUND conditions, if the condition was raised normally, the\n action is CONTINUE. If it was raised by SIGNAL or RESIGNAL, the\n action is EXIT.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/declare-handler.html\n\n','mysql> CREATE TABLE test.t (s1 INT, PRIMARY KEY (s1));\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> delimiter //\n\nmysql> CREATE PROCEDURE handlerdemo ()\n -> BEGIN\n -> DECLARE CONTINUE HANDLER FOR SQLSTATE \'23000\' SET @x2 = 1;\n -> SET @x = 1;\n -> INSERT INTO test.t VALUES (1);\n -> SET @x = 2;\n -> INSERT INTO test.t VALUES (1);\n -> SET @x = 3;\n -> END;\n -> //\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> CALL handlerdemo()//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT @x//\n +------+\n | @x |\n +------+\n | 3 |\n +------+\n 1 row in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/declare-handler.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (314,22,'DOUBLE','DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA normal-size (double-precision) floating-point number. Permissible\nvalues are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and\n2.2250738585072014E-308 to 1.7976931348623157E+308. These are the\ntheoretical limits, based on the IEEE standard. The actual range might\nbe slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits permitted by the hardware. A double-precision floating-point\nnumber is accurate to approximately 15 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (315,22,'TIME','TIME\n\nA time. The range is \'-838:59:59\' to \'838:59:59\'. MySQL displays TIME\nvalues in \'HH:MM:SS\' format, but permits assignment of values to TIME\ncolumns using either strings or numbers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (316,15,'&&','Syntax:\nAND, &&\n\nLogical AND. Evaluates to 1 if all operands are nonzero and not NULL,\nto 0 if one or more operands are 0, otherwise NULL is returned.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html\n\n','mysql> SELECT 1 && 1;\n -> 1\nmysql> SELECT 1 && 0;\n -> 0\nmysql> SELECT 1 && NULL;\n -> NULL\nmysql> SELECT 0 && NULL;\n -> 0\nmysql> SELECT NULL && 0;\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/logical-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (317,11,'X','X(p)\n\nReturns the X-coordinate value for the Point object p as a\ndouble-precision number.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#point-property-functions\n\n','mysql> SELECT X(POINT(56.7, 53.34));\n+-----------------------+\n| X(POINT(56.7, 53.34)) |\n+-----------------------+\n| 56.7 |\n+-----------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#point-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,17,'SYSTEM_USER','Syntax:\nSYSTEM_USER()\n\nSYSTEM_USER() is a synonym for USER().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (319,17,'FOUND_ROWS','Syntax:\nFOUND_ROWS()\n\nA SELECT statement may include a LIMIT clause to restrict the number of\nrows the server returns to the client. In some cases, it is desirable\nto know how many rows the statement would have returned without the\nLIMIT, but without running the statement again. To obtain this row\ncount, include a SQL_CALC_FOUND_ROWS option in the SELECT statement,\nand then invoke FOUND_ROWS() afterward:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name\n -> WHERE id > 100 LIMIT 10;\nmysql> SELECT FOUND_ROWS();\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (320,30,'CROSSES','Crosses(g1,g2)\n\nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon\nor a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\no The two geometries intersect\n\no Their intersection results in a geometry that has a dimension that is\n one less than the maximum dimension of the two given geometries\n\no Their intersection is not equal to either of the two given geometries\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (321,39,'TRUNCATE TABLE','Syntax:\nTRUNCATE [TABLE] tbl_name\n\nTRUNCATE TABLE empties a table completely. It requires the DROP\nprivilege.\n\nLogically, TRUNCATE TABLE is similar to a DELETE statement that deletes\nall rows, or a sequence of DROP TABLE and CREATE TABLE statements. To\nachieve high performance, it bypasses the DML method of deleting data.\nThus, it cannot be rolled back, it does not cause ON DELETE triggers to\nfire, and it cannot be performed for InnoDB tables with parent-child\nforeign key relationships.\n\nAlthough TRUNCATE TABLE is similar to DELETE, it is classified as a DDL\nstatement rather than a DML statement. It differs from DELETE in the\nfollowing ways in MySQL 5.5:\n\no Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n\no Truncate operations cause an implicit commit, and so cannot be rolled\n back.\n\no Truncation operations cannot be performed if the session holds an\n active table lock.\n\no TRUNCATE TABLE fails for an InnoDB table if there are any FOREIGN KEY\n constraints from other tables that reference the table. Foreign key\n constraints between columns of the same table are permitted.\n\no Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is "0 rows affected," which should\n be interpreted as "no information."\n\no As long as the table format file tbl_name.frm is valid, the table can\n be re-created as an empty table with TRUNCATE TABLE, even if the data\n or index files have become corrupted.\n\no Any AUTO_INCREMENT value is reset to its start value. This is true\n even for MyISAM and InnoDB, which normally do not reuse sequence\n values.\n\no When used with partitioned tables, TRUNCATE TABLE preserves the\n partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n\no The TRUNCATE TABLE statement does not invoke ON DELETE triggers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/truncate-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/truncate-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (322,16,'BIT_XOR','Syntax:\nBIT_XOR(expr)\n\nReturns the bitwise XOR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (323,31,'CURRENT_DATE','Syntax:\nCURRENT_DATE, CURRENT_DATE()\n\nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (324,8,'START SLAVE','Syntax:\nSTART SLAVE [thread_types]\n\nSTART SLAVE [SQL_THREAD] UNTIL\n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos\n\nSTART SLAVE [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos\n\nthread_types:\n [thread_type [, thread_type] ... ]\n\nthread_type: IO_THREAD | SQL_THREAD\n\nSTART SLAVE with no thread_type options starts both of the slave\nthreads. The I/O thread reads events from the master server and stores\nthem in the relay log. The SQL thread reads events from the relay log\nand executes them. START SLAVE requires the SUPER privilege.\n\nIf START SLAVE succeeds in starting the slave threads, it returns\nwithout any error. However, even in that case, it might be that the\nslave threads start and then later stop (for example, because they do\nnot manage to connect to the master or read its binary log, or some\nother problem). START SLAVE does not warn you about this. You must\ncheck the slave\'s error log for error messages generated by the slave\nthreads, or check that they are running satisfactorily with SHOW SLAVE\nSTATUS.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/start-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/start-slave.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (325,2,'AREA','Area(poly)\n\nReturns as a double-precision number the area of the Polygon value\npoly, as measured in its spatial reference system.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly = \'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))\';\nmysql> SELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (326,26,'FLUSH','Syntax:\nFLUSH [NO_WRITE_TO_BINLOG | LOCAL]\n flush_option [, flush_option] ...\n\nThe FLUSH statement has several variant forms that clear or reload\nvarious internal caches, flush tables, or acquire locks. To execute\nFLUSH, you must have the RELOAD privilege. Specific flush options might\nrequire additional privileges, as described later.\n\nBy default, the server writes FLUSH statements to the binary log so\nthat they replicate to replication slaves. To suppress logging, use the\noptional NO_WRITE_TO_BINLOG keyword or its alias LOCAL.\n\n*Note*: FLUSH LOGS, FLUSH MASTER, FLUSH SLAVE, and FLUSH TABLES WITH\nREAD LOCK (with or without a table list) are not written to the binary\nlog in any case because they would cause problems if replicated to a\nslave.\n\nThe FLUSH statement causes an implicit commit. See\nhttp://dev.mysql.com/doc/refman/5.5/en/implicit-commit.html.\n\nThe RESET statement is similar to FLUSH. See [HELP RESET], for\ninformation about using the RESET statement with replication.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/flush.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/flush.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (327,23,'BEGIN END','Syntax:\n[begin_label:] BEGIN\n [statement_list]\nEND [end_label]\n\nBEGIN ... END syntax is used for writing compound statements, which can\nappear within stored programs (stored procedures and functions,\ntriggers, and events). A compound statement can contain multiple\nstatements, enclosed by the BEGIN and END keywords. statement_list\nrepresents a list of one or more statements, each terminated by a\nsemicolon (;) statement delimiter. The statement_list itself is\noptional, so the empty compound statement (BEGIN END) is legal.\n\nBEGIN ... END blocks can be nested.\n\nUse of multiple statements requires that a client is able to send\nstatement strings containing the ; statement delimiter. In the mysql\ncommand-line client, this is handled with the delimiter command.\nChanging the ; end-of-statement delimiter (for example, to //) permit ;\nto be used in a program body. For an example, see\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-defining.html.\n\nA BEGIN ... END block can be labeled. See [HELP labels].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/begin-end.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/begin-end.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (328,26,'SHOW PROCEDURE STATUS','Syntax:\nSHOW PROCEDURE STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement is a MySQL extension. It returns characteristics of a\nstored procedure, such as the database, name, type, creator, creation\nand modification dates, and character set information. A similar\nstatement, SHOW FUNCTION STATUS, displays information about stored\nfunctions (see [HELP SHOW FUNCTION STATUS]).\n\nThe LIKE clause, if present, indicates which procedure or function\nnames to match. The WHERE clause can be given to select rows using more\ngeneral conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-procedure-status.html\n\n','mysql> SHOW PROCEDURE STATUS LIKE \'sp1\'\\G\n*************************** 1. row ***************************\n Db: test\n Name: sp1\n Type: PROCEDURE\n Definer: testuser@localhost\n Modified: 2004-08-03 15:29:37\n Created: 2004-08-03 15:29:37\n Security_type: DEFINER\n Comment:\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.5/en/show-procedure-status.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (329,28,'DESCRIBE','Syntax:\n{DESCRIBE | DESC} tbl_name [col_name | wild]\n\nDESCRIBE provides information about the columns in a table. It is a\nshortcut for SHOW COLUMNS FROM. These statements also display\ninformation for views. (See [HELP SHOW COLUMNS].)\n\ncol_name can be a column name, or a string containing the SQL "%" and\n"_" wildcard characters to obtain output only for the columns with\nnames matching the string. There is no need to enclose the string\nwithin quotation marks unless it contains spaces or other special\ncharacters.\n\nmysql> DESCRIBE City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nThe description for SHOW COLUMNS provides more information about the\noutput columns (see [HELP SHOW COLUMNS]).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/describe.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/describe.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (330,26,'SHOW WARNINGS','Syntax:\nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW COUNT(*) WARNINGS\n\nSHOW WARNINGS shows information about the conditions (errors, warnings,\nand notes) that resulted from the last statement in the current session\nthat generated messages. It shows nothing if the last statement used a\ntable and generated no messages. (That is, a statement that uses a\ntable but generates no messages clears the message list.) Statements\nthat do not use tables and do not generate messages have no effect on\nthe message list.\n\nWarnings are generated for DML statements such as INSERT, UPDATE, and\nLOAD DATA INFILE as well as DDL statements such as CREATE TABLE and\nALTER TABLE.\n\nSHOW WARNINGS is also used following EXPLAIN EXTENDED, to display the\nextra information generated by EXPLAIN when the EXTENDED keyword is\nused. See http://dev.mysql.com/doc/refman/5.5/en/explain-extended.html.\n\nThe LIMIT clause has the same syntax as for the SELECT statement. See\nhttp://dev.mysql.com/doc/refman/5.5/en/select.html.\n\nA related statement, SHOW ERRORS, shows only the error conditions (it\nexcludes warnings and notes). See [HELP SHOW ERRORS].\n\nThe SHOW COUNT(*) WARNINGS statement displays the total number of\nerrors, warnings, and notes. You can also retrieve this number from the\nwarning_count system variable:\n\nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-warnings.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-warnings.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (331,10,'DROP USER','Syntax:\nDROP USER user [, user] ...\n\nThe DROP USER statement removes one or more MySQL accounts and their\nprivileges. It removes privilege rows for the account from all grant\ntables. To use this statement, you must have the global CREATE USER\nprivilege or the DELETE privilege for the mysql database. Each account\nname uses the format described in\nhttp://dev.mysql.com/doc/refman/5.5/en/account-names.html. For example:\n\nDROP USER \'jeffrey\'@\'localhost\';\n\nIf you specify only the user name part of the account name, a host name\npart of \'%\' is used.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-user.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-user.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (332,16,'STDDEV_POP','Syntax:\nSTDDEV_POP(expr)\n\nReturns the population standard deviation of expr (the square root of\nVAR_POP()). You can also use STD() or STDDEV(), which are equivalent\nbut not standard SQL.\n\nSTDDEV_POP() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (333,26,'SHOW CHARACTER SET','Syntax:\nSHOW CHARACTER SET\n [LIKE \'pattern\' | WHERE expr]\n\nThe SHOW CHARACTER SET statement shows all available character sets.\nThe LIKE clause, if present, indicates which character set names to\nmatch. The WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html. For example:\n\nmysql> SHOW CHARACTER SET LIKE \'latin%\';\n+---------+-----------------------------+-------------------+--------+\n| Charset | Description | Default collation | Maxlen |\n+---------+-----------------------------+-------------------+--------+\n| latin1 | cp1252 West European | latin1_swedish_ci | 1 |\n| latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 |\n| latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 |\n| latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 |\n+---------+-----------------------------+-------------------+--------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-character-set.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-character-set.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (334,37,'SUBSTRING','Syntax:\nSUBSTRING(str,pos), SUBSTRING(str FROM pos), SUBSTRING(str,pos,len),\nSUBSTRING(str FROM pos FOR len)\n\nThe forms without a len argument return a substring from string str\nstarting at position pos. The forms with a len argument return a\nsubstring len characters long from string str, starting at position\npos. The forms that use FROM are standard SQL syntax. It is also\npossible to use a negative value for pos. In this case, the beginning\nof the substring is pos characters from the end of the string, rather\nthan the beginning. A negative value may be used for pos in any of the\nforms of this function.\n\nFor all forms of SUBSTRING(), the position of the first character in\nthe string from which the substring is to be extracted is reckoned as\n1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT SUBSTRING(\'Quadratically\',5);\n -> \'ratically\'\nmysql> SELECT SUBSTRING(\'foobarbar\' FROM 4);\n -> \'barbar\'\nmysql> SELECT SUBSTRING(\'Quadratically\',5,6);\n -> \'ratica\'\nmysql> SELECT SUBSTRING(\'Sakila\', -3);\n -> \'ila\'\nmysql> SELECT SUBSTRING(\'Sakila\', -5, 3);\n -> \'aki\'\nmysql> SELECT SUBSTRING(\'Sakila\' FROM -4 FOR 2);\n -> \'ki\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (335,36,'ISEMPTY','IsEmpty(g)\n\nReturns 1 if the geometry value g is the empty geometry, 0 if it is not\nempty, and -1 if the argument is NULL. If the geometry is empty, it\nrepresents the empty point set.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (336,26,'SHOW FUNCTION STATUS','Syntax:\nSHOW FUNCTION STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement is similar to SHOW PROCEDURE STATUS but for stored\nfunctions. See [HELP SHOW PROCEDURE STATUS].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-function-status.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-function-status.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (337,37,'LTRIM','Syntax:\nLTRIM(str)\n\nReturns the string str with leading space characters removed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT LTRIM(\' barbar\');\n -> \'barbar\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (338,30,'INTERSECTS','Intersects(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 spatially intersects g2.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (339,27,'CALL','Syntax:\nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n\nThe CALL statement invokes a stored procedure that was defined\npreviously with CREATE PROCEDURE.\n\nStored procedures that take no arguments can be invoked without\nparentheses. That is, CALL p() and CALL p are equivalent.\n\nCALL can pass back values to its caller using parameters that are\ndeclared as OUT or INOUT parameters. When the procedure returns, a\nclient program can also obtain the number of rows affected for the\nfinal statement executed within the routine: At the SQL level, call the\nROW_COUNT() function; from the C API, call the mysql_affected_rows()\nfunction.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/call.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/call.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (340,6,'MBRDISJOINT','MBRDisjoint(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are disjoint (do not intersect).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,14,'VALUES','Syntax:\nVALUES(col_name)\n\nIn an INSERT ... ON DUPLICATE KEY UPDATE statement, you can use the\nVALUES(col_name) function in the UPDATE clause to refer to column\nvalues from the INSERT portion of the statement. In other words,\nVALUES(col_name) in the UPDATE clause refers to the value of col_name\nthat would be inserted, had no duplicate-key conflict occurred. This\nfunction is especially useful in multiple-row inserts. The VALUES()\nfunction is meaningful only in the ON DUPLICATE KEY UPDATE clause of\nINSERT statements and returns NULL otherwise. See\nhttp://dev.mysql.com/doc/refman/5.5/en/insert-on-duplicate.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)\n -> ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,37,'SUBSTRING_INDEX','Syntax:\nSUBSTRING_INDEX(str,delim,count)\n\nReturns the substring from string str before count occurrences of the\ndelimiter delim. If count is positive, everything to the left of the\nfinal delimiter (counting from the left) is returned. If count is\nnegative, everything to the right of the final delimiter (counting from\nthe right) is returned. SUBSTRING_INDEX() performs a case-sensitive\nmatch when searching for delim.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT SUBSTRING_INDEX(\'www.mysql.com\', \'.\', 2);\n -> \'www.mysql\'\nmysql> SELECT SUBSTRING_INDEX(\'www.mysql.com\', \'.\', -2);\n -> \'mysql.com\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,12,'ENCODE','Syntax:\nENCODE(str,pass_str)\n\nEncrypt str using pass_str as the password. To decrypt the result, use\nDECODE().\n\nThe result is a binary string of the same length as str.\n\nThe strength of the encryption is based on how good the random\ngenerator is. It should suffice for short strings.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,23,'LOOP','Syntax:\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\nLOOP implements a simple loop construct, enabling repeated execution of\nthe statement list, which consists of one or more statements, each\nterminated by a semicolon (;) statement delimiter. The statements\nwithin the loop are repeated until the loop is terminated. Usually,\nthis is accomplished with a LEAVE statement. Within a stored function,\nRETURN can also be used, which exits the function entirely.\n\nNeglecting to include a loop-termination statement results in an\ninfinite loop.\n\nA LOOP statement can be labeled. For the rules regarding label use, see\n[HELP labels].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/loop.html\n\n','CREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n label1: LOOP\n SET p1 = p1 + 1;\n IF p1 < 10 THEN\n ITERATE label1;\n END IF;\n LEAVE label1;\n END LOOP label1;\n SET @x = p1;\nEND;\n','http://dev.mysql.com/doc/refman/5.5/en/loop.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,4,'TRUNCATE','Syntax:\nTRUNCATE(X,D)\n\nReturns the number X, truncated to D decimal places. If D is 0, the\nresult has no decimal point or fractional part. D can be negative to\ncause D digits left of the decimal point of the value X to become zero.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT TRUNCATE(1.223,1);\n -> 1.2\nmysql> SELECT TRUNCATE(1.999,1);\n -> 1.9\nmysql> SELECT TRUNCATE(1.999,0);\n -> 1\nmysql> SELECT TRUNCATE(-1.999,1);\n -> -1.9\nmysql> SELECT TRUNCATE(122,-2);\n -> 100\nmysql> SELECT TRUNCATE(10.28*100,0);\n -> 1028\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,31,'TIMESTAMPADD','Syntax:\nTIMESTAMPADD(unit,interval,datetime_expr)\n\nAdds the integer expression interval to the date or datetime expression\ndatetime_expr. The unit for interval is given by the unit argument,\nwhich should be one of the following values: MICROSECOND\n(microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or\nYEAR.\n\nIt is possible to use FRAC_SECOND in place of MICROSECOND, but\nFRAC_SECOND is deprecated. FRAC_SECOND was removed in MySQL 5.5.3.\n\nThe unit value may be specified using one of keywords as shown, or with\na prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMPADD(MINUTE,1,\'2003-01-02\');\n -> \'2003-01-02 00:01:00\'\nmysql> SELECT TIMESTAMPADD(WEEK,1,\'2003-01-02\');\n -> \'2003-01-09\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,26,'SHOW','SHOW has many forms that provide information about databases, tables,\ncolumns, or status information about the server. This section describes\nthose following:\n\nSHOW AUTHORS\nSHOW {BINARY | MASTER} LOGS\nSHOW BINLOG EVENTS [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE FUNCTION func_name\nSHOW CREATE PROCEDURE proc_name\nSHOW CREATE TABLE tbl_name\nSHOW CREATE TRIGGER trigger_name\nSHOW CREATE VIEW view_name\nSHOW DATABASES [like_or_where]\nSHOW ENGINE engine_name {STATUS | MUTEX}\nSHOW [STORAGE] ENGINES\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW MASTER STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW SLAVE HOSTS\nSHOW SLAVE STATUS\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW [FULL] TABLES [FROM db_name] [like_or_where]\nSHOW TRIGGERS [FROM db_name] [like_or_where]\nSHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\nSHOW WARNINGS [LIMIT [offset,] row_count]\n\nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n\nIf the syntax for a given SHOW statement includes a LIKE \'pattern\'\npart, \'pattern\' is a string that can contain the SQL "%" and "_"\nwildcard characters. The pattern is useful for restricting statement\noutput to matching values.\n\nSeveral SHOW statements also accept a WHERE clause that provides more\nflexibility in specifying which rows to display. See\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,18,'GREATEST','Syntax:\nGREATEST(value1,value2,...)\n\nWith two or more arguments, returns the largest (maximum-valued)\nargument. The arguments are compared using the same rules as for\nLEAST().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT GREATEST(2,0);\n -> 2\nmysql> SELECT GREATEST(34.0,3.0,5.0,767.0);\n -> 767.0\nmysql> SELECT GREATEST(\'B\',\'A\',\'C\');\n -> \'C\'\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (349,26,'SHOW VARIABLES','Syntax:\nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW VARIABLES shows the values of MySQL system variables. This\ninformation also can be obtained using the mysqladmin variables\ncommand. The LIKE clause, if present, indicates which variable names to\nmatch. The WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html. This\nstatement does not require any privilege. It requires only the ability\nto connect to the server.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are\nused for new connections to MySQL. As of MySQL 5.5.3, if a variable has\nno global value, no value is displayed. Before 5.5.3, the session value\nis displayed. With SESSION, SHOW VARIABLES displays the values that are\nin effect for the current connection. If no modifier is present, the\ndefault is SESSION. LOCAL is a synonym for SESSION.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern. To obtain the row for a\nspecific variable, use a LIKE clause as shown:\n\nSHOW VARIABLES LIKE \'max_join_size\';\nSHOW SESSION VARIABLES LIKE \'max_join_size\';\n\nTo get a list of variables whose name match a pattern, use the "%"\nwildcard character in a LIKE clause:\n\nSHOW VARIABLES LIKE \'%size%\';\nSHOW GLOBAL VARIABLES LIKE \'%size%\';\n\nWildcard characters can be used in any position within the pattern to\nbe matched. Strictly speaking, because "_" is a wildcard that matches\nany single character, you should escape it as "\\_" to match it\nliterally. In practice, this is rarely necessary.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-variables.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-variables.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (350,26,'BINLOG','Syntax:\nBINLOG \'str\'\n\nBINLOG is an internal-use statement. It is generated by the mysqlbinlog\nprogram as the printable representation of certain events in binary log\nfiles. (See http://dev.mysql.com/doc/refman/5.5/en/mysqlbinlog.html.)\nThe \'str\' value is a base 64-encoded string the that server decodes to\ndetermine the data change indicated by the corresponding event. This\nstatement requires the SUPER privilege.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/binlog.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/binlog.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (351,16,'BIT_AND','Syntax:\nBIT_AND(expr)\n\nReturns the bitwise AND of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,31,'SECOND','Syntax:\nSECOND(time)\n\nReturns the second for time, in the range 0 to 59.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT SECOND(\'10:05:03\');\n -> 3\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,4,'ATAN2','Syntax:\nATAN(Y,X), ATAN2(Y,X)\n\nReturns the arc tangent of the two variables X and Y. It is similar to\ncalculating the arc tangent of Y / X, except that the signs of both\narguments are used to determine the quadrant of the result.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ATAN(-2,2);\n -> -0.78539816339745\nmysql> SELECT ATAN2(PI(),0);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,6,'MBRCONTAINS','MBRContains(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\ncontains the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRWithin().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','mysql> SET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nmysql> SET @g2 = GeomFromText(\'Point(1 1)\');\nmysql> SELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,31,'HOUR','Syntax:\nHOUR(time)\n\nReturns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much\nlarger, so HOUR can return values greater than 23.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT HOUR(\'10:05:03\');\n -> 10\nmysql> SELECT HOUR(\'272:59:59\');\n -> 272\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,27,'SELECT','Syntax:\nSELECT\n [ALL | DISTINCT | DISTINCTROW ]\n [HIGH_PRIORITY]\n [STRAIGHT_JOIN]\n [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n select_expr [, select_expr ...]\n [FROM table_references\n [WHERE where_condition]\n [GROUP BY {col_name | expr | position}\n [ASC | DESC], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position}\n [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\'\n [CHARACTER SET charset_name]\n export_options\n | INTO DUMPFILE \'file_name\'\n | INTO var_name [, var_name]]\n [FOR UPDATE | LOCK IN SHARE MODE]]\n\nSELECT is used to retrieve rows selected from one or more tables, and\ncan include UNION statements and subqueries. See [HELP UNION], and\nhttp://dev.mysql.com/doc/refman/5.5/en/subqueries.html.\n\nThe most commonly used clauses of SELECT statements are these:\n\no Each select_expr indicates a column that you want to retrieve. There\n must be at least one select_expr.\n\no table_references indicates the table or tables from which to retrieve\n rows. Its syntax is described in [HELP JOIN].\n\no The WHERE clause, if given, indicates the condition or conditions\n that rows must satisfy to be selected. where_condition is an\n expression that evaluates to true for each row to be selected. The\n statement selects all rows if there is no WHERE clause.\n\n In the WHERE expression, you can use any of the functions and\n operators that MySQL supports, except for aggregate (summary)\n functions. See\n http://dev.mysql.com/doc/refman/5.5/en/expressions.html, and\n http://dev.mysql.com/doc/refman/5.5/en/functions.html.\n\nSELECT can also be used to retrieve rows computed without reference to\nany table.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/select.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/select.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (357,4,'COT','Syntax:\nCOT(X)\n\nReturns the cotangent of X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT COT(12);\n -> -1.5726734063977\nmysql> SELECT COT(0);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (358,26,'SHOW CREATE EVENT','Syntax:\nSHOW CREATE EVENT event_name\n\nThis statement displays the CREATE EVENT statement needed to re-create\na given event. It requires the EVENT privilege for the database from\nwhich the event is to be shown. For example (using the same event\ne_daily defined and then altered in [HELP SHOW EVENTS]):\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-event.html\n\n','mysql> SHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row ***************************\n Event: e_daily\n sql_mode:\n time_zone: SYSTEM\n Create Event: CREATE EVENT `e_daily`\n ON SCHEDULE EVERY 1 DAY\n STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR\n ON COMPLETION NOT PRESERVE\n ENABLE\n COMMENT \'Saves total number of sessions then\n clears the table each day\'\n DO BEGIN\n INSERT INTO site_activity.totals (time, total)\n SELECT CURRENT_TIMESTAMP, COUNT(*)\n FROM site_activity.sessions;\n DELETE FROM site_activity.sessions;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.5/en/show-create-event.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (359,37,'LOAD_FILE','Syntax:\nLOAD_FILE(file_name)\n\nReads the file and returns the file contents as a string. To use this\nfunction, the file must be located on the server host, you must specify\nthe full path name to the file, and you must have the FILE privilege.\nThe file must be readable by all and its size less than\nmax_allowed_packet bytes. If the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nIf the file does not exist or cannot be read because one of the\npreceding conditions is not satisfied, the function returns NULL.\n\nThe character_set_filesystem system variable controls interpretation of\nfile names that are given as literal strings.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> UPDATE t\n SET blob_col=LOAD_FILE(\'/tmp/picture\')\n WHERE id=1;\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (360,3,'POINTFROMTEXT','PointFromText(wkt[,srid])\n\nConstructs a POINT value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (361,16,'GROUP_CONCAT','Syntax:\nGROUP_CONCAT(expr)\n\nThis function returns a string result with the concatenated non-NULL\nvalues from a group. It returns NULL if there are no non-NULL values.\nThe full syntax is as follows:\n\nGROUP_CONCAT([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [SEPARATOR str_val])\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT student_name,\n -> GROUP_CONCAT(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (362,31,'DATE_FORMAT','Syntax:\nDATE_FORMAT(date,format)\n\nFormats the date value according to the format string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DATE_FORMAT(\'2009-10-04 22:23:00\', \'%W %M %Y\');\n -> \'Sunday October 2009\'\nmysql> SELECT DATE_FORMAT(\'2007-10-04 22:23:00\', \'%H:%i:%s\');\n -> \'22:23:00\'\nmysql> SELECT DATE_FORMAT(\'1900-10-04 22:23:00\',\n -> \'%D %y %a %d %m %b %j\');\n -> \'4th 00 Thu 04 10 Oct 277\'\nmysql> SELECT DATE_FORMAT(\'1997-10-04 22:23:00\',\n -> \'%H %k %I %r %T %S %w\');\n -> \'22 22 10 10:23:00 PM 22:23:00 00 6\'\nmysql> SELECT DATE_FORMAT(\'1999-01-01\', \'%X %V\');\n -> \'1998 52\'\nmysql> SELECT DATE_FORMAT(\'2006-06-00\', \'%d\');\n -> \'00\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (363,17,'BENCHMARK','Syntax:\nBENCHMARK(count,expr)\n\nThe BENCHMARK() function executes the expression expr repeatedly count\ntimes. It may be used to time how quickly MySQL processes the\nexpression. The result value is always 0. The intended use is from\nwithin the mysql client, which reports query execution times:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\'));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE(\'hello\',\'goodbye\')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (4.74 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (364,31,'YEAR','Syntax:\nYEAR(date)\n\nReturns the year for date, in the range 1000 to 9999, or 0 for the\n"zero" date.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT YEAR(\'1987-01-01\');\n -> 1987\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (365,26,'SHOW ENGINE','Syntax:\nSHOW ENGINE engine_name {STATUS | MUTEX}\n\nSHOW ENGINE displays operational information about a storage engine.\nThe following statements currently are supported:\n\nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE {NDB | NDBCLUSTER} STATUS\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n\nSHOW ENGINE INNODB STATUS displays extensive information from the\nstandard InnoDB Monitor about the state of the InnoDB storage engine.\nFor information about the standard monitor and other InnoDB Monitors\nthat provide information about InnoDB processing, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-monitors.html.\n\nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics. The\nstatement displays the following fields:\n\no Type\n\n Always InnoDB.\n\no Name\n\n The source file where the mutex is implemented, and the line number\n in the file where the mutex is created. The line number may change\n depending on your version of MySQL.\n\no Status\n\n The mutex status. This field displays several values if UNIV_DEBUG\n was defined at MySQL compilation time (for example, in include/univ.i\n in the InnoDB part of the MySQL source tree). If UNIV_DEBUG was not\n defined, the statement displays only the os_waits value. In the\n latter case (without UNIV_DEBUG), the information on which the output\n is based is insufficient to distinguish regular mutexes and mutexes\n that protect rw-locks (which permit multiple readers or a single\n writer). Consequently, the output may appear to contain multiple rows\n for the same mutex.\n\n o count indicates how many times the mutex was requested.\n\n o spin_waits indicates how many times the spinlock had to run.\n\n o spin_rounds indicates the number of spinlock rounds. (spin_rounds\n divided by spin_waits provides the average round count.)\n\n o os_waits indicates the number of operating system waits. This\n occurs when the spinlock did not work (the mutex was not locked\n during the spinlock and it was necessary to yield to the operating\n system and wait).\n\n o os_yields indicates the number of times a the thread trying to lock\n a mutex gave up its timeslice and yielded to the operating system\n (on the presumption that permitting other threads to run will free\n the mutex so that it can be locked).\n\n o os_wait_times indicates the amount of time (in ms) spent in\n operating system waits, if the timed_mutexes system variable is 1\n (ON). If timed_mutexes is 0 (OFF), timing is disabled, so\n os_wait_times is 0. timed_mutexes is off by default.\n\nInformation from this statement can be used to diagnose system\nproblems. For example, large values of spin_waits and spin_rounds may\nindicate scalability problems.\n\nUse SHOW ENGINE PERFORMANCE_SCHEMA STATUS to inspect the internal\noperation of the Performance Schema code:\n\nmysql> SHOW ENGINE PERFORMANCE_SCHEMA STATUS\\G\n...\n*************************** 3. row ***************************\n Type: performance_schema\n Name: events_waits_history.row_size\nStatus: 76\n*************************** 4. row ***************************\n Type: performance_schema\n Name: events_waits_history.row_count\nStatus: 10000\n*************************** 5. row ***************************\n Type: performance_schema\n Name: events_waits_history.memory\nStatus: 760000\n...\n*************************** 57. row ***************************\n Type: performance_schema\n Name: performance_schema.memory\nStatus: 26459600\n...\n\nThe intent of this statement is to help the DBA to understand the\neffects that different options have on memory requirements.\n\nName values consist of two parts, which name an internal buffer and an\nattribute of the buffer, respectively:\n\no Internal buffers that are exposed as a table in the\n performance_schema database are named after the table. Examples:\n events_waits_history.row_size, mutex_instances.row_count.\n\no Internal buffers that are not exposed as a table are named within\n parentheses. Examples: (pfs_cond_class).row_size,\n (pfs_mutex_class).memory.\n\no Values that apply to the Performance Schema as a whole begin with\n performance_schema. Example: performance_schema.memory.\n\nAttributes have these meanings:\n\no row_size cannot be changed. It is the size of the internal record\n used by the implementation.\n\no row_count can be changed depending on the configuration options.\n\no For a table, tbl_name.memory is the product of row_size multiplied by\n row_count. For the Performance Schema as a whole,\n performance_schema.memory is the sum of all the memory used (the sum\n of all other memory values).\n\nIn some cases, there is a direct relationship between a configuration\nparameter and a SHOW ENGINE value. For example,\nevents_waits_history_long.row_count corresponds to\nperformance_schema_events_waits_history_long_size. In other cases, the\nrelationship is more complex. For example,\nevents_waits_history.row_count corresponds to\nperformance_schema_events_waits_history_size (the number of rows per\nthread) multiplied by performance_schema_max_thread_instances ( the\nnumber of threads).\n\nIf the server has the NDBCLUSTER storage engine enabled, SHOW ENGINE\nNDB STATUS displays cluster status information such as the number of\nconnected data nodes, the cluster connectstring, and cluster binlog\nepochs, as well as counts of various Cluster API objects created by the\nMySQL Server when connected to the cluster. Sample output from this\nstatement is shown here:\n\nmysql> SHOW ENGINE NDB STATUS;\n+------------+-----------------------+--------------------------------------------------+\n| Type | Name | Status |\n+------------+-----------------------+--------------------------------------------------+\n| ndbcluster | connection | cluster_node_id=7,\n connected_host=192.168.0.103, connected_port=1186, number_of_data_nodes=4,\n number_of_ready_data_nodes=3, connect_count=0 |\n| ndbcluster | NdbTransaction | created=6, free=0, sizeof=212 |\n| ndbcluster | NdbOperation | created=8, free=8, sizeof=660 |\n| ndbcluster | NdbIndexScanOperation | created=1, free=1, sizeof=744 |\n| ndbcluster | NdbIndexOperation | created=0, free=0, sizeof=664 |\n| ndbcluster | NdbRecAttr | created=1285, free=1285, sizeof=60 |\n| ndbcluster | NdbApiSignal | created=16, free=16, sizeof=136 |\n| ndbcluster | NdbLabel | created=0, free=0, sizeof=196 |\n| ndbcluster | NdbBranch | created=0, free=0, sizeof=24 |\n| ndbcluster | NdbSubroutine | created=0, free=0, sizeof=68 |\n| ndbcluster | NdbCall | created=0, free=0, sizeof=16 |\n| ndbcluster | NdbBlob | created=1, free=1, sizeof=264 |\n| ndbcluster | NdbReceiver | created=4, free=0, sizeof=68 |\n| ndbcluster | binlog | latest_epoch=155467, latest_trans_epoch=148126,\n latest_received_binlog_epoch=0, latest_handled_binlog_epoch=0,\n latest_applied_binlog_epoch=0 |\n+------------+-----------------------+--------------------------------------------------+\n\nThe rows with connection and binlog in the Name column were added to\nthe output of this statement in MySQL 5.1. The Status column in each of\nthese rows provides information about the MySQL server\'s connection to\nthe cluster and about the cluster binary log\'s status, respectively.\nThe Status information is in the form of comma-delimited set of\nname/value pairs.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-engine.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-engine.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (366,14,'NAME_CONST','Syntax:\nNAME_CONST(name,value)\n\nReturns the given value. When used to produce a result set column,\nNAME_CONST() causes the column to have the given name. The arguments\nshould be constants.\n\nmysql> SELECT NAME_CONST(\'myname\', 14);\n+--------+\n| myname |\n+--------+\n| 14 |\n+--------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (367,14,'RELEASE_LOCK','Syntax:\nRELEASE_LOCK(str)\n\nReleases the lock named by the string str that was obtained with\nGET_LOCK(). Returns 1 if the lock was released, 0 if the lock was not\nestablished by this thread (in which case the lock is not released),\nand NULL if the named lock did not exist. The lock does not exist if it\nwas never obtained by a call to GET_LOCK() or if it has previously been\nreleased.\n\nThe DO statement is convenient to use with RELEASE_LOCK(). See [HELP\nDO].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (368,18,'IS NULL','Syntax:\nIS NULL\n\nTests whether a value is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;\n -> 0, 0, 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (369,31,'CONVERT_TZ','Syntax:\nCONVERT_TZ(dt,from_tz,to_tz)\n\nCONVERT_TZ() converts a datetime value dt from the time zone given by\nfrom_tz to the time zone given by to_tz and returns the resulting\nvalue. Time zones are specified as described in\nhttp://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html. This\nfunction returns NULL if the arguments are invalid.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT CONVERT_TZ(\'2004-01-01 12:00:00\',\'GMT\',\'MET\');\n -> \'2004-01-01 13:00:00\'\nmysql> SELECT CONVERT_TZ(\'2004-01-01 12:00:00\',\'+00:00\',\'+10:00\');\n -> \'2004-01-01 22:00:00\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (370,31,'TIME_TO_SEC','Syntax:\nTIME_TO_SEC(time)\n\nReturns the time argument, converted to seconds.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIME_TO_SEC(\'22:23:00\');\n -> 80580\nmysql> SELECT TIME_TO_SEC(\'00:39:38\');\n -> 2378\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (371,31,'WEEKDAY','Syntax:\nWEEKDAY(date)\n\nReturns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 =\nSunday).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT WEEKDAY(\'2008-02-03 22:23:00\');\n -> 6\nmysql> SELECT WEEKDAY(\'2007-11-06\');\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (372,37,'EXPORT_SET','Syntax:\nEXPORT_SET(bits,on,off[,separator[,number_of_bits]])\n\nReturns a string such that for every bit set in the value bits, you get\nan on string and for every bit not set in the value, you get an off\nstring. Bits in bits are examined from right to left (from low-order to\nhigh-order bits). Strings are added to the result from left to right,\nseparated by the separator string (the default being the comma\ncharacter ","). The number of bits examined is given by number_of_bits,\nwhich has a default of 64 if not specified. number_of_bits is silently\nclipped to 64 if larger than 64. It is treated as an unsigned integer,\nso a value of -1 is effectively the same as 64.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT EXPORT_SET(5,\'Y\',\'N\',\',\',4);\n -> \'Y,N,Y,N\'\nmysql> SELECT EXPORT_SET(6,\'1\',\'0\',\',\',10);\n -> \'0,1,1,0,0,0,0,0,0,0\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (373,39,'ALTER SERVER','Syntax:\nALTER SERVER server_name\n OPTIONS (option [, option] ...)\n\nAlters the server information for server_name, adjusting any of the\noptions permitted in the CREATE SERVER statement. See [HELP CREATE\nSERVER]. The corresponding fields in the mysql.servers table are\nupdated accordingly. This statement requires the SUPER privilege.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-server.html\n\n','ALTER SERVER s OPTIONS (USER \'sally\');\n','http://dev.mysql.com/doc/refman/5.5/en/alter-server.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (374,23,'RESIGNAL','Syntax:\nRESIGNAL [condition_value]\n [SET signal_information_item\n [, signal_information_item] ...]\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n\nsignal_information_item:\n condition_information_item_name = simple_value_specification\n\ncondition_information_item_name:\n CLASS_ORIGIN\n | SUBCLASS_ORIGIN\n | MESSAGE_TEXT\n | MYSQL_ERRNO\n | CONSTRAINT_CATALOG\n | CONSTRAINT_SCHEMA\n | CONSTRAINT_NAME\n | CATALOG_NAME\n | SCHEMA_NAME\n | TABLE_NAME\n | COLUMN_NAME\n | CURSOR_NAME\n\ncondition_name, simple_value_specification:\n (see following discussion)\n\nRESIGNAL passes on the error condition information that is available\nduring execution of a condition handler within a compound statement\ninside a stored procedure or function, trigger, or event. RESIGNAL may\nchange some or all information before passing it on. RESIGNAL is\nrelated to SIGNAL, but instead of originating a condition as SIGNAL\ndoes, RESIGNAL relays existing condition information, possibly after\nmodifying it.\n\nRESIGNAL makes it possible to both handle an error and return the error\ninformation. Otherwise, by executing an SQL statement within the\nhandler, information that caused the handler\'s activation is destroyed.\nRESIGNAL also can make some procedures shorter if a given handler can\nhandle part of a situation, then pass the condition "up the line" to\nanother handler.\n\nNo special privileges are required to execute the RESIGNAL statement.\n\nFor condition_value and signal_information_item, the definitions and\nrules are the same for RESIGNAL as for SIGNAL (see [HELP SIGNAL]).\n\nThe RESIGNAL statement takes condition_value and SET clauses, both of\nwhich are optional. This leads to several possible uses:\n\no RESIGNAL alone:\n\nRESIGNAL;\n\no RESIGNAL with new signal information:\n\nRESIGNAL SET signal_information_item [, signal_information_item] ...;\n\no RESIGNAL with a condition value and possibly new signal information:\n\nRESIGNAL condition_value\n [SET signal_information_item [, signal_information_item] ...];\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/resignal.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/resignal.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (375,31,'TIME FUNCTION','Syntax:\nTIME(expr)\n\nExtracts the time part of the time or datetime expression expr and\nreturns it as a string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT TIME(\'2003-12-31 01:02:03\');\n -> \'01:02:03\'\nmysql> SELECT TIME(\'2003-12-31 01:02:03.000123\');\n -> \'01:02:03.000123\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (376,31,'DATE_ADD','Syntax:\nDATE_ADD(date,INTERVAL expr unit), DATE_SUB(date,INTERVAL expr unit)\n\nThese functions perform date arithmetic. The date argument specifies\nthe starting date or datetime value. expr is an expression specifying\nthe interval value to be added or subtracted from the starting date.\nexpr is a string; it may start with a "-" for negative intervals. unit\nis a keyword indicating the units in which the expression should be\ninterpreted.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\n -> \'2009-01-01 00:00:00\'\nmysql> SELECT INTERVAL 1 DAY + \'2008-12-31\';\n -> \'2009-01-01\'\nmysql> SELECT \'2005-01-01\' - INTERVAL 1 SECOND;\n -> \'2004-12-31 23:59:59\'\nmysql> SELECT DATE_ADD(\'2000-12-31 23:59:59\',\n -> INTERVAL 1 SECOND);\n -> \'2001-01-01 00:00:00\'\nmysql> SELECT DATE_ADD(\'2010-12-31 23:59:59\',\n -> INTERVAL 1 DAY);\n -> \'2011-01-01 23:59:59\'\nmysql> SELECT DATE_ADD(\'2100-12-31 23:59:59\',\n -> INTERVAL \'1:1\' MINUTE_SECOND);\n -> \'2101-01-01 00:01:00\'\nmysql> SELECT DATE_SUB(\'2005-01-01 00:00:00\',\n -> INTERVAL \'1 1:1:1\' DAY_SECOND);\n -> \'2004-12-30 22:58:59\'\nmysql> SELECT DATE_ADD(\'1900-01-01 00:00:00\',\n -> INTERVAL \'-1 10\' DAY_HOUR);\n -> \'1899-12-30 14:00:00\'\nmysql> SELECT DATE_SUB(\'1998-01-02\', INTERVAL 31 DAY);\n -> \'1997-12-02\'\nmysql> SELECT DATE_ADD(\'1992-12-31 23:59:59.000002\',\n -> INTERVAL \'1.999999\' SECOND_MICROSECOND);\n -> \'1993-01-01 00:00:01.000001\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (377,37,'CAST','Syntax:\nCAST(expr AS type)\n\nThe CAST() function takes an expression of any type and produces a\nresult value of a specified type, similar to CONVERT(). See the\ndescription of CONVERT() for more information.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (378,37,'SOUNDS LIKE','Syntax:\nexpr1 SOUNDS LIKE expr2\n\nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (379,31,'PERIOD_DIFF','Syntax:\nPERIOD_DIFF(P1,P2)\n\nReturns the number of months between periods P1 and P2. P1 and P2\nshould be in the format YYMM or YYYYMM. Note that the period arguments\nP1 and P2 are not date values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT PERIOD_DIFF(200802,200703);\n -> 11\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (380,37,'LIKE','Syntax:\nexpr LIKE pat [ESCAPE \'escape_char\']\n\nPattern matching using SQL simple regular expression comparison.\nReturns 1 (TRUE) or 0 (FALSE). If either expr or pat is NULL, the\nresult is NULL.\n\nThe pattern need not be a literal string. For example, it can be\nspecified as a string expression or table column.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html\n\n','mysql> SELECT \'David!\' LIKE \'David_\';\n -> 1\nmysql> SELECT \'David!\' LIKE \'%D%v%\';\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (381,24,'MULTIPOINT','MultiPoint(pt1,pt2,...)\n\nConstructs a MultiPoint value using Point or WKB Point arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (382,19,'>>','Syntax:\n>>\n\nShifts a longlong (BIGINT) number to the right.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 4 >> 2;\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (383,23,'FETCH','Syntax:\nFETCH [[NEXT] FROM] cursor_name INTO var_name [, var_name] ...\n\nThis statement fetches the next row for the SELECT statement associated\nwith the specified cursor (which must be open), and advances the cursor\npointer. If a row exists, the fetched columns are stored in the named\nvariables. The number of columns retrieved by the SELECT statement must\nmatch the number of output variables specified in the FETCH statement.\n\nIf no more rows are available, a No Data condition occurs with SQLSTATE\nvalue \'02000\'. To detect this condition, you can set up a handler for\nit (or for a NOT FOUND condition). For an example, see\nhttp://dev.mysql.com/doc/refman/5.5/en/cursors.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/fetch.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/fetch.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (384,16,'AVG','Syntax:\nAVG([DISTINCT] expr)\n\nReturns the average value of expr. The DISTINCT option can be used to\nreturn the average of the distinct values of expr.\n\nAVG() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT student_name, AVG(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (385,29,'TRUE FALSE','The constants TRUE and FALSE evaluate to 1 and 0, respectively. The\nconstant names can be written in any lettercase.\n\nmysql> SELECT TRUE, true, FALSE, false;\n -> 1, 1, 0, 0\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/boolean-literals.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/boolean-literals.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (386,6,'MBRWITHIN','MBRWithin(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\nis within the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRContains().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr\n\n','mysql> SET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nmysql> SET @g2 = GeomFromText(\'Polygon((0 0,0 5,5 5,5 0,0 0))\');\nmysql> SELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#relations-on-geometry-mbr');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (387,17,'SESSION_USER','Syntax:\nSESSION_USER()\n\nSESSION_USER() is a synonym for USER().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (388,18,'IN','Syntax:\nexpr IN (value,...)\n\nReturns 1 if expr is equal to any of the values in the IN list, else\nreturns 0. If all values are constants, they are evaluated according to\nthe type of expr and sorted. The search for the item then is done using\na binary search. This means IN is very quick if the IN value list\nconsists entirely of constants. Otherwise, type conversion takes place\naccording to the rules described in\nhttp://dev.mysql.com/doc/refman/5.5/en/type-conversion.html, but\napplied to all the arguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 2 IN (0,3,5,7);\n -> 0\nmysql> SELECT \'wefwf\' IN (\'wee\',\'wefwf\',\'weg\');\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (389,37,'QUOTE','Syntax:\nQUOTE(str)\n\nQuotes a string to produce a result that can be used as a properly\nescaped data value in an SQL statement. The string is returned enclosed\nby single quotation marks and with each instance of backslash ("\\"),\nsingle quote ("\'"), ASCII NUL, and Control+Z preceded by a backslash.\nIf the argument is NULL, the return value is the word "NULL" without\nenclosing single quotation marks.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT QUOTE(\'Don\\\'t!\');\n -> \'Don\\\'t!\'\nmysql> SELECT QUOTE(NULL);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (390,26,'HELP COMMAND','Syntax:\nmysql> help search_string\n\nIf you provide an argument to the help command, mysql uses it as a\nsearch string to access server-side help from the contents of the MySQL\nReference Manual. The proper operation of this command requires that\nthe help tables in the mysql database be initialized with help topic\ninformation (see\nhttp://dev.mysql.com/doc/refman/5.5/en/server-side-help-support.html).\n\nIf there is no match for the search string, the search fails:\n\nmysql> help me\n\nNothing found\nPlease try to run \'help contents\' for a list of all accessible topics\n\nUse help contents to see a list of the help categories:\n\nmysql> help contents\nYou asked for help about help category: "Contents"\nFor more information, type \'help <item>\', where <item> is one of the\nfollowing categories:\n Account Management\n Administration\n Data Definition\n Data Manipulation\n Data Types\n Functions\n Functions and Modifiers for Use with GROUP BY\n Geographic Features\n Language Structure\n Plugins\n Storage Engines\n Stored Routines\n Table Maintenance\n Transactions\n Triggers\n\nIf the search string matches multiple items, mysql shows a list of\nmatching topics:\n\nmysql> help logs\nMany help items for your request exist.\nTo make a more specific request, please type \'help <item>\',\nwhere <item> is one of the following topics:\n SHOW\n SHOW BINARY LOGS\n SHOW ENGINE\n SHOW LOGS\n\nUse a topic as the search string to see the help entry for that topic:\n\nmysql> help show binary logs\nName: \'SHOW BINARY LOGS\'\nDescription:\nSyntax:\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nLists the binary log files on the server. This statement is used as\npart of the procedure described in [purge-binary-logs], that shows how\nto determine which logs can be purged.\n\nmysql> SHOW BINARY LOGS;\n+---------------+-----------+\n| Log_name | File_size |\n+---------------+-----------+\n| binlog.000015 | 724935 |\n| binlog.000016 | 733481 |\n+---------------+-----------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mysql-server-side-help.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/mysql-server-side-help.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (391,31,'QUARTER','Syntax:\nQUARTER(date)\n\nReturns the quarter of the year for date, in the range 1 to 4.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT QUARTER(\'2008-04-01\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (392,37,'POSITION','Syntax:\nPOSITION(substr IN str)\n\nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (393,26,'SHOW CREATE FUNCTION','Syntax:\nSHOW CREATE FUNCTION func_name\n\nThis statement is similar to SHOW CREATE PROCEDURE but for stored\nfunctions. See [HELP SHOW CREATE PROCEDURE].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-function.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-create-function.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (394,14,'IS_USED_LOCK','Syntax:\nIS_USED_LOCK(str)\n\nChecks whether the lock named str is in use (that is, locked). If so,\nit returns the connection identifier of the client that holds the lock.\nOtherwise, it returns NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (395,3,'POLYFROMTEXT','PolyFromText(wkt[,srid]), PolygonFromText(wkt[,srid])\n\nConstructs a POLYGON value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (396,12,'DES_ENCRYPT','Syntax:\nDES_ENCRYPT(str[,{key_num|key_str}])\n\nEncrypts the string with the given key using the Triple-DES algorithm.\n\nThis function works only if MySQL has been configured with SSL support.\nSee http://dev.mysql.com/doc/refman/5.5/en/ssl-connections.html.\n\nThe encryption key to use is chosen based on the second argument to\nDES_ENCRYPT(), if one was given. With no argument, the first key from\nthe DES key file is used. With a key_num argument, the given key number\n(0 to 9) from the DES key file is used. With a key_str argument, the\ngiven key string is used to encrypt str.\n\nThe key file can be specified with the --des-key-file server option.\n\nThe return string is a binary string where the first character is\nCHAR(128 | key_num). If an error occurs, DES_ENCRYPT() returns NULL.\n\nThe 128 is added to make it easier to recognize an encrypted key. If\nyou use a string key, key_num is 127.\n\nThe string length for the result is given by this formula:\n\nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n\nEach line in the DES key file has the following format:\n\nkey_num des_key_str\n\nEach key_num value must be a number in the range from 0 to 9. Lines in\nthe file may be in any order. des_key_str is the string that is used to\nencrypt the message. There should be at least one space between the\nnumber and the key. The first key is the default key that is used if\nyou do not specify any key argument to DES_ENCRYPT().\n\nYou can tell MySQL to read new key values from the key file with the\nFLUSH DES_KEY_FILE statement. This requires the RELOAD privilege.\n\nOne benefit of having a set of default keys is that it gives\napplications a way to check for the existence of encrypted column\nvalues, without giving the end user the right to decrypt those values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT customer_address FROM customer_table \n > WHERE crypted_credit_card = DES_ENCRYPT(\'credit_card_number\');\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (397,4,'CEIL','Syntax:\nCEIL(X)\n\nCEIL() is a synonym for CEILING().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (398,37,'LENGTH','Syntax:\nLENGTH(str)\n\nReturns the length of the string str, measured in bytes. A multi-byte\ncharacter counts as multiple bytes. This means that for a string\ncontaining five 2-byte characters, LENGTH() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT LENGTH(\'text\');\n -> 4\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (399,31,'STR_TO_DATE','Syntax:\nSTR_TO_DATE(str,format)\n\nThis is the inverse of the DATE_FORMAT() function. It takes a string\nstr and a format string format. STR_TO_DATE() returns a DATETIME value\nif the format string contains both date and time parts, or a DATE or\nTIME value if the string contains only date or time parts. If the date,\ntime, or datetime value extracted from str is illegal, STR_TO_DATE()\nreturns NULL and produces a warning.\n\nThe server scans str attempting to match format to it. The format\nstring can contain literal characters and format specifiers beginning\nwith %. Literal characters in format must match literally in str.\nFormat specifiers in format must match a date or time part in str. For\nthe specifiers that can be used in format, see the DATE_FORMAT()\nfunction description.\n\nmysql> SELECT STR_TO_DATE(\'01,5,2013\',\'%d,%m,%Y\');\n -> \'2013-05-01\'\nmysql> SELECT STR_TO_DATE(\'May 1, 2013\',\'%M %d,%Y\');\n -> \'2013-05-01\'\n\nScanning starts at the beginning of str and fails if format is found\nnot to match. Extra characters at the end of str are ignored.\n\nmysql> SELECT STR_TO_DATE(\'a09:30:17\',\'a%h:%i:%s\');\n -> \'09:30:17\'\nmysql> SELECT STR_TO_DATE(\'a09:30:17\',\'%h:%i:%s\');\n -> NULL\nmysql> SELECT STR_TO_DATE(\'09:30:17a\',\'%h:%i:%s\');\n -> \'09:30:17\'\n\nUnspecified date or time parts have a value of 0, so incompletely\nspecified values in str produce a result with some or all parts set to\n0:\n\nmysql> SELECT STR_TO_DATE(\'abc\',\'abc\');\n -> \'0000-00-00\'\nmysql> SELECT STR_TO_DATE(\'9\',\'%m\');\n -> \'0000-09-00\'\nmysql> SELECT STR_TO_DATE(\'9\',\'%s\');\n -> \'00:00:09\'\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (400,11,'Y','Y(p)\n\nReturns the Y-coordinate value for the Point object p as a\ndouble-precision number.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#point-property-functions\n\n','mysql> SELECT Y(POINT(56.7, 53.34));\n+-----------------------+\n| Y(POINT(56.7, 53.34)) |\n+-----------------------+\n| 53.34 |\n+-----------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#point-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (401,20,'CHECKSUM TABLE','Syntax:\nCHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]\n\nCHECKSUM TABLE reports a table checksum. This statement requires the\nSELECT privilege for the table.\n\nWith QUICK, the live table checksum is reported if it is available, or\nNULL otherwise. This is very fast. A live checksum is enabled by\nspecifying the CHECKSUM=1 table option when you create the table;\ncurrently, this is supported only for MyISAM tables. See [HELP CREATE\nTABLE].\n\nWith EXTENDED, the entire table is read row by row and the checksum is\ncalculated. This can be very slow for large tables.\n\nIf neither QUICK nor EXTENDED is specified, MySQL returns a live\nchecksum if the table storage engine supports it and scans the table\notherwise.\n\nFor a nonexistent table, CHECKSUM TABLE returns NULL and generates a\nwarning.\n\nIn MySQL 5.5, CHECKSUM TABLE returns 0 for partitioned tables unless\nyou include the EXTENDED option. This issue is resolved in MySQL 5.6.\n(Bug #11933226, Bug #60681)\n\nThe checksum value depends on the table row format. If the row format\nchanges, the checksum also changes. For example, the storage format for\nVARCHAR changed between MySQL 4.1 and 5.0, so if a 4.1 table is\nupgraded to MySQL 5.0, the checksum value may change.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/checksum-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/checksum-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (402,2,'NUMINTERIORRINGS','NumInteriorRings(poly)\n\nReturns the number of interior rings in the Polygon value poly.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nmysql> SELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (403,2,'INTERIORRINGN','InteriorRingN(poly,N)\n\nReturns the N-th interior ring for the Polygon value poly as a\nLineString. Rings are numbered beginning with 1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions\n\n','mysql> SET @poly =\n -> \'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))\';\nmysql> SELECT AsText(InteriorRingN(GeomFromText(@poly),1));\n+----------------------------------------------+\n| AsText(InteriorRingN(GeomFromText(@poly),1)) |\n+----------------------------------------------+\n| LINESTRING(1 1,1 2,2 2,2 1,1 1) |\n+----------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#polygon-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (404,31,'UTC_TIME','Syntax:\nUTC_TIME, UTC_TIME()\n\nReturns the current UTC time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_TIME(), UTC_TIME() + 0;\n -> \'18:07:53\', 180753.000000\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (405,39,'DROP FUNCTION','The DROP FUNCTION statement is used to drop stored functions and\nuser-defined functions (UDFs):\n\no For information about dropping stored functions, see [HELP DROP\n PROCEDURE].\n\no For information about dropping user-defined functions, see [HELP DROP\n FUNCTION UDF].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-function.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-function.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (406,39,'ALTER EVENT','Syntax:\nALTER\n [DEFINER = { user | CURRENT_USER }]\n EVENT event_name\n [ON SCHEDULE schedule]\n [ON COMPLETION [NOT] PRESERVE]\n [RENAME TO new_event_name]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n [DO event_body]\n\nThe ALTER EVENT statement changes one or more of the characteristics of\nan existing event without the need to drop and recreate it. The syntax\nfor each of the DEFINER, ON SCHEDULE, ON COMPLETION, COMMENT, ENABLE /\nDISABLE, and DO clauses is exactly the same as when used with CREATE\nEVENT. (See [HELP CREATE EVENT].)\n\nAny user can alter an event defined on a database for which that user\nhas the EVENT privilege. When a user executes a successful ALTER EVENT\nstatement, that user becomes the definer for the affected event.\n\nALTER EVENT works only with an existing event:\n\nmysql> ALTER EVENT no_such_event \n > ON SCHEDULE \n > EVERY \'2:3\' DAY_HOUR;\nERROR 1517 (HY000): Unknown event \'no_such_event\'\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-event.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-event.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (407,16,'STDDEV','Syntax:\nSTDDEV(expr)\n\nReturns the population standard deviation of expr. This function is\nprovided for compatibility with Oracle. The standard SQL function\nSTDDEV_POP() can be used instead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (408,31,'DATE_SUB','Syntax:\nDATE_SUB(date,INTERVAL expr unit)\n\nSee the description for DATE_ADD().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (409,31,'PERIOD_ADD','Syntax:\nPERIOD_ADD(P,N)\n\nAdds N months to period P (in the format YYMM or YYYYMM). Returns a\nvalue in the format YYYYMM. Note that the period argument P is not a\ndate value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT PERIOD_ADD(200801,2);\n -> 200803\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (410,19,'|','Syntax:\n|\n\nBitwise OR:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT 29 | 15;\n -> 31\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (411,3,'GEOMFROMTEXT','GeomFromText(wkt[,srid]), GeometryFromText(wkt[,srid])\n\nConstructs a geometry value of any type using its WKT representation\nand SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (412,14,'UUID_SHORT','Syntax:\nUUID_SHORT()\n\nReturns a "short" universal identifier as a 64-bit unsigned integer\n(rather than a string-form 128-bit identifier as returned by the UUID()\nfunction).\n\nThe value of UUID_SHORT() is guaranteed to be unique if the following\nconditions hold:\n\no The server_id of the current host is unique among your set of master\n and slave servers\n\no server_id is between 0 and 255\n\no You do not set back your system time for your server between mysqld\n restarts\n\no You do not invoke UUID_SHORT() on average more than 16 million times\n per second between mysqld restarts\n\nThe UUID_SHORT() return value is constructed this way:\n\n (server_id & 255) << 56\n+ (server_startup_time_in_seconds << 24)\n+ incremented_variable++;\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> SELECT UUID_SHORT();\n -> 92395783831158784\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (413,37,'RIGHT','Syntax:\nRIGHT(str,len)\n\nReturns the rightmost len characters from the string str, or NULL if\nany argument is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT RIGHT(\'foobarbar\', 4);\n -> \'rbar\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (414,31,'DATEDIFF','Syntax:\nDATEDIFF(expr1,expr2)\n\nDATEDIFF() returns expr1 - expr2 expressed as a value in days from one\ndate to the other. expr1 and expr2 are date or date-and-time\nexpressions. Only the date parts of the values are used in the\ncalculation.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DATEDIFF(\'2007-12-31 23:59:59\',\'2007-12-30\');\n -> 1\nmysql> SELECT DATEDIFF(\'2010-11-30 23:59:59\',\'2010-12-31\');\n -> -31\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (415,39,'DROP TABLESPACE','Syntax:\nDROP TABLESPACE tablespace_name\n ENGINE [=] engine_name\n\nThis statement drops a tablespace that was previously created using\nCREATE TABLESPACE (see [HELP CREATE TABLESPACE]).\n\n*Important*: The tablespace to be dropped must not contain any data\nfiles; in other words, before you can drop a tablespace, you must first\ndrop each of its data files using ALTER TABLESPACE ... DROP DATAFILE\n(see [HELP ALTER TABLESPACE]).\n\nThe ENGINE clause (required) specifies the storage engine used by the\ntablespace. Currently, the only accepted values for engine_name are NDB\nand NDBCLUSTER.\n\nDROP TABLESPACE is useful only with Disk Data storage for MySQL\nCluster. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-disk-data.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-tablespace.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-tablespace.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (416,39,'DROP PROCEDURE','Syntax:\nDROP {PROCEDURE | FUNCTION} [IF EXISTS] sp_name\n\nThis statement is used to drop a stored procedure or function. That is,\nthe specified routine is removed from the server. You must have the\nALTER ROUTINE privilege for the routine. (If the\nautomatic_sp_privileges system variable is enabled, that privilege and\nEXECUTE are granted automatically to the routine creator when the\nroutine is created and dropped from the creator when the routine is\ndropped. See\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-routines-privileges.html.\n)\n\nThe IF EXISTS clause is a MySQL extension. It prevents an error from\noccurring if the procedure or function does not exist. A warning is\nproduced that can be viewed with SHOW WARNINGS.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/drop-procedure.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/drop-procedure.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (417,20,'CHECK TABLE','Syntax:\nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n\noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}\n\nCHECK TABLE checks a table or tables for errors. CHECK TABLE works for\nInnoDB, MyISAM, ARCHIVE, and CSV tables. For MyISAM tables, the key\nstatistics are updated as well.\n\nTo check a table, you must have some privilege for it.\n\nCHECK TABLE can also check views for problems, such as tables that are\nreferenced in the view definition that no longer exist.\n\nCHECK TABLE is supported for partitioned tables, and you can use ALTER\nTABLE ... CHECK PARTITION to check one or more partitions; for more\ninformation, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/check-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/check-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (418,37,'BIN','Syntax:\nBIN(N)\n\nReturns a string representation of the binary value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,2). Returns\nNULL if N is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT BIN(12);\n -> \'1100\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,5,'INSTALL PLUGIN','Syntax:\nINSTALL PLUGIN plugin_name SONAME \'shared_library_name\'\n\nThis statement installs a server plugin. It requires the INSERT\nprivilege for the mysql.plugin table.\n\nplugin_name is the name of the plugin as defined in the plugin\ndescriptor structure contained in the library file (see\nhttp://dev.mysql.com/doc/refman/5.5/en/plugin-data-structures.html).\nPlugin names are not case sensitive. For maximal compatibility, plugin\nnames should be limited to ASCII letters, digits, and underscore\nbecause they are used in C source files, shell command lines, M4 and\nBourne shell scripts, and SQL environments.\n\nshared_library_name is the name of the shared library that contains the\nplugin code. The name includes the file name extension (for example,\nlibmyplugin.so, libmyplugin.dll, or libmyplugin.dylib).\n\nThe shared library must be located in the plugin directory (the\ndirectory named by the plugin_dir system variable). The library must be\nin the plugin directory itself, not in a subdirectory. By default,\nplugin_dir is the plugin directory under the directory named by the\npkglibdir configuration variable, but it can be changed by setting the\nvalue of plugin_dir at server startup. For example, set its value in a\nmy.cnf file:\n\n[mysqld]\nplugin_dir=/path/to/plugin/directory\n\nIf the value of plugin_dir is a relative path name, it is taken to be\nrelative to the MySQL base directory (the value of the basedir system\nvariable).\n\nINSTALL PLUGIN loads and initializes the plugin code to make the plugin\navailable for use. A plugin is initialized by executing its\ninitialization function, which handles any setup that the plugin must\nperform before it can be used. When the server shuts down, it executes\nthe deinitialization function for each plugin that is loaded so that\nthe plugin has a change to perform any final cleanup.\n\nINSTALL PLUGIN also registers the plugin by adding a line that\nindicates the plugin name and library file name to the mysql.plugin\ntable. At server startup, the server loads and initializes any plugin\nthat is listed in the mysql.plugin table. This means that a plugin is\ninstalled with INSTALL PLUGIN only once, not every time the server\nstarts. Plugin loading at startup does not occur if the server is\nstarted with the --skip-grant-tables option.\n\nA plugin library can contain multiple plugins. For each of them to be\ninstalled, use a separate INSTALL PLUGIN statement. Each statement\nnames a different plugin, but all of them specify the same library\nname.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/install-plugin.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/install-plugin.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,23,'DECLARE CURSOR','Syntax:\nDECLARE cursor_name CURSOR FOR select_statement\n\nThis statement declares a cursor and associates it with a SELECT\nstatement that retrieves the rows to be traversed by the cursor. To\nfetch the rows later, use a FETCH statement. The number of columns\nretrieved by the SELECT statement must match the number of output\nvariables specified in the FETCH statement.\n\nThe SELECT statement cannot have an INTO clause.\n\nCursor declarations must appear before handler declarations and after\nvariable and condition declarations.\n\nA stored program may contain multiple cursor declarations, but each\ncursor declared in a given block must have a unique name. For an\nexample, see http://dev.mysql.com/doc/refman/5.5/en/cursors.html.\n\nFor information available through SHOW statements, it is possible in\nmany cases to obtain equivalent information by using a cursor with an\nINFORMATION_SCHEMA table.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/declare-cursor.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/declare-cursor.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,27,'LOAD DATA','Syntax:\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number {LINES | ROWS}]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD DATA INFILE statement reads rows from a text file into a table\nat a very high speed. The file name must be given as a literal string.\n\nLOAD DATA INFILE is the complement of SELECT ... INTO OUTFILE. (See\nhttp://dev.mysql.com/doc/refman/5.5/en/select-into.html.) To write data\nfrom a table to a file, use SELECT ... INTO OUTFILE. To read the file\nback into a table, use LOAD DATA INFILE. The syntax of the FIELDS and\nLINES clauses is the same for both statements. Both clauses are\noptional, but FIELDS must precede LINES if both are specified.\n\nFor more information about the efficiency of INSERT versus LOAD DATA\nINFILE and speeding up LOAD DATA INFILE, see\nhttp://dev.mysql.com/doc/refman/5.5/en/insert-speed.html.\n\nThe character set indicated by the character_set_database system\nvariable is used to interpret the information in the file. SET NAMES\nand the setting of character_set_client do not affect interpretation of\ninput. If the contents of the input file use a character set that\ndiffers from the default, it is usually preferable to specify the\ncharacter set of the file by using the CHARACTER SET clause. A\ncharacter set of binary specifies "no conversion."\n\nLOAD DATA INFILE interprets all fields in the file as having the same\ncharacter set, regardless of the data types of the columns into which\nfield values are loaded. For proper interpretation of file contents,\nyou must ensure that it was written with the correct character set. For\nexample, if you write a data file with mysqldump -T or by issuing a\nSELECT ... INTO OUTFILE statement in mysql, be sure to use a\n--default-character-set option with mysqldump or mysql so that output\nis written in the character set to be used when the file is loaded with\nLOAD DATA INFILE.\n\n*Note*: It is not possible to load data files that use the ucs2, utf16,\nor utf32 character set.\n\nThe character_set_filesystem system variable controls the\ninterpretation of the file name.\n\nYou can also load data files by using the mysqlimport utility; it\noperates by sending a LOAD DATA INFILE statement to the server. The\n--local option causes mysqlimport to read data files from the client\nhost. You can specify the --compress option to get better performance\nover slow networks if the client and server support the compressed\nprotocol. See http://dev.mysql.com/doc/refman/5.5/en/mysqlimport.html.\n\nIf you use LOW_PRIORITY, execution of the LOAD DATA statement is\ndelayed until no other clients are reading from the table. This affects\nonly storage engines that use only table-level locking (such as MyISAM,\nMEMORY, and MERGE).\n\nIf you specify CONCURRENT with a MyISAM table that satisfies the\ncondition for concurrent inserts (that is, it contains no free blocks\nin the middle), other threads can retrieve data from the table while\nLOAD DATA is executing. Using this option affects the performance of\nLOAD DATA a bit, even if no other thread is using the table at the same\ntime.\n\nPrior to MySQL 5.5.1, CONCURRENT was not replicated when using\nstatement-based replication (see Bug #34628). However, it is replicated\nwhen using row-based replication, regardless of the version. See\nhttp://dev.mysql.com/doc/refman/5.5/en/replication-features-load-data.h\ntml, for more information.\n\nThe LOCAL keyword, if specified, is interpreted with respect to the\nclient end of the connection:\n\no If LOCAL is specified, the file is read by the client program on the\n client host and sent to the server. The file can be given as a full\n path name to specify its exact location. If given as a relative path\n name, the name is interpreted relative to the directory in which the\n client program was started.\n\n When using LOCAL with LOAD DATA, a copy of the file is created in the\n server\'s temporary directory. This is not the directory determined by\n the value of tmpdir or slave_load_tmpdir, but rather the operating\n system\'s temporary directory, and is not configurable in the MySQL\n Server. (Typically the system temporary directory is /tmp on Linux\n systems and C:\\WINDOWS\\TEMP on Windows.) Lack of sufficient space for\n the copy in this directory can cause the LOAD DATA LOCAL statement to\n fail.\n\no If LOCAL is not specified, the file must be located on the server\n host and is read directly by the server. The server uses the\n following rules to locate the file:\n\n o If the file name is an absolute path name, the server uses it as\n given.\n\n o If the file name is a relative path name with one or more leading\n components, the server searches for the file relative to the\n server\'s data directory.\n\n o If a file name with no leading components is given, the server\n looks for the file in the database directory of the default\n database.\n\nNote that, in the non-LOCAL case, these rules mean that a file named as\n./myfile.txt is read from the server\'s data directory, whereas the file\nnamed as myfile.txt is read from the database directory of the default\ndatabase. For example, if db1 is the default database, the following\nLOAD DATA statement reads the file data.txt from the database directory\nfor db1, even though the statement explicitly loads the file into a\ntable in the db2 database:\n\nLOAD DATA INFILE \'data.txt\' INTO TABLE db2.my_table;\n\nWindows path names are specified using forward slashes rather than\nbackslashes. If you do use backslashes, you must double them.\n\nFor security reasons, when reading text files located on the server,\nthe files must either reside in the database directory or be readable\nby all. Also, to use LOAD DATA INFILE on server files, you must have\nthe FILE privilege. See\nhttp://dev.mysql.com/doc/refman/5.5/en/privileges-provided.html. For\nnon-LOCAL load operations, if the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/load-data.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/load-data.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,24,'MULTILINESTRING','MultiLineString(ls1,ls2,...)\n\nConstructs a MultiLineString value using LineString or WKB LineString\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-mysql-specific-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,31,'LOCALTIME','Syntax:\nLOCALTIME, LOCALTIME()\n\nLOCALTIME and LOCALTIME() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (424,26,'SHOW RELAYLOG EVENTS','Syntax:\nSHOW RELAYLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n\nShows the events in the relay log of a replication slave. If you do not\nspecify \'log_name\', the first relay log is displayed. This statement\nhas no effect on the master.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-relaylog-events.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-relaylog-events.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (425,3,'MPOINTFROMTEXT','MPointFromText(wkt[,srid]), MultiPointFromText(wkt[,srid])\n\nConstructs a MULTIPOINT value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkt-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (426,22,'BLOB','BLOB[(M)]\n\nA BLOB column with a maximum length of 65,535 (216 - 1) bytes. Each\nBLOB value is stored using a 2-byte length prefix that indicates the\nnumber of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MySQL\ncreates the column as the smallest BLOB type large enough to hold\nvalues M bytes long.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (427,12,'SHA1','Syntax:\nSHA1(str), SHA(str)\n\nCalculates an SHA-1 160-bit checksum for the string, as described in\nRFC 3174 (Secure Hash Algorithm). The value is returned as a string of\n40 hex digits, or NULL if the argument was NULL. One of the possible\nuses for this function is as a hash key. See the notes at the beginning\nof this section about storing hash values efficiently. You can also use\nSHA1() as a cryptographic function for storing passwords. SHA() is\nsynonymous with SHA1().\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring; see the notes at the beginning of this section about using the\nvalue as a nonbinary string.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SELECT SHA1(\'abc\');\n -> \'a9993e364706816aba3e25717850c26c9cd0d89d\'\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,37,'SUBSTR','Syntax:\nSUBSTR(str,pos), SUBSTR(str FROM pos), SUBSTR(str,pos,len), SUBSTR(str\nFROM pos FOR len)\n\nSUBSTR() is a synonym for SUBSTRING().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (429,12,'PASSWORD','Syntax:\nPASSWORD(str)\n\nCalculates and returns a hashed password string from the plaintext\npassword str and returns a nonbinary string in the connection character\nset (a binary string before MySQL 5.5.3), or NULL if the argument is\nNULL. This function is the SQL interface to the algorithm used by the\nserver to encrypt MySQL passwords for storage in the mysql.user grant\ntable.\n\nThe password hashing method used by PASSWORD() depends on the value of\nthe old_passwords system variable:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','mysql> SET old_passwords = 0;\nmysql> SELECT PASSWORD(\'mypass\');\n+-------------------------------------------+\n| PASSWORD(\'mypass\') |\n+-------------------------------------------+\n| *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |\n+-------------------------------------------+\n\nmysql> SET old_passwords = 1;\nmysql> SELECT PASSWORD(\'mypass\');\n+--------------------+\n| PASSWORD(\'mypass\') |\n+--------------------+\n| 6f8c114b58f2ce9e |\n+--------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,22,'CHAR','[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA fixed-length string that is always right-padded with spaces to the\nspecified length when stored. M represents the column length in\ncharacters. The range of M is 0 to 255. If M is omitted, the length is\n1.\n\n*Note*: Trailing spaces are removed when CHAR values are retrieved\nunless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,31,'UTC_DATE','Syntax:\nUTC_DATE, UTC_DATE()\n\nReturns the current UTC date as a value in \'YYYY-MM-DD\' or YYYYMMDD\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_DATE(), UTC_DATE() + 0;\n -> \'2003-08-14\', 20030814\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (432,36,'DIMENSION','Dimension(g)\n\nReturns the inherent dimension of the geometry value g. The result can\nbe -1, 0, 1, or 2. The meaning of these values is given in\nhttp://dev.mysql.com/doc/refman/5.5/en/gis-class-geometry.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (433,16,'COUNT DISTINCT','Syntax:\nCOUNT(DISTINCT expr,[expr...])\n\nReturns a count of the number of rows with different non-NULL expr\nvalues.\n\nCOUNT(DISTINCT) returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html\n\n','mysql> SELECT COUNT(DISTINCT results) FROM student;\n','http://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (434,22,'BIT','BIT[(M)]\n\nA bit-field type. M indicates the number of bits per value, from 1 to\n64. The default is 1 if M is omitted.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (435,30,'EQUALS','Equals(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries\n\n','','http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html#functions-that-test-spatial-relationships-between-geometries');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (436,26,'SHOW CREATE VIEW','Syntax:\nSHOW CREATE VIEW view_name\n\nThis statement shows a CREATE VIEW statement that creates the given\nview.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-create-view.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-create-view.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (437,18,'INTERVAL','Syntax:\nINTERVAL(N,N1,N2,N3,...)\n\nReturns 0 if N < N1, 1 if N < N2 and so on or -1 if N is NULL. All\narguments are treated as integers. It is required that N1 < N2 < N3 <\n... < Nn for this function to work correctly. This is because a binary\nsearch is used (very fast).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT INTERVAL(23, 1, 15, 17, 30, 44, 200);\n -> 3\nmysql> SELECT INTERVAL(10, 1, 10, 100, 1000);\n -> 2\nmysql> SELECT INTERVAL(22, 23, 30, 44, 200);\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (438,31,'FROM_DAYS','Syntax:\nFROM_DAYS(N)\n\nGiven a day number N, returns a DATE value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT FROM_DAYS(730669);\n -> \'2007-07-03\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (439,39,'ALTER PROCEDURE','Syntax:\nALTER PROCEDURE proc_name [characteristic ...]\n\ncharacteristic:\n COMMENT \'string\'\n | LANGUAGE SQL\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nThis statement can be used to change the characteristics of a stored\nprocedure. More than one change may be specified in an ALTER PROCEDURE\nstatement. However, you cannot change the parameters or body of a\nstored procedure using this statement; to make such changes, you must\ndrop and re-create the procedure using DROP PROCEDURE and CREATE\nPROCEDURE.\n\nYou must have the ALTER ROUTINE privilege for the procedure. By\ndefault, that privilege is granted automatically to the procedure\ncreator. This behavior can be changed by disabling the\nautomatic_sp_privileges system variable. See\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-routines-privileges.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-procedure.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-procedure.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (440,19,'BIT_COUNT','Syntax:\nBIT_COUNT(N)\n\nReturns the number of bits that are set in the argument N.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html\n\n','mysql> SELECT BIT_COUNT(29), BIT_COUNT(b\'101010\');\n -> 4, 3\n','http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (441,37,'OCTET_LENGTH','Syntax:\nOCTET_LENGTH(str)\n\nOCTET_LENGTH() is a synonym for LENGTH().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (442,31,'UTC_TIMESTAMP','Syntax:\nUTC_TIMESTAMP, UTC_TIMESTAMP()\n\nReturns the current UTC date and time as a value in \'YYYY-MM-DD\nHH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the\nfunction is used in a string or numeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\n -> \'2003-08-14 18:08:04\', 20030814180804.000000\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (443,12,'AES_ENCRYPT','Syntax:\nAES_ENCRYPT(str,key_str)\n\nAES_ENCRYPT() and AES_DECRYPT() enable encryption and decryption of\ndata using the official AES (Advanced Encryption Standard) algorithm,\npreviously known as "Rijndael." Encoding with a 128-bit key length is\nused, but you can extend it up to 256 bits by modifying the source. We\nchose 128 bits because it is much faster and it is secure enough for\nmost purposes.\n\nAES_ENCRYPT() encrypts a string and returns a binary string.\nAES_DECRYPT() decrypts the encrypted string and returns the original\nstring. The input arguments may be any length. If either argument is\nNULL, the result of this function is also NULL.\n\nBecause AES is a block-level algorithm, padding is used to encode\nuneven length strings and so the result string length may be calculated\nusing this formula:\n\n16 * (trunc(string_length / 16) + 1)\n\nIf AES_DECRYPT() detects invalid data or incorrect padding, it returns\nNULL. However, it is possible for AES_DECRYPT() to return a non-NULL\nvalue (possibly garbage) if the input data or the key is invalid.\n\nYou can use the AES functions to store data in an encrypted form by\nmodifying your queries:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','INSERT INTO t VALUES (1,AES_ENCRYPT(\'text\',\'password\'));\n','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (444,4,'+','Syntax:\n+\n\nAddition:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html\n\n','mysql> SELECT 3+5;\n -> 8\n','http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (445,14,'INET_NTOA','Syntax:\nINET_NTOA(expr)\n\nGiven a numeric IPv4 network address in network byte order, returns the\ndotted-quad representation of the address as a string. INET_NTOA()\nreturns NULL if it does not understand its argument.\n\nAs of MySQL 5.5.3, the return value is a nonbinary string in the\nconnection character set. Before 5.5.3, the return value is a binary\nstring.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html\n\n','mysql> SELECT INET_NTOA(167773449);\n -> \'10.0.5.9\'\n','http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (446,4,'ACOS','Syntax:\nACOS(X)\n\nReturns the arc cosine of X, that is, the value whose cosine is X.\nReturns NULL if X is not in the range -1 to 1.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ACOS(1);\n -> 0\nmysql> SELECT ACOS(1.0001);\n -> NULL\nmysql> SELECT ACOS(0);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (447,8,'ISOLATION','Syntax:\nSET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL\n {\n REPEATABLE READ\n | READ COMMITTED\n | READ UNCOMMITTED\n | SERIALIZABLE\n }\n\nThis statement sets the transaction isolation level, used for\noperations on InnoDB tables.\n\nScope of the Isolation Level\n\nYou can set the isolation level globally, for the current session, or\nfor the next transaction:\n\no With the GLOBAL keyword, the statement sets the default transaction\n level globally for all subsequent sessions. Existing sessions are\n unaffected.\n\no With the SESSION keyword, the statement sets the default transaction\n level for all subsequent transactions performed within the current\n session.\n\no Without any SESSION or GLOBAL keyword, the statement sets the\n isolation level for the next (not started) transaction performed\n within the current session.\n\nA change to the global default isolation level requires the SUPER\nprivilege. Any session is free to change its session isolation level\n(even in the middle of a transaction), or the isolation level for its\nnext transaction.\n\nSET TRANSACTION ISOLATION LEVEL without GLOBAL or SESSION is not\npermitted while there is an active transaction:\n\nmysql> START TRANSACTION;\nQuery OK, 0 rows affected (0.02 sec)\n\nmysql> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;\nERROR 1568 (25001): Transaction isolation level can\'t be changed\nwhile a transaction is in progress\n\nTo set the global default isolation level at server startup, use the\n--transaction-isolation=level option to mysqld on the command line or\nin an option file. Values of level for this option use dashes rather\nthan spaces, so the permissible values are READ-UNCOMMITTED,\nREAD-COMMITTED, REPEATABLE-READ, or SERIALIZABLE. For example, to set\nthe default isolation level to REPEATABLE READ, use these lines in the\n[mysqld] section of an option file:\n\n[mysqld]\ntransaction-isolation = REPEATABLE-READ\n\nIt is possible to check or set the global and session transaction\nisolation levels at runtime by using the tx_isolation system variable:\n\nSELECT @@GLOBAL.tx_isolation, @@tx_isolation;\nSET GLOBAL tx_isolation=\'REPEATABLE-READ\';\nSET SESSION tx_isolation=\'SERIALIZABLE\';\n\nDetails and Usage of Isolation Levels\n\nInnoDB supports each of the transaction isolation levels described here\nusing different locking strategies. You can enforce a high degree of\nconsistency with the default REPEATABLE READ level, for operations on\ncrucial data where ACID compliance is important. Or you can relax the\nconsistency rules with READ COMMITTED or even READ UNCOMMITTED, in\nsituations such as bulk reporting where precise consistency and\nrepeatable results are less important than minimizing the amount of\noverhead for locking. SERIALIZABLE enforces even stricter rules than\nREPEATABLE READ, and is used mainly in specialized situations, such as\nwith XA transactions and for troubleshooting issues with concurrency\nand deadlocks.\n\nFor full information about how these isolation levels work with InnoDB\ntransactions, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-transaction-model.html.\nIn particular, for additional information about InnoDB record-level\nlocks and how it uses them to execute various types of statements, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-record-level-locks.html\nand http://dev.mysql.com/doc/refman/5.5/en/innodb-locks-set.html.\n\nThe following list describes how MySQL supports the different\ntransaction levels. The list goes from the most commonly used level to\nthe least used.\n\no REPEATABLE READ\n\n This is the default isolation level for InnoDB. For consistent reads,\n there is an important difference from the READ COMMITTED isolation\n level: All consistent reads within the same transaction read the\n snapshot established by the first read. This convention means that if\n you issue several plain (nonlocking) SELECT statements within the\n same transaction, these SELECT statements are consistent also with\n respect to each other. See\n http://dev.mysql.com/doc/refman/5.5/en/innodb-consistent-read.html.\n\n For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE),\n UPDATE, and DELETE statements, locking depends on whether the\n statement uses a unique index with a unique search condition, or a\n range-type search condition. For a unique index with a unique search\n condition, InnoDB locks only the index record found, not the gap\n before it. For other search conditions, InnoDB locks the index range\n scanned, using gap locks or next-key (gap plus index-record) locks to\n block insertions by other sessions into the gaps covered by the\n range.\n\no READ COMMITTED\n\n A somewhat Oracle-like isolation level with respect to consistent\n (nonlocking) reads: Each consistent read, even within the same\n transaction, sets and reads its own fresh snapshot. See\n http://dev.mysql.com/doc/refman/5.5/en/innodb-consistent-read.html.\n\n For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE),\n InnoDB locks only index records, not the gaps before them, and thus\n permits the free insertion of new records next to locked records. For\n UPDATE and DELETE statements, locking depends on whether the\n statement uses a unique index with a unique search condition (such as\n WHERE id = 100), or a range-type search condition (such as WHERE id >\n 100). For a unique index with a unique search condition, InnoDB locks\n only the index record found, not the gap before it. For range-type\n searches, InnoDB locks the index range scanned, using gap locks or\n next-key (gap plus index-record) locks to block insertions by other\n sessions into the gaps covered by the range. This is necessary\n because "phantom rows" must be blocked for MySQL replication and\n recovery to work.\n\n *Note*: In MySQL 5.5, if the READ COMMITTED isolation level is used\n or the innodb_locks_unsafe_for_binlog system variable is enabled,\n there is no InnoDB gap locking except for foreign-key constraint\n checking and duplicate-key checking. Also, record locks for\n nonmatching rows are released after MySQL has evaluated the WHERE\n condition. If you use READ COMMITTED or enable\n innodb_locks_unsafe_for_binlog, you must use row-based binary\n logging.\n\no READ UNCOMMITTED\n\n SELECT statements are performed in a nonlocking fashion, but a\n possible earlier version of a row might be used. Thus, using this\n isolation level, such reads are not consistent. This is also called a\n "dirty read." Otherwise, this isolation level works like READ\n COMMITTED.\n\no SERIALIZABLE\n\n This level is like REPEATABLE READ, but InnoDB implicitly converts\n all plain SELECT statements to SELECT ... LOCK IN SHARE MODE if\n autocommit is disabled. If autocommit is enabled, the SELECT is its\n own transaction. It therefore is known to be read only and can be\n serialized if performed as a consistent (nonlocking) read and need\n not block for other transactions. (To force a plain SELECT to block\n if other transactions have modified the selected rows, disable\n autocommit.)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/set-transaction.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/set-transaction.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (448,4,'CEILING','Syntax:\nCEILING(X)\n\nReturns the smallest integer value not less than X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT CEILING(1.23);\n -> 2\nmysql> SELECT CEILING(-1.23);\n -> -1\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (449,4,'SIN','Syntax:\nSIN(X)\n\nReturns the sine of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT SIN(PI());\n -> 1.2246063538224e-16\nmysql> SELECT ROUND(SIN(PI()));\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (450,31,'DAYOFWEEK','Syntax:\nDAYOFWEEK(date)\n\nReturns the weekday index for date (1 = Sunday, 2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC standard.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFWEEK(\'2007-02-03\');\n -> 7\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (451,26,'SHOW PROCESSLIST','Syntax:\nSHOW [FULL] PROCESSLIST\n\nSHOW PROCESSLIST shows you which threads are running. You can also get\nthis information from the INFORMATION_SCHEMA PROCESSLIST table or the\nmysqladmin processlist command. If you have the PROCESS privilege, you\ncan see all threads. Otherwise, you can see only your own threads (that\nis, threads associated with the MySQL account that you are using). If\nyou do not use the FULL keyword, only the first 100 characters of each\nstatement are shown in the Info field.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-processlist.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-processlist.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (452,32,'LINEFROMWKB','LineFromWKB(wkb[,srid]), LineStringFromWKB(wkb[,srid])\n\nConstructs a LINESTRING value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (453,36,'GEOMETRYTYPE','GeometryType(g)\n\nReturns as a binary string the name of the geometry type of which the\ngeometry instance g is a member. The name corresponds to one of the\ninstantiable Geometry subclasses.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions\n\n','mysql> SELECT GeometryType(GeomFromText(\'POINT(1 1)\'));\n+------------------------------------------+\n| GeometryType(GeomFromText(\'POINT(1 1)\')) |\n+------------------------------------------+\n| POINT |\n+------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#general-geometry-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (454,39,'CREATE VIEW','Syntax:\nCREATE\n [OR REPLACE]\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n\nThe CREATE VIEW statement creates a new view, or replaces an existing\none if the OR REPLACE clause is given. If the view does not exist,\nCREATE OR REPLACE VIEW is the same as CREATE VIEW. If the view does\nexist, CREATE OR REPLACE VIEW is the same as ALTER VIEW.\n\nThe select_statement is a SELECT statement that provides the definition\nof the view. (When you select from the view, you select in effect using\nthe SELECT statement.) select_statement can select from base tables or\nother views.\n\nThe view definition is "frozen" at creation time, so changes to the\nunderlying tables afterward do not affect the view definition. For\nexample, if a view is defined as SELECT * on a table, new columns added\nto the table later do not become part of the view.\n\nThe ALGORITHM clause affects how MySQL processes the view. The DEFINER\nand SQL SECURITY clauses specify the security context to be used when\nchecking access privileges at view invocation time. The WITH CHECK\nOPTION clause can be given to constrain inserts or updates to rows in\ntables referenced by the view. These clauses are described later in\nthis section.\n\nThe CREATE VIEW statement requires the CREATE VIEW privilege for the\nview, and some privilege for each column selected by the SELECT\nstatement. For columns used elsewhere in the SELECT statement you must\nhave the SELECT privilege. If the OR REPLACE clause is present, you\nmust also have the DROP privilege for the view. CREATE VIEW might also\nrequire the SUPER privilege, depending on the DEFINER value, as\ndescribed later in this section.\n\nWhen a view is referenced, privilege checking occurs as described later\nin this section.\n\nA view belongs to a database. By default, a new view is created in the\ndefault database. To create the view explicitly in a given database,\nspecify the name as db_name.view_name when you create it:\n\nmysql> CREATE VIEW test.v AS SELECT * FROM t;\n\nWithin a database, base tables and views share the same namespace, so a\nbase table and a view cannot have the same name.\n\nColumns retrieved by the SELECT statement can be simple references to\ntable columns. They can also be expressions that use functions,\nconstant values, operators, and so forth.\n\nViews must have unique column names with no duplicates, just like base\ntables. By default, the names of the columns retrieved by the SELECT\nstatement are used for the view column names. To define explicit names\nfor the view columns, the optional column_list clause can be given as a\nlist of comma-separated identifiers. The number of names in column_list\nmust be the same as the number of columns retrieved by the SELECT\nstatement.\n\nUnqualified table or view names in the SELECT statement are interpreted\nwith respect to the default database. A view can refer to tables or\nviews in other databases by qualifying the table or view name with the\nproper database name.\n\nA view can be created from many kinds of SELECT statements. It can\nrefer to base tables or other views. It can use joins, UNION, and\nsubqueries. The SELECT need not even refer to any tables. The following\nexample defines a view that selects two columns from another table, as\nwell as an expression calculated from those columns:\n\nmysql> CREATE TABLE t (qty INT, price INT);\nmysql> INSERT INTO t VALUES(3, 50);\nmysql> CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;\nmysql> SELECT * FROM v;\n+------+-------+-------+\n| qty | price | value |\n+------+-------+-------+\n| 3 | 50 | 150 |\n+------+-------+-------+\n\nA view definition is subject to the following restrictions:\n\no The SELECT statement cannot contain a subquery in the FROM clause.\n\no The SELECT statement cannot refer to system or user variables.\n\no Within a stored program, the definition cannot refer to program\n parameters or local variables.\n\no The SELECT statement cannot refer to prepared statement parameters.\n\no Any table or view referred to in the definition must exist. However,\n after a view has been created, it is possible to drop a table or view\n that the definition refers to. In this case, use of the view results\n in an error. To check a view definition for problems of this kind,\n use the CHECK TABLE statement.\n\no The definition cannot refer to a TEMPORARY table, and you cannot\n create a TEMPORARY view.\n\no Any tables named in the view definition must exist at definition\n time.\n\no You cannot associate a trigger with a view.\n\no Aliases for column names in the SELECT statement are checked against\n the maximum column length of 64 characters (not the maximum alias\n length of 256 characters).\n\nORDER BY is permitted in a view definition, but it is ignored if you\nselect from a view using a statement that has its own ORDER BY.\n\nFor other options or clauses in the definition, they are added to the\noptions or clauses of the statement that references the view, but the\neffect is undefined. For example, if a view definition includes a LIMIT\nclause, and you select from the view using a statement that has its own\nLIMIT clause, it is undefined which limit applies. This same principle\napplies to options such as ALL, DISTINCT, or SQL_SMALL_RESULT that\nfollow the SELECT keyword, and to clauses such as INTO, FOR UPDATE,\nLOCK IN SHARE MODE, and PROCEDURE.\n\nIf you create a view and then change the query processing environment\nby changing system variables, that may affect the results that you get\nfrom the view:\n\nmysql> CREATE VIEW v (mycol) AS SELECT \'abc\';\nQuery OK, 0 rows affected (0.01 sec)\n\nmysql> SET sql_mode = \'\';\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT "mycol" FROM v;\n+-------+\n| mycol |\n+-------+\n| mycol |\n+-------+\n1 row in set (0.01 sec)\n\nmysql> SET sql_mode = \'ANSI_QUOTES\';\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT "mycol" FROM v;\n+-------+\n| mycol |\n+-------+\n| abc |\n+-------+\n1 row in set (0.00 sec)\n\nThe DEFINER and SQL SECURITY clauses determine which MySQL account to\nuse when checking access privileges for the view when a statement is\nexecuted that references the view. The valid SQL SECURITY\ncharacteristic values are DEFINER and INVOKER. These indicate that the\nrequired privileges must be held by the user who defined or invoked the\nview, respectively. The default SQL SECURITY value is DEFINER.\n\nIf a user value is given for the DEFINER clause, it should be a MySQL\naccount specified as \'user_name\'@\'host_name\' (the same format used in\nthe GRANT statement), CURRENT_USER, or CURRENT_USER(). The default\nDEFINER value is the user who executes the CREATE VIEW statement. This\nis the same as specifying DEFINER = CURRENT_USER explicitly.\n\nIf you specify the DEFINER clause, these rules determine the valid\nDEFINER user values:\n\no If you do not have the SUPER privilege, the only valid user value is\n your own account, either specified literally or by using\n CURRENT_USER. You cannot set the definer to some other account.\n\no If you have the SUPER privilege, you can specify any syntactically\n valid account name. If the account does not actually exist, a warning\n is generated.\n\no Although it is possible to create a view with a nonexistent DEFINER\n account, an error occurs when the view is referenced if the SQL\n SECURITY value is DEFINER but the definer account does not exist.\n\nFor more information about view security, see\nhttp://dev.mysql.com/doc/refman/5.5/en/stored-programs-security.html.\n\nWithin a view definition, CURRENT_USER returns the view\'s DEFINER value\nby default. For views defined with the SQL SECURITY INVOKER\ncharacteristic, CURRENT_USER returns the account for the view\'s\ninvoker. For information about user auditing within views, see\nhttp://dev.mysql.com/doc/refman/5.5/en/account-activity-auditing.html.\n\nWithin a stored routine that is defined with the SQL SECURITY DEFINER\ncharacteristic, CURRENT_USER returns the routine\'s DEFINER value. This\nalso affects a view defined within such a routine, if the view\ndefinition contains a DEFINER value of CURRENT_USER.\n\nView privileges are checked like this:\n\no At view definition time, the view creator must have the privileges\n needed to use the top-level objects accessed by the view. For\n example, if the view definition refers to table columns, the creator\n must have some privilege for each column in the select list of the\n definition, and the SELECT privilege for each column used elsewhere\n in the definition. If the definition refers to a stored function,\n only the privileges needed to invoke the function can be checked. The\n privileges required at function invocation time can be checked only\n as it executes: For different invocations, different execution paths\n within the function might be taken.\n\no The user who references a view must have appropriate privileges to\n access it (SELECT to select from it, INSERT to insert into it, and so\n forth.)\n\no When a view has been referenced, privileges for objects accessed by\n the view are checked against the privileges held by the view DEFINER\n account or invoker, depending on whether the SQL SECURITY\n characteristic is DEFINER or INVOKER, respectively.\n\no If reference to a view causes execution of a stored function,\n privilege checking for statements executed within the function depend\n on whether the function SQL SECURITY characteristic is DEFINER or\n INVOKER. If the security characteristic is DEFINER, the function runs\n with the privileges of the DEFINER account. If the characteristic is\n INVOKER, the function runs with the privileges determined by the\n view\'s SQL SECURITY characteristic.\n\nExample: A view might depend on a stored function, and that function\nmight invoke other stored routines. For example, the following view\ninvokes a stored function f():\n\nCREATE VIEW v AS SELECT * FROM t WHERE t.id = f(t.name);\n\nSuppose that f() contains a statement such as this:\n\nIF name IS NULL then\n CALL p1();\nELSE\n CALL p2();\nEND IF;\n\nThe privileges required for executing statements within f() need to be\nchecked when f() executes. This might mean that privileges are needed\nfor p1() or p2(), depending on the execution path within f(). Those\nprivileges must be checked at runtime, and the user who must possess\nthe privileges is determined by the SQL SECURITY values of the view v\nand the function f().\n\nThe DEFINER and SQL SECURITY clauses for views are extensions to\nstandard SQL. In standard SQL, views are handled using the rules for\nSQL SECURITY DEFINER. The standard says that the definer of the view,\nwhich is the same as the owner of the view\'s schema, gets applicable\nprivileges on the view (for example, SELECT) and may grant them. MySQL\nhas no concept of a schema "owner", so MySQL adds a clause to identify\nthe definer. The DEFINER clause is an extension where the intent is to\nhave what the standard has; that is, a permanent record of who defined\nthe view. This is why the default DEFINER value is the account of the\nview creator.\n\nThe optional ALGORITHM clause is a MySQL extension to standard SQL. It\naffects how MySQL processes the view. ALGORITHM takes three values:\nMERGE, TEMPTABLE, or UNDEFINED. The default algorithm is UNDEFINED if\nno ALGORITHM clause is present. For more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/view-algorithms.html.\n\nSome views are updatable. That is, you can use them in statements such\nas UPDATE, DELETE, or INSERT to update the contents of the underlying\ntable. For a view to be updatable, there must be a one-to-one\nrelationship between the rows in the view and the rows in the\nunderlying table. There are also certain other constructs that make a\nview nonupdatable.\n\nThe WITH CHECK OPTION clause can be given for an updatable view to\nprevent inserts or updates to rows except those for which the WHERE\nclause in the select_statement is true.\n\nIn a WITH CHECK OPTION clause for an updatable view, the LOCAL and\nCASCADED keywords determine the scope of check testing when the view is\ndefined in terms of another view. The LOCAL keyword restricts the CHECK\nOPTION only to the view being defined. CASCADED causes the checks for\nunderlying views to be evaluated as well. When neither keyword is\ngiven, the default is CASCADED.\n\nFor more information about updatable views and the WITH CHECK OPTION\nclause, see\nhttp://dev.mysql.com/doc/refman/5.5/en/view-updatability.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-view.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-view.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (455,37,'TRIM','Syntax:\nTRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr\nFROM] str)\n\nReturns the string str with all remstr prefixes or suffixes removed. If\nnone of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is\nassumed. remstr is optional and, if not specified, spaces are removed.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT TRIM(\' bar \');\n -> \'bar\'\nmysql> SELECT TRIM(LEADING \'x\' FROM \'xxxbarxxx\');\n -> \'barxxx\'\nmysql> SELECT TRIM(BOTH \'x\' FROM \'xxxbarxxx\');\n -> \'bar\'\nmysql> SELECT TRIM(TRAILING \'xyz\' FROM \'barxxyz\');\n -> \'barx\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (456,18,'IS','Syntax:\nIS boolean_value\n\nTests a value against a boolean value, where boolean_value can be TRUE,\nFALSE, or UNKNOWN.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;\n -> 1, 1, 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (457,31,'GET_FORMAT','Syntax:\nGET_FORMAT({DATE|TIME|DATETIME}, {\'EUR\'|\'USA\'|\'JIS\'|\'ISO\'|\'INTERNAL\'})\n\nReturns a format string. This function is useful in combination with\nthe DATE_FORMAT() and the STR_TO_DATE() functions.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DATE_FORMAT(\'2003-10-03\',GET_FORMAT(DATE,\'EUR\'));\n -> \'03.10.2003\'\nmysql> SELECT STR_TO_DATE(\'10.31.2003\',GET_FORMAT(DATE,\'USA\'));\n -> \'2003-10-31\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (458,22,'TINYBLOB','TINYBLOB\n\nA BLOB column with a maximum length of 255 (28 - 1) bytes. Each\nTINYBLOB value is stored using a 1-byte length prefix that indicates\nthe number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (459,23,'SIGNAL','Syntax:\nSIGNAL condition_value\n [SET signal_information_item\n [, signal_information_item] ...]\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | condition_name\n\nsignal_information_item:\n condition_information_item_name = simple_value_specification\n\ncondition_information_item_name:\n CLASS_ORIGIN\n | SUBCLASS_ORIGIN\n | MESSAGE_TEXT\n | MYSQL_ERRNO\n | CONSTRAINT_CATALOG\n | CONSTRAINT_SCHEMA\n | CONSTRAINT_NAME\n | CATALOG_NAME\n | SCHEMA_NAME\n | TABLE_NAME\n | COLUMN_NAME\n | CURSOR_NAME\n\ncondition_name, simple_value_specification:\n (see following discussion)\n\nSIGNAL is the way to "return" an error. SIGNAL provides error\ninformation to a handler, to an outer portion of the application, or to\nthe client. Also, it provides control over the error\'s characteristics\n(error number, SQLSTATE value, message). Without SIGNAL, it is\nnecessary to resort to workarounds such as deliberately referring to a\nnonexistent table to cause a routine to return an error.\n\nNo special privileges are required to execute the SIGNAL statement.\n\nThe condition_value in a SIGNAL statement indicates the error value to\nbe returned. It can be an SQLSTATE value (a 5-character string literal)\nor a condition_name that refers to a named condition previously defined\nwith DECLARE ... CONDITION (see [HELP DECLARE CONDITION]).\n\nAn SQLSTATE value can indicate errors, warnings, or "not found." The\nfirst two characters of the value indicate its error class, as\ndiscussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/signal.html#signal-condition-inf\normation-items. Some signal values cause statement termination; see\nhttp://dev.mysql.com/doc/refman/5.5/en/signal.html#signal-effects.\n\nThe SQLSTATE value for a SIGNAL statement should not start with \'00\'\nbecause such values indicate success and are not valid for signaling an\nerror. This is true whether the SQLSTATE value is specified directly in\nthe SIGNAL statement or in a named condition referred to in the\nstatement. If the value is invalid, a Bad SQLSTATE error occurs.\n\nTo signal a generic SQLSTATE value, use \'45000\', which means "unhandled\nuser-defined exception."\n\nThe SIGNAL statement optionally includes a SET clause that contains\nmultiple signal items, in a comma-separated list of\ncondition_information_item_name = simple_value_specification\nassignments.\n\nEach condition_information_item_name may be specified only once in the\nSET clause. Otherwise, a Duplicate condition information item error\noccurs.\n\nValid simple_value_specification designators can be specified using\nstored procedure or function parameters, stored program local variables\ndeclared with DECLARE, user-defined variables, system variables, or\nliterals. A character literal may include a _charset introducer.\n\nFor information about permissible condition_information_item_name\nvalues, see\nhttp://dev.mysql.com/doc/refman/5.5/en/signal.html#signal-condition-inf\normation-items.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/signal.html\n\n','CREATE PROCEDURE p (pval INT)\nBEGIN\n DECLARE specialty CONDITION FOR SQLSTATE \'45000\';\n IF pval = 0 THEN\n SIGNAL SQLSTATE \'01000\';\n ELSEIF pval = 1 THEN\n SIGNAL SQLSTATE \'45000\'\n SET MESSAGE_TEXT = \'An error occurred\';\n ELSEIF pval = 2 THEN\n SIGNAL specialty\n SET MESSAGE_TEXT = \'An error occurred\';\n ELSE\n SIGNAL SQLSTATE \'01000\'\n SET MESSAGE_TEXT = \'A warning occurred\', MYSQL_ERRNO = 1000;\n SIGNAL SQLSTATE \'45000\'\n SET MESSAGE_TEXT = \'An error occurred\', MYSQL_ERRNO = 1001;\n END IF;\nEND;\n','http://dev.mysql.com/doc/refman/5.5/en/signal.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (460,8,'SAVEPOINT','Syntax:\nSAVEPOINT identifier\nROLLBACK [WORK] TO [SAVEPOINT] identifier\nRELEASE SAVEPOINT identifier\n\nInnoDB supports the SQL statements SAVEPOINT, ROLLBACK TO SAVEPOINT,\nRELEASE SAVEPOINT and the optional WORK keyword for ROLLBACK.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/savepoint.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/savepoint.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (461,17,'USER','Syntax:\nUSER()\n\nReturns the current MySQL user name and host name as a string in the\nutf8 character set.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT USER();\n -> \'davida@localhost\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (462,23,'LABELS','Syntax:\n[begin_label:] BEGIN\n [statement_list]\nEND [end_label]\n\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\n[begin_label:] REPEAT\n statement_list\nUNTIL search_condition\nEND REPEAT [end_label]\n\n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n\nLabels are permitted for BEGIN ... END blocks and for the LOOP, REPEAT,\nand WHILE statements. Label use for those statements follows these\nrules:\n\no begin_label must be followed by a colon.\n\no begin_label can be given without end_label. If end_label is present,\n it must be the same as begin_label.\n\no end_label cannot be given without begin_label.\n\no Labels at the same nesting level must be distinct.\n\no Labels can be up to 16 characters long.\n\nTo refer to a label within the labeled construct, use an ITERATE or\nLEAVE statement. The following example uses those statements to\ncontinue iterating or terminate the loop:\n\nCREATE PROCEDURE doiterate(p1 INT)\nBEGIN\n label1: LOOP\n SET p1 = p1 + 1;\n IF p1 < 10 THEN ITERATE label1; END IF;\n LEAVE label1;\n END LOOP label1;\nEND;\n\nThe scope of a block label does not include the code for handlers\ndeclared within the block. For details, see [HELP DECLARE HANDLER].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/statement-labels.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/statement-labels.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,39,'ALTER TABLE','Syntax:\nALTER [ONLINE | OFFLINE] [IGNORE] TABLE tbl_name\n [alter_specification [, alter_specification] ...]\n [partition_options]\n\nalter_specification:\n table_options\n | ADD [COLUMN] col_name column_definition\n [FIRST | AFTER col_name ]\n | ADD [COLUMN] (col_name column_definition,...)\n | ADD {INDEX|KEY} [index_name]\n [index_type] (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]] PRIMARY KEY\n [index_type] (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]]\n UNIQUE [INDEX|KEY] [index_name]\n [index_type] (index_col_name,...) [index_option] ...\n | ADD FULLTEXT [INDEX|KEY] [index_name]\n (index_col_name,...) [index_option] ...\n | ADD SPATIAL [INDEX|KEY] [index_name]\n (index_col_name,...) [index_option] ...\n | ADD [CONSTRAINT [symbol]]\n FOREIGN KEY [index_name] (index_col_name,...)\n reference_definition\n | ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}\n | CHANGE [COLUMN] old_col_name new_col_name column_definition\n [FIRST|AFTER col_name]\n | MODIFY [COLUMN] col_name column_definition\n [FIRST | AFTER col_name]\n | DROP [COLUMN] col_name\n | DROP PRIMARY KEY\n | DROP {INDEX|KEY} index_name\n | DROP FOREIGN KEY fk_symbol\n | MAX_ROWS = rows\n | DISABLE KEYS\n | ENABLE KEYS\n | RENAME [TO|AS] new_tbl_name\n | ORDER BY col_name [, col_name] ...\n | CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]\n | [DEFAULT] CHARACTER SET [=] charset_name [COLLATE [=] collation_name]\n | DISCARD TABLESPACE\n | IMPORT TABLESPACE\n | FORCE\n | ADD PARTITION (partition_definition)\n | DROP PARTITION partition_names\n | TRUNCATE PARTITION {partition_names | ALL}\n | COALESCE PARTITION number\n | REORGANIZE PARTITION [partition_names INTO (partition_definitions)]\n | ANALYZE PARTITION {partition_names | ALL}\n | CHECK PARTITION {partition_names | ALL}\n | OPTIMIZE PARTITION {partition_names | ALL}\n | REBUILD PARTITION {partition_names | ALL}\n | REPAIR PARTITION {partition_names | ALL}\n | PARTITION BY partitioning_expression\n | REMOVE PARTITIONING\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n\ntable_options:\n table_option [[,] table_option] ... (see CREATE TABLE options)\n\npartition_options:\n (see CREATE TABLE options)\n\nALTER TABLE changes the structure of a table. For example, you can add\nor delete columns, create or destroy indexes, change the type of\nexisting columns, or rename columns or the table itself. You can also\nchange characteristics such as the storage engine used for the table or\nthe table comment.\n\nPartitioning-related clauses for ALTER TABLE can be used with\npartitioned tables for repartitioning, for adding, dropping, merging,\nand splitting partitions, and for performing partitioning maintenance.\nFor more information, see\nhttp://dev.mysql.com/doc/refman/5.5/en/alter-table-partition-operations\n.html.\n\nFollowing the table name, specify the alterations to be made. If none\nare given, ALTER TABLE does nothing.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,32,'MPOINTFROMWKB','MPointFromWKB(wkb[,srid]), MultiPointFromWKB(wkb[,srid])\n\nConstructs a MULTIPOINT value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (465,22,'CHAR BYTE','The CHAR BYTE data type is an alias for the BINARY data type. This is a\ncompatibility feature.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,20,'REPAIR TABLE','Syntax:\nREPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [QUICK] [EXTENDED] [USE_FRM]\n\nREPAIR TABLE repairs a possibly corrupted table. By default, it has the\nsame effect as myisamchk --recover tbl_name. REPAIR TABLE works for\nMyISAM, ARCHIVE, and CSV tables. See\nhttp://dev.mysql.com/doc/refman/5.5/en/myisam-storage-engine.html, and\nhttp://dev.mysql.com/doc/refman/5.5/en/archive-storage-engine.html, and\nhttp://dev.mysql.com/doc/refman/5.5/en/csv-storage-engine.html\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nREPAIR TABLE is supported for partitioned tables. However, the USE_FRM\noption cannot be used with this statement on a partitioned table.\n\nYou can use ALTER TABLE ... REPAIR PARTITION to repair one or more\npartitions; for more information, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/repair-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/repair-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (467,39,'MERGE','The MERGE storage engine, also known as the MRG_MyISAM engine, is a\ncollection of identical MyISAM tables that can be used as one.\n"Identical" means that all tables have identical column and index\ninformation. You cannot merge MyISAM tables in which the columns are\nlisted in a different order, do not have exactly the same columns, or\nhave the indexes in different order. However, any or all of the MyISAM\ntables can be compressed with myisampack. See\nhttp://dev.mysql.com/doc/refman/5.5/en/myisampack.html. Differences in\ntable options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS do not\nmatter.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/merge-storage-engine.html\n\n','mysql> CREATE TABLE t1 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nmysql> CREATE TABLE t2 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nmysql> INSERT INTO t1 (message) VALUES (\'Testing\'),(\'table\'),(\'t1\');\nmysql> INSERT INTO t2 (message) VALUES (\'Testing\'),(\'table\'),(\'t2\');\nmysql> CREATE TABLE total (\n -> a INT NOT NULL AUTO_INCREMENT,\n -> message CHAR(20), INDEX(a))\n -> ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;\n','http://dev.mysql.com/doc/refman/5.5/en/merge-storage-engine.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,39,'CREATE TABLE','Syntax:\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n (create_definition,...)\n [table_options]\n [partition_options]\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n [(create_definition,...)]\n [table_options]\n [partition_options]\n select_statement\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n { LIKE old_tbl_name | (LIKE old_tbl_name) }\n\ncreate_definition:\n col_name column_definition\n | [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)\n [index_option] ...\n | {INDEX|KEY} [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY]\n [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name,...) reference_definition\n | CHECK (expr)\n\ncolumn_definition:\n data_type [NOT NULL | NULL] [DEFAULT default_value]\n [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY]\n [COMMENT \'string\']\n [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]\n [STORAGE {DISK|MEMORY|DEFAULT}]\n [reference_definition]\n\ndata_type:\n BIT[(length)]\n | TINYINT[(length)] [UNSIGNED] [ZEROFILL]\n | SMALLINT[(length)] [UNSIGNED] [ZEROFILL]\n | MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]\n | INT[(length)] [UNSIGNED] [ZEROFILL]\n | INTEGER[(length)] [UNSIGNED] [ZEROFILL]\n | BIGINT[(length)] [UNSIGNED] [ZEROFILL]\n | REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DECIMAL[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | NUMERIC[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | DATE\n | TIME\n | TIMESTAMP\n | DATETIME\n | YEAR\n | CHAR[(length)]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | VARCHAR(length)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | BINARY[(length)]\n | VARBINARY(length)\n | TINYBLOB\n | BLOB\n | MEDIUMBLOB\n | LONGBLOB\n | TINYTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | TEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | MEDIUMTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | LONGTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | ENUM(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | SET(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | spatial_type\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n\nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\ntable_options:\n table_option [[,] table_option] ...\n\ntable_option:\n ENGINE [=] engine_name\n | AUTO_INCREMENT [=] value\n | AVG_ROW_LENGTH [=] value\n | [DEFAULT] CHARACTER SET [=] charset_name\n | CHECKSUM [=] {0 | 1}\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'string\'\n | CONNECTION [=] \'connect_string\'\n | DATA DIRECTORY [=] \'absolute path to directory\'\n | DELAY_KEY_WRITE [=] {0 | 1}\n | INDEX DIRECTORY [=] \'absolute path to directory\'\n | INSERT_METHOD [=] { NO | FIRST | LAST }\n | KEY_BLOCK_SIZE [=] value\n | MAX_ROWS [=] value\n | MIN_ROWS [=] value\n | PACK_KEYS [=] {0 | 1 | DEFAULT}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT}\n | TABLESPACE tablespace_name [STORAGE {DISK|MEMORY|DEFAULT}]\n | UNION [=] (tbl_name[,tbl_name]...)\n\npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE{(expr) | COLUMNS(column_list)}\n | LIST{(expr) | COLUMNS(column_list)} }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\n\npartition_definition:\n PARTITION partition_name\n [VALUES \n {LESS THAN {(expr | value_list) | MAXVALUE} \n | \n IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\n\nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n\nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some valid select statement)\n\nCREATE TABLE creates a table with the given name. You must have the\nCREATE privilege for the table.\n\nRules for permissible table names are given in\nhttp://dev.mysql.com/doc/refman/5.5/en/identifiers.html. By default,\nthe table is created in the default database, using the InnoDB storage\nengine. An error occurs if the table exists, if there is no default\ndatabase, or if the database does not exist.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/create-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (469,18,'>','Syntax:\n>\n\nGreater than:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT 2 > 2;\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (470,20,'ANALYZE TABLE','Syntax:\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nANALYZE TABLE analyzes and stores the key distribution for a table.\nDuring the analysis, the table is locked with a read lock for InnoDB\nand MyISAM. This statement works with InnoDB, NDB, and MyISAM tables.\nFor MyISAM tables, this statement is equivalent to using myisamchk\n--analyze.\n\nFor more information on how the analysis works within InnoDB, see\nhttp://dev.mysql.com/doc/refman/5.5/en/innodb-restrictions.html.\n\nMySQL uses the stored key distribution to decide the order in which\ntables should be joined when you perform a join on something other than\na constant. In addition, key distributions can be used when deciding\nwhich indexes to use for a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nANALYZE TABLE is supported for partitioned tables, and you can use\nALTER TABLE ... ANALYZE PARTITION to analyze one or more partitions;\nfor more information, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/analyze-table.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/analyze-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (471,31,'MICROSECOND','Syntax:\nMICROSECOND(expr)\n\nReturns the microseconds from the time or datetime expression expr as a\nnumber in the range from 0 to 999999.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MICROSECOND(\'12:00:00.123456\');\n -> 123456\nmysql> SELECT MICROSECOND(\'2009-12-31 23:59:59.000010\');\n -> 10\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (472,39,'CONSTRAINT','InnoDB supports foreign keys, which let you cross-reference related\ndata across tables, and foreign key constraints, which help keep this\nspread-out data consistent. The syntax for an InnoDB foreign key\nconstraint definition in the CREATE TABLE or ALTER TABLE statement\nlooks like this:\n\n[CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name, ...)\n REFERENCES tbl_name (index_col_name,...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html\n\n','CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\nCREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,\n product_category INT NOT NULL,\n product_id INT NOT NULL,\n customer_id INT NOT NULL,\n PRIMARY KEY(no),\n INDEX (product_category, product_id),\n FOREIGN KEY (product_category, product_id)\n REFERENCES product(category, id)\n ON UPDATE CASCADE ON DELETE RESTRICT,\n INDEX (customer_id),\n FOREIGN KEY (customer_id)\n REFERENCES customer(id)) ENGINE=INNODB;\n','http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (473,39,'CREATE SERVER','Syntax:\nCREATE SERVER server_name\n FOREIGN DATA WRAPPER wrapper_name\n OPTIONS (option [, option] ...)\n\noption:\n { HOST character-literal\n | DATABASE character-literal\n | USER character-literal\n | PASSWORD character-literal\n | SOCKET character-literal\n | OWNER character-literal\n | PORT numeric-literal }\n\nThis statement creates the definition of a server for use with the\nFEDERATED storage engine. The CREATE SERVER statement creates a new row\nwithin the servers table within the mysql database. This statement\nrequires the SUPER privilege.\n\nThe server_name should be a unique reference to the server. Server\ndefinitions are global within the scope of the server, it is not\npossible to qualify the server definition to a specific database.\nserver_name has a maximum length of 64 characters (names longer than 64\ncharacters are silently truncated), and is case insensitive. You may\nspecify the name as a quoted string.\n\nThe wrapper_name should be mysql, and may be quoted with single\nquotation marks. Other values for wrapper_name are not currently\nsupported.\n\nFor each option you must specify either a character literal or numeric\nliteral. Character literals are UTF-8, support a maximum length of 64\ncharacters and default to a blank (empty) string. String literals are\nsilently truncated to 64 characters. Numeric literals must be a number\nbetween 0 and 9999, default value is 0.\n\n*Note*: Note that the OWNER option is currently not applied, and has no\neffect on the ownership or operation of the server connection that is\ncreated.\n\nThe CREATE SERVER statement creates an entry in the mysql.servers table\nthat can later be used with the CREATE TABLE statement when creating a\nFEDERATED table. The options that you specify will be used to populate\nthe columns in the mysql.servers table. The table columns are\nServer_name, Host, Db, Username, Password, Port and Socket.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/create-server.html\n\n','CREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE \'test\');\n','http://dev.mysql.com/doc/refman/5.5/en/create-server.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (474,37,'FIELD','Syntax:\nFIELD(str,str1,str2,str3,...)\n\nReturns the index (position) of str in the str1, str2, str3, ... list.\nReturns 0 if str is not found.\n\nIf all arguments to FIELD() are strings, all arguments are compared as\nstrings. If all arguments are numbers, they are compared as numbers.\nOtherwise, the arguments are compared as double.\n\nIf str is NULL, the return value is 0 because NULL fails equality\ncomparison with any value. FIELD() is the complement of ELT().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT FIELD(\'ej\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\');\n -> 2\nmysql> SELECT FIELD(\'fo\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\');\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,31,'MAKETIME','Syntax:\nMAKETIME(hour,minute,second)\n\nReturns a time value calculated from the hour, minute, and second\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT MAKETIME(12,15,30);\n -> \'12:15:30\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (476,31,'CURDATE','Syntax:\nCURDATE()\n\nReturns the current date as a value in \'YYYY-MM-DD\' or YYYYMMDD format,\ndepending on whether the function is used in a string or numeric\ncontext.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT CURDATE();\n -> \'2008-06-13\'\nmysql> SELECT CURDATE() + 0;\n -> 20080613\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (477,10,'SET PASSWORD','Syntax:\nSET PASSWORD [FOR user] =\n {\n PASSWORD(\'cleartext password\')\n | OLD_PASSWORD(\'cleartext password\')\n | \'encrypted password\'\n }\n\nThe SET PASSWORD statement assigns a password to an existing MySQL user\naccount. When the read_only system variable is enabled, the SUPER\nprivilege is required to use SET PASSWORD, in addition to whatever\nother privileges might be required.\n\nIf the password is specified using the PASSWORD() or OLD_PASSWORD()\nfunction, the cleartext (unencrypted) password should be given as the\nargument to the function, which hashes the password and returns the\nencrypted password string. If the password is specified without using\neither function, it should be the already encrypted password value as a\nliteral string. In all cases, the encrypted password string must be in\nthe format required by the authentication method used for the account.\n\nThe old_passwords system variable value determines the hashing method\nused by PASSWORD(). If you specify the password using that function and\nSET PASSWORD rejects the password as not being in the correct format,\nit may be necessary to set old_passwords to change the hashing method.\nFor descriptions of the permitted values, see\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nWith no FOR user clause, this statement sets the password for the\ncurrent user. (To see which account the server authenticated you as,\ninvoke the CURRENT_USER() function.) Any client who successfully\nconnects to the server using a nonanonymous account can change the\npassword for that account.\n\nWith a FOR user clause, this statement sets the password for the named\nuser. You must have the UPDATE privilege for the mysql database to do\nthis. The user account name uses the format described in\nhttp://dev.mysql.com/doc/refman/5.5/en/account-names.html. The user\nvalue should be given as \'user_name\'@\'host_name\', where \'user_name\' and\n\'host_name\' are exactly as listed in the User and Host columns of the\nmysql.user table row. (If you specify only a user name, a host name of\n\'%\' is used.) For example, to set the password for an account with User\nand Host column values of \'bob\' and \'%.example.org\', write the\nstatement like this:\n\nSET PASSWORD FOR \'bob\'@\'%.example.org\' = PASSWORD(\'cleartext password\');\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/set-password.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/set-password.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (478,39,'ALTER TABLESPACE','Syntax:\nALTER TABLESPACE tablespace_name\n {ADD|DROP} DATAFILE \'file_name\'\n [INITIAL_SIZE [=] size]\n [WAIT]\n ENGINE [=] engine_name\n\nThis statement can be used either to add a new data file, or to drop a\ndata file from a tablespace.\n\nThe ADD DATAFILE variant enables you to specify an initial size using\nan INITIAL_SIZE clause, where size is measured in bytes; the default\nvalue is 128M (128 megabytes). You may optionally follow this integer\nvalue with a one-letter abbreviation for an order of magnitude, similar\nto those used in my.cnf. Generally, this is one of the letters M (for\nmegabytes) or G (for gigabytes).\n\n*Note*: All MySQL Cluster Disk Data objects share the same namespace.\nThis means that each Disk Data object must be uniquely named (and not\nmerely each Disk Data object of a given type). For example, you cannot\nhave a tablespace and an data file with the same name, or an undo log\nfile and a tablespace with the same name.\n\nOn 32-bit systems, the maximum supported value for INITIAL_SIZE is 4G.\n(Bug #29186)\n\nINITIAL_SIZE is rounded, explicitly, as for CREATE TABLESPACE.\n\nOnce a data file has been created, its size cannot be changed; however,\nyou can add more data files to the tablespace using additional ALTER\nTABLESPACE ... ADD DATAFILE statements.\n\nUsing DROP DATAFILE with ALTER TABLESPACE drops the data file\n\'file_name\' from the tablespace. You cannot drop a data file from a\ntablespace which is in use by any table; in other words, the data file\nmust be empty (no extents used). See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-disk-data-objects.\nhtml. In addition, any data file to be dropped must previously have\nbeen added to the tablespace with CREATE TABLESPACE or ALTER\nTABLESPACE.\n\nBoth ALTER TABLESPACE ... ADD DATAFILE and ALTER TABLESPACE ... DROP\nDATAFILE require an ENGINE clause which specifies the storage engine\nused by the tablespace. Currently, the only accepted values for\nengine_name are NDB and NDBCLUSTER.\n\nWAIT is parsed but otherwise ignored, and so has no effect in MySQL\n5.5. It is intended for future expansion.\n\nWhen ALTER TABLESPACE ... ADD DATAFILE is used with ENGINE = NDB, a\ndata file is created on each Cluster data node. You can verify that the\ndata files were created and obtain information about them by querying\nthe INFORMATION_SCHEMA.FILES table. For example, the following query\nshows all data files belonging to the tablespace named newts:\n\nmysql> SELECT LOGFILE_GROUP_NAME, FILE_NAME, EXTRA\n -> FROM INFORMATION_SCHEMA.FILES\n -> WHERE TABLESPACE_NAME = \'newts\' AND FILE_TYPE = \'DATAFILE\';\n+--------------------+--------------+----------------+\n| LOGFILE_GROUP_NAME | FILE_NAME | EXTRA |\n+--------------------+--------------+----------------+\n| lg_3 | newdata.dat | CLUSTER_NODE=3 |\n| lg_3 | newdata.dat | CLUSTER_NODE=4 |\n| lg_3 | newdata2.dat | CLUSTER_NODE=3 |\n| lg_3 | newdata2.dat | CLUSTER_NODE=4 |\n+--------------------+--------------+----------------+\n2 rows in set (0.03 sec)\n\nSee http://dev.mysql.com/doc/refman/5.5/en/files-table.html.\n\nALTER TABLESPACE is useful only with Disk Data storage for MySQL\nCluster. See\nhttp://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-disk-data.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/alter-tablespace.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/alter-tablespace.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (479,7,'IF FUNCTION','Syntax:\nIF(expr1,expr2,expr3)\n\nIf expr1 is TRUE (expr1 <> 0 and expr1 <> NULL) then IF() returns\nexpr2; otherwise it returns expr3. IF() returns a numeric or string\nvalue, depending on the context in which it is used.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html\n\n','mysql> SELECT IF(1>2,2,3);\n -> 3\nmysql> SELECT IF(1<2,\'yes\',\'no\');\n -> \'yes\'\nmysql> SELECT IF(STRCMP(\'test\',\'test1\'),\'no\',\'yes\');\n -> \'no\'\n','http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (480,22,'ENUM','ENUM(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nAn enumeration. A string object that can have only one value, chosen\nfrom the list of values \'value1\', \'value2\', ..., NULL or the special \'\'\nerror value. An ENUM column can have a maximum of 65,535 distinct\nvalues. ENUM values are represented internally as integers.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (481,17,'DATABASE','Syntax:\nDATABASE()\n\nReturns the default (current) database name as a string in the utf8\ncharacter set. If there is no default database, DATABASE() returns\nNULL. Within a stored routine, the default database is the database\nthat the routine is associated with, which is not necessarily the same\nas the database that is the default in the calling context.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT DATABASE();\n -> \'test\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (482,32,'POINTFROMWKB','PointFromWKB(wkb[,srid])\n\nConstructs a POINT value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions\n\n','','http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-values.html#gis-wkb-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (483,4,'POWER','Syntax:\nPOWER(X,Y)\n\nThis is a synonym for POW().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (484,4,'ATAN','Syntax:\nATAN(X)\n\nReturns the arc tangent of X, that is, the value whose tangent is X.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT ATAN(2);\n -> 1.1071487177941\nmysql> SELECT ATAN(-2);\n -> -1.1071487177941\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (485,37,'STRCMP','Syntax:\nSTRCMP(expr1,expr2)\n\nSTRCMP() returns 0 if the strings are the same, -1 if the first\nargument is smaller than the second according to the current sort\norder, and 1 otherwise.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html\n\n','mysql> SELECT STRCMP(\'text\', \'text2\');\n -> -1\nmysql> SELECT STRCMP(\'text2\', \'text\');\n -> 1\nmysql> SELECT STRCMP(\'text\', \'text\');\n -> 0\n','http://dev.mysql.com/doc/refman/5.5/en/string-comparison-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (486,27,'INSERT DELAYED','Syntax:\nINSERT DELAYED ...\n\nThe DELAYED option for the INSERT statement is a MySQL extension to\nstandard SQL that is very useful if you have clients that cannot or\nneed not wait for the INSERT to complete. This is a common situation\nwhen you use MySQL for logging and you also periodically run SELECT and\nUPDATE statements that take a long time to complete.\n\nWhen a client uses INSERT DELAYED, it gets an okay from the server at\nonce, and the row is queued to be inserted when the table is not in use\nby any other thread.\n\nAnother major benefit of using INSERT DELAYED is that inserts from many\nclients are bundled together and written in one block. This is much\nfaster than performing many separate inserts.\n\nNote that INSERT DELAYED is slower than a normal INSERT if the table is\nnot otherwise in use. There is also the additional overhead for the\nserver to handle a separate thread for each table for which there are\ndelayed rows. This means that you should use INSERT DELAYED only when\nyou are really sure that you need it.\n\nThe queued rows are held only in memory until they are inserted into\nthe table. This means that if you terminate mysqld forcibly (for\nexample, with kill -9) or if mysqld dies unexpectedly, any queued rows\nthat have not been written to disk are lost.\n\nThere are some constraints on the use of DELAYED:\n\no INSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE, and BLACKHOLE\n tables. For engines that do not support DELAYED, an error occurs.\n\no An error occurs for INSERT DELAYED if used with a table that has been\n locked with LOCK TABLES because the insert must be handled by a\n separate thread, not by the session that holds the lock.\n\no For MyISAM tables, if there are no free blocks in the middle of the\n data file, concurrent SELECT and INSERT statements are supported.\n Under these circumstances, you very seldom need to use INSERT DELAYED\n with MyISAM.\n\no INSERT DELAYED should be used only for INSERT statements that specify\n value lists. The server ignores DELAYED for INSERT ... SELECT or\n INSERT ... ON DUPLICATE KEY UPDATE statements.\n\no Because the INSERT DELAYED statement returns immediately, before the\n rows are inserted, you cannot use LAST_INSERT_ID() to get the\n AUTO_INCREMENT value that the statement might generate.\n\no DELAYED rows are not visible to SELECT statements until they actually\n have been inserted.\n\no Prior to MySQL 5.5.7, INSERT DELAYED was treated as a normal INSERT\n if the statement inserted multiple rows, binary logging was enabled,\n and the global logging format was statement-based (that is, whenever\n binlog_format was set to STATEMENT). Beginning with MySQL 5.5.7,\n INSERT DELAYED is always handled as a simple INSERT (that is, without\n the DELAYED option) whenever the value of binlog_format is STATEMENT\n or MIXED. (In the latter case, the statement no longer triggers a\n switch to row-based logging, and so is logged using the\n statement-based format.)\n\n This does not apply when using row-based binary logging mode\n (binlog_format set to ROW), in which INSERT DELAYED statements are\n always executed using the DELAYED option as specified, and logged as\n row-update events.\n\no DELAYED is ignored on slave replication servers, so that INSERT\n DELAYED is treated as a normal INSERT on slaves. This is because\n DELAYED could cause the slave to have different data than the master.\n\no Pending INSERT DELAYED statements are lost if a table is write locked\n and ALTER TABLE is used to modify the table structure.\n\no INSERT DELAYED is not supported for views.\n\no INSERT DELAYED is not supported for partitioned tables.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/insert-delayed.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/insert-delayed.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (487,26,'SHOW PROFILE','Syntax:\nSHOW PROFILE [type [, type] ... ]\n [FOR QUERY n]\n [LIMIT row_count [OFFSET offset]]\n\ntype:\n ALL\n | BLOCK IO\n | CONTEXT SWITCHES\n | CPU\n | IPC\n | MEMORY\n | PAGE FAULTS\n | SOURCE\n | SWAPS\n\nThe SHOW PROFILE and SHOW PROFILES statements display profiling\ninformation that indicates resource usage for statements executed\nduring the course of the current session.\n\nProfiling is controlled by the profiling session variable, which has a\ndefault value of 0 (OFF). Profiling is enabled by setting profiling to\n1 or ON:\n\nmysql> SET profiling = 1;\n\nSHOW PROFILES displays a list of the most recent statements sent to the\nserver. The size of the list is controlled by the\nprofiling_history_size session variable, which has a default value of\n15. The maximum value is 100. Setting the value to 0 has the practical\neffect of disabling profiling.\n\nAll statements are profiled except SHOW PROFILE and SHOW PROFILES, so\nyou will find neither of those statements in the profile list.\nMalformed statements are profiled. For example, SHOW PROFILING is an\nillegal statement, and a syntax error occurs if you try to execute it,\nbut it will show up in the profiling list.\n\nSHOW PROFILE displays detailed information about a single statement.\nWithout the FOR QUERY n clause, the output pertains to the most\nrecently executed statement. If FOR QUERY n is included, SHOW PROFILE\ndisplays information for statement n. The values of n correspond to the\nQuery_ID values displayed by SHOW PROFILES.\n\nThe LIMIT row_count clause may be given to limit the output to\nrow_count rows. If LIMIT is given, OFFSET offset may be added to begin\nthe output offset rows into the full set of rows.\n\nBy default, SHOW PROFILE displays Status and Duration columns. The\nStatus values are like the State values displayed by SHOW PROCESSLIST,\nalthough there might be some minor differences in interpretion for the\ntwo statements for some status values (see\nhttp://dev.mysql.com/doc/refman/5.5/en/thread-information.html).\n\nOptional type values may be specified to display specific additional\ntypes of information:\n\no ALL displays all information\n\no BLOCK IO displays counts for block input and output operations\n\no CONTEXT SWITCHES displays counts for voluntary and involuntary\n context switches\n\no CPU displays user and system CPU usage times\n\no IPC displays counts for messages sent and received\n\no MEMORY is not currently implemented\n\no PAGE FAULTS displays counts for major and minor page faults\n\no SOURCE displays the names of functions from the source code, together\n with the name and line number of the file in which the function\n occurs\n\no SWAPS displays swap counts\n\nProfiling is enabled per session. When a session ends, its profiling\ninformation is lost.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-profile.html\n\n','mysql> SELECT @@profiling;\n+-------------+\n| @@profiling |\n+-------------+\n| 0 |\n+-------------+\n1 row in set (0.00 sec)\n\nmysql> SET profiling = 1;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> DROP TABLE IF EXISTS t1;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nmysql> CREATE TABLE T1 (id INT);\nQuery OK, 0 rows affected (0.01 sec)\n\nmysql> SHOW PROFILES;\n+----------+----------+--------------------------+\n| Query_ID | Duration | Query |\n+----------+----------+--------------------------+\n| 0 | 0.000088 | SET PROFILING = 1 |\n| 1 | 0.000136 | DROP TABLE IF EXISTS t1 |\n| 2 | 0.011947 | CREATE TABLE t1 (id INT) |\n+----------+----------+--------------------------+\n3 rows in set (0.00 sec)\n\nmysql> SHOW PROFILE;\n+----------------------+----------+\n| Status | Duration |\n+----------------------+----------+\n| checking permissions | 0.000040 |\n| creating table | 0.000056 |\n| After create | 0.011363 |\n| query end | 0.000375 |\n| freeing items | 0.000089 |\n| logging slow query | 0.000019 |\n| cleaning up | 0.000005 |\n+----------------------+----------+\n7 rows in set (0.00 sec)\n\nmysql> SHOW PROFILE FOR QUERY 1;\n+--------------------+----------+\n| Status | Duration |\n+--------------------+----------+\n| query end | 0.000107 |\n| freeing items | 0.000008 |\n| logging slow query | 0.000015 |\n| cleaning up | 0.000006 |\n+--------------------+----------+\n4 rows in set (0.00 sec)\n\nmysql> SHOW PROFILE CPU FOR QUERY 2;\n+----------------------+----------+----------+------------+\n| Status | Duration | CPU_user | CPU_system |\n+----------------------+----------+----------+------------+\n| checking permissions | 0.000040 | 0.000038 | 0.000002 |\n| creating table | 0.000056 | 0.000028 | 0.000028 |\n| After create | 0.011363 | 0.000217 | 0.001571 |\n| query end | 0.000375 | 0.000013 | 0.000028 |\n| freeing items | 0.000089 | 0.000010 | 0.000014 |\n| logging slow query | 0.000019 | 0.000009 | 0.000010 |\n| cleaning up | 0.000005 | 0.000003 | 0.000002 |\n+----------------------+----------+----------+------------+\n7 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/show-profile.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (488,26,'SHOW PROCEDURE CODE','Syntax:\nSHOW PROCEDURE CODE proc_name\n\nThis statement is a MySQL extension that is available only for servers\nthat have been built with debugging support. It displays a\nrepresentation of the internal implementation of the named stored\nprocedure. A similar statement, SHOW FUNCTION CODE, displays\ninformation about stored functions (see [HELP SHOW FUNCTION CODE]).\n\nBoth statements require that you be the owner of the routine or have\nSELECT access to the mysql.proc table.\n\nIf the named routine is available, each statement produces a result\nset. Each row in the result set corresponds to one "instruction" in the\nroutine. The first column is Pos, which is an ordinal number beginning\nwith 0. The second column is Instruction, which contains an SQL\nstatement (usually changed from the original source), or a directive\nwhich has meaning only to the stored-routine handler.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-procedure-code.html\n\n','mysql> DELIMITER //\nmysql> CREATE PROCEDURE p1 ()\n -> BEGIN\n -> DECLARE fanta INT DEFAULT 55;\n -> DROP TABLE t2;\n -> LOOP\n -> INSERT INTO t3 VALUES (fanta);\n -> END LOOP;\n -> END//\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SHOW PROCEDURE CODE p1//\n+-----+----------------------------------------+\n| Pos | Instruction |\n+-----+----------------------------------------+\n| 0 | set fanta@0 55 |\n| 1 | stmt 9 "DROP TABLE t2" |\n| 2 | stmt 5 "INSERT INTO t3 VALUES (fanta)" |\n| 3 | jump 2 |\n+-----+----------------------------------------+\n4 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.5/en/show-procedure-code.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (489,22,'MEDIUMTEXT','MEDIUMTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nA TEXT column with a maximum length of 16,777,215 (224 - 1) characters.\nThe effective maximum length is less if the value contains multi-byte\ncharacters. Each MEDIUMTEXT value is stored using a 3-byte length\nprefix that indicates the number of bytes in the value.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (490,4,'LN','Syntax:\nLN(X)\n\nReturns the natural logarithm of X; that is, the base-e logarithm of X.\nIf X is less than or equal to 0, then NULL is returned.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT LN(2);\n -> 0.69314718055995\nmysql> SELECT LN(-2);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (491,23,'RETURN','Syntax:\nRETURN expr\n\nThe RETURN statement terminates execution of a stored function and\nreturns the value expr to the function caller. There must be at least\none RETURN statement in a stored function. There may be more than one\nif the function has multiple exit points.\n\nThis statement is not used in stored procedures, triggers, or events.\nThe LEAVE statement can be used to exit a stored program of those\ntypes.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/return.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/return.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (492,26,'SHOW COLLATION','Syntax:\nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n\nThis statement lists collations supported by the server. By default,\nthe output from SHOW COLLATION includes all available collations. The\nLIKE clause, if present, indicates which collation names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttp://dev.mysql.com/doc/refman/5.5/en/extended-show.html. For example:\n\nmysql> SHOW COLLATION LIKE \'latin1%\';\n+-------------------+---------+----+---------+----------+---------+\n| Collation | Charset | Id | Default | Compiled | Sortlen |\n+-------------------+---------+----+---------+----------+---------+\n| latin1_german1_ci | latin1 | 5 | | | 0 |\n| latin1_swedish_ci | latin1 | 8 | Yes | Yes | 0 |\n| latin1_danish_ci | latin1 | 15 | | | 0 |\n| latin1_german2_ci | latin1 | 31 | | Yes | 2 |\n| latin1_bin | latin1 | 47 | | Yes | 0 |\n| latin1_general_ci | latin1 | 48 | | | 0 |\n| latin1_general_cs | latin1 | 49 | | | 0 |\n| latin1_spanish_ci | latin1 | 94 | | | 0 |\n+-------------------+---------+----+---------+----------+---------+\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/show-collation.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/show-collation.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (493,4,'LOG','Syntax:\nLOG(X), LOG(B,X)\n\nIf called with one parameter, this function returns the natural\nlogarithm of X. If X is less than or equal to 0, then NULL is returned.\n\nThe inverse of this function (when called with a single argument) is\nthe EXP() function.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT LOG(2);\n -> 0.69314718055995\nmysql> SELECT LOG(-2);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (494,8,'SET SQL_LOG_BIN','Syntax:\nSET sql_log_bin = {0|1}\n\nThe sql_log_bin variable controls whether logging to the binary log is\ndone. The default value is 1 (do logging). To change logging for the\ncurrent session, change the session value of this variable. The session\nuser must have the SUPER privilege to set this variable.\n\nBeginning with MySQL 5.5.5, it is no longer possible to set\n@@session.sql_log_bin within a transaction or subquery. (Bug #53437)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/set-sql-log-bin.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/set-sql-log-bin.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (495,18,'!=','Syntax:\n<>, !=\n\nNot equal:\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT \'.01\' <> \'0.01\';\n -> 1\nmysql> SELECT .01 <> \'0.01\';\n -> 0\nmysql> SELECT \'zapp\' <> \'zappp\';\n -> 1\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (496,23,'WHILE','Syntax:\n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n\nThe statement list within a WHILE statement is repeated as long as the\nsearch_condition expression is true. statement_list consists of one or\nmore SQL statements, each terminated by a semicolon (;) statement\ndelimiter.\n\nA WHILE statement can be labeled. For the rules regarding label use,\nsee [HELP labels].\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/while.html\n\n','CREATE PROCEDURE dowhile()\nBEGIN\n DECLARE v1 INT DEFAULT 5;\n\n WHILE v1 > 0 DO\n ...\n SET v1 = v1 - 1;\n END WHILE;\nEND;\n','http://dev.mysql.com/doc/refman/5.5/en/while.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (497,12,'AES_DECRYPT','Syntax:\nAES_DECRYPT(crypt_str,key_str)\n\nThis function decrypts data using the official AES (Advanced Encryption\nStandard) algorithm. For more information, see the description of\nAES_ENCRYPT().\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (498,31,'DAYNAME','Syntax:\nDAYNAME(date)\n\nReturns the name of the weekday for date. The language used for the\nname is controlled by the value of the lc_time_names system variable\n(http://dev.mysql.com/doc/refman/5.5/en/locale-support.html).\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html\n\n','mysql> SELECT DAYNAME(\'2007-02-03\');\n -> \'Saturday\'\n','http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (499,17,'COERCIBILITY','Syntax:\nCOERCIBILITY(str)\n\nReturns the collation coercibility value of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT COERCIBILITY(\'abc\' COLLATE latin1_swedish_ci);\n -> 0\nmysql> SELECT COERCIBILITY(USER());\n -> 3\nmysql> SELECT COERCIBILITY(\'abc\');\n -> 4\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (500,22,'INT','INT[(M)] [UNSIGNED] [ZEROFILL]\n\nA normal-size integer. The signed range is -2147483648 to 2147483647.\nThe unsigned range is 0 to 4294967295.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,13,'GLENGTH','GLength(ls)\n\nReturns as a double-precision number the length of the LineString value\nls in its associated spatial reference.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions\n\n','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.8284271247462 |\n+----------------------------+\n','http://dev.mysql.com/doc/refman/5.5/en/geometry-property-functions.html#linestring-property-functions');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (502,4,'RADIANS','Syntax:\nRADIANS(X)\n\nReturns the argument X, converted from degrees to radians. (Note that\nπ radians equals 180 degrees.)\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html\n\n','mysql> SELECT RADIANS(90);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (503,17,'COLLATION','Syntax:\nCOLLATION(str)\n\nReturns the collation of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT COLLATION(\'abc\');\n -> \'latin1_swedish_ci\'\nmysql> SELECT COLLATION(_utf8\'abc\');\n -> \'utf8_general_ci\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (504,18,'COALESCE','Syntax:\nCOALESCE(value,...)\n\nReturns the first non-NULL value in the list, or NULL if there are no\nnon-NULL values.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html\n\n','mysql> SELECT COALESCE(NULL,1);\n -> 1\nmysql> SELECT COALESCE(NULL,NULL,NULL);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (505,17,'VERSION','Syntax:\nVERSION()\n\nReturns a string that indicates the MySQL server version. The string\nuses the utf8 character set. The value might have a suffix in addition\nto the version number. See the description of the version system\nvariable in\nhttp://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html\n\n','mysql> SELECT VERSION();\n -> \'5.5.29-standard\'\n','http://dev.mysql.com/doc/refman/5.5/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (506,37,'MAKE_SET','Syntax:\nMAKE_SET(bits,str1,str2,...)\n\nReturns a set value (a string containing substrings separated by ","\ncharacters) consisting of the strings that have the corresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL\nvalues in str1, str2, ... are not appended to the result.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT MAKE_SET(1,\'a\',\'b\',\'c\');\n -> \'a\'\nmysql> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\');\n -> \'hello,world\'\nmysql> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\');\n -> \'hello\'\nmysql> SELECT MAKE_SET(0,\'a\',\'b\',\'c\');\n -> \'\'\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (507,37,'FIND_IN_SET','Syntax:\nFIND_IN_SET(str,strlist)\n\nReturns a value in the range of 1 to N if the string str is in the\nstring list strlist consisting of N substrings. A string list is a\nstring composed of substrings separated by "," characters. If the first\nargument is a constant string and the second is a column of type SET,\nthe FIND_IN_SET() function is optimized to use bit arithmetic. Returns\n0 if str is not in strlist or if strlist is the empty string. Returns\nNULL if either argument is NULL. This function does not work properly\nif the first argument contains a comma (",") character.\n\nURL: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html\n\n','mysql> SELECT FIND_IN_SET(\'b\',\'a,b,c,d\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.5/en/string-functions.html');
insert into help_keyword (help_keyword_id,name) values (0,'JOIN');
insert into help_keyword (help_keyword_id,name) values (1,'HOST');
@@ -596,1418 +603,1471 @@ insert into help_keyword (help_keyword_id,name) values (22,'DROP');
insert into help_keyword (help_keyword_id,name) values (23,'GEOMETRYCOLLECTIONFROMWKB');
insert into help_keyword (help_keyword_id,name) values (24,'EVENTS');
insert into help_keyword (help_keyword_id,name) values (25,'MONTH');
-insert into help_keyword (help_keyword_id,name) values (26,'INFO');
-insert into help_keyword (help_keyword_id,name) values (27,'PROFILES');
-insert into help_keyword (help_keyword_id,name) values (28,'DUPLICATE');
-insert into help_keyword (help_keyword_id,name) values (29,'REPLICATION');
-insert into help_keyword (help_keyword_id,name) values (30,'UNLOCK');
-insert into help_keyword (help_keyword_id,name) values (31,'INNODB');
-insert into help_keyword (help_keyword_id,name) values (32,'YEAR_MONTH');
-insert into help_keyword (help_keyword_id,name) values (33,'SUBJECT');
-insert into help_keyword (help_keyword_id,name) values (34,'PREPARE');
-insert into help_keyword (help_keyword_id,name) values (35,'LOCK');
-insert into help_keyword (help_keyword_id,name) values (36,'NDB');
-insert into help_keyword (help_keyword_id,name) values (37,'CHECK');
-insert into help_keyword (help_keyword_id,name) values (38,'FULL');
-insert into help_keyword (help_keyword_id,name) values (39,'INT4');
-insert into help_keyword (help_keyword_id,name) values (40,'BY');
-insert into help_keyword (help_keyword_id,name) values (41,'NO');
-insert into help_keyword (help_keyword_id,name) values (42,'MINUTE');
-insert into help_keyword (help_keyword_id,name) values (43,'PARTITION');
-insert into help_keyword (help_keyword_id,name) values (44,'DATA');
-insert into help_keyword (help_keyword_id,name) values (45,'DAY');
-insert into help_keyword (help_keyword_id,name) values (46,'SHARE');
-insert into help_keyword (help_keyword_id,name) values (47,'REAL');
-insert into help_keyword (help_keyword_id,name) values (48,'SEPARATOR');
+insert into help_keyword (help_keyword_id,name) values (26,'PROFILES');
+insert into help_keyword (help_keyword_id,name) values (27,'DUPLICATE');
+insert into help_keyword (help_keyword_id,name) values (28,'REPLICATION');
+insert into help_keyword (help_keyword_id,name) values (29,'UNLOCK');
+insert into help_keyword (help_keyword_id,name) values (30,'INNODB');
+insert into help_keyword (help_keyword_id,name) values (31,'YEAR_MONTH');
+insert into help_keyword (help_keyword_id,name) values (32,'SUBJECT');
+insert into help_keyword (help_keyword_id,name) values (33,'PREPARE');
+insert into help_keyword (help_keyword_id,name) values (34,'LOCK');
+insert into help_keyword (help_keyword_id,name) values (35,'NDB');
+insert into help_keyword (help_keyword_id,name) values (36,'CHECK');
+insert into help_keyword (help_keyword_id,name) values (37,'FULL');
+insert into help_keyword (help_keyword_id,name) values (38,'INT4');
+insert into help_keyword (help_keyword_id,name) values (39,'BY');
+insert into help_keyword (help_keyword_id,name) values (40,'NO');
+insert into help_keyword (help_keyword_id,name) values (41,'MINUTE');
+insert into help_keyword (help_keyword_id,name) values (42,'PARTITION');
+insert into help_keyword (help_keyword_id,name) values (43,'DATA');
+insert into help_keyword (help_keyword_id,name) values (44,'DAY');
+insert into help_keyword (help_keyword_id,name) values (45,'SHARE');
+insert into help_keyword (help_keyword_id,name) values (46,'REAL');
+insert into help_keyword (help_keyword_id,name) values (47,'SEPARATOR');
+insert into help_keyword (help_keyword_id,name) values (48,'MESSAGE_TEXT');
insert into help_keyword (help_keyword_id,name) values (49,'MASTER_HEARTBEAT_PERIOD');
insert into help_keyword (help_keyword_id,name) values (50,'DELETE');
insert into help_keyword (help_keyword_id,name) values (51,'ON');
-insert into help_keyword (help_keyword_id,name) values (52,'CONNECTION');
-insert into help_keyword (help_keyword_id,name) values (53,'CLOSE');
-insert into help_keyword (help_keyword_id,name) values (54,'X509');
-insert into help_keyword (help_keyword_id,name) values (55,'USE');
-insert into help_keyword (help_keyword_id,name) values (56,'WHERE');
-insert into help_keyword (help_keyword_id,name) values (57,'PRIVILEGES');
-insert into help_keyword (help_keyword_id,name) values (58,'SPATIAL');
-insert into help_keyword (help_keyword_id,name) values (59,'EVENT');
-insert into help_keyword (help_keyword_id,name) values (60,'SUPER');
-insert into help_keyword (help_keyword_id,name) values (61,'SQL_BUFFER_RESULT');
-insert into help_keyword (help_keyword_id,name) values (62,'IGNORE');
-insert into help_keyword (help_keyword_id,name) values (63,'QUICK');
-insert into help_keyword (help_keyword_id,name) values (64,'SIGNED');
-insert into help_keyword (help_keyword_id,name) values (65,'OFFLINE');
-insert into help_keyword (help_keyword_id,name) values (66,'SECURITY');
-insert into help_keyword (help_keyword_id,name) values (67,'AUTOEXTEND_SIZE');
-insert into help_keyword (help_keyword_id,name) values (68,'NDBCLUSTER');
-insert into help_keyword (help_keyword_id,name) values (69,'POLYGONFROMWKB');
-insert into help_keyword (help_keyword_id,name) values (70,'FALSE');
-insert into help_keyword (help_keyword_id,name) values (71,'LEVEL');
-insert into help_keyword (help_keyword_id,name) values (72,'FORCE');
-insert into help_keyword (help_keyword_id,name) values (73,'BINARY');
-insert into help_keyword (help_keyword_id,name) values (74,'TO');
-insert into help_keyword (help_keyword_id,name) values (75,'CHANGE');
-insert into help_keyword (help_keyword_id,name) values (76,'CURRENT_USER');
-insert into help_keyword (help_keyword_id,name) values (77,'HOUR_MINUTE');
-insert into help_keyword (help_keyword_id,name) values (78,'UPDATE');
-insert into help_keyword (help_keyword_id,name) values (79,'PRESERVE');
-insert into help_keyword (help_keyword_id,name) values (80,'INTO');
-insert into help_keyword (help_keyword_id,name) values (81,'FEDERATED');
-insert into help_keyword (help_keyword_id,name) values (82,'VARYING');
-insert into help_keyword (help_keyword_id,name) values (83,'MAX_SIZE');
-insert into help_keyword (help_keyword_id,name) values (84,'HOUR_SECOND');
-insert into help_keyword (help_keyword_id,name) values (85,'VARIABLE');
-insert into help_keyword (help_keyword_id,name) values (86,'ROLLBACK');
-insert into help_keyword (help_keyword_id,name) values (87,'RTREE');
-insert into help_keyword (help_keyword_id,name) values (88,'PROCEDURE');
-insert into help_keyword (help_keyword_id,name) values (89,'TIMESTAMP');
-insert into help_keyword (help_keyword_id,name) values (90,'IMPORT');
-insert into help_keyword (help_keyword_id,name) values (91,'AGAINST');
-insert into help_keyword (help_keyword_id,name) values (92,'CHECKSUM');
-insert into help_keyword (help_keyword_id,name) values (93,'COUNT');
-insert into help_keyword (help_keyword_id,name) values (94,'LONGBINARY');
-insert into help_keyword (help_keyword_id,name) values (95,'THEN');
-insert into help_keyword (help_keyword_id,name) values (96,'INSERT');
-insert into help_keyword (help_keyword_id,name) values (97,'ENGINES');
-insert into help_keyword (help_keyword_id,name) values (98,'HANDLER');
-insert into help_keyword (help_keyword_id,name) values (99,'PORT');
-insert into help_keyword (help_keyword_id,name) values (100,'DAY_SECOND');
-insert into help_keyword (help_keyword_id,name) values (101,'EXISTS');
-insert into help_keyword (help_keyword_id,name) values (102,'MUTEX');
-insert into help_keyword (help_keyword_id,name) values (103,'RELEASE');
-insert into help_keyword (help_keyword_id,name) values (104,'BOOLEAN');
-insert into help_keyword (help_keyword_id,name) values (105,'MOD');
-insert into help_keyword (help_keyword_id,name) values (106,'DEFAULT');
-insert into help_keyword (help_keyword_id,name) values (107,'TYPE');
-insert into help_keyword (help_keyword_id,name) values (108,'NO_WRITE_TO_BINLOG');
-insert into help_keyword (help_keyword_id,name) values (109,'OPTIMIZE');
-insert into help_keyword (help_keyword_id,name) values (110,'RESET');
-insert into help_keyword (help_keyword_id,name) values (111,'ITERATE');
-insert into help_keyword (help_keyword_id,name) values (112,'INSTALL');
-insert into help_keyword (help_keyword_id,name) values (113,'DO');
-insert into help_keyword (help_keyword_id,name) values (114,'BIGINT');
-insert into help_keyword (help_keyword_id,name) values (115,'SET');
-insert into help_keyword (help_keyword_id,name) values (116,'ISSUER');
-insert into help_keyword (help_keyword_id,name) values (117,'DATE');
-insert into help_keyword (help_keyword_id,name) values (118,'STATUS');
-insert into help_keyword (help_keyword_id,name) values (119,'FULLTEXT');
-insert into help_keyword (help_keyword_id,name) values (120,'COMMENT');
-insert into help_keyword (help_keyword_id,name) values (121,'MASTER_CONNECT_RETRY');
-insert into help_keyword (help_keyword_id,name) values (122,'INNER');
-insert into help_keyword (help_keyword_id,name) values (123,'STOP');
-insert into help_keyword (help_keyword_id,name) values (124,'MASTER_LOG_FILE');
-insert into help_keyword (help_keyword_id,name) values (125,'MRG_MYISAM');
-insert into help_keyword (help_keyword_id,name) values (126,'PRECISION');
-insert into help_keyword (help_keyword_id,name) values (127,'REQUIRE');
-insert into help_keyword (help_keyword_id,name) values (128,'TRAILING');
-insert into help_keyword (help_keyword_id,name) values (129,'PARTITIONS');
-insert into help_keyword (help_keyword_id,name) values (130,'LONG');
-insert into help_keyword (help_keyword_id,name) values (131,'OPTION');
-insert into help_keyword (help_keyword_id,name) values (132,'REORGANIZE');
-insert into help_keyword (help_keyword_id,name) values (133,'ELSE');
-insert into help_keyword (help_keyword_id,name) values (134,'DEALLOCATE');
-insert into help_keyword (help_keyword_id,name) values (135,'IO_THREAD');
-insert into help_keyword (help_keyword_id,name) values (136,'CASE');
-insert into help_keyword (help_keyword_id,name) values (137,'CIPHER');
-insert into help_keyword (help_keyword_id,name) values (138,'CONTINUE');
-insert into help_keyword (help_keyword_id,name) values (139,'FROM');
-insert into help_keyword (help_keyword_id,name) values (140,'READ');
-insert into help_keyword (help_keyword_id,name) values (141,'LEFT');
-insert into help_keyword (help_keyword_id,name) values (142,'ELSEIF');
-insert into help_keyword (help_keyword_id,name) values (143,'MINUTE_SECOND');
-insert into help_keyword (help_keyword_id,name) values (144,'COMPACT');
-insert into help_keyword (help_keyword_id,name) values (145,'RESTORE');
-insert into help_keyword (help_keyword_id,name) values (146,'DEC');
-insert into help_keyword (help_keyword_id,name) values (147,'FOR');
-insert into help_keyword (help_keyword_id,name) values (148,'WARNINGS');
-insert into help_keyword (help_keyword_id,name) values (149,'MIN_ROWS');
-insert into help_keyword (help_keyword_id,name) values (150,'CONDITION');
-insert into help_keyword (help_keyword_id,name) values (151,'STRING');
-insert into help_keyword (help_keyword_id,name) values (152,'ENCLOSED');
-insert into help_keyword (help_keyword_id,name) values (153,'FUNCTION');
-insert into help_keyword (help_keyword_id,name) values (154,'AGGREGATE');
-insert into help_keyword (help_keyword_id,name) values (155,'FIELDS');
-insert into help_keyword (help_keyword_id,name) values (156,'INT3');
-insert into help_keyword (help_keyword_id,name) values (157,'ARCHIVE');
-insert into help_keyword (help_keyword_id,name) values (158,'AVG_ROW_LENGTH');
-insert into help_keyword (help_keyword_id,name) values (159,'ADD');
-insert into help_keyword (help_keyword_id,name) values (160,'KILL');
-insert into help_keyword (help_keyword_id,name) values (161,'FLOAT4');
-insert into help_keyword (help_keyword_id,name) values (162,'TABLESPACE');
-insert into help_keyword (help_keyword_id,name) values (163,'VIEW');
-insert into help_keyword (help_keyword_id,name) values (164,'REPEATABLE');
-insert into help_keyword (help_keyword_id,name) values (165,'INFILE');
-insert into help_keyword (help_keyword_id,name) values (166,'ORDER');
-insert into help_keyword (help_keyword_id,name) values (167,'USING');
-insert into help_keyword (help_keyword_id,name) values (168,'MIDDLEINT');
-insert into help_keyword (help_keyword_id,name) values (169,'GRANT');
-insert into help_keyword (help_keyword_id,name) values (170,'UNSIGNED');
-insert into help_keyword (help_keyword_id,name) values (171,'DECIMAL');
-insert into help_keyword (help_keyword_id,name) values (172,'GEOMETRYFROMTEXT');
-insert into help_keyword (help_keyword_id,name) values (173,'INDEXES');
-insert into help_keyword (help_keyword_id,name) values (174,'FOREIGN');
-insert into help_keyword (help_keyword_id,name) values (175,'CACHE');
-insert into help_keyword (help_keyword_id,name) values (176,'HOSTS');
-insert into help_keyword (help_keyword_id,name) values (177,'COMMIT');
-insert into help_keyword (help_keyword_id,name) values (178,'SCHEMAS');
-insert into help_keyword (help_keyword_id,name) values (179,'LEADING');
-insert into help_keyword (help_keyword_id,name) values (180,'SNAPSHOT');
-insert into help_keyword (help_keyword_id,name) values (181,'DECLARE');
-insert into help_keyword (help_keyword_id,name) values (182,'LOAD');
-insert into help_keyword (help_keyword_id,name) values (183,'SQL_CACHE');
-insert into help_keyword (help_keyword_id,name) values (184,'CONVERT');
-insert into help_keyword (help_keyword_id,name) values (185,'DYNAMIC');
-insert into help_keyword (help_keyword_id,name) values (186,'COLLATE');
-insert into help_keyword (help_keyword_id,name) values (187,'POLYGONFROMTEXT');
-insert into help_keyword (help_keyword_id,name) values (188,'BYTE');
-insert into help_keyword (help_keyword_id,name) values (189,'GLOBAL');
-insert into help_keyword (help_keyword_id,name) values (190,'LINESTRINGFROMWKB');
-insert into help_keyword (help_keyword_id,name) values (191,'WHEN');
-insert into help_keyword (help_keyword_id,name) values (192,'COLUMN_FORMAT');
-insert into help_keyword (help_keyword_id,name) values (193,'HAVING');
-insert into help_keyword (help_keyword_id,name) values (194,'AS');
-insert into help_keyword (help_keyword_id,name) values (195,'STARTING');
-insert into help_keyword (help_keyword_id,name) values (196,'RELOAD');
-insert into help_keyword (help_keyword_id,name) values (197,'AUTOCOMMIT');
-insert into help_keyword (help_keyword_id,name) values (198,'REVOKE');
-insert into help_keyword (help_keyword_id,name) values (199,'GRANTS');
-insert into help_keyword (help_keyword_id,name) values (200,'OUTER');
-insert into help_keyword (help_keyword_id,name) values (201,'FLOOR');
-insert into help_keyword (help_keyword_id,name) values (202,'EXPLAIN');
-insert into help_keyword (help_keyword_id,name) values (203,'WITH');
-insert into help_keyword (help_keyword_id,name) values (204,'AFTER');
-insert into help_keyword (help_keyword_id,name) values (205,'STD');
-insert into help_keyword (help_keyword_id,name) values (206,'CSV');
-insert into help_keyword (help_keyword_id,name) values (207,'DISABLE');
-insert into help_keyword (help_keyword_id,name) values (208,'UNINSTALL');
-insert into help_keyword (help_keyword_id,name) values (209,'OUTFILE');
-insert into help_keyword (help_keyword_id,name) values (210,'LOW_PRIORITY');
-insert into help_keyword (help_keyword_id,name) values (211,'FILE');
-insert into help_keyword (help_keyword_id,name) values (212,'NODEGROUP');
-insert into help_keyword (help_keyword_id,name) values (213,'SCHEMA');
-insert into help_keyword (help_keyword_id,name) values (214,'SONAME');
-insert into help_keyword (help_keyword_id,name) values (215,'POW');
-insert into help_keyword (help_keyword_id,name) values (216,'DUAL');
-insert into help_keyword (help_keyword_id,name) values (217,'MULTIPOINTFROMWKB');
-insert into help_keyword (help_keyword_id,name) values (218,'INDEX');
-insert into help_keyword (help_keyword_id,name) values (219,'BACKUP');
-insert into help_keyword (help_keyword_id,name) values (220,'MULTIPOINTFROMTEXT');
-insert into help_keyword (help_keyword_id,name) values (221,'DEFINER');
-insert into help_keyword (help_keyword_id,name) values (222,'MASTER_BIND');
-insert into help_keyword (help_keyword_id,name) values (223,'REMOVE');
-insert into help_keyword (help_keyword_id,name) values (224,'EXTENDED');
-insert into help_keyword (help_keyword_id,name) values (225,'MULTILINESTRINGFROMWKB');
-insert into help_keyword (help_keyword_id,name) values (226,'CROSS');
-insert into help_keyword (help_keyword_id,name) values (227,'CONTRIBUTORS');
-insert into help_keyword (help_keyword_id,name) values (228,'NATIONAL');
-insert into help_keyword (help_keyword_id,name) values (229,'GROUP');
-insert into help_keyword (help_keyword_id,name) values (230,'SHA');
-insert into help_keyword (help_keyword_id,name) values (231,'ONLINE');
-insert into help_keyword (help_keyword_id,name) values (232,'UNDO');
-insert into help_keyword (help_keyword_id,name) values (233,'ZEROFILL');
-insert into help_keyword (help_keyword_id,name) values (234,'CLIENT');
-insert into help_keyword (help_keyword_id,name) values (235,'MASTER_PASSWORD');
-insert into help_keyword (help_keyword_id,name) values (236,'OWNER');
-insert into help_keyword (help_keyword_id,name) values (237,'RELAY_LOG_FILE');
-insert into help_keyword (help_keyword_id,name) values (238,'TRUE');
-insert into help_keyword (help_keyword_id,name) values (239,'CHARACTER');
-insert into help_keyword (help_keyword_id,name) values (240,'MASTER_USER');
-insert into help_keyword (help_keyword_id,name) values (241,'TABLE');
-insert into help_keyword (help_keyword_id,name) values (242,'ENGINE');
-insert into help_keyword (help_keyword_id,name) values (243,'INSERT_METHOD');
-insert into help_keyword (help_keyword_id,name) values (244,'CASCADE');
-insert into help_keyword (help_keyword_id,name) values (245,'RELAY_LOG_POS');
-insert into help_keyword (help_keyword_id,name) values (246,'SQL_CALC_FOUND_ROWS');
-insert into help_keyword (help_keyword_id,name) values (247,'UNION');
-insert into help_keyword (help_keyword_id,name) values (248,'MYISAM');
-insert into help_keyword (help_keyword_id,name) values (249,'LEAVE');
-insert into help_keyword (help_keyword_id,name) values (250,'MODIFY');
-insert into help_keyword (help_keyword_id,name) values (251,'MATCH');
-insert into help_keyword (help_keyword_id,name) values (252,'MASTER_LOG_POS');
-insert into help_keyword (help_keyword_id,name) values (253,'DISTINCTROW');
-insert into help_keyword (help_keyword_id,name) values (254,'DESC');
-insert into help_keyword (help_keyword_id,name) values (255,'TIME');
-insert into help_keyword (help_keyword_id,name) values (256,'NUMERIC');
-insert into help_keyword (help_keyword_id,name) values (257,'EXPANSION');
-insert into help_keyword (help_keyword_id,name) values (258,'CURSOR');
-insert into help_keyword (help_keyword_id,name) values (259,'CODE');
-insert into help_keyword (help_keyword_id,name) values (260,'GEOMETRYCOLLECTIONFROMTEXT');
-insert into help_keyword (help_keyword_id,name) values (261,'CHAIN');
-insert into help_keyword (help_keyword_id,name) values (262,'LOGFILE');
-insert into help_keyword (help_keyword_id,name) values (263,'FLUSH');
-insert into help_keyword (help_keyword_id,name) values (264,'CREATE');
-insert into help_keyword (help_keyword_id,name) values (265,'DESCRIBE');
-insert into help_keyword (help_keyword_id,name) values (266,'EXTENT_SIZE');
-insert into help_keyword (help_keyword_id,name) values (267,'MAX_UPDATES_PER_HOUR');
-insert into help_keyword (help_keyword_id,name) values (268,'INT2');
-insert into help_keyword (help_keyword_id,name) values (269,'PROCESSLIST');
-insert into help_keyword (help_keyword_id,name) values (270,'ENDS');
-insert into help_keyword (help_keyword_id,name) values (271,'LOGS');
-insert into help_keyword (help_keyword_id,name) values (272,'DISCARD');
-insert into help_keyword (help_keyword_id,name) values (273,'HEAP');
-insert into help_keyword (help_keyword_id,name) values (274,'SOUNDS');
-insert into help_keyword (help_keyword_id,name) values (275,'BETWEEN');
-insert into help_keyword (help_keyword_id,name) values (276,'MULTILINESTRINGFROMTEXT');
-insert into help_keyword (help_keyword_id,name) values (277,'REPAIR');
-insert into help_keyword (help_keyword_id,name) values (278,'PACK_KEYS');
-insert into help_keyword (help_keyword_id,name) values (279,'FAST');
-insert into help_keyword (help_keyword_id,name) values (280,'VALUES');
-insert into help_keyword (help_keyword_id,name) values (281,'CALL');
-insert into help_keyword (help_keyword_id,name) values (282,'LOOP');
-insert into help_keyword (help_keyword_id,name) values (283,'VARCHARACTER');
-insert into help_keyword (help_keyword_id,name) values (284,'BEFORE');
-insert into help_keyword (help_keyword_id,name) values (285,'TRUNCATE');
-insert into help_keyword (help_keyword_id,name) values (286,'SHOW');
-insert into help_keyword (help_keyword_id,name) values (287,'ALL');
-insert into help_keyword (help_keyword_id,name) values (288,'REDUNDANT');
-insert into help_keyword (help_keyword_id,name) values (289,'USER_RESOURCES');
-insert into help_keyword (help_keyword_id,name) values (290,'PARTIAL');
-insert into help_keyword (help_keyword_id,name) values (291,'BINLOG');
-insert into help_keyword (help_keyword_id,name) values (292,'END');
-insert into help_keyword (help_keyword_id,name) values (293,'SECOND');
-insert into help_keyword (help_keyword_id,name) values (294,'AND');
-insert into help_keyword (help_keyword_id,name) values (295,'FLOAT8');
-insert into help_keyword (help_keyword_id,name) values (296,'PREV');
-insert into help_keyword (help_keyword_id,name) values (297,'HOUR');
-insert into help_keyword (help_keyword_id,name) values (298,'SELECT');
-insert into help_keyword (help_keyword_id,name) values (299,'DATABASES');
-insert into help_keyword (help_keyword_id,name) values (300,'OR');
-insert into help_keyword (help_keyword_id,name) values (301,'IDENTIFIED');
-insert into help_keyword (help_keyword_id,name) values (302,'WRAPPER');
-insert into help_keyword (help_keyword_id,name) values (303,'MASTER_SSL_CIPHER');
-insert into help_keyword (help_keyword_id,name) values (304,'SQL_SLAVE_SKIP_COUNTER');
-insert into help_keyword (help_keyword_id,name) values (305,'BOTH');
-insert into help_keyword (help_keyword_id,name) values (306,'BOOL');
-insert into help_keyword (help_keyword_id,name) values (307,'YEAR');
-insert into help_keyword (help_keyword_id,name) values (308,'MASTER_PORT');
-insert into help_keyword (help_keyword_id,name) values (309,'CONCURRENT');
-insert into help_keyword (help_keyword_id,name) values (310,'HELP');
-insert into help_keyword (help_keyword_id,name) values (311,'UNIQUE');
-insert into help_keyword (help_keyword_id,name) values (312,'TRIGGERS');
-insert into help_keyword (help_keyword_id,name) values (313,'PROCESS');
-insert into help_keyword (help_keyword_id,name) values (314,'OPTIONS');
-insert into help_keyword (help_keyword_id,name) values (315,'CONSISTENT');
-insert into help_keyword (help_keyword_id,name) values (316,'MASTER_SSL');
-insert into help_keyword (help_keyword_id,name) values (317,'DATE_ADD');
-insert into help_keyword (help_keyword_id,name) values (318,'MAX_CONNECTIONS_PER_HOUR');
-insert into help_keyword (help_keyword_id,name) values (319,'LIKE');
-insert into help_keyword (help_keyword_id,name) values (320,'PLUGIN');
-insert into help_keyword (help_keyword_id,name) values (321,'FETCH');
-insert into help_keyword (help_keyword_id,name) values (322,'IN');
-insert into help_keyword (help_keyword_id,name) values (323,'COLUMN');
-insert into help_keyword (help_keyword_id,name) values (324,'DUMPFILE');
-insert into help_keyword (help_keyword_id,name) values (325,'USAGE');
-insert into help_keyword (help_keyword_id,name) values (326,'EXECUTE');
-insert into help_keyword (help_keyword_id,name) values (327,'MEMORY');
-insert into help_keyword (help_keyword_id,name) values (328,'CEIL');
-insert into help_keyword (help_keyword_id,name) values (329,'QUERY');
-insert into help_keyword (help_keyword_id,name) values (330,'MASTER_HOST');
-insert into help_keyword (help_keyword_id,name) values (331,'LINES');
-insert into help_keyword (help_keyword_id,name) values (332,'SQL_THREAD');
-insert into help_keyword (help_keyword_id,name) values (333,'SERVER');
-insert into help_keyword (help_keyword_id,name) values (334,'MAX_QUERIES_PER_HOUR');
-insert into help_keyword (help_keyword_id,name) values (335,'MASTER_SSL_CERT');
-insert into help_keyword (help_keyword_id,name) values (336,'MULTIPOLYGONFROMWKB');
-insert into help_keyword (help_keyword_id,name) values (337,'TRANSACTION');
-insert into help_keyword (help_keyword_id,name) values (338,'DAY_MINUTE');
-insert into help_keyword (help_keyword_id,name) values (339,'STDDEV');
-insert into help_keyword (help_keyword_id,name) values (340,'DATE_SUB');
-insert into help_keyword (help_keyword_id,name) values (341,'REBUILD');
-insert into help_keyword (help_keyword_id,name) values (342,'GEOMETRYFROMWKB');
-insert into help_keyword (help_keyword_id,name) values (343,'INT1');
-insert into help_keyword (help_keyword_id,name) values (344,'RENAME');
-insert into help_keyword (help_keyword_id,name) values (345,'PARSER');
-insert into help_keyword (help_keyword_id,name) values (346,'RIGHT');
-insert into help_keyword (help_keyword_id,name) values (347,'ALTER');
-insert into help_keyword (help_keyword_id,name) values (348,'MAX_ROWS');
-insert into help_keyword (help_keyword_id,name) values (349,'SOCKET');
-insert into help_keyword (help_keyword_id,name) values (350,'STRAIGHT_JOIN');
-insert into help_keyword (help_keyword_id,name) values (351,'NATURAL');
-insert into help_keyword (help_keyword_id,name) values (352,'VARIABLES');
-insert into help_keyword (help_keyword_id,name) values (353,'ESCAPED');
-insert into help_keyword (help_keyword_id,name) values (354,'SHA1');
-insert into help_keyword (help_keyword_id,name) values (355,'KEY_BLOCK_SIZE');
-insert into help_keyword (help_keyword_id,name) values (356,'PASSWORD');
-insert into help_keyword (help_keyword_id,name) values (357,'OFFSET');
-insert into help_keyword (help_keyword_id,name) values (358,'CHAR');
-insert into help_keyword (help_keyword_id,name) values (359,'NEXT');
-insert into help_keyword (help_keyword_id,name) values (360,'SQL_LOG_BIN');
-insert into help_keyword (help_keyword_id,name) values (361,'ERRORS');
-insert into help_keyword (help_keyword_id,name) values (362,'TEMPORARY');
-insert into help_keyword (help_keyword_id,name) values (363,'COMMITTED');
-insert into help_keyword (help_keyword_id,name) values (364,'SQL_SMALL_RESULT');
-insert into help_keyword (help_keyword_id,name) values (365,'UPGRADE');
-insert into help_keyword (help_keyword_id,name) values (366,'BEGIN');
-insert into help_keyword (help_keyword_id,name) values (367,'DELAY_KEY_WRITE');
-insert into help_keyword (help_keyword_id,name) values (368,'PROFILE');
-insert into help_keyword (help_keyword_id,name) values (369,'MEDIUM');
-insert into help_keyword (help_keyword_id,name) values (370,'INTERVAL');
-insert into help_keyword (help_keyword_id,name) values (371,'SSL');
-insert into help_keyword (help_keyword_id,name) values (372,'DAY_HOUR');
-insert into help_keyword (help_keyword_id,name) values (373,'NAME');
-insert into help_keyword (help_keyword_id,name) values (374,'REFERENCES');
-insert into help_keyword (help_keyword_id,name) values (375,'AES_ENCRYPT');
-insert into help_keyword (help_keyword_id,name) values (376,'STORAGE');
-insert into help_keyword (help_keyword_id,name) values (377,'ISOLATION');
-insert into help_keyword (help_keyword_id,name) values (378,'CEILING');
-insert into help_keyword (help_keyword_id,name) values (379,'EVERY');
-insert into help_keyword (help_keyword_id,name) values (380,'INT8');
-insert into help_keyword (help_keyword_id,name) values (381,'AUTHORS');
-insert into help_keyword (help_keyword_id,name) values (382,'RESTRICT');
-insert into help_keyword (help_keyword_id,name) values (383,'UNCOMMITTED');
-insert into help_keyword (help_keyword_id,name) values (384,'LINESTRINGFROMTEXT');
-insert into help_keyword (help_keyword_id,name) values (385,'IS');
-insert into help_keyword (help_keyword_id,name) values (386,'NOT');
-insert into help_keyword (help_keyword_id,name) values (387,'ANALYSE');
-insert into help_keyword (help_keyword_id,name) values (388,'DATAFILE');
-insert into help_keyword (help_keyword_id,name) values (389,'DES_KEY_FILE');
-insert into help_keyword (help_keyword_id,name) values (390,'COMPRESSED');
-insert into help_keyword (help_keyword_id,name) values (391,'START');
-insert into help_keyword (help_keyword_id,name) values (392,'PLUGINS');
-insert into help_keyword (help_keyword_id,name) values (393,'SAVEPOINT');
-insert into help_keyword (help_keyword_id,name) values (394,'IF');
-insert into help_keyword (help_keyword_id,name) values (395,'PRIMARY');
-insert into help_keyword (help_keyword_id,name) values (396,'PURGE');
-insert into help_keyword (help_keyword_id,name) values (397,'LAST');
-insert into help_keyword (help_keyword_id,name) values (398,'USER');
-insert into help_keyword (help_keyword_id,name) values (399,'INNOBASE');
-insert into help_keyword (help_keyword_id,name) values (400,'EXIT');
-insert into help_keyword (help_keyword_id,name) values (401,'KEYS');
-insert into help_keyword (help_keyword_id,name) values (402,'LIMIT');
-insert into help_keyword (help_keyword_id,name) values (403,'KEY');
-insert into help_keyword (help_keyword_id,name) values (404,'MERGE');
-insert into help_keyword (help_keyword_id,name) values (405,'UNTIL');
-insert into help_keyword (help_keyword_id,name) values (406,'SQL_NO_CACHE');
-insert into help_keyword (help_keyword_id,name) values (407,'DELAYED');
-insert into help_keyword (help_keyword_id,name) values (408,'ANALYZE');
-insert into help_keyword (help_keyword_id,name) values (409,'CONSTRAINT');
-insert into help_keyword (help_keyword_id,name) values (410,'SERIAL');
-insert into help_keyword (help_keyword_id,name) values (411,'ACTION');
-insert into help_keyword (help_keyword_id,name) values (412,'WRITE');
-insert into help_keyword (help_keyword_id,name) values (413,'INITIAL_SIZE');
-insert into help_keyword (help_keyword_id,name) values (414,'SESSION');
-insert into help_keyword (help_keyword_id,name) values (415,'DATABASE');
-insert into help_keyword (help_keyword_id,name) values (416,'NULL');
-insert into help_keyword (help_keyword_id,name) values (417,'POWER');
-insert into help_keyword (help_keyword_id,name) values (418,'USE_FRM');
-insert into help_keyword (help_keyword_id,name) values (419,'TERMINATED');
-insert into help_keyword (help_keyword_id,name) values (420,'SLAVE');
-insert into help_keyword (help_keyword_id,name) values (421,'NVARCHAR');
-insert into help_keyword (help_keyword_id,name) values (422,'ASC');
-insert into help_keyword (help_keyword_id,name) values (423,'RETURN');
-insert into help_keyword (help_keyword_id,name) values (424,'OPTIONALLY');
-insert into help_keyword (help_keyword_id,name) values (425,'ENABLE');
-insert into help_keyword (help_keyword_id,name) values (426,'DIRECTORY');
-insert into help_keyword (help_keyword_id,name) values (427,'WHILE');
-insert into help_keyword (help_keyword_id,name) values (428,'MAX_USER_CONNECTIONS');
-insert into help_keyword (help_keyword_id,name) values (429,'LOCAL');
-insert into help_keyword (help_keyword_id,name) values (430,'DISTINCT');
-insert into help_keyword (help_keyword_id,name) values (431,'AES_DECRYPT');
-insert into help_keyword (help_keyword_id,name) values (432,'MASTER_SSL_KEY');
-insert into help_keyword (help_keyword_id,name) values (433,'NONE');
-insert into help_keyword (help_keyword_id,name) values (434,'TABLES');
-insert into help_keyword (help_keyword_id,name) values (435,'<>');
-insert into help_keyword (help_keyword_id,name) values (436,'RLIKE');
-insert into help_keyword (help_keyword_id,name) values (437,'TRIGGER');
-insert into help_keyword (help_keyword_id,name) values (438,'COLLATION');
-insert into help_keyword (help_keyword_id,name) values (439,'SHUTDOWN');
-insert into help_keyword (help_keyword_id,name) values (440,'HIGH_PRIORITY');
-insert into help_keyword (help_keyword_id,name) values (441,'BTREE');
-insert into help_keyword (help_keyword_id,name) values (442,'FIRST');
-insert into help_keyword (help_keyword_id,name) values (443,'COALESCE');
-insert into help_keyword (help_keyword_id,name) values (444,'WAIT');
-insert into help_keyword (help_keyword_id,name) values (445,'TYPES');
-insert into help_keyword (help_keyword_id,name) values (446,'MASTER');
-insert into help_keyword (help_keyword_id,name) values (447,'FIXED');
-insert into help_keyword (help_keyword_id,name) values (448,'MULTIPOLYGONFROMTEXT');
-insert into help_keyword (help_keyword_id,name) values (449,'ROW_FORMAT');
+insert into help_keyword (help_keyword_id,name) values (52,'COLUMN_NAME');
+insert into help_keyword (help_keyword_id,name) values (53,'CONNECTION');
+insert into help_keyword (help_keyword_id,name) values (54,'CLOSE');
+insert into help_keyword (help_keyword_id,name) values (55,'X509');
+insert into help_keyword (help_keyword_id,name) values (56,'USE');
+insert into help_keyword (help_keyword_id,name) values (57,'SUBCLASS_ORIGIN');
+insert into help_keyword (help_keyword_id,name) values (58,'WHERE');
+insert into help_keyword (help_keyword_id,name) values (59,'PRIVILEGES');
+insert into help_keyword (help_keyword_id,name) values (60,'SPATIAL');
+insert into help_keyword (help_keyword_id,name) values (61,'EVENT');
+insert into help_keyword (help_keyword_id,name) values (62,'SUPER');
+insert into help_keyword (help_keyword_id,name) values (63,'SQL_BUFFER_RESULT');
+insert into help_keyword (help_keyword_id,name) values (64,'IGNORE');
+insert into help_keyword (help_keyword_id,name) values (65,'SHA2');
+insert into help_keyword (help_keyword_id,name) values (66,'QUICK');
+insert into help_keyword (help_keyword_id,name) values (67,'SIGNED');
+insert into help_keyword (help_keyword_id,name) values (68,'OFFLINE');
+insert into help_keyword (help_keyword_id,name) values (69,'SECURITY');
+insert into help_keyword (help_keyword_id,name) values (70,'AUTOEXTEND_SIZE');
+insert into help_keyword (help_keyword_id,name) values (71,'NDBCLUSTER');
+insert into help_keyword (help_keyword_id,name) values (72,'POLYGONFROMWKB');
+insert into help_keyword (help_keyword_id,name) values (73,'FALSE');
+insert into help_keyword (help_keyword_id,name) values (74,'LEVEL');
+insert into help_keyword (help_keyword_id,name) values (75,'FORCE');
+insert into help_keyword (help_keyword_id,name) values (76,'BINARY');
+insert into help_keyword (help_keyword_id,name) values (77,'TO');
+insert into help_keyword (help_keyword_id,name) values (78,'CHANGE');
+insert into help_keyword (help_keyword_id,name) values (79,'CURRENT_USER');
+insert into help_keyword (help_keyword_id,name) values (80,'HOUR_MINUTE');
+insert into help_keyword (help_keyword_id,name) values (81,'UPDATE');
+insert into help_keyword (help_keyword_id,name) values (82,'PRESERVE');
+insert into help_keyword (help_keyword_id,name) values (83,'TABLE_NAME');
+insert into help_keyword (help_keyword_id,name) values (84,'INTO');
+insert into help_keyword (help_keyword_id,name) values (85,'FEDERATED');
+insert into help_keyword (help_keyword_id,name) values (86,'VARYING');
+insert into help_keyword (help_keyword_id,name) values (87,'MAX_SIZE');
+insert into help_keyword (help_keyword_id,name) values (88,'HOUR_SECOND');
+insert into help_keyword (help_keyword_id,name) values (89,'VARIABLE');
+insert into help_keyword (help_keyword_id,name) values (90,'ROLLBACK');
+insert into help_keyword (help_keyword_id,name) values (91,'PROCEDURE');
+insert into help_keyword (help_keyword_id,name) values (92,'TIMESTAMP');
+insert into help_keyword (help_keyword_id,name) values (93,'IMPORT');
+insert into help_keyword (help_keyword_id,name) values (94,'AGAINST');
+insert into help_keyword (help_keyword_id,name) values (95,'CHECKSUM');
+insert into help_keyword (help_keyword_id,name) values (96,'COUNT');
+insert into help_keyword (help_keyword_id,name) values (97,'LONGBINARY');
+insert into help_keyword (help_keyword_id,name) values (98,'THEN');
+insert into help_keyword (help_keyword_id,name) values (99,'INSERT');
+insert into help_keyword (help_keyword_id,name) values (100,'ENGINES');
+insert into help_keyword (help_keyword_id,name) values (101,'HANDLER');
+insert into help_keyword (help_keyword_id,name) values (102,'PORT');
+insert into help_keyword (help_keyword_id,name) values (103,'DAY_SECOND');
+insert into help_keyword (help_keyword_id,name) values (104,'EXISTS');
+insert into help_keyword (help_keyword_id,name) values (105,'MUTEX');
+insert into help_keyword (help_keyword_id,name) values (106,'HELP_DATE');
+insert into help_keyword (help_keyword_id,name) values (107,'RELEASE');
+insert into help_keyword (help_keyword_id,name) values (108,'BOOLEAN');
+insert into help_keyword (help_keyword_id,name) values (109,'MOD');
+insert into help_keyword (help_keyword_id,name) values (110,'DEFAULT');
+insert into help_keyword (help_keyword_id,name) values (111,'TYPE');
+insert into help_keyword (help_keyword_id,name) values (112,'NO_WRITE_TO_BINLOG');
+insert into help_keyword (help_keyword_id,name) values (113,'OPTIMIZE');
+insert into help_keyword (help_keyword_id,name) values (114,'SQLSTATE');
+insert into help_keyword (help_keyword_id,name) values (115,'RESET');
+insert into help_keyword (help_keyword_id,name) values (116,'CLASS_ORIGIN');
+insert into help_keyword (help_keyword_id,name) values (117,'INSTALL');
+insert into help_keyword (help_keyword_id,name) values (118,'ITERATE');
+insert into help_keyword (help_keyword_id,name) values (119,'DO');
+insert into help_keyword (help_keyword_id,name) values (120,'BIGINT');
+insert into help_keyword (help_keyword_id,name) values (121,'SET');
+insert into help_keyword (help_keyword_id,name) values (122,'ISSUER');
+insert into help_keyword (help_keyword_id,name) values (123,'DATE');
+insert into help_keyword (help_keyword_id,name) values (124,'STATUS');
+insert into help_keyword (help_keyword_id,name) values (125,'FULLTEXT');
+insert into help_keyword (help_keyword_id,name) values (126,'COMMENT');
+insert into help_keyword (help_keyword_id,name) values (127,'MASTER_CONNECT_RETRY');
+insert into help_keyword (help_keyword_id,name) values (128,'INNER');
+insert into help_keyword (help_keyword_id,name) values (129,'RELAYLOG');
+insert into help_keyword (help_keyword_id,name) values (130,'STOP');
+insert into help_keyword (help_keyword_id,name) values (131,'MASTER_LOG_FILE');
+insert into help_keyword (help_keyword_id,name) values (132,'MRG_MYISAM');
+insert into help_keyword (help_keyword_id,name) values (133,'PRECISION');
+insert into help_keyword (help_keyword_id,name) values (134,'REQUIRE');
+insert into help_keyword (help_keyword_id,name) values (135,'TRAILING');
+insert into help_keyword (help_keyword_id,name) values (136,'PARTITIONS');
+insert into help_keyword (help_keyword_id,name) values (137,'LONG');
+insert into help_keyword (help_keyword_id,name) values (138,'OPTION');
+insert into help_keyword (help_keyword_id,name) values (139,'REORGANIZE');
+insert into help_keyword (help_keyword_id,name) values (140,'ELSE');
+insert into help_keyword (help_keyword_id,name) values (141,'DEALLOCATE');
+insert into help_keyword (help_keyword_id,name) values (142,'IO_THREAD');
+insert into help_keyword (help_keyword_id,name) values (143,'CASE');
+insert into help_keyword (help_keyword_id,name) values (144,'CIPHER');
+insert into help_keyword (help_keyword_id,name) values (145,'CONTINUE');
+insert into help_keyword (help_keyword_id,name) values (146,'FROM');
+insert into help_keyword (help_keyword_id,name) values (147,'READ');
+insert into help_keyword (help_keyword_id,name) values (148,'LEFT');
+insert into help_keyword (help_keyword_id,name) values (149,'ELSEIF');
+insert into help_keyword (help_keyword_id,name) values (150,'MINUTE_SECOND');
+insert into help_keyword (help_keyword_id,name) values (151,'COMPACT');
+insert into help_keyword (help_keyword_id,name) values (152,'DEC');
+insert into help_keyword (help_keyword_id,name) values (153,'FOR');
+insert into help_keyword (help_keyword_id,name) values (154,'WARNINGS');
+insert into help_keyword (help_keyword_id,name) values (155,'MIN_ROWS');
+insert into help_keyword (help_keyword_id,name) values (156,'STRING');
+insert into help_keyword (help_keyword_id,name) values (157,'CONDITION');
+insert into help_keyword (help_keyword_id,name) values (158,'ENCLOSED');
+insert into help_keyword (help_keyword_id,name) values (159,'FUNCTION');
+insert into help_keyword (help_keyword_id,name) values (160,'AGGREGATE');
+insert into help_keyword (help_keyword_id,name) values (161,'FIELDS');
+insert into help_keyword (help_keyword_id,name) values (162,'INT3');
+insert into help_keyword (help_keyword_id,name) values (163,'ARCHIVE');
+insert into help_keyword (help_keyword_id,name) values (164,'AVG_ROW_LENGTH');
+insert into help_keyword (help_keyword_id,name) values (165,'ADD');
+insert into help_keyword (help_keyword_id,name) values (166,'KILL');
+insert into help_keyword (help_keyword_id,name) values (167,'FLOAT4');
+insert into help_keyword (help_keyword_id,name) values (168,'TABLESPACE');
+insert into help_keyword (help_keyword_id,name) values (169,'VIEW');
+insert into help_keyword (help_keyword_id,name) values (170,'REPEATABLE');
+insert into help_keyword (help_keyword_id,name) values (171,'INFILE');
+insert into help_keyword (help_keyword_id,name) values (172,'HELP_VERSION');
+insert into help_keyword (help_keyword_id,name) values (173,'ORDER');
+insert into help_keyword (help_keyword_id,name) values (174,'USING');
+insert into help_keyword (help_keyword_id,name) values (175,'CONSTRAINT_CATALOG');
+insert into help_keyword (help_keyword_id,name) values (176,'MIDDLEINT');
+insert into help_keyword (help_keyword_id,name) values (177,'GRANT');
+insert into help_keyword (help_keyword_id,name) values (178,'UNSIGNED');
+insert into help_keyword (help_keyword_id,name) values (179,'DECIMAL');
+insert into help_keyword (help_keyword_id,name) values (180,'GEOMETRYFROMTEXT');
+insert into help_keyword (help_keyword_id,name) values (181,'INDEXES');
+insert into help_keyword (help_keyword_id,name) values (182,'FOREIGN');
+insert into help_keyword (help_keyword_id,name) values (183,'CACHE');
+insert into help_keyword (help_keyword_id,name) values (184,'HOSTS');
+insert into help_keyword (help_keyword_id,name) values (185,'MYSQL_ERRNO');
+insert into help_keyword (help_keyword_id,name) values (186,'COMMIT');
+insert into help_keyword (help_keyword_id,name) values (187,'SCHEMAS');
+insert into help_keyword (help_keyword_id,name) values (188,'LEADING');
+insert into help_keyword (help_keyword_id,name) values (189,'SNAPSHOT');
+insert into help_keyword (help_keyword_id,name) values (190,'CONSTRAINT_NAME');
+insert into help_keyword (help_keyword_id,name) values (191,'DECLARE');
+insert into help_keyword (help_keyword_id,name) values (192,'LOAD');
+insert into help_keyword (help_keyword_id,name) values (193,'SQL_CACHE');
+insert into help_keyword (help_keyword_id,name) values (194,'CONVERT');
+insert into help_keyword (help_keyword_id,name) values (195,'DYNAMIC');
+insert into help_keyword (help_keyword_id,name) values (196,'COLLATE');
+insert into help_keyword (help_keyword_id,name) values (197,'POLYGONFROMTEXT');
+insert into help_keyword (help_keyword_id,name) values (198,'BYTE');
+insert into help_keyword (help_keyword_id,name) values (199,'GLOBAL');
+insert into help_keyword (help_keyword_id,name) values (200,'LINESTRINGFROMWKB');
+insert into help_keyword (help_keyword_id,name) values (201,'WHEN');
+insert into help_keyword (help_keyword_id,name) values (202,'HAVING');
+insert into help_keyword (help_keyword_id,name) values (203,'AS');
+insert into help_keyword (help_keyword_id,name) values (204,'STARTING');
+insert into help_keyword (help_keyword_id,name) values (205,'RELOAD');
+insert into help_keyword (help_keyword_id,name) values (206,'AUTOCOMMIT');
+insert into help_keyword (help_keyword_id,name) values (207,'REVOKE');
+insert into help_keyword (help_keyword_id,name) values (208,'GRANTS');
+insert into help_keyword (help_keyword_id,name) values (209,'OUTER');
+insert into help_keyword (help_keyword_id,name) values (210,'CURSOR_NAME');
+insert into help_keyword (help_keyword_id,name) values (211,'FLOOR');
+insert into help_keyword (help_keyword_id,name) values (212,'EXPLAIN');
+insert into help_keyword (help_keyword_id,name) values (213,'WITH');
+insert into help_keyword (help_keyword_id,name) values (214,'AFTER');
+insert into help_keyword (help_keyword_id,name) values (215,'STD');
+insert into help_keyword (help_keyword_id,name) values (216,'CSV');
+insert into help_keyword (help_keyword_id,name) values (217,'DISABLE');
+insert into help_keyword (help_keyword_id,name) values (218,'UNINSTALL');
+insert into help_keyword (help_keyword_id,name) values (219,'OUTFILE');
+insert into help_keyword (help_keyword_id,name) values (220,'LOW_PRIORITY');
+insert into help_keyword (help_keyword_id,name) values (221,'FILE');
+insert into help_keyword (help_keyword_id,name) values (222,'NODEGROUP');
+insert into help_keyword (help_keyword_id,name) values (223,'SCHEMA');
+insert into help_keyword (help_keyword_id,name) values (224,'SONAME');
+insert into help_keyword (help_keyword_id,name) values (225,'POW');
+insert into help_keyword (help_keyword_id,name) values (226,'DUAL');
+insert into help_keyword (help_keyword_id,name) values (227,'MULTIPOINTFROMWKB');
+insert into help_keyword (help_keyword_id,name) values (228,'INDEX');
+insert into help_keyword (help_keyword_id,name) values (229,'MULTIPOINTFROMTEXT');
+insert into help_keyword (help_keyword_id,name) values (230,'DEFINER');
+insert into help_keyword (help_keyword_id,name) values (231,'MASTER_BIND');
+insert into help_keyword (help_keyword_id,name) values (232,'REMOVE');
+insert into help_keyword (help_keyword_id,name) values (233,'EXTENDED');
+insert into help_keyword (help_keyword_id,name) values (234,'MULTILINESTRINGFROMWKB');
+insert into help_keyword (help_keyword_id,name) values (235,'CROSS');
+insert into help_keyword (help_keyword_id,name) values (236,'CONTRIBUTORS');
+insert into help_keyword (help_keyword_id,name) values (237,'NATIONAL');
+insert into help_keyword (help_keyword_id,name) values (238,'GROUP');
+insert into help_keyword (help_keyword_id,name) values (239,'SHA');
+insert into help_keyword (help_keyword_id,name) values (240,'ONLINE');
+insert into help_keyword (help_keyword_id,name) values (241,'UNDO');
+insert into help_keyword (help_keyword_id,name) values (242,'IGNORE_SERVER_IDS');
+insert into help_keyword (help_keyword_id,name) values (243,'ZEROFILL');
+insert into help_keyword (help_keyword_id,name) values (244,'CLIENT');
+insert into help_keyword (help_keyword_id,name) values (245,'MASTER_PASSWORD');
+insert into help_keyword (help_keyword_id,name) values (246,'OWNER');
+insert into help_keyword (help_keyword_id,name) values (247,'RELAY_LOG_FILE');
+insert into help_keyword (help_keyword_id,name) values (248,'TRUE');
+insert into help_keyword (help_keyword_id,name) values (249,'CHARACTER');
+insert into help_keyword (help_keyword_id,name) values (250,'MASTER_USER');
+insert into help_keyword (help_keyword_id,name) values (251,'SCHEMA_NAME');
+insert into help_keyword (help_keyword_id,name) values (252,'TABLE');
+insert into help_keyword (help_keyword_id,name) values (253,'ENGINE');
+insert into help_keyword (help_keyword_id,name) values (254,'INSERT_METHOD');
+insert into help_keyword (help_keyword_id,name) values (255,'CASCADE');
+insert into help_keyword (help_keyword_id,name) values (256,'RELAY_LOG_POS');
+insert into help_keyword (help_keyword_id,name) values (257,'SQL_CALC_FOUND_ROWS');
+insert into help_keyword (help_keyword_id,name) values (258,'UNION');
+insert into help_keyword (help_keyword_id,name) values (259,'MYISAM');
+insert into help_keyword (help_keyword_id,name) values (260,'LEAVE');
+insert into help_keyword (help_keyword_id,name) values (261,'MODIFY');
+insert into help_keyword (help_keyword_id,name) values (262,'MATCH');
+insert into help_keyword (help_keyword_id,name) values (263,'MASTER_LOG_POS');
+insert into help_keyword (help_keyword_id,name) values (264,'DISTINCTROW');
+insert into help_keyword (help_keyword_id,name) values (265,'DESC');
+insert into help_keyword (help_keyword_id,name) values (266,'TIME');
+insert into help_keyword (help_keyword_id,name) values (267,'NUMERIC');
+insert into help_keyword (help_keyword_id,name) values (268,'EXPANSION');
+insert into help_keyword (help_keyword_id,name) values (269,'CODE');
+insert into help_keyword (help_keyword_id,name) values (270,'CURSOR');
+insert into help_keyword (help_keyword_id,name) values (271,'GEOMETRYCOLLECTIONFROMTEXT');
+insert into help_keyword (help_keyword_id,name) values (272,'CHAIN');
+insert into help_keyword (help_keyword_id,name) values (273,'LOGFILE');
+insert into help_keyword (help_keyword_id,name) values (274,'FLUSH');
+insert into help_keyword (help_keyword_id,name) values (275,'CREATE');
+insert into help_keyword (help_keyword_id,name) values (276,'DESCRIBE');
+insert into help_keyword (help_keyword_id,name) values (277,'EXTENT_SIZE');
+insert into help_keyword (help_keyword_id,name) values (278,'MAX_UPDATES_PER_HOUR');
+insert into help_keyword (help_keyword_id,name) values (279,'INT2');
+insert into help_keyword (help_keyword_id,name) values (280,'PROCESSLIST');
+insert into help_keyword (help_keyword_id,name) values (281,'ENDS');
+insert into help_keyword (help_keyword_id,name) values (282,'LOGS');
+insert into help_keyword (help_keyword_id,name) values (283,'DISCARD');
+insert into help_keyword (help_keyword_id,name) values (284,'HEAP');
+insert into help_keyword (help_keyword_id,name) values (285,'SOUNDS');
+insert into help_keyword (help_keyword_id,name) values (286,'BETWEEN');
+insert into help_keyword (help_keyword_id,name) values (287,'MULTILINESTRINGFROMTEXT');
+insert into help_keyword (help_keyword_id,name) values (288,'REPAIR');
+insert into help_keyword (help_keyword_id,name) values (289,'PACK_KEYS');
+insert into help_keyword (help_keyword_id,name) values (290,'FAST');
+insert into help_keyword (help_keyword_id,name) values (291,'VALUES');
+insert into help_keyword (help_keyword_id,name) values (292,'CALL');
+insert into help_keyword (help_keyword_id,name) values (293,'LOOP');
+insert into help_keyword (help_keyword_id,name) values (294,'VARCHARACTER');
+insert into help_keyword (help_keyword_id,name) values (295,'BEFORE');
+insert into help_keyword (help_keyword_id,name) values (296,'TRUNCATE');
+insert into help_keyword (help_keyword_id,name) values (297,'SHOW');
+insert into help_keyword (help_keyword_id,name) values (298,'ALL');
+insert into help_keyword (help_keyword_id,name) values (299,'REDUNDANT');
+insert into help_keyword (help_keyword_id,name) values (300,'USER_RESOURCES');
+insert into help_keyword (help_keyword_id,name) values (301,'PARTIAL');
+insert into help_keyword (help_keyword_id,name) values (302,'BINLOG');
+insert into help_keyword (help_keyword_id,name) values (303,'END');
+insert into help_keyword (help_keyword_id,name) values (304,'SECOND');
+insert into help_keyword (help_keyword_id,name) values (305,'AND');
+insert into help_keyword (help_keyword_id,name) values (306,'FLOAT8');
+insert into help_keyword (help_keyword_id,name) values (307,'PREV');
+insert into help_keyword (help_keyword_id,name) values (308,'HOUR');
+insert into help_keyword (help_keyword_id,name) values (309,'SELECT');
+insert into help_keyword (help_keyword_id,name) values (310,'DATABASES');
+insert into help_keyword (help_keyword_id,name) values (311,'OR');
+insert into help_keyword (help_keyword_id,name) values (312,'IDENTIFIED');
+insert into help_keyword (help_keyword_id,name) values (313,'WRAPPER');
+insert into help_keyword (help_keyword_id,name) values (314,'MASTER_SSL_CIPHER');
+insert into help_keyword (help_keyword_id,name) values (315,'SQL_SLAVE_SKIP_COUNTER');
+insert into help_keyword (help_keyword_id,name) values (316,'BOTH');
+insert into help_keyword (help_keyword_id,name) values (317,'BOOL');
+insert into help_keyword (help_keyword_id,name) values (318,'YEAR');
+insert into help_keyword (help_keyword_id,name) values (319,'MASTER_PORT');
+insert into help_keyword (help_keyword_id,name) values (320,'CONCURRENT');
+insert into help_keyword (help_keyword_id,name) values (321,'HELP');
+insert into help_keyword (help_keyword_id,name) values (322,'UNIQUE');
+insert into help_keyword (help_keyword_id,name) values (323,'TRIGGERS');
+insert into help_keyword (help_keyword_id,name) values (324,'PROCESS');
+insert into help_keyword (help_keyword_id,name) values (325,'OPTIONS');
+insert into help_keyword (help_keyword_id,name) values (326,'RESIGNAL');
+insert into help_keyword (help_keyword_id,name) values (327,'CONSISTENT');
+insert into help_keyword (help_keyword_id,name) values (328,'MASTER_SSL');
+insert into help_keyword (help_keyword_id,name) values (329,'DATE_ADD');
+insert into help_keyword (help_keyword_id,name) values (330,'MAX_CONNECTIONS_PER_HOUR');
+insert into help_keyword (help_keyword_id,name) values (331,'LIKE');
+insert into help_keyword (help_keyword_id,name) values (332,'PLUGIN');
+insert into help_keyword (help_keyword_id,name) values (333,'FETCH');
+insert into help_keyword (help_keyword_id,name) values (334,'IN');
+insert into help_keyword (help_keyword_id,name) values (335,'COLUMN');
+insert into help_keyword (help_keyword_id,name) values (336,'DUMPFILE');
+insert into help_keyword (help_keyword_id,name) values (337,'USAGE');
+insert into help_keyword (help_keyword_id,name) values (338,'EXECUTE');
+insert into help_keyword (help_keyword_id,name) values (339,'MEMORY');
+insert into help_keyword (help_keyword_id,name) values (340,'CEIL');
+insert into help_keyword (help_keyword_id,name) values (341,'QUERY');
+insert into help_keyword (help_keyword_id,name) values (342,'MASTER_HOST');
+insert into help_keyword (help_keyword_id,name) values (343,'LINES');
+insert into help_keyword (help_keyword_id,name) values (344,'SQL_THREAD');
+insert into help_keyword (help_keyword_id,name) values (345,'SERVER');
+insert into help_keyword (help_keyword_id,name) values (346,'MAX_QUERIES_PER_HOUR');
+insert into help_keyword (help_keyword_id,name) values (347,'MASTER_SSL_CERT');
+insert into help_keyword (help_keyword_id,name) values (348,'MULTIPOLYGONFROMWKB');
+insert into help_keyword (help_keyword_id,name) values (349,'TRANSACTION');
+insert into help_keyword (help_keyword_id,name) values (350,'DAY_MINUTE');
+insert into help_keyword (help_keyword_id,name) values (351,'STDDEV');
+insert into help_keyword (help_keyword_id,name) values (352,'DATE_SUB');
+insert into help_keyword (help_keyword_id,name) values (353,'REBUILD');
+insert into help_keyword (help_keyword_id,name) values (354,'GEOMETRYFROMWKB');
+insert into help_keyword (help_keyword_id,name) values (355,'INT1');
+insert into help_keyword (help_keyword_id,name) values (356,'RENAME');
+insert into help_keyword (help_keyword_id,name) values (357,'PARSER');
+insert into help_keyword (help_keyword_id,name) values (358,'RIGHT');
+insert into help_keyword (help_keyword_id,name) values (359,'ALTER');
+insert into help_keyword (help_keyword_id,name) values (360,'MAX_ROWS');
+insert into help_keyword (help_keyword_id,name) values (361,'SOCKET');
+insert into help_keyword (help_keyword_id,name) values (362,'STRAIGHT_JOIN');
+insert into help_keyword (help_keyword_id,name) values (363,'NATURAL');
+insert into help_keyword (help_keyword_id,name) values (364,'VARIABLES');
+insert into help_keyword (help_keyword_id,name) values (365,'ESCAPED');
+insert into help_keyword (help_keyword_id,name) values (366,'SHA1');
+insert into help_keyword (help_keyword_id,name) values (367,'KEY_BLOCK_SIZE');
+insert into help_keyword (help_keyword_id,name) values (368,'PASSWORD');
+insert into help_keyword (help_keyword_id,name) values (369,'OFFSET');
+insert into help_keyword (help_keyword_id,name) values (370,'CHAR');
+insert into help_keyword (help_keyword_id,name) values (371,'NEXT');
+insert into help_keyword (help_keyword_id,name) values (372,'ERRORS');
+insert into help_keyword (help_keyword_id,name) values (373,'SQL_LOG_BIN');
+insert into help_keyword (help_keyword_id,name) values (374,'TEMPORARY');
+insert into help_keyword (help_keyword_id,name) values (375,'COMMITTED');
+insert into help_keyword (help_keyword_id,name) values (376,'SQL_SMALL_RESULT');
+insert into help_keyword (help_keyword_id,name) values (377,'UPGRADE');
+insert into help_keyword (help_keyword_id,name) values (378,'BEGIN');
+insert into help_keyword (help_keyword_id,name) values (379,'DELAY_KEY_WRITE');
+insert into help_keyword (help_keyword_id,name) values (380,'PROFILE');
+insert into help_keyword (help_keyword_id,name) values (381,'MEDIUM');
+insert into help_keyword (help_keyword_id,name) values (382,'INTERVAL');
+insert into help_keyword (help_keyword_id,name) values (383,'SSL');
+insert into help_keyword (help_keyword_id,name) values (384,'DAY_HOUR');
+insert into help_keyword (help_keyword_id,name) values (385,'NAME');
+insert into help_keyword (help_keyword_id,name) values (386,'REFERENCES');
+insert into help_keyword (help_keyword_id,name) values (387,'AES_ENCRYPT');
+insert into help_keyword (help_keyword_id,name) values (388,'STORAGE');
+insert into help_keyword (help_keyword_id,name) values (389,'ISOLATION');
+insert into help_keyword (help_keyword_id,name) values (390,'CEILING');
+insert into help_keyword (help_keyword_id,name) values (391,'EVERY');
+insert into help_keyword (help_keyword_id,name) values (392,'INT8');
+insert into help_keyword (help_keyword_id,name) values (393,'AUTHORS');
+insert into help_keyword (help_keyword_id,name) values (394,'RESTRICT');
+insert into help_keyword (help_keyword_id,name) values (395,'UNCOMMITTED');
+insert into help_keyword (help_keyword_id,name) values (396,'LINESTRINGFROMTEXT');
+insert into help_keyword (help_keyword_id,name) values (397,'IS');
+insert into help_keyword (help_keyword_id,name) values (398,'NOT');
+insert into help_keyword (help_keyword_id,name) values (399,'ANALYSE');
+insert into help_keyword (help_keyword_id,name) values (400,'DATAFILE');
+insert into help_keyword (help_keyword_id,name) values (401,'DES_KEY_FILE');
+insert into help_keyword (help_keyword_id,name) values (402,'SIGNAL');
+insert into help_keyword (help_keyword_id,name) values (403,'COMPRESSED');
+insert into help_keyword (help_keyword_id,name) values (404,'START');
+insert into help_keyword (help_keyword_id,name) values (405,'PLUGINS');
+insert into help_keyword (help_keyword_id,name) values (406,'SAVEPOINT');
+insert into help_keyword (help_keyword_id,name) values (407,'IF');
+insert into help_keyword (help_keyword_id,name) values (408,'ROWS');
+insert into help_keyword (help_keyword_id,name) values (409,'PRIMARY');
+insert into help_keyword (help_keyword_id,name) values (410,'PURGE');
+insert into help_keyword (help_keyword_id,name) values (411,'LAST');
+insert into help_keyword (help_keyword_id,name) values (412,'USER');
+insert into help_keyword (help_keyword_id,name) values (413,'EXIT');
+insert into help_keyword (help_keyword_id,name) values (414,'KEYS');
+insert into help_keyword (help_keyword_id,name) values (415,'LIMIT');
+insert into help_keyword (help_keyword_id,name) values (416,'KEY');
+insert into help_keyword (help_keyword_id,name) values (417,'MERGE');
+insert into help_keyword (help_keyword_id,name) values (418,'UNTIL');
+insert into help_keyword (help_keyword_id,name) values (419,'SQL_NO_CACHE');
+insert into help_keyword (help_keyword_id,name) values (420,'DELAYED');
+insert into help_keyword (help_keyword_id,name) values (421,'CONSTRAINT_SCHEMA');
+insert into help_keyword (help_keyword_id,name) values (422,'ANALYZE');
+insert into help_keyword (help_keyword_id,name) values (423,'CONSTRAINT');
+insert into help_keyword (help_keyword_id,name) values (424,'SERIAL');
+insert into help_keyword (help_keyword_id,name) values (425,'ACTION');
+insert into help_keyword (help_keyword_id,name) values (426,'WRITE');
+insert into help_keyword (help_keyword_id,name) values (427,'INITIAL_SIZE');
+insert into help_keyword (help_keyword_id,name) values (428,'SESSION');
+insert into help_keyword (help_keyword_id,name) values (429,'DATABASE');
+insert into help_keyword (help_keyword_id,name) values (430,'NULL');
+insert into help_keyword (help_keyword_id,name) values (431,'POWER');
+insert into help_keyword (help_keyword_id,name) values (432,'USE_FRM');
+insert into help_keyword (help_keyword_id,name) values (433,'TERMINATED');
+insert into help_keyword (help_keyword_id,name) values (434,'SLAVE');
+insert into help_keyword (help_keyword_id,name) values (435,'NVARCHAR');
+insert into help_keyword (help_keyword_id,name) values (436,'ASC');
+insert into help_keyword (help_keyword_id,name) values (437,'RETURN');
+insert into help_keyword (help_keyword_id,name) values (438,'OPTIONALLY');
+insert into help_keyword (help_keyword_id,name) values (439,'ENABLE');
+insert into help_keyword (help_keyword_id,name) values (440,'DIRECTORY');
+insert into help_keyword (help_keyword_id,name) values (441,'MAX_USER_CONNECTIONS');
+insert into help_keyword (help_keyword_id,name) values (442,'WHILE');
+insert into help_keyword (help_keyword_id,name) values (443,'LOCAL');
+insert into help_keyword (help_keyword_id,name) values (444,'DISTINCT');
+insert into help_keyword (help_keyword_id,name) values (445,'AES_DECRYPT');
+insert into help_keyword (help_keyword_id,name) values (446,'MASTER_SSL_KEY');
+insert into help_keyword (help_keyword_id,name) values (447,'NONE');
+insert into help_keyword (help_keyword_id,name) values (448,'TABLES');
+insert into help_keyword (help_keyword_id,name) values (449,'<>');
+insert into help_keyword (help_keyword_id,name) values (450,'RLIKE');
+insert into help_keyword (help_keyword_id,name) values (451,'TRIGGER');
+insert into help_keyword (help_keyword_id,name) values (452,'COLLATION');
+insert into help_keyword (help_keyword_id,name) values (453,'SHUTDOWN');
+insert into help_keyword (help_keyword_id,name) values (454,'HIGH_PRIORITY');
+insert into help_keyword (help_keyword_id,name) values (455,'BTREE');
+insert into help_keyword (help_keyword_id,name) values (456,'FIRST');
+insert into help_keyword (help_keyword_id,name) values (457,'COALESCE');
+insert into help_keyword (help_keyword_id,name) values (458,'WAIT');
+insert into help_keyword (help_keyword_id,name) values (459,'CATALOG_NAME');
+insert into help_keyword (help_keyword_id,name) values (460,'MASTER');
+insert into help_keyword (help_keyword_id,name) values (461,'FIXED');
+insert into help_keyword (help_keyword_id,name) values (462,'MULTIPOLYGONFROMTEXT');
+insert into help_keyword (help_keyword_id,name) values (463,'ROW_FORMAT');
insert into help_relation (help_topic_id,help_keyword_id) values (1,0);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,0);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,1);
-insert into help_relation (help_topic_id,help_keyword_id) values (228,2);
-insert into help_relation (help_topic_id,help_keyword_id) values (445,3);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,0);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,1);
+insert into help_relation (help_topic_id,help_keyword_id) values (232,2);
+insert into help_relation (help_topic_id,help_keyword_id) values (447,3);
insert into help_relation (help_topic_id,help_keyword_id) values (3,4);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,4);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,5);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,6);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,6);
-insert into help_relation (help_topic_id,help_keyword_id) values (95,7);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,8);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,9);
-insert into help_relation (help_topic_id,help_keyword_id) values (428,10);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,11);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,4);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,4);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,5);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,6);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,6);
+insert into help_relation (help_topic_id,help_keyword_id) values (97,7);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,8);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,9);
+insert into help_relation (help_topic_id,help_keyword_id) values (430,10);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,11);
insert into help_relation (help_topic_id,help_keyword_id) values (21,11);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,11);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,12);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,12);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,13);
-insert into help_relation (help_topic_id,help_keyword_id) values (226,14);
-insert into help_relation (help_topic_id,help_keyword_id) values (86,15);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,15);
-insert into help_relation (help_topic_id,help_keyword_id) values (16,16);
-insert into help_relation (help_topic_id,help_keyword_id) values (130,16);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,16);
-insert into help_relation (help_topic_id,help_keyword_id) values (104,16);
-insert into help_relation (help_topic_id,help_keyword_id) values (496,17);
-insert into help_relation (help_topic_id,help_keyword_id) values (95,17);
-insert into help_relation (help_topic_id,help_keyword_id) values (378,18);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,11);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,11);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,11);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,12);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,12);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,13);
+insert into help_relation (help_topic_id,help_keyword_id) values (230,14);
+insert into help_relation (help_topic_id,help_keyword_id) values (88,15);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,15);
+insert into help_relation (help_topic_id,help_keyword_id) values (18,16);
+insert into help_relation (help_topic_id,help_keyword_id) values (134,16);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,16);
+insert into help_relation (help_topic_id,help_keyword_id) values (106,16);
+insert into help_relation (help_topic_id,help_keyword_id) values (500,17);
+insert into help_relation (help_topic_id,help_keyword_id) values (97,17);
+insert into help_relation (help_topic_id,help_keyword_id) values (380,18);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,19);
insert into help_relation (help_topic_id,help_keyword_id) values (3,19);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,19);
-insert into help_relation (help_topic_id,help_keyword_id) values (239,19);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,20);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,21);
-insert into help_relation (help_topic_id,help_keyword_id) values (474,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,19);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,19);
+insert into help_relation (help_topic_id,help_keyword_id) values (243,19);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,20);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,21);
+insert into help_relation (help_topic_id,help_keyword_id) values (478,22);
insert into help_relation (help_topic_id,help_keyword_id) values (34,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (233,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (297,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (237,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (300,22);
insert into help_relation (help_topic_id,help_keyword_id) values (9,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (414,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (273,22);
insert into help_relation (help_topic_id,help_keyword_id) values (415,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (276,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (416,22);
insert into help_relation (help_topic_id,help_keyword_id) values (30,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (85,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (260,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (185,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (404,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (328,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,22);
-insert into help_relation (help_topic_id,help_keyword_id) values (106,23);
-insert into help_relation (help_topic_id,help_keyword_id) values (120,24);
-insert into help_relation (help_topic_id,help_keyword_id) values (167,24);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,25);
-insert into help_relation (help_topic_id,help_keyword_id) values (256,26);
-insert into help_relation (help_topic_id,help_keyword_id) values (80,27);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,28);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,29);
-insert into help_relation (help_topic_id,help_keyword_id) values (36,30);
-insert into help_relation (help_topic_id,help_keyword_id) values (399,31);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,31);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,31);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,32);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,33);
-insert into help_relation (help_topic_id,help_keyword_id) values (35,34);
-insert into help_relation (help_topic_id,help_keyword_id) values (233,34);
-insert into help_relation (help_topic_id,help_keyword_id) values (36,35);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,35);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,36);
-insert into help_relation (help_topic_id,help_keyword_id) values (416,37);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,37);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,37);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,38);
-insert into help_relation (help_topic_id,help_keyword_id) values (21,38);
-insert into help_relation (help_topic_id,help_keyword_id) values (291,38);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,38);
-insert into help_relation (help_topic_id,help_keyword_id) values (449,38);
-insert into help_relation (help_topic_id,help_keyword_id) values (496,39);
-insert into help_relation (help_topic_id,help_keyword_id) values (48,40);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,40);
-insert into help_relation (help_topic_id,help_keyword_id) values (81,40);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,40);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,40);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,40);
-insert into help_relation (help_topic_id,help_keyword_id) values (360,40);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,40);
-insert into help_relation (help_topic_id,help_keyword_id) values (75,40);
-insert into help_relation (help_topic_id,help_keyword_id) values (468,41);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,41);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,42);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,43);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,43);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,44);
-insert into help_relation (help_topic_id,help_keyword_id) values (116,44);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,44);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,44);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,44);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,45);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,46);
-insert into help_relation (help_topic_id,help_keyword_id) values (311,47);
-insert into help_relation (help_topic_id,help_keyword_id) values (95,47);
-insert into help_relation (help_topic_id,help_keyword_id) values (360,48);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,49);
-insert into help_relation (help_topic_id,help_keyword_id) values (468,50);
+insert into help_relation (help_topic_id,help_keyword_id) values (87,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (263,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (186,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (405,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (331,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,22);
+insert into help_relation (help_topic_id,help_keyword_id) values (108,23);
+insert into help_relation (help_topic_id,help_keyword_id) values (424,24);
+insert into help_relation (help_topic_id,help_keyword_id) values (122,24);
+insert into help_relation (help_topic_id,help_keyword_id) values (170,24);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,25);
+insert into help_relation (help_topic_id,help_keyword_id) values (82,26);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,27);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,28);
+insert into help_relation (help_topic_id,help_keyword_id) values (36,29);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,30);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,30);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,31);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,32);
+insert into help_relation (help_topic_id,help_keyword_id) values (35,33);
+insert into help_relation (help_topic_id,help_keyword_id) values (237,33);
+insert into help_relation (help_topic_id,help_keyword_id) values (36,34);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,34);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,35);
+insert into help_relation (help_topic_id,help_keyword_id) values (417,36);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,36);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,36);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,37);
+insert into help_relation (help_topic_id,help_keyword_id) values (21,37);
+insert into help_relation (help_topic_id,help_keyword_id) values (294,37);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,37);
+insert into help_relation (help_topic_id,help_keyword_id) values (451,37);
+insert into help_relation (help_topic_id,help_keyword_id) values (500,38);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,39);
+insert into help_relation (help_topic_id,help_keyword_id) values (48,39);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,39);
+insert into help_relation (help_topic_id,help_keyword_id) values (83,39);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,39);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,39);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,39);
+insert into help_relation (help_topic_id,help_keyword_id) values (77,39);
+insert into help_relation (help_topic_id,help_keyword_id) values (361,39);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,39);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,40);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,40);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,41);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,42);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,42);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,43);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,43);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,43);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,43);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,44);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,45);
+insert into help_relation (help_topic_id,help_keyword_id) values (314,46);
+insert into help_relation (help_topic_id,help_keyword_id) values (97,46);
+insert into help_relation (help_topic_id,help_keyword_id) values (361,47);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,48);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,48);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,49);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,50);
insert into help_relation (help_topic_id,help_keyword_id) values (48,50);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,50);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,51);
-insert into help_relation (help_topic_id,help_keyword_id) values (468,51);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,50);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,51);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,51);
insert into help_relation (help_topic_id,help_keyword_id) values (1,51);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,51);
-insert into help_relation (help_topic_id,help_keyword_id) values (173,52);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,52);
-insert into help_relation (help_topic_id,help_keyword_id) values (51,53);
-insert into help_relation (help_topic_id,help_keyword_id) values (104,53);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,54);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,55);
-insert into help_relation (help_topic_id,help_keyword_id) values (55,55);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,55);
-insert into help_relation (help_topic_id,help_keyword_id) values (48,56);
-insert into help_relation (help_topic_id,help_keyword_id) values (81,56);
-insert into help_relation (help_topic_id,help_keyword_id) values (104,56);
-insert into help_relation (help_topic_id,help_keyword_id) values (190,57);
-insert into help_relation (help_topic_id,help_keyword_id) values (245,57);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,57);
-insert into help_relation (help_topic_id,help_keyword_id) values (207,58);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,58);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,59);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,59);
-insert into help_relation (help_topic_id,help_keyword_id) values (297,59);
-insert into help_relation (help_topic_id,help_keyword_id) values (355,59);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,60);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,61);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,62);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,62);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,62);
-insert into help_relation (help_topic_id,help_keyword_id) values (81,62);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,62);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,62);
-insert into help_relation (help_topic_id,help_keyword_id) values (462,63);
-insert into help_relation (help_topic_id,help_keyword_id) values (416,63);
-insert into help_relation (help_topic_id,help_keyword_id) values (48,63);
-insert into help_relation (help_topic_id,help_keyword_id) values (226,64);
-insert into help_relation (help_topic_id,help_keyword_id) values (85,65);
-insert into help_relation (help_topic_id,help_keyword_id) values (207,65);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,65);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,66);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,67);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,68);
-insert into help_relation (help_topic_id,help_keyword_id) values (89,69);
-insert into help_relation (help_topic_id,help_keyword_id) values (478,69);
-insert into help_relation (help_topic_id,help_keyword_id) values (383,70);
-insert into help_relation (help_topic_id,help_keyword_id) values (445,71);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,72);
-insert into help_relation (help_topic_id,help_keyword_id) values (39,73);
-insert into help_relation (help_topic_id,help_keyword_id) values (266,73);
-insert into help_relation (help_topic_id,help_keyword_id) values (226,73);
-insert into help_relation (help_topic_id,help_keyword_id) values (266,74);
-insert into help_relation (help_topic_id,help_keyword_id) values (457,74);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,74);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,75);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,75);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,76);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,76);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,77);
-insert into help_relation (help_topic_id,help_keyword_id) values (468,78);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,78);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,78);
-insert into help_relation (help_topic_id,help_keyword_id) values (81,78);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,79);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,79);
-insert into help_relation (help_topic_id,help_keyword_id) values (301,80);
-insert into help_relation (help_topic_id,help_keyword_id) values (3,80);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,80);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,80);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,81);
-insert into help_relation (help_topic_id,help_keyword_id) values (253,82);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,83);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,84);
-insert into help_relation (help_topic_id,help_keyword_id) values (127,85);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,86);
-insert into help_relation (help_topic_id,help_keyword_id) values (457,86);
-insert into help_relation (help_topic_id,help_keyword_id) values (207,87);
-insert into help_relation (help_topic_id,help_keyword_id) values (18,88);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,88);
-insert into help_relation (help_topic_id,help_keyword_id) values (437,88);
-insert into help_relation (help_topic_id,help_keyword_id) values (299,88);
-insert into help_relation (help_topic_id,help_keyword_id) values (484,88);
-insert into help_relation (help_topic_id,help_keyword_id) values (415,88);
-insert into help_relation (help_topic_id,help_keyword_id) values (325,88);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,88);
-insert into help_relation (help_topic_id,help_keyword_id) values (183,88);
-insert into help_relation (help_topic_id,help_keyword_id) values (187,89);
-insert into help_relation (help_topic_id,help_keyword_id) values (97,89);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,90);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,90);
-insert into help_relation (help_topic_id,help_keyword_id) values (86,91);
-insert into help_relation (help_topic_id,help_keyword_id) values (400,92);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,92);
-insert into help_relation (help_topic_id,help_keyword_id) values (67,93);
-insert into help_relation (help_topic_id,help_keyword_id) values (431,93);
-insert into help_relation (help_topic_id,help_keyword_id) values (327,93);
-insert into help_relation (help_topic_id,help_keyword_id) values (282,94);
-insert into help_relation (help_topic_id,help_keyword_id) values (83,95);
-insert into help_relation (help_topic_id,help_keyword_id) values (57,95);
-insert into help_relation (help_topic_id,help_keyword_id) values (28,95);
-insert into help_relation (help_topic_id,help_keyword_id) values (192,96);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,96);
-insert into help_relation (help_topic_id,help_keyword_id) values (482,96);
-insert into help_relation (help_topic_id,help_keyword_id) values (298,96);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,97);
-insert into help_relation (help_topic_id,help_keyword_id) values (279,97);
-insert into help_relation (help_topic_id,help_keyword_id) values (310,98);
-insert into help_relation (help_topic_id,help_keyword_id) values (104,98);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,99);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,100);
-insert into help_relation (help_topic_id,help_keyword_id) values (152,101);
-insert into help_relation (help_topic_id,help_keyword_id) values (30,101);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,101);
-insert into help_relation (help_topic_id,help_keyword_id) values (297,101);
-insert into help_relation (help_topic_id,help_keyword_id) values (185,101);
-insert into help_relation (help_topic_id,help_keyword_id) values (9,101);
-insert into help_relation (help_topic_id,help_keyword_id) values (273,101);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,102);
-insert into help_relation (help_topic_id,help_keyword_id) values (364,102);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,103);
-insert into help_relation (help_topic_id,help_keyword_id) values (457,103);
-insert into help_relation (help_topic_id,help_keyword_id) values (86,104);
-insert into help_relation (help_topic_id,help_keyword_id) values (24,104);
-insert into help_relation (help_topic_id,help_keyword_id) values (110,105);
-insert into help_relation (help_topic_id,help_keyword_id) values (172,105);
-insert into help_relation (help_topic_id,help_keyword_id) values (3,106);
-insert into help_relation (help_topic_id,help_keyword_id) values (152,106);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,106);
-insert into help_relation (help_topic_id,help_keyword_id) values (196,106);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,106);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,106);
-insert into help_relation (help_topic_id,help_keyword_id) values (239,106);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,106);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,107);
-insert into help_relation (help_topic_id,help_keyword_id) values (462,108);
-insert into help_relation (help_topic_id,help_keyword_id) values (324,108);
-insert into help_relation (help_topic_id,help_keyword_id) values (112,108);
-insert into help_relation (help_topic_id,help_keyword_id) values (466,108);
-insert into help_relation (help_topic_id,help_keyword_id) values (112,109);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,109);
-insert into help_relation (help_topic_id,help_keyword_id) values (38,110);
-insert into help_relation (help_topic_id,help_keyword_id) values (117,110);
-insert into help_relation (help_topic_id,help_keyword_id) values (261,110);
-insert into help_relation (help_topic_id,help_keyword_id) values (148,110);
-insert into help_relation (help_topic_id,help_keyword_id) values (122,111);
-insert into help_relation (help_topic_id,help_keyword_id) values (418,112);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,113);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,113);
-insert into help_relation (help_topic_id,help_keyword_id) values (123,113);
-insert into help_relation (help_topic_id,help_keyword_id) values (492,113);
-insert into help_relation (help_topic_id,help_keyword_id) values (218,114);
-insert into help_relation (help_topic_id,help_keyword_id) values (330,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (127,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (3,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (152,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (490,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (136,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (81,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (468,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (180,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (473,115);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,116);
-insert into help_relation (help_topic_id,help_keyword_id) values (259,117);
-insert into help_relation (help_topic_id,help_keyword_id) values (129,117);
-insert into help_relation (help_topic_id,help_keyword_id) values (226,117);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,117);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,118);
-insert into help_relation (help_topic_id,help_keyword_id) values (333,118);
-insert into help_relation (help_topic_id,help_keyword_id) values (364,118);
-insert into help_relation (help_topic_id,help_keyword_id) values (220,118);
-insert into help_relation (help_topic_id,help_keyword_id) values (399,118);
-insert into help_relation (help_topic_id,help_keyword_id) values (58,118);
-insert into help_relation (help_topic_id,help_keyword_id) values (325,118);
-insert into help_relation (help_topic_id,help_keyword_id) values (133,118);
-insert into help_relation (help_topic_id,help_keyword_id) values (212,118);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,119);
-insert into help_relation (help_topic_id,help_keyword_id) values (207,119);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,119);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,120);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,120);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,120);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,120);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,121);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,122);
-insert into help_relation (help_topic_id,help_keyword_id) values (52,123);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,124);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,125);
-insert into help_relation (help_topic_id,help_keyword_id) values (311,126);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,127);
-insert into help_relation (help_topic_id,help_keyword_id) values (453,128);
-insert into help_relation (help_topic_id,help_keyword_id) values (251,129);
-insert into help_relation (help_topic_id,help_keyword_id) values (282,130);
-insert into help_relation (help_topic_id,help_keyword_id) values (245,131);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,131);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,132);
-insert into help_relation (help_topic_id,help_keyword_id) values (83,133);
-insert into help_relation (help_topic_id,help_keyword_id) values (57,133);
-insert into help_relation (help_topic_id,help_keyword_id) values (233,134);
-insert into help_relation (help_topic_id,help_keyword_id) values (52,135);
-insert into help_relation (help_topic_id,help_keyword_id) values (321,135);
-insert into help_relation (help_topic_id,help_keyword_id) values (83,136);
-insert into help_relation (help_topic_id,help_keyword_id) values (57,136);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,137);
-insert into help_relation (help_topic_id,help_keyword_id) values (310,138);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,139);
-insert into help_relation (help_topic_id,help_keyword_id) values (116,139);
-insert into help_relation (help_topic_id,help_keyword_id) values (453,139);
-insert into help_relation (help_topic_id,help_keyword_id) values (48,139);
-insert into help_relation (help_topic_id,help_keyword_id) values (120,139);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,139);
-insert into help_relation (help_topic_id,help_keyword_id) values (358,139);
-insert into help_relation (help_topic_id,help_keyword_id) values (445,140);
-insert into help_relation (help_topic_id,help_keyword_id) values (36,140);
-insert into help_relation (help_topic_id,help_keyword_id) values (104,140);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,141);
-insert into help_relation (help_topic_id,help_keyword_id) values (28,142);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,143);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,144);
-insert into help_relation (help_topic_id,help_keyword_id) values (177,145);
-insert into help_relation (help_topic_id,help_keyword_id) values (206,146);
-insert into help_relation (help_topic_id,help_keyword_id) values (310,147);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,147);
-insert into help_relation (help_topic_id,help_keyword_id) values (178,147);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,147);
-insert into help_relation (help_topic_id,help_keyword_id) values (419,147);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,148);
-insert into help_relation (help_topic_id,help_keyword_id) values (327,148);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,149);
-insert into help_relation (help_topic_id,help_keyword_id) values (178,150);
-insert into help_relation (help_topic_id,help_keyword_id) values (95,151);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,152);
-insert into help_relation (help_topic_id,help_keyword_id) values (66,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (333,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (34,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (95,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (299,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (415,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (391,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (208,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (404,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (229,153);
-insert into help_relation (help_topic_id,help_keyword_id) values (95,154);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,155);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,155);
-insert into help_relation (help_topic_id,help_keyword_id) values (248,156);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,157);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,158);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,158);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,159);
-insert into help_relation (help_topic_id,help_keyword_id) values (474,159);
-insert into help_relation (help_topic_id,help_keyword_id) values (60,159);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,159);
-insert into help_relation (help_topic_id,help_keyword_id) values (173,160);
-insert into help_relation (help_topic_id,help_keyword_id) values (165,161);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,162);
-insert into help_relation (help_topic_id,help_keyword_id) values (474,162);
-insert into help_relation (help_topic_id,help_keyword_id) values (414,162);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,162);
-insert into help_relation (help_topic_id,help_keyword_id) values (452,163);
-insert into help_relation (help_topic_id,help_keyword_id) values (30,163);
-insert into help_relation (help_topic_id,help_keyword_id) values (156,163);
-insert into help_relation (help_topic_id,help_keyword_id) values (445,164);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,165);
-insert into help_relation (help_topic_id,help_keyword_id) values (48,166);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,166);
-insert into help_relation (help_topic_id,help_keyword_id) values (81,166);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,166);
-insert into help_relation (help_topic_id,help_keyword_id) values (360,166);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,167);
-insert into help_relation (help_topic_id,help_keyword_id) values (84,167);
-insert into help_relation (help_topic_id,help_keyword_id) values (48,167);
-insert into help_relation (help_topic_id,help_keyword_id) values (248,168);
-insert into help_relation (help_topic_id,help_keyword_id) values (245,169);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,169);
-insert into help_relation (help_topic_id,help_keyword_id) values (311,170);
-insert into help_relation (help_topic_id,help_keyword_id) values (496,170);
-insert into help_relation (help_topic_id,help_keyword_id) values (206,170);
-insert into help_relation (help_topic_id,help_keyword_id) values (226,170);
-insert into help_relation (help_topic_id,help_keyword_id) values (24,170);
-insert into help_relation (help_topic_id,help_keyword_id) values (165,170);
-insert into help_relation (help_topic_id,help_keyword_id) values (126,170);
-insert into help_relation (help_topic_id,help_keyword_id) values (153,171);
-insert into help_relation (help_topic_id,help_keyword_id) values (95,171);
-insert into help_relation (help_topic_id,help_keyword_id) values (226,171);
-insert into help_relation (help_topic_id,help_keyword_id) values (410,172);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,173);
-insert into help_relation (help_topic_id,help_keyword_id) values (468,174);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,174);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,174);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,174);
-insert into help_relation (help_topic_id,help_keyword_id) values (301,175);
-insert into help_relation (help_topic_id,help_keyword_id) values (99,175);
-insert into help_relation (help_topic_id,help_keyword_id) values (148,175);
-insert into help_relation (help_topic_id,help_keyword_id) values (142,176);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,176);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,177);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,178);
-insert into help_relation (help_topic_id,help_keyword_id) values (157,178);
-insert into help_relation (help_topic_id,help_keyword_id) values (453,179);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,180);
-insert into help_relation (help_topic_id,help_keyword_id) values (310,181);
-insert into help_relation (help_topic_id,help_keyword_id) values (178,181);
-insert into help_relation (help_topic_id,help_keyword_id) values (419,181);
-insert into help_relation (help_topic_id,help_keyword_id) values (196,181);
-insert into help_relation (help_topic_id,help_keyword_id) values (301,182);
-insert into help_relation (help_topic_id,help_keyword_id) values (116,182);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,182);
-insert into help_relation (help_topic_id,help_keyword_id) values (358,182);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,183);
-insert into help_relation (help_topic_id,help_keyword_id) values (226,184);
-insert into help_relation (help_topic_id,help_keyword_id) values (375,184);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,185);
-insert into help_relation (help_topic_id,help_keyword_id) values (152,186);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,186);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,186);
-insert into help_relation (help_topic_id,help_keyword_id) values (393,187);
-insert into help_relation (help_topic_id,help_keyword_id) values (461,188);
-insert into help_relation (help_topic_id,help_keyword_id) values (127,189);
-insert into help_relation (help_topic_id,help_keyword_id) values (445,189);
-insert into help_relation (help_topic_id,help_keyword_id) values (180,189);
-insert into help_relation (help_topic_id,help_keyword_id) values (346,189);
-insert into help_relation (help_topic_id,help_keyword_id) values (133,189);
-insert into help_relation (help_topic_id,help_keyword_id) values (450,190);
-insert into help_relation (help_topic_id,help_keyword_id) values (83,191);
-insert into help_relation (help_topic_id,help_keyword_id) values (57,191);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,192);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,193);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,194);
-insert into help_relation (help_topic_id,help_keyword_id) values (36,194);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,194);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,195);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,196);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,197);
-insert into help_relation (help_topic_id,help_keyword_id) values (245,198);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,199);
-insert into help_relation (help_topic_id,help_keyword_id) values (189,199);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,200);
-insert into help_relation (help_topic_id,help_keyword_id) values (218,201);
-insert into help_relation (help_topic_id,help_keyword_id) values (251,202);
-insert into help_relation (help_topic_id,help_keyword_id) values (86,203);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,203);
-insert into help_relation (help_topic_id,help_keyword_id) values (207,203);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,203);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,203);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,204);
-insert into help_relation (help_topic_id,help_keyword_id) values (257,205);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,206);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,206);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,207);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,207);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,207);
-insert into help_relation (help_topic_id,help_keyword_id) values (288,208);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,209);
-insert into help_relation (help_topic_id,help_keyword_id) values (3,210);
-insert into help_relation (help_topic_id,help_keyword_id) values (36,210);
-insert into help_relation (help_topic_id,help_keyword_id) values (48,210);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,210);
-insert into help_relation (help_topic_id,help_keyword_id) values (81,210);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,210);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,211);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,212);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,213);
-insert into help_relation (help_topic_id,help_keyword_id) values (152,213);
-insert into help_relation (help_topic_id,help_keyword_id) values (306,213);
-insert into help_relation (help_topic_id,help_keyword_id) values (185,213);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,213);
-insert into help_relation (help_topic_id,help_keyword_id) values (95,214);
-insert into help_relation (help_topic_id,help_keyword_id) values (274,215);
-insert into help_relation (help_topic_id,help_keyword_id) values (276,216);
-insert into help_relation (help_topic_id,help_keyword_id) values (460,217);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,218);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,218);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,218);
-insert into help_relation (help_topic_id,help_keyword_id) values (301,218);
-insert into help_relation (help_topic_id,help_keyword_id) values (85,218);
-insert into help_relation (help_topic_id,help_keyword_id) values (99,218);
-insert into help_relation (help_topic_id,help_keyword_id) values (60,218);
-insert into help_relation (help_topic_id,help_keyword_id) values (305,218);
-insert into help_relation (help_topic_id,help_keyword_id) values (207,218);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,218);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,51);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,52);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,52);
+insert into help_relation (help_topic_id,help_keyword_id) values (176,53);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,53);
+insert into help_relation (help_topic_id,help_keyword_id) values (51,54);
+insert into help_relation (help_topic_id,help_keyword_id) values (106,54);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,55);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,56);
+insert into help_relation (help_topic_id,help_keyword_id) values (55,56);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,56);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,57);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,57);
+insert into help_relation (help_topic_id,help_keyword_id) values (48,58);
+insert into help_relation (help_topic_id,help_keyword_id) values (83,58);
+insert into help_relation (help_topic_id,help_keyword_id) values (106,58);
+insert into help_relation (help_topic_id,help_keyword_id) values (193,59);
+insert into help_relation (help_topic_id,help_keyword_id) values (249,59);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,59);
+insert into help_relation (help_topic_id,help_keyword_id) values (210,60);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,60);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,61);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,61);
+insert into help_relation (help_topic_id,help_keyword_id) values (300,61);
+insert into help_relation (help_topic_id,help_keyword_id) values (358,61);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,62);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,63);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,64);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,64);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,64);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,64);
+insert into help_relation (help_topic_id,help_keyword_id) values (83,64);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,64);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,64);
+insert into help_relation (help_topic_id,help_keyword_id) values (66,65);
+insert into help_relation (help_topic_id,help_keyword_id) values (466,66);
+insert into help_relation (help_topic_id,help_keyword_id) values (417,66);
+insert into help_relation (help_topic_id,help_keyword_id) values (48,66);
+insert into help_relation (help_topic_id,help_keyword_id) values (230,67);
+insert into help_relation (help_topic_id,help_keyword_id) values (87,68);
+insert into help_relation (help_topic_id,help_keyword_id) values (210,68);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,68);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,69);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,70);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,71);
+insert into help_relation (help_topic_id,help_keyword_id) values (91,72);
+insert into help_relation (help_topic_id,help_keyword_id) values (482,72);
+insert into help_relation (help_topic_id,help_keyword_id) values (385,73);
+insert into help_relation (help_topic_id,help_keyword_id) values (447,74);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,75);
+insert into help_relation (help_topic_id,help_keyword_id) values (39,76);
+insert into help_relation (help_topic_id,help_keyword_id) values (269,76);
+insert into help_relation (help_topic_id,help_keyword_id) values (230,76);
+insert into help_relation (help_topic_id,help_keyword_id) values (269,77);
+insert into help_relation (help_topic_id,help_keyword_id) values (460,77);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,77);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,78);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,78);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,79);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,79);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,80);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,81);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,81);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,81);
+insert into help_relation (help_topic_id,help_keyword_id) values (83,81);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,82);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,82);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,83);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,83);
+insert into help_relation (help_topic_id,help_keyword_id) values (304,84);
+insert into help_relation (help_topic_id,help_keyword_id) values (3,84);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,84);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,84);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,85);
+insert into help_relation (help_topic_id,help_keyword_id) values (257,86);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,87);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,88);
+insert into help_relation (help_topic_id,help_keyword_id) values (129,89);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,90);
+insert into help_relation (help_topic_id,help_keyword_id) values (460,90);
+insert into help_relation (help_topic_id,help_keyword_id) values (17,91);
+insert into help_relation (help_topic_id,help_keyword_id) values (416,91);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,91);
+insert into help_relation (help_topic_id,help_keyword_id) values (439,91);
+insert into help_relation (help_topic_id,help_keyword_id) values (328,91);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,91);
+insert into help_relation (help_topic_id,help_keyword_id) values (189,91);
+insert into help_relation (help_topic_id,help_keyword_id) values (302,91);
+insert into help_relation (help_topic_id,help_keyword_id) values (488,91);
+insert into help_relation (help_topic_id,help_keyword_id) values (188,92);
+insert into help_relation (help_topic_id,help_keyword_id) values (99,92);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,93);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,93);
+insert into help_relation (help_topic_id,help_keyword_id) values (88,94);
+insert into help_relation (help_topic_id,help_keyword_id) values (401,95);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,95);
+insert into help_relation (help_topic_id,help_keyword_id) values (69,96);
+insert into help_relation (help_topic_id,help_keyword_id) values (433,96);
+insert into help_relation (help_topic_id,help_keyword_id) values (330,96);
+insert into help_relation (help_topic_id,help_keyword_id) values (285,97);
+insert into help_relation (help_topic_id,help_keyword_id) values (85,98);
+insert into help_relation (help_topic_id,help_keyword_id) values (57,98);
+insert into help_relation (help_topic_id,help_keyword_id) values (28,98);
+insert into help_relation (help_topic_id,help_keyword_id) values (195,99);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,99);
+insert into help_relation (help_topic_id,help_keyword_id) values (486,99);
+insert into help_relation (help_topic_id,help_keyword_id) values (301,99);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,100);
+insert into help_relation (help_topic_id,help_keyword_id) values (282,100);
+insert into help_relation (help_topic_id,help_keyword_id) values (313,101);
+insert into help_relation (help_topic_id,help_keyword_id) values (106,101);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,102);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,103);
+insert into help_relation (help_topic_id,help_keyword_id) values (155,104);
+insert into help_relation (help_topic_id,help_keyword_id) values (30,104);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,104);
+insert into help_relation (help_topic_id,help_keyword_id) values (300,104);
+insert into help_relation (help_topic_id,help_keyword_id) values (186,104);
+insert into help_relation (help_topic_id,help_keyword_id) values (9,104);
+insert into help_relation (help_topic_id,help_keyword_id) values (276,104);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,105);
+insert into help_relation (help_topic_id,help_keyword_id) values (365,105);
+insert into help_relation (help_topic_id,help_keyword_id) values (109,106);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,107);
+insert into help_relation (help_topic_id,help_keyword_id) values (460,107);
+insert into help_relation (help_topic_id,help_keyword_id) values (88,108);
+insert into help_relation (help_topic_id,help_keyword_id) values (24,108);
+insert into help_relation (help_topic_id,help_keyword_id) values (113,109);
+insert into help_relation (help_topic_id,help_keyword_id) values (174,109);
+insert into help_relation (help_topic_id,help_keyword_id) values (3,110);
+insert into help_relation (help_topic_id,help_keyword_id) values (155,110);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,110);
+insert into help_relation (help_topic_id,help_keyword_id) values (200,110);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,110);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,110);
+insert into help_relation (help_topic_id,help_keyword_id) values (243,110);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,110);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,111);
+insert into help_relation (help_topic_id,help_keyword_id) values (466,112);
+insert into help_relation (help_topic_id,help_keyword_id) values (326,112);
+insert into help_relation (help_topic_id,help_keyword_id) values (115,112);
+insert into help_relation (help_topic_id,help_keyword_id) values (470,112);
+insert into help_relation (help_topic_id,help_keyword_id) values (115,113);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,113);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,114);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,114);
+insert into help_relation (help_topic_id,help_keyword_id) values (38,115);
+insert into help_relation (help_topic_id,help_keyword_id) values (119,115);
+insert into help_relation (help_topic_id,help_keyword_id) values (264,115);
+insert into help_relation (help_topic_id,help_keyword_id) values (151,115);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,116);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,116);
+insert into help_relation (help_topic_id,help_keyword_id) values (419,117);
+insert into help_relation (help_topic_id,help_keyword_id) values (124,118);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,119);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,119);
+insert into help_relation (help_topic_id,help_keyword_id) values (125,119);
+insert into help_relation (help_topic_id,help_keyword_id) values (496,119);
+insert into help_relation (help_topic_id,help_keyword_id) values (221,120);
+insert into help_relation (help_topic_id,help_keyword_id) values (333,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (129,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (3,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (155,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (494,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (83,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (182,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (477,121);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,122);
+insert into help_relation (help_topic_id,help_keyword_id) values (262,123);
+insert into help_relation (help_topic_id,help_keyword_id) values (132,123);
+insert into help_relation (help_topic_id,help_keyword_id) values (230,123);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,123);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,124);
+insert into help_relation (help_topic_id,help_keyword_id) values (336,124);
+insert into help_relation (help_topic_id,help_keyword_id) values (365,124);
+insert into help_relation (help_topic_id,help_keyword_id) values (223,124);
+insert into help_relation (help_topic_id,help_keyword_id) values (58,124);
+insert into help_relation (help_topic_id,help_keyword_id) values (328,124);
+insert into help_relation (help_topic_id,help_keyword_id) values (137,124);
+insert into help_relation (help_topic_id,help_keyword_id) values (215,124);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,125);
+insert into help_relation (help_topic_id,help_keyword_id) values (210,125);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,125);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,126);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,126);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,126);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,126);
+insert into help_relation (help_topic_id,help_keyword_id) values (210,126);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,127);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,128);
+insert into help_relation (help_topic_id,help_keyword_id) values (424,129);
+insert into help_relation (help_topic_id,help_keyword_id) values (52,130);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,131);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,132);
+insert into help_relation (help_topic_id,help_keyword_id) values (314,133);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,134);
+insert into help_relation (help_topic_id,help_keyword_id) values (455,135);
+insert into help_relation (help_topic_id,help_keyword_id) values (255,136);
+insert into help_relation (help_topic_id,help_keyword_id) values (285,137);
+insert into help_relation (help_topic_id,help_keyword_id) values (249,138);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,138);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,139);
+insert into help_relation (help_topic_id,help_keyword_id) values (85,140);
+insert into help_relation (help_topic_id,help_keyword_id) values (57,140);
+insert into help_relation (help_topic_id,help_keyword_id) values (237,141);
+insert into help_relation (help_topic_id,help_keyword_id) values (52,142);
+insert into help_relation (help_topic_id,help_keyword_id) values (324,142);
+insert into help_relation (help_topic_id,help_keyword_id) values (85,143);
+insert into help_relation (help_topic_id,help_keyword_id) values (57,143);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,144);
+insert into help_relation (help_topic_id,help_keyword_id) values (313,145);
+insert into help_relation (help_topic_id,help_keyword_id) values (424,146);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,146);
+insert into help_relation (help_topic_id,help_keyword_id) values (455,146);
+insert into help_relation (help_topic_id,help_keyword_id) values (48,146);
+insert into help_relation (help_topic_id,help_keyword_id) values (122,146);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,146);
+insert into help_relation (help_topic_id,help_keyword_id) values (447,147);
+insert into help_relation (help_topic_id,help_keyword_id) values (36,147);
+insert into help_relation (help_topic_id,help_keyword_id) values (106,147);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,148);
+insert into help_relation (help_topic_id,help_keyword_id) values (28,149);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,150);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,151);
+insert into help_relation (help_topic_id,help_keyword_id) values (209,152);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,153);
+insert into help_relation (help_topic_id,help_keyword_id) values (313,153);
+insert into help_relation (help_topic_id,help_keyword_id) values (180,153);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,153);
+insert into help_relation (help_topic_id,help_keyword_id) values (420,153);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,154);
+insert into help_relation (help_topic_id,help_keyword_id) values (330,154);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,155);
+insert into help_relation (help_topic_id,help_keyword_id) values (97,156);
+insert into help_relation (help_topic_id,help_keyword_id) values (180,157);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,158);
+insert into help_relation (help_topic_id,help_keyword_id) values (68,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (336,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (34,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (97,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (302,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (416,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (393,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (211,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (405,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (233,159);
+insert into help_relation (help_topic_id,help_keyword_id) values (97,160);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,161);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,161);
+insert into help_relation (help_topic_id,help_keyword_id) values (252,162);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,163);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,164);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,164);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,165);
+insert into help_relation (help_topic_id,help_keyword_id) values (478,165);
+insert into help_relation (help_topic_id,help_keyword_id) values (60,165);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,165);
+insert into help_relation (help_topic_id,help_keyword_id) values (176,166);
+insert into help_relation (help_topic_id,help_keyword_id) values (168,167);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,168);
+insert into help_relation (help_topic_id,help_keyword_id) values (478,168);
+insert into help_relation (help_topic_id,help_keyword_id) values (415,168);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,168);
+insert into help_relation (help_topic_id,help_keyword_id) values (454,169);
+insert into help_relation (help_topic_id,help_keyword_id) values (30,169);
+insert into help_relation (help_topic_id,help_keyword_id) values (159,169);
+insert into help_relation (help_topic_id,help_keyword_id) values (447,170);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,171);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,171);
+insert into help_relation (help_topic_id,help_keyword_id) values (190,172);
+insert into help_relation (help_topic_id,help_keyword_id) values (48,173);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,173);
+insert into help_relation (help_topic_id,help_keyword_id) values (83,173);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,173);
+insert into help_relation (help_topic_id,help_keyword_id) values (361,173);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,174);
+insert into help_relation (help_topic_id,help_keyword_id) values (86,174);
+insert into help_relation (help_topic_id,help_keyword_id) values (48,174);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,175);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,175);
+insert into help_relation (help_topic_id,help_keyword_id) values (252,176);
+insert into help_relation (help_topic_id,help_keyword_id) values (249,177);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,177);
+insert into help_relation (help_topic_id,help_keyword_id) values (314,178);
+insert into help_relation (help_topic_id,help_keyword_id) values (500,178);
+insert into help_relation (help_topic_id,help_keyword_id) values (209,178);
+insert into help_relation (help_topic_id,help_keyword_id) values (230,178);
+insert into help_relation (help_topic_id,help_keyword_id) values (24,178);
+insert into help_relation (help_topic_id,help_keyword_id) values (168,178);
+insert into help_relation (help_topic_id,help_keyword_id) values (128,178);
+insert into help_relation (help_topic_id,help_keyword_id) values (156,179);
+insert into help_relation (help_topic_id,help_keyword_id) values (97,179);
+insert into help_relation (help_topic_id,help_keyword_id) values (230,179);
+insert into help_relation (help_topic_id,help_keyword_id) values (411,180);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,181);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,182);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,182);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,182);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,182);
+insert into help_relation (help_topic_id,help_keyword_id) values (304,183);
+insert into help_relation (help_topic_id,help_keyword_id) values (101,183);
+insert into help_relation (help_topic_id,help_keyword_id) values (151,183);
+insert into help_relation (help_topic_id,help_keyword_id) values (145,184);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,184);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,185);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,185);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,186);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,187);
+insert into help_relation (help_topic_id,help_keyword_id) values (160,187);
+insert into help_relation (help_topic_id,help_keyword_id) values (455,188);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,189);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,190);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,190);
+insert into help_relation (help_topic_id,help_keyword_id) values (313,191);
+insert into help_relation (help_topic_id,help_keyword_id) values (180,191);
+insert into help_relation (help_topic_id,help_keyword_id) values (420,191);
+insert into help_relation (help_topic_id,help_keyword_id) values (200,191);
+insert into help_relation (help_topic_id,help_keyword_id) values (304,192);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,192);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,193);
+insert into help_relation (help_topic_id,help_keyword_id) values (230,194);
+insert into help_relation (help_topic_id,help_keyword_id) values (377,194);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,195);
+insert into help_relation (help_topic_id,help_keyword_id) values (155,196);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,196);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,196);
+insert into help_relation (help_topic_id,help_keyword_id) values (395,197);
+insert into help_relation (help_topic_id,help_keyword_id) values (465,198);
+insert into help_relation (help_topic_id,help_keyword_id) values (129,199);
+insert into help_relation (help_topic_id,help_keyword_id) values (447,199);
+insert into help_relation (help_topic_id,help_keyword_id) values (182,199);
+insert into help_relation (help_topic_id,help_keyword_id) values (349,199);
+insert into help_relation (help_topic_id,help_keyword_id) values (137,199);
+insert into help_relation (help_topic_id,help_keyword_id) values (452,200);
+insert into help_relation (help_topic_id,help_keyword_id) values (85,201);
+insert into help_relation (help_topic_id,help_keyword_id) values (57,201);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,202);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,203);
+insert into help_relation (help_topic_id,help_keyword_id) values (36,203);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,203);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,204);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,205);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,206);
+insert into help_relation (help_topic_id,help_keyword_id) values (249,207);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,208);
+insert into help_relation (help_topic_id,help_keyword_id) values (192,208);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,209);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,210);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,210);
+insert into help_relation (help_topic_id,help_keyword_id) values (221,211);
+insert into help_relation (help_topic_id,help_keyword_id) values (255,212);
+insert into help_relation (help_topic_id,help_keyword_id) values (88,213);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,213);
+insert into help_relation (help_topic_id,help_keyword_id) values (210,213);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,213);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,213);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,214);
+insert into help_relation (help_topic_id,help_keyword_id) values (260,215);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,216);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,216);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,217);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,217);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,217);
+insert into help_relation (help_topic_id,help_keyword_id) values (291,218);
insert into help_relation (help_topic_id,help_keyword_id) values (356,219);
-insert into help_relation (help_topic_id,help_keyword_id) values (423,220);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,221);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,221);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,222);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,223);
-insert into help_relation (help_topic_id,help_keyword_id) values (462,224);
-insert into help_relation (help_topic_id,help_keyword_id) values (251,224);
-insert into help_relation (help_topic_id,help_keyword_id) values (269,225);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,226);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,227);
-insert into help_relation (help_topic_id,help_keyword_id) values (7,227);
-insert into help_relation (help_topic_id,help_keyword_id) values (253,228);
-insert into help_relation (help_topic_id,help_keyword_id) values (428,228);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,229);
-insert into help_relation (help_topic_id,help_keyword_id) values (223,229);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,229);
-insert into help_relation (help_topic_id,help_keyword_id) values (425,230);
-insert into help_relation (help_topic_id,help_keyword_id) values (85,231);
-insert into help_relation (help_topic_id,help_keyword_id) values (207,231);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,231);
-insert into help_relation (help_topic_id,help_keyword_id) values (310,232);
-insert into help_relation (help_topic_id,help_keyword_id) values (311,233);
-insert into help_relation (help_topic_id,help_keyword_id) values (496,233);
-insert into help_relation (help_topic_id,help_keyword_id) values (206,233);
-insert into help_relation (help_topic_id,help_keyword_id) values (24,233);
-insert into help_relation (help_topic_id,help_keyword_id) values (165,233);
-insert into help_relation (help_topic_id,help_keyword_id) values (126,233);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,234);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,235);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,236);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,237);
-insert into help_relation (help_topic_id,help_keyword_id) values (383,238);
-insert into help_relation (help_topic_id,help_keyword_id) values (330,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (152,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (428,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (253,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,240);
-insert into help_relation (help_topic_id,help_keyword_id) values (273,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (275,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (400,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (212,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (462,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (107,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (318,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (112,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (466,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (177,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (416,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (60,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (356,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (358,241);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,242);
-insert into help_relation (help_topic_id,help_keyword_id) values (474,242);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,242);
-insert into help_relation (help_topic_id,help_keyword_id) values (364,242);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,242);
-insert into help_relation (help_topic_id,help_keyword_id) values (414,242);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,242);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,243);
-insert into help_relation (help_topic_id,help_keyword_id) values (468,244);
-insert into help_relation (help_topic_id,help_keyword_id) values (30,244);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,244);
-insert into help_relation (help_topic_id,help_keyword_id) values (273,244);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,245);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,246);
-insert into help_relation (help_topic_id,help_keyword_id) values (302,247);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,248);
-insert into help_relation (help_topic_id,help_keyword_id) values (307,249);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,250);
-insert into help_relation (help_topic_id,help_keyword_id) values (86,251);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,252);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,253);
-insert into help_relation (help_topic_id,help_keyword_id) values (326,254);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,254);
-insert into help_relation (help_topic_id,help_keyword_id) values (360,254);
-insert into help_relation (help_topic_id,help_keyword_id) values (312,255);
-insert into help_relation (help_topic_id,help_keyword_id) values (373,255);
-insert into help_relation (help_topic_id,help_keyword_id) values (226,255);
-insert into help_relation (help_topic_id,help_keyword_id) values (206,256);
-insert into help_relation (help_topic_id,help_keyword_id) values (86,257);
-insert into help_relation (help_topic_id,help_keyword_id) values (419,258);
-insert into help_relation (help_topic_id,help_keyword_id) values (66,259);
-insert into help_relation (help_topic_id,help_keyword_id) values (484,259);
-insert into help_relation (help_topic_id,help_keyword_id) values (242,260);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,261);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,262);
-insert into help_relation (help_topic_id,help_keyword_id) values (223,262);
-insert into help_relation (help_topic_id,help_keyword_id) values (324,263);
-insert into help_relation (help_topic_id,help_keyword_id) values (148,263);
-insert into help_relation (help_topic_id,help_keyword_id) values (452,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (152,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (95,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (299,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (275,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (306,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (208,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (207,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (75,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (18,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (22,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (391,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (60,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (355,264);
-insert into help_relation (help_topic_id,help_keyword_id) values (326,265);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,266);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,267);
-insert into help_relation (help_topic_id,help_keyword_id) values (230,268);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,269);
-insert into help_relation (help_topic_id,help_keyword_id) values (449,269);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,270);
-insert into help_relation (help_topic_id,help_keyword_id) values (39,271);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,271);
-insert into help_relation (help_topic_id,help_keyword_id) values (266,271);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,272);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,273);
-insert into help_relation (help_topic_id,help_keyword_id) values (376,274);
-insert into help_relation (help_topic_id,help_keyword_id) values (144,275);
-insert into help_relation (help_topic_id,help_keyword_id) values (105,276);
-insert into help_relation (help_topic_id,help_keyword_id) values (462,277);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,277);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,278);
-insert into help_relation (help_topic_id,help_keyword_id) values (416,279);
-insert into help_relation (help_topic_id,help_keyword_id) values (3,280);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,280);
-insert into help_relation (help_topic_id,help_keyword_id) values (336,281);
-insert into help_relation (help_topic_id,help_keyword_id) values (341,282);
-insert into help_relation (help_topic_id,help_keyword_id) values (253,283);
-insert into help_relation (help_topic_id,help_keyword_id) values (266,284);
-insert into help_relation (help_topic_id,help_keyword_id) values (318,285);
-insert into help_relation (help_topic_id,help_keyword_id) values (190,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (66,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (330,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (67,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (333,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (7,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (130,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (399,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (275,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (10,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (279,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (133,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (212,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (18,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (21,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (346,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (80,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (220,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (25,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (142,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (291,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (355,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (33,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (364,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (157,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (484,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (483,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (39,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (306,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (488,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (305,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (167,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (58,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (391,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (325,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (327,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (120,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (189,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (449,286);
-insert into help_relation (help_topic_id,help_keyword_id) values (302,287);
-insert into help_relation (help_topic_id,help_keyword_id) values (245,287);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,287);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,287);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,288);
-insert into help_relation (help_topic_id,help_keyword_id) values (324,289);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,290);
-insert into help_relation (help_topic_id,help_keyword_id) values (120,291);
-insert into help_relation (help_topic_id,help_keyword_id) values (347,291);
-insert into help_relation (help_topic_id,help_keyword_id) values (83,292);
-insert into help_relation (help_topic_id,help_keyword_id) values (57,292);
-insert into help_relation (help_topic_id,help_keyword_id) values (28,292);
-insert into help_relation (help_topic_id,help_keyword_id) values (323,292);
-insert into help_relation (help_topic_id,help_keyword_id) values (341,292);
-insert into help_relation (help_topic_id,help_keyword_id) values (492,292);
-insert into help_relation (help_topic_id,help_keyword_id) values (228,292);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,293);
-insert into help_relation (help_topic_id,help_keyword_id) values (144,294);
-insert into help_relation (help_topic_id,help_keyword_id) values (313,294);
-insert into help_relation (help_topic_id,help_keyword_id) values (311,295);
-insert into help_relation (help_topic_id,help_keyword_id) values (104,296);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,297);
-insert into help_relation (help_topic_id,help_keyword_id) values (256,298);
-insert into help_relation (help_topic_id,help_keyword_id) values (3,298);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,298);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,298);
-insert into help_relation (help_topic_id,help_keyword_id) values (298,298);
-insert into help_relation (help_topic_id,help_keyword_id) values (251,298);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,299);
-insert into help_relation (help_topic_id,help_keyword_id) values (157,299);
-insert into help_relation (help_topic_id,help_keyword_id) values (138,300);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,301);
-insert into help_relation (help_topic_id,help_keyword_id) values (75,301);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,302);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,303);
-insert into help_relation (help_topic_id,help_keyword_id) values (180,304);
-insert into help_relation (help_topic_id,help_keyword_id) values (453,305);
-insert into help_relation (help_topic_id,help_keyword_id) values (108,306);
-insert into help_relation (help_topic_id,help_keyword_id) values (24,306);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,307);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,308);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,309);
-insert into help_relation (help_topic_id,help_keyword_id) values (388,310);
-insert into help_relation (help_topic_id,help_keyword_id) values (115,310);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,311);
-insert into help_relation (help_topic_id,help_keyword_id) values (25,312);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,312);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,313);
-insert into help_relation (help_topic_id,help_keyword_id) values (372,314);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,314);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,315);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,316);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,317);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,318);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,319);
-insert into help_relation (help_topic_id,help_keyword_id) values (376,319);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,320);
-insert into help_relation (help_topic_id,help_keyword_id) values (288,320);
-insert into help_relation (help_topic_id,help_keyword_id) values (418,320);
-insert into help_relation (help_topic_id,help_keyword_id) values (381,321);
-insert into help_relation (help_topic_id,help_keyword_id) values (86,322);
-insert into help_relation (help_topic_id,help_keyword_id) values (120,322);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,322);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,323);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,324);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,325);
-insert into help_relation (help_topic_id,help_keyword_id) values (84,326);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,326);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,327);
-insert into help_relation (help_topic_id,help_keyword_id) values (395,328);
-insert into help_relation (help_topic_id,help_keyword_id) values (86,329);
-insert into help_relation (help_topic_id,help_keyword_id) values (173,329);
-insert into help_relation (help_topic_id,help_keyword_id) values (148,329);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,330);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,331);
-insert into help_relation (help_topic_id,help_keyword_id) values (52,332);
-insert into help_relation (help_topic_id,help_keyword_id) values (321,332);
-insert into help_relation (help_topic_id,help_keyword_id) values (372,333);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,333);
-insert into help_relation (help_topic_id,help_keyword_id) values (9,333);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,334);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,335);
-insert into help_relation (help_topic_id,help_keyword_id) values (121,336);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,337);
-insert into help_relation (help_topic_id,help_keyword_id) values (445,337);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,338);
-insert into help_relation (help_topic_id,help_keyword_id) values (406,339);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,340);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,341);
-insert into help_relation (help_topic_id,help_keyword_id) values (141,342);
-insert into help_relation (help_topic_id,help_keyword_id) values (24,343);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,344);
-insert into help_relation (help_topic_id,help_keyword_id) values (107,344);
-insert into help_relation (help_topic_id,help_keyword_id) values (219,344);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,344);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,345);
-insert into help_relation (help_topic_id,help_keyword_id) values (207,345);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,345);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,346);
-insert into help_relation (help_topic_id,help_keyword_id) values (474,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (437,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (156,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (372,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (223,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (60,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (229,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,347);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,348);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,349);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,350);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,350);
-insert into help_relation (help_topic_id,help_keyword_id) values (1,351);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,352);
-insert into help_relation (help_topic_id,help_keyword_id) values (346,352);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,353);
-insert into help_relation (help_topic_id,help_keyword_id) values (425,354);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,355);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,356);
-insert into help_relation (help_topic_id,help_keyword_id) values (473,356);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,356);
-insert into help_relation (help_topic_id,help_keyword_id) values (75,356);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,357);
-insert into help_relation (help_topic_id,help_keyword_id) values (461,358);
-insert into help_relation (help_topic_id,help_keyword_id) values (226,358);
-insert into help_relation (help_topic_id,help_keyword_id) values (104,359);
-insert into help_relation (help_topic_id,help_keyword_id) values (490,360);
-insert into help_relation (help_topic_id,help_keyword_id) values (67,361);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,361);
-insert into help_relation (help_topic_id,help_keyword_id) values (273,362);
-insert into help_relation (help_topic_id,help_keyword_id) values (445,363);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,364);
-insert into help_relation (help_topic_id,help_keyword_id) values (416,365);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,365);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,366);
-insert into help_relation (help_topic_id,help_keyword_id) values (323,366);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,367);
-insert into help_relation (help_topic_id,help_keyword_id) values (483,368);
-insert into help_relation (help_topic_id,help_keyword_id) values (416,369);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,370);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,370);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,371);
-insert into help_relation (help_topic_id,help_keyword_id) values (374,372);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,373);
-insert into help_relation (help_topic_id,help_keyword_id) values (468,374);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,374);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,374);
-insert into help_relation (help_topic_id,help_keyword_id) values (441,375);
-insert into help_relation (help_topic_id,help_keyword_id) values (279,376);
-insert into help_relation (help_topic_id,help_keyword_id) values (445,377);
-insert into help_relation (help_topic_id,help_keyword_id) values (446,378);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,379);
-insert into help_relation (help_topic_id,help_keyword_id) values (126,380);
-insert into help_relation (help_topic_id,help_keyword_id) values (10,381);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,381);
-insert into help_relation (help_topic_id,help_keyword_id) values (468,382);
-insert into help_relation (help_topic_id,help_keyword_id) values (30,382);
-insert into help_relation (help_topic_id,help_keyword_id) values (273,382);
-insert into help_relation (help_topic_id,help_keyword_id) values (445,383);
-insert into help_relation (help_topic_id,help_keyword_id) values (56,384);
-insert into help_relation (help_topic_id,help_keyword_id) values (82,385);
-insert into help_relation (help_topic_id,help_keyword_id) values (203,385);
-insert into help_relation (help_topic_id,help_keyword_id) values (454,385);
-insert into help_relation (help_topic_id,help_keyword_id) values (367,385);
-insert into help_relation (help_topic_id,help_keyword_id) values (82,386);
-insert into help_relation (help_topic_id,help_keyword_id) values (203,386);
-insert into help_relation (help_topic_id,help_keyword_id) values (152,386);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,386);
-insert into help_relation (help_topic_id,help_keyword_id) values (309,386);
-insert into help_relation (help_topic_id,help_keyword_id) values (183,387);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,388);
-insert into help_relation (help_topic_id,help_keyword_id) values (474,388);
-insert into help_relation (help_topic_id,help_keyword_id) values (324,389);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,390);
-insert into help_relation (help_topic_id,help_keyword_id) values (143,391);
-insert into help_relation (help_topic_id,help_keyword_id) values (321,391);
-insert into help_relation (help_topic_id,help_keyword_id) values (33,392);
-insert into help_relation (help_topic_id,help_keyword_id) values (457,393);
-insert into help_relation (help_topic_id,help_keyword_id) values (476,394);
-insert into help_relation (help_topic_id,help_keyword_id) values (152,394);
-insert into help_relation (help_topic_id,help_keyword_id) values (297,394);
-insert into help_relation (help_topic_id,help_keyword_id) values (9,394);
-insert into help_relation (help_topic_id,help_keyword_id) values (273,394);
-insert into help_relation (help_topic_id,help_keyword_id) values (28,394);
+insert into help_relation (help_topic_id,help_keyword_id) values (3,220);
+insert into help_relation (help_topic_id,help_keyword_id) values (36,220);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,220);
+insert into help_relation (help_topic_id,help_keyword_id) values (48,220);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,220);
+insert into help_relation (help_topic_id,help_keyword_id) values (83,220);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,220);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,221);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,222);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,223);
+insert into help_relation (help_topic_id,help_keyword_id) values (155,223);
+insert into help_relation (help_topic_id,help_keyword_id) values (309,223);
+insert into help_relation (help_topic_id,help_keyword_id) values (186,223);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,223);
+insert into help_relation (help_topic_id,help_keyword_id) values (97,224);
+insert into help_relation (help_topic_id,help_keyword_id) values (277,225);
+insert into help_relation (help_topic_id,help_keyword_id) values (279,226);
+insert into help_relation (help_topic_id,help_keyword_id) values (464,227);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,228);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,228);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,228);
+insert into help_relation (help_topic_id,help_keyword_id) values (304,228);
+insert into help_relation (help_topic_id,help_keyword_id) values (87,228);
+insert into help_relation (help_topic_id,help_keyword_id) values (101,228);
+insert into help_relation (help_topic_id,help_keyword_id) values (60,228);
+insert into help_relation (help_topic_id,help_keyword_id) values (308,228);
+insert into help_relation (help_topic_id,help_keyword_id) values (210,228);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,228);
+insert into help_relation (help_topic_id,help_keyword_id) values (425,229);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,230);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,230);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,231);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,232);
+insert into help_relation (help_topic_id,help_keyword_id) values (466,233);
+insert into help_relation (help_topic_id,help_keyword_id) values (255,233);
+insert into help_relation (help_topic_id,help_keyword_id) values (272,234);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,235);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,236);
+insert into help_relation (help_topic_id,help_keyword_id) values (7,236);
+insert into help_relation (help_topic_id,help_keyword_id) values (257,237);
+insert into help_relation (help_topic_id,help_keyword_id) values (430,237);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,238);
+insert into help_relation (help_topic_id,help_keyword_id) values (226,238);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,238);
+insert into help_relation (help_topic_id,help_keyword_id) values (427,239);
+insert into help_relation (help_topic_id,help_keyword_id) values (87,240);
+insert into help_relation (help_topic_id,help_keyword_id) values (210,240);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,240);
+insert into help_relation (help_topic_id,help_keyword_id) values (313,241);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,242);
+insert into help_relation (help_topic_id,help_keyword_id) values (314,243);
+insert into help_relation (help_topic_id,help_keyword_id) values (500,243);
+insert into help_relation (help_topic_id,help_keyword_id) values (209,243);
+insert into help_relation (help_topic_id,help_keyword_id) values (24,243);
+insert into help_relation (help_topic_id,help_keyword_id) values (168,243);
+insert into help_relation (help_topic_id,help_keyword_id) values (128,243);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,244);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,245);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,246);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,247);
+insert into help_relation (help_topic_id,help_keyword_id) values (385,248);
+insert into help_relation (help_topic_id,help_keyword_id) values (333,249);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,249);
+insert into help_relation (help_topic_id,help_keyword_id) values (155,249);
+insert into help_relation (help_topic_id,help_keyword_id) values (430,249);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,249);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,249);
+insert into help_relation (help_topic_id,help_keyword_id) values (257,249);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,249);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,249);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,249);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,250);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,251);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,251);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (466,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (110,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (115,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (321,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (470,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (276,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (278,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (417,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (401,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (60,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (215,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,252);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,253);
+insert into help_relation (help_topic_id,help_keyword_id) values (478,253);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,253);
+insert into help_relation (help_topic_id,help_keyword_id) values (365,253);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,253);
+insert into help_relation (help_topic_id,help_keyword_id) values (415,253);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,253);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,254);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,255);
+insert into help_relation (help_topic_id,help_keyword_id) values (30,255);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,255);
+insert into help_relation (help_topic_id,help_keyword_id) values (276,255);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,256);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,257);
+insert into help_relation (help_topic_id,help_keyword_id) values (305,258);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,259);
+insert into help_relation (help_topic_id,help_keyword_id) values (310,260);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,261);
+insert into help_relation (help_topic_id,help_keyword_id) values (88,262);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,263);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,264);
+insert into help_relation (help_topic_id,help_keyword_id) values (329,265);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,265);
+insert into help_relation (help_topic_id,help_keyword_id) values (361,265);
+insert into help_relation (help_topic_id,help_keyword_id) values (315,266);
+insert into help_relation (help_topic_id,help_keyword_id) values (375,266);
+insert into help_relation (help_topic_id,help_keyword_id) values (230,266);
+insert into help_relation (help_topic_id,help_keyword_id) values (209,267);
+insert into help_relation (help_topic_id,help_keyword_id) values (88,268);
+insert into help_relation (help_topic_id,help_keyword_id) values (68,269);
+insert into help_relation (help_topic_id,help_keyword_id) values (488,269);
+insert into help_relation (help_topic_id,help_keyword_id) values (420,270);
+insert into help_relation (help_topic_id,help_keyword_id) values (246,271);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,272);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,273);
+insert into help_relation (help_topic_id,help_keyword_id) values (226,273);
+insert into help_relation (help_topic_id,help_keyword_id) values (326,274);
+insert into help_relation (help_topic_id,help_keyword_id) values (151,274);
+insert into help_relation (help_topic_id,help_keyword_id) values (454,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (155,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (97,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (302,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (278,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (309,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (211,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (210,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (77,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (17,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (22,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (393,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (60,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (358,275);
+insert into help_relation (help_topic_id,help_keyword_id) values (329,276);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,277);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,278);
+insert into help_relation (help_topic_id,help_keyword_id) values (234,279);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,280);
+insert into help_relation (help_topic_id,help_keyword_id) values (451,280);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,281);
+insert into help_relation (help_topic_id,help_keyword_id) values (39,282);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,282);
+insert into help_relation (help_topic_id,help_keyword_id) values (269,282);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,283);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,284);
+insert into help_relation (help_topic_id,help_keyword_id) values (378,285);
+insert into help_relation (help_topic_id,help_keyword_id) values (147,286);
+insert into help_relation (help_topic_id,help_keyword_id) values (107,287);
+insert into help_relation (help_topic_id,help_keyword_id) values (466,288);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,288);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,289);
+insert into help_relation (help_topic_id,help_keyword_id) values (417,290);
+insert into help_relation (help_topic_id,help_keyword_id) values (3,291);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,291);
+insert into help_relation (help_topic_id,help_keyword_id) values (339,292);
+insert into help_relation (help_topic_id,help_keyword_id) values (344,293);
+insert into help_relation (help_topic_id,help_keyword_id) values (257,294);
+insert into help_relation (help_topic_id,help_keyword_id) values (269,295);
+insert into help_relation (help_topic_id,help_keyword_id) values (321,296);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,296);
+insert into help_relation (help_topic_id,help_keyword_id) values (193,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (68,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (333,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (69,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (336,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (7,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (134,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (278,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (10,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (282,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (137,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (215,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (17,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (21,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (349,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (82,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (223,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (25,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (145,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (294,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (358,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (424,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (33,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (365,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (160,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (488,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (487,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (39,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (309,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (492,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (308,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (170,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (58,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (393,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (328,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (330,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (122,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (192,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (451,297);
+insert into help_relation (help_topic_id,help_keyword_id) values (38,298);
+insert into help_relation (help_topic_id,help_keyword_id) values (305,298);
+insert into help_relation (help_topic_id,help_keyword_id) values (249,298);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,298);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,298);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,299);
+insert into help_relation (help_topic_id,help_keyword_id) values (326,300);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,301);
+insert into help_relation (help_topic_id,help_keyword_id) values (122,302);
+insert into help_relation (help_topic_id,help_keyword_id) values (350,302);
+insert into help_relation (help_topic_id,help_keyword_id) values (85,303);
+insert into help_relation (help_topic_id,help_keyword_id) values (57,303);
+insert into help_relation (help_topic_id,help_keyword_id) values (28,303);
+insert into help_relation (help_topic_id,help_keyword_id) values (327,303);
+insert into help_relation (help_topic_id,help_keyword_id) values (344,303);
+insert into help_relation (help_topic_id,help_keyword_id) values (496,303);
+insert into help_relation (help_topic_id,help_keyword_id) values (232,303);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,304);
+insert into help_relation (help_topic_id,help_keyword_id) values (147,305);
+insert into help_relation (help_topic_id,help_keyword_id) values (316,305);
+insert into help_relation (help_topic_id,help_keyword_id) values (314,306);
+insert into help_relation (help_topic_id,help_keyword_id) values (106,307);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,308);
+insert into help_relation (help_topic_id,help_keyword_id) values (3,309);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,309);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,309);
+insert into help_relation (help_topic_id,help_keyword_id) values (301,309);
+insert into help_relation (help_topic_id,help_keyword_id) values (255,309);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,310);
+insert into help_relation (help_topic_id,help_keyword_id) values (160,310);
+insert into help_relation (help_topic_id,help_keyword_id) values (141,311);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,312);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,312);
+insert into help_relation (help_topic_id,help_keyword_id) values (77,312);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,313);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,314);
+insert into help_relation (help_topic_id,help_keyword_id) values (182,315);
+insert into help_relation (help_topic_id,help_keyword_id) values (455,316);
+insert into help_relation (help_topic_id,help_keyword_id) values (111,317);
+insert into help_relation (help_topic_id,help_keyword_id) values (24,317);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,318);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,319);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,320);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,320);
+insert into help_relation (help_topic_id,help_keyword_id) values (390,321);
+insert into help_relation (help_topic_id,help_keyword_id) values (118,321);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,322);
+insert into help_relation (help_topic_id,help_keyword_id) values (25,323);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,323);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,324);
+insert into help_relation (help_topic_id,help_keyword_id) values (373,325);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,325);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,326);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,327);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,328);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,329);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,330);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,331);
+insert into help_relation (help_topic_id,help_keyword_id) values (378,331);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,332);
+insert into help_relation (help_topic_id,help_keyword_id) values (291,332);
+insert into help_relation (help_topic_id,help_keyword_id) values (419,332);
+insert into help_relation (help_topic_id,help_keyword_id) values (383,333);
+insert into help_relation (help_topic_id,help_keyword_id) values (424,334);
+insert into help_relation (help_topic_id,help_keyword_id) values (88,334);
+insert into help_relation (help_topic_id,help_keyword_id) values (122,334);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,334);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,335);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,336);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,337);
+insert into help_relation (help_topic_id,help_keyword_id) values (86,338);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,338);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,339);
+insert into help_relation (help_topic_id,help_keyword_id) values (397,340);
+insert into help_relation (help_topic_id,help_keyword_id) values (88,341);
+insert into help_relation (help_topic_id,help_keyword_id) values (176,341);
+insert into help_relation (help_topic_id,help_keyword_id) values (151,341);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,342);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,343);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,343);
+insert into help_relation (help_topic_id,help_keyword_id) values (52,344);
+insert into help_relation (help_topic_id,help_keyword_id) values (324,344);
+insert into help_relation (help_topic_id,help_keyword_id) values (373,345);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,345);
+insert into help_relation (help_topic_id,help_keyword_id) values (9,345);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,346);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,347);
+insert into help_relation (help_topic_id,help_keyword_id) values (123,348);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,349);
+insert into help_relation (help_topic_id,help_keyword_id) values (447,349);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,350);
+insert into help_relation (help_topic_id,help_keyword_id) values (407,351);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,352);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,353);
+insert into help_relation (help_topic_id,help_keyword_id) values (144,354);
+insert into help_relation (help_topic_id,help_keyword_id) values (24,355);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,356);
+insert into help_relation (help_topic_id,help_keyword_id) values (110,356);
+insert into help_relation (help_topic_id,help_keyword_id) values (222,356);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,356);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,357);
+insert into help_relation (help_topic_id,help_keyword_id) values (210,357);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,357);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,358);
+insert into help_relation (help_topic_id,help_keyword_id) values (478,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (439,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (159,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (373,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (226,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (60,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (233,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,359);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,360);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,360);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,361);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,362);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,362);
+insert into help_relation (help_topic_id,help_keyword_id) values (1,363);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,364);
+insert into help_relation (help_topic_id,help_keyword_id) values (349,364);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,365);
+insert into help_relation (help_topic_id,help_keyword_id) values (427,366);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,367);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,368);
+insert into help_relation (help_topic_id,help_keyword_id) values (477,368);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,368);
+insert into help_relation (help_topic_id,help_keyword_id) values (77,368);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,369);
+insert into help_relation (help_topic_id,help_keyword_id) values (465,370);
+insert into help_relation (help_topic_id,help_keyword_id) values (230,370);
+insert into help_relation (help_topic_id,help_keyword_id) values (106,371);
+insert into help_relation (help_topic_id,help_keyword_id) values (69,372);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,372);
+insert into help_relation (help_topic_id,help_keyword_id) values (494,373);
+insert into help_relation (help_topic_id,help_keyword_id) values (276,374);
+insert into help_relation (help_topic_id,help_keyword_id) values (447,375);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,376);
+insert into help_relation (help_topic_id,help_keyword_id) values (417,377);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,377);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,378);
+insert into help_relation (help_topic_id,help_keyword_id) values (327,378);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,379);
+insert into help_relation (help_topic_id,help_keyword_id) values (487,380);
+insert into help_relation (help_topic_id,help_keyword_id) values (417,381);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,382);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,382);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,383);
+insert into help_relation (help_topic_id,help_keyword_id) values (376,384);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,385);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,386);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,386);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,386);
+insert into help_relation (help_topic_id,help_keyword_id) values (443,387);
+insert into help_relation (help_topic_id,help_keyword_id) values (282,388);
+insert into help_relation (help_topic_id,help_keyword_id) values (447,389);
+insert into help_relation (help_topic_id,help_keyword_id) values (448,390);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,391);
+insert into help_relation (help_topic_id,help_keyword_id) values (128,392);
+insert into help_relation (help_topic_id,help_keyword_id) values (10,393);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,393);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,394);
insert into help_relation (help_topic_id,help_keyword_id) values (30,394);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,394);
-insert into help_relation (help_topic_id,help_keyword_id) values (185,394);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,395);
-insert into help_relation (help_topic_id,help_keyword_id) values (266,396);
-insert into help_relation (help_topic_id,help_keyword_id) values (104,397);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,398);
-insert into help_relation (help_topic_id,help_keyword_id) values (219,398);
-insert into help_relation (help_topic_id,help_keyword_id) values (328,398);
-insert into help_relation (help_topic_id,help_keyword_id) values (75,398);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,399);
-insert into help_relation (help_topic_id,help_keyword_id) values (310,400);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,401);
-insert into help_relation (help_topic_id,help_keyword_id) values (305,401);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,401);
-insert into help_relation (help_topic_id,help_keyword_id) values (48,402);
-insert into help_relation (help_topic_id,help_keyword_id) values (120,402);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,402);
-insert into help_relation (help_topic_id,help_keyword_id) values (81,402);
-insert into help_relation (help_topic_id,help_keyword_id) values (104,402);
+insert into help_relation (help_topic_id,help_keyword_id) values (276,394);
+insert into help_relation (help_topic_id,help_keyword_id) values (447,395);
+insert into help_relation (help_topic_id,help_keyword_id) values (56,396);
+insert into help_relation (help_topic_id,help_keyword_id) values (84,397);
+insert into help_relation (help_topic_id,help_keyword_id) values (206,397);
+insert into help_relation (help_topic_id,help_keyword_id) values (456,397);
+insert into help_relation (help_topic_id,help_keyword_id) values (368,397);
+insert into help_relation (help_topic_id,help_keyword_id) values (84,398);
+insert into help_relation (help_topic_id,help_keyword_id) values (206,398);
+insert into help_relation (help_topic_id,help_keyword_id) values (155,398);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,398);
+insert into help_relation (help_topic_id,help_keyword_id) values (312,398);
+insert into help_relation (help_topic_id,help_keyword_id) values (189,399);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,400);
+insert into help_relation (help_topic_id,help_keyword_id) values (478,400);
+insert into help_relation (help_topic_id,help_keyword_id) values (326,401);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,402);
insert into help_relation (help_topic_id,help_keyword_id) values (468,403);
-insert into help_relation (help_topic_id,help_keyword_id) values (60,403);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,403);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,403);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,403);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,404);
-insert into help_relation (help_topic_id,help_keyword_id) values (228,405);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,406);
-insert into help_relation (help_topic_id,help_keyword_id) values (3,407);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,407);
-insert into help_relation (help_topic_id,help_keyword_id) values (482,407);
-insert into help_relation (help_topic_id,help_keyword_id) values (466,408);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,408);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,409);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,409);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,410);
-insert into help_relation (help_topic_id,help_keyword_id) values (239,410);
-insert into help_relation (help_topic_id,help_keyword_id) values (468,411);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,411);
-insert into help_relation (help_topic_id,help_keyword_id) values (36,412);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,413);
-insert into help_relation (help_topic_id,help_keyword_id) values (474,413);
-insert into help_relation (help_topic_id,help_keyword_id) values (127,414);
-insert into help_relation (help_topic_id,help_keyword_id) values (445,414);
-insert into help_relation (help_topic_id,help_keyword_id) values (346,414);
-insert into help_relation (help_topic_id,help_keyword_id) values (133,414);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,415);
-insert into help_relation (help_topic_id,help_keyword_id) values (469,415);
-insert into help_relation (help_topic_id,help_keyword_id) values (152,415);
-insert into help_relation (help_topic_id,help_keyword_id) values (306,415);
-insert into help_relation (help_topic_id,help_keyword_id) values (185,415);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,415);
-insert into help_relation (help_topic_id,help_keyword_id) values (82,416);
+insert into help_relation (help_topic_id,help_keyword_id) values (146,404);
+insert into help_relation (help_topic_id,help_keyword_id) values (324,404);
+insert into help_relation (help_topic_id,help_keyword_id) values (33,405);
+insert into help_relation (help_topic_id,help_keyword_id) values (460,406);
+insert into help_relation (help_topic_id,help_keyword_id) values (479,407);
+insert into help_relation (help_topic_id,help_keyword_id) values (155,407);
+insert into help_relation (help_topic_id,help_keyword_id) values (300,407);
+insert into help_relation (help_topic_id,help_keyword_id) values (9,407);
+insert into help_relation (help_topic_id,help_keyword_id) values (276,407);
+insert into help_relation (help_topic_id,help_keyword_id) values (28,407);
+insert into help_relation (help_topic_id,help_keyword_id) values (30,407);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,407);
+insert into help_relation (help_topic_id,help_keyword_id) values (186,407);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,408);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,409);
+insert into help_relation (help_topic_id,help_keyword_id) values (269,410);
+insert into help_relation (help_topic_id,help_keyword_id) values (106,411);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,412);
+insert into help_relation (help_topic_id,help_keyword_id) values (222,412);
+insert into help_relation (help_topic_id,help_keyword_id) values (331,412);
+insert into help_relation (help_topic_id,help_keyword_id) values (77,412);
+insert into help_relation (help_topic_id,help_keyword_id) values (313,413);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,414);
+insert into help_relation (help_topic_id,help_keyword_id) values (308,414);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,414);
+insert into help_relation (help_topic_id,help_keyword_id) values (424,415);
+insert into help_relation (help_topic_id,help_keyword_id) values (48,415);
+insert into help_relation (help_topic_id,help_keyword_id) values (122,415);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,415);
+insert into help_relation (help_topic_id,help_keyword_id) values (83,415);
+insert into help_relation (help_topic_id,help_keyword_id) values (106,415);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,416);
+insert into help_relation (help_topic_id,help_keyword_id) values (60,416);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,416);
insert into help_relation (help_topic_id,help_keyword_id) values (468,416);
-insert into help_relation (help_topic_id,help_keyword_id) values (367,416);
-insert into help_relation (help_topic_id,help_keyword_id) values (479,417);
-insert into help_relation (help_topic_id,help_keyword_id) values (462,418);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,419);
-insert into help_relation (help_topic_id,help_keyword_id) values (38,420);
-insert into help_relation (help_topic_id,help_keyword_id) values (142,420);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,420);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,420);
-insert into help_relation (help_topic_id,help_keyword_id) values (220,420);
-insert into help_relation (help_topic_id,help_keyword_id) values (52,420);
-insert into help_relation (help_topic_id,help_keyword_id) values (321,420);
-insert into help_relation (help_topic_id,help_keyword_id) values (253,421);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,422);
-insert into help_relation (help_topic_id,help_keyword_id) values (360,422);
-insert into help_relation (help_topic_id,help_keyword_id) values (487,423);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,424);
-insert into help_relation (help_topic_id,help_keyword_id) values (405,425);
-insert into help_relation (help_topic_id,help_keyword_id) values (87,425);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,425);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,426);
-insert into help_relation (help_topic_id,help_keyword_id) values (209,426);
-insert into help_relation (help_topic_id,help_keyword_id) values (492,427);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,428);
-insert into help_relation (help_topic_id,help_keyword_id) values (462,429);
-insert into help_relation (help_topic_id,help_keyword_id) values (324,429);
-insert into help_relation (help_topic_id,help_keyword_id) values (36,429);
-insert into help_relation (help_topic_id,help_keyword_id) values (112,429);
-insert into help_relation (help_topic_id,help_keyword_id) values (420,429);
-insert into help_relation (help_topic_id,help_keyword_id) values (466,429);
-insert into help_relation (help_topic_id,help_keyword_id) values (0,430);
-insert into help_relation (help_topic_id,help_keyword_id) values (94,430);
-insert into help_relation (help_topic_id,help_keyword_id) values (382,430);
-insert into help_relation (help_topic_id,help_keyword_id) values (285,430);
-insert into help_relation (help_topic_id,help_keyword_id) values (431,430);
-insert into help_relation (help_topic_id,help_keyword_id) values (302,430);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,430);
-insert into help_relation (help_topic_id,help_keyword_id) values (360,430);
-insert into help_relation (help_topic_id,help_keyword_id) values (493,431);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,432);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,433);
-insert into help_relation (help_topic_id,help_keyword_id) values (130,434);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,434);
-insert into help_relation (help_topic_id,help_keyword_id) values (291,434);
-insert into help_relation (help_topic_id,help_keyword_id) values (36,434);
-insert into help_relation (help_topic_id,help_keyword_id) values (491,435);
-insert into help_relation (help_topic_id,help_keyword_id) values (27,436);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,437);
-insert into help_relation (help_topic_id,help_keyword_id) values (22,437);
-insert into help_relation (help_topic_id,help_keyword_id) values (260,437);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,438);
-insert into help_relation (help_topic_id,help_keyword_id) values (488,438);
-insert into help_relation (help_topic_id,help_keyword_id) values (197,439);
-insert into help_relation (help_topic_id,help_keyword_id) values (353,440);
-insert into help_relation (help_topic_id,help_keyword_id) values (102,440);
-insert into help_relation (help_topic_id,help_keyword_id) values (207,441);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,442);
-insert into help_relation (help_topic_id,help_keyword_id) values (104,442);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,442);
-insert into help_relation (help_topic_id,help_keyword_id) values (459,443);
-insert into help_relation (help_topic_id,help_keyword_id) values (191,444);
-insert into help_relation (help_topic_id,help_keyword_id) values (474,444);
-insert into help_relation (help_topic_id,help_keyword_id) values (344,445);
-insert into help_relation (help_topic_id,help_keyword_id) values (39,446);
-insert into help_relation (help_topic_id,help_keyword_id) values (116,446);
-insert into help_relation (help_topic_id,help_keyword_id) values (266,446);
-insert into help_relation (help_topic_id,help_keyword_id) values (58,446);
-insert into help_relation (help_topic_id,help_keyword_id) values (184,446);
-insert into help_relation (help_topic_id,help_keyword_id) values (261,446);
-insert into help_relation (help_topic_id,help_keyword_id) values (358,446);
-insert into help_relation (help_topic_id,help_keyword_id) values (206,447);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,447);
-insert into help_relation (help_topic_id,help_keyword_id) values (198,448);
-insert into help_relation (help_topic_id,help_keyword_id) values (464,449);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,416);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,417);
+insert into help_relation (help_topic_id,help_keyword_id) values (232,418);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,419);
+insert into help_relation (help_topic_id,help_keyword_id) values (3,420);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,420);
+insert into help_relation (help_topic_id,help_keyword_id) values (486,420);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,421);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,421);
+insert into help_relation (help_topic_id,help_keyword_id) values (470,422);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,422);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,423);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,423);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,424);
+insert into help_relation (help_topic_id,help_keyword_id) values (243,424);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,425);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,425);
+insert into help_relation (help_topic_id,help_keyword_id) values (36,426);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,427);
+insert into help_relation (help_topic_id,help_keyword_id) values (478,427);
+insert into help_relation (help_topic_id,help_keyword_id) values (129,428);
+insert into help_relation (help_topic_id,help_keyword_id) values (447,428);
+insert into help_relation (help_topic_id,help_keyword_id) values (349,428);
+insert into help_relation (help_topic_id,help_keyword_id) values (137,428);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,429);
+insert into help_relation (help_topic_id,help_keyword_id) values (473,429);
+insert into help_relation (help_topic_id,help_keyword_id) values (155,429);
+insert into help_relation (help_topic_id,help_keyword_id) values (309,429);
+insert into help_relation (help_topic_id,help_keyword_id) values (186,429);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,429);
+insert into help_relation (help_topic_id,help_keyword_id) values (84,430);
+insert into help_relation (help_topic_id,help_keyword_id) values (472,430);
+insert into help_relation (help_topic_id,help_keyword_id) values (368,430);
+insert into help_relation (help_topic_id,help_keyword_id) values (483,431);
+insert into help_relation (help_topic_id,help_keyword_id) values (466,432);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,433);
+insert into help_relation (help_topic_id,help_keyword_id) values (145,434);
+insert into help_relation (help_topic_id,help_keyword_id) values (38,434);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,434);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,434);
+insert into help_relation (help_topic_id,help_keyword_id) values (223,434);
+insert into help_relation (help_topic_id,help_keyword_id) values (52,434);
+insert into help_relation (help_topic_id,help_keyword_id) values (324,434);
+insert into help_relation (help_topic_id,help_keyword_id) values (257,435);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,436);
+insert into help_relation (help_topic_id,help_keyword_id) values (361,436);
+insert into help_relation (help_topic_id,help_keyword_id) values (491,437);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,438);
+insert into help_relation (help_topic_id,help_keyword_id) values (406,439);
+insert into help_relation (help_topic_id,help_keyword_id) values (89,439);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,439);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,440);
+insert into help_relation (help_topic_id,help_keyword_id) values (212,440);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,441);
+insert into help_relation (help_topic_id,help_keyword_id) values (496,442);
+insert into help_relation (help_topic_id,help_keyword_id) values (466,443);
+insert into help_relation (help_topic_id,help_keyword_id) values (326,443);
+insert into help_relation (help_topic_id,help_keyword_id) values (36,443);
+insert into help_relation (help_topic_id,help_keyword_id) values (130,443);
+insert into help_relation (help_topic_id,help_keyword_id) values (115,443);
+insert into help_relation (help_topic_id,help_keyword_id) values (421,443);
+insert into help_relation (help_topic_id,help_keyword_id) values (470,443);
+insert into help_relation (help_topic_id,help_keyword_id) values (0,444);
+insert into help_relation (help_topic_id,help_keyword_id) values (96,444);
+insert into help_relation (help_topic_id,help_keyword_id) values (384,444);
+insert into help_relation (help_topic_id,help_keyword_id) values (288,444);
+insert into help_relation (help_topic_id,help_keyword_id) values (433,444);
+insert into help_relation (help_topic_id,help_keyword_id) values (305,444);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,444);
+insert into help_relation (help_topic_id,help_keyword_id) values (361,444);
+insert into help_relation (help_topic_id,help_keyword_id) values (497,445);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,446);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,447);
+insert into help_relation (help_topic_id,help_keyword_id) values (134,448);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,448);
+insert into help_relation (help_topic_id,help_keyword_id) values (294,448);
+insert into help_relation (help_topic_id,help_keyword_id) values (36,448);
+insert into help_relation (help_topic_id,help_keyword_id) values (495,449);
+insert into help_relation (help_topic_id,help_keyword_id) values (27,450);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,451);
+insert into help_relation (help_topic_id,help_keyword_id) values (22,451);
+insert into help_relation (help_topic_id,help_keyword_id) values (263,451);
+insert into help_relation (help_topic_id,help_keyword_id) values (347,452);
+insert into help_relation (help_topic_id,help_keyword_id) values (492,452);
+insert into help_relation (help_topic_id,help_keyword_id) values (199,453);
+insert into help_relation (help_topic_id,help_keyword_id) values (356,454);
+insert into help_relation (help_topic_id,help_keyword_id) values (104,454);
+insert into help_relation (help_topic_id,help_keyword_id) values (210,455);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,456);
+insert into help_relation (help_topic_id,help_keyword_id) values (106,456);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,456);
+insert into help_relation (help_topic_id,help_keyword_id) values (463,457);
+insert into help_relation (help_topic_id,help_keyword_id) values (194,458);
+insert into help_relation (help_topic_id,help_keyword_id) values (478,458);
+insert into help_relation (help_topic_id,help_keyword_id) values (459,459);
+insert into help_relation (help_topic_id,help_keyword_id) values (374,459);
+insert into help_relation (help_topic_id,help_keyword_id) values (39,460);
+insert into help_relation (help_topic_id,help_keyword_id) values (58,460);
+insert into help_relation (help_topic_id,help_keyword_id) values (269,460);
+insert into help_relation (help_topic_id,help_keyword_id) values (185,460);
+insert into help_relation (help_topic_id,help_keyword_id) values (264,460);
+insert into help_relation (help_topic_id,help_keyword_id) values (209,461);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,461);
+insert into help_relation (help_topic_id,help_keyword_id) values (201,462);
+insert into help_relation (help_topic_id,help_keyword_id) values (468,463);
+
diff --git a/scripts/mytop.sh b/scripts/mytop.sh
index a36fddf7368..f0456498da7 100755
--- a/scripts/mytop.sh
+++ b/scripts/mytop.sh
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
#
-# $Id: mytop,v 1.90 2010/05/23 10:51:21 mark Exp $
+# $Id: mytop,v 1.91 2012/01/18 16:49:12 mgrennan Exp $
=pod
@@ -15,12 +15,13 @@ mytop - display MySQL server performance info like `top'
use 5.005;
use strict;
use DBI;
+use DBD::mysql;
use Getopt::Long;
use Socket;
use List::Util qw(min max);
use File::Basename;
-$main::VERSION = "1.9a";
+$main::VERSION = "1.91a";
my $path_for_script= dirname($0);
$|=1;
@@ -96,7 +97,7 @@ my %config = (
resolve => 0,
slow => 10, # slow query time
socket => '',
- sort => 0, # default or reverse sort ("s")
+ sort => 1, # default or reverse sort ("s")
user => 'root',
fullqueries => 0
);
@@ -378,12 +379,11 @@ while (1)
## keystroke command processing (if we get this far)
##
- # ! - Force past a replication error
-
- if ($key eq 'r')
+ if ($key eq '!')
{
- Execute("STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; START SLAVE;");
- next;
+ Execute("stop slave");
+ Execute("set global sql_slave_skip_counter=1");
+ Execute("start slave");
}
# t - top
@@ -415,7 +415,7 @@ while (1)
next;
}
- ## m - mode swtich to qps
+ ## m - mode switch to qps
if ($key eq 'm')
{
@@ -425,17 +425,7 @@ while (1)
next;
}
- ## M - mode swtich to qps
-
- if ($key eq 'M')
- {
- $config{mode} = 'status';
- Clear() unless $config{batchmode};
- print "Queries Per Second [hit q to exit this mode]\n";
- next;
- }
-
- ## c - mode swtich to command summary
+ ## c - mode switch to command summary
if ($key eq 'c')
{
@@ -467,8 +457,6 @@ while (1)
next;
}
- # Change the SLOW query value
-
if ($key eq 'S')
{
cmd_S();
@@ -755,7 +743,9 @@ while (1)
ReadKey(0);
}
- if ($key eq 'S')
+ # Switch to show status mode
+
+ if ($key eq 'M')
{
$config{mode} = 'status';
}
@@ -931,6 +921,11 @@ sub GetData()
}
}
+ open L, "</proc/loadavg";
+ my $l = <L>;
+ close L;
+ chomp $l;
+
$last_time = $now_time;
## Server Uptime in meaningful terms...
@@ -962,6 +957,7 @@ sub GetData()
printf "%-.${host_width}s %${up_width}s\n",
"$server on $config{host} ($db_version)",
"up $uptime $current_time";
+# "load $l up $uptime $current_time";
$lines_left--;
@@ -1055,19 +1051,29 @@ sub GetData()
if ($t_delta)
{
+ my $rows_read;
+ if (defined($STATUS{Rows_read}))
+ {
+ $rows_read= $STATUS{Rows_read} - $OLD_STATUS{Rows_read};
+ }
+ else
+ {
+ $rows_read=
+ ($STATUS{Handler_read_first}+$STATUS{Handler_read_key}+
+ $STATUS{Handler_read_next}+$STATUS{Handler_read_prev}+
+ $STATUS{Handler_read_rnd}+$STATUS{Handler_read_rnd_next} -
+ $OLD_STATUS{Handler_read_first}-$OLD_STATUS{Handler_read_key}-
+ $OLD_STATUS{Handler_read_next}-$OLD_STATUS{Handler_read_prev}-
+ $OLD_STATUS{Handler_read_rnd}-
+ $OLD_STATUS{Handler_read_rnd_next});
+ }
printf(" Handler: (R/W/U/D) %5d/%5d/%5d/%5d Tmp: R/W/U: %5d/%5d/%5d\n",
- ($STATUS{Handler_read_first}+$STATUS{Handler_read_key}+
- $STATUS{Handler_read_next}+$STATUS{Handler_read_prev}+
- $STATUS{Handler_read_rnd}+$STATUS{Handler_read_rnd_next} -
- $OLD_STATUS{Handler_read_first}-$OLD_STATUS{Handler_read_key}-
- $OLD_STATUS{Handler_read_next}-$OLD_STATUS{Handler_read_prev}-
- $OLD_STATUS{Handler_read_rnd}-
- $OLD_STATUS{Handler_read_rnd_next})/$t_delta,
+ $rows_read/$t_delta,
($STATUS{Handler_write} - $OLD_STATUS{Handler_write}) /
$t_delta,
($STATUS{Handler_update} - $OLD_STATUS{Handler_update}) /
$t_delta,
- ($STATUS{Handler_delete} - $OLD_STATUS{Handler_delete}) /
+ ($STATUS{Handler_delete} - $OLD_STATUS{Handler_delete}) /
$t_delta,
($STATUS{Rows_tmp_read} - $OLD_STATUS{Rows_tmp_read}) /
$t_delta,
@@ -1083,7 +1089,7 @@ sub GetData()
$lines_left--;
- printf(" MyISAM Key Efficiency: %2.1f%% Bps in/out: %5s/%5s ",
+ printf(" ISAM Key Efficiency: %2.1f%% Bps in/out: %5s/%5s ",
$cache_hits_percent,
make_short($STATUS{Bytes_received} / $STATUS{Uptime} ),
make_short($STATUS{Bytes_sent} / $STATUS{Uptime}));
@@ -1095,35 +1101,40 @@ sub GetData()
$lines_left--;
- my($data) = Hashes('SHOW SLAVE STATUS');
- if (defined($data->{Master_Host}))
+ my($data) = Hashes('show global variables like "read_only"');
+ if ($data->{Value} ne "OFF")
{
- print " Replication ";
- if ($HAS_COLOR) {
- print GREEN();
- print RED() if ($data->{Slave_IO_Running} ne "Yes") ;
- }
- print "IO:$data->{Slave_IO_Running} ";
+ print RED() if ($HAS_COLOR) ;
+ print " ReadOnly";
RESET() if ($HAS_COLOR);
+ }
- if ($HAS_COLOR) {
- print GREEN();
- print RED() if ($data->{Slave_SQL_Running} ne "Yes") ;
+ ($data) = Hashes('SHOW SLAVE STATUS');
+ if (defined($data->{Master_Host}))
+ {
+ if (defined($data->{Seconds_Behind_Master}))
+ {
+ if ($HAS_COLOR) {
+ print GREEN();
+ print YELLOW() if ($data->{Seconds_Behind_Master} > 60);
+ print MAGENTA() if ($data->{Seconds_Behind_Master} > 360);
+ }
}
+ print " Replication ";
+ print "IO:$data->{Slave_IO_Running} ";
print "SQL:$data->{Slave_SQL_Running} ";
print RESET() if ($HAS_COLOR);
- my $SlaveDelay = $data->{Seconds_Behind_Master};
- if ($SlaveDelay)
+ if (defined($data->{Seconds_Behind_Master}))
{
if ($HAS_COLOR) {
print GREEN();
- print YELLOW() if ($SlaveDelay > 10);
- print MAGENTA() if ($SlaveDelay > 120);
+ print YELLOW() if ($data->{Seconds_Behind_Master} > 60);
+ print MAGENTA() if ($data->{Seconds_Behind_Master} > 360);
}
- print "Delay: $SlaveDelay sec.";
+ print "Delay: $data->{Seconds_Behind_Master} sec.";
} else {
- my $free = $width - 35;
+ my $free = $width - 45;
my $Err = substr $data->{Last_Error},0 ,$free;
printf(" ERR: %-${free}s", $Err) if ( $Err ne "" );
}
@@ -1198,6 +1209,7 @@ sub GetData()
if ($is_ip and $config{resolve})
{
$thread->{Host} =~ s/:\d+$//;
+# my $host = $thread->{Host};
my $host = gethostbyaddr(inet_aton($thread->{Host}), AF_INET);
# $host =~ s/^([^.]+).*/$1/;
$thread->{Host} = $host;
@@ -1483,7 +1495,7 @@ sub GetShowStatus()
Clear() unless $config{batchmode};
my @rows = Hashes("SHOW STATUS");
- printf "%32s %10s %10s\n", 'Counter', 'Total', 'Change';
+ printf "%32s %10s %10s Toggle idle with 'i'\n", 'Counter', 'Total', 'Change';
printf "%32s %10s %10s\n", '-------', '-----', '------';
for my $row (@rows)
@@ -1519,9 +1531,7 @@ sub GetShowStatus()
}
}
- if ($delta != 0) {
- printf "%32s: %10s %10s\n", $name, $value, $delta;
- }
+ printf "%32s: %10s %10s\n", $name, $value, $delta;
print RESET() if $HAS_COLOR;
$statcache{$name} = $value;
@@ -1703,12 +1713,11 @@ sub trim($)
sub PrintHelp()
{
my $help = qq[
-Help for mytop version $main::VERSION by Mark Grennan <${YELLOW}Mark\@Grennan.com${RESET}>
-Origional work by Jeremy D. Zawodny <${YELLOW}Jeremy\@Zawodny.com${RESET}>
+Help for mytop version $main::VERSION by Jeremy D. Zawodny <${YELLOW}Jeremy\@Zawodny.com${RESET}>
+ with updates by Mark Grennan <${YELLOW}mark\@grennan.com${RESET}>
? - display this screen
# - toggle short/long numbers (not yet implemented)
- ! - force past replication error
c - command summary view (based on Com_* counters)
C - turn color on and off
d - show only a specific database
@@ -1733,8 +1742,9 @@ Origional work by Jeremy D. Zawodny <${YELLOW}Jeremy\@Zawodny.com${RESET}>
S - change slow quiery hightlighting
t - switch to thread view (default)
u - show only a specific user
- V - show variablesi
+ V - show variables
: - enter a command (not yet implemented)
+ ! - Skip an error that has stopped replications (at your own risk)
L - show full queries (do not strip to terminal width)
Base version from ${GREEN}http://www.mysqlfanboy.com/mytop${RESET}
@@ -2317,11 +2327,8 @@ having the User column appear, for example.
mytop was developed and is maintained by Jeremy D. Zawodny
(Jeremy@Zawodny.com).
-(Mark Grennan) After weeks and months of trying to get Jeremy's
-attention I desided to release my own update to mytop. I use it
-every day as a part of my job. Thanks Jeremy for creating mytop.
-I hope you find my updates as helpful as I have. I can be
-reached at (Mark@Grennan.com).
+If you wish to e-mail me regarding this software, B<PLEASE> subscribe
+to the B<mytop> mailing list. See the B<mytop> homepage for details.
=head1 DISCLAIMER
@@ -2330,12 +2337,6 @@ for it. Yahoo! does not necessarily support this software in any
way. It is merely a personal idea which happened to be very useful in
my job.
-=head1 RECRUITING
-
-If you hack Perl and grok MySQL, come work at Yahoo! Contact me for
-details. Or just send me your resume. Er, unless we just had layoffs,
-in which case we're not hiring. :-(
-
=head1 SEE ALSO
Please check the MySQL manual if you're not sure where some of the
@@ -2344,7 +2345,6 @@ output of B<mytop> is coming from.
=head1 COPYRIGHT
Copyright (C) 2000-2010, Jeremy D. Zawodny.
-Copyright (C) 2010, Mark T. Grennan.
=head1 CREDITS
@@ -2358,6 +2358,15 @@ Many thanks go to these fine folks:
Added --fullqueries and reading of .my.cnf
+=item Mark Grennan (mark@grennan.com) www.linuxfangoy.com
+
+Added updates for MySQL 5.x. Added 'S' (slow) highlighting.
+Added 'C' to turn on and off Color. Added 'l' command to change
+color for long running queries. Fixed a few documentation issues.
+Monitors Slave status. Added color to Queue hit ratio.
+Added number of rows sorted per second.
+Created release 1.7.
+
=item Sami Ahlroos (sami@avis-net.de)
Suggested the idle/noidle stuff.
diff --git a/sql-common/client.c b/sql-common/client.c
index bb015760b0c..404d9c8cb17 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2003, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2003, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 2012, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
@@ -1472,7 +1472,7 @@ static void cli_fetch_lengths(ulong *to, MYSQL_ROW column,
***************************************************************************/
MYSQL_FIELD *
-unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
+unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
my_bool default_value, uint server_capabilities)
{
MYSQL_ROWS *row;
@@ -1485,6 +1485,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
if (!result)
{
free_rows(data); /* Free old data */
+ set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
DBUG_RETURN(0);
}
bzero((char*) field, (uint) sizeof(MYSQL_FIELD)*fields);
@@ -1512,6 +1513,14 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
field->org_name_length= lengths[5];
/* Unpack fixed length parts */
+ if (lengths[6] != 12)
+ {
+ /* malformed packet. signal an error. */
+ free_rows(data); /* Free old data */
+ set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
+ DBUG_RETURN(0);
+ }
+
pos= (uchar*) row->data[6];
field->charsetnr= uint2korr(pos);
field->length= (uint) uint4korr(pos+2);
@@ -3409,6 +3418,12 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->server_status=uint2korr(end+3);
mysql->server_capabilities|= uint2korr(end+5) << 16;
pkt_scramble_len= end[7];
+ if (pkt_scramble_len < 0)
+ {
+ set_mysql_error(mysql, CR_MALFORMED_PACKET,
+ unknown_sqlstate); /* purecov: inspected */
+ goto error;
+ }
}
end+= 18;
@@ -3944,7 +3959,7 @@ get_info:
if (!(fields=cli_read_rows(mysql,(MYSQL_FIELD*)0, protocol_41(mysql) ? 7:5)))
DBUG_RETURN(1);
- if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,
+ if (!(mysql->fields=unpack_fields(mysql, fields,&mysql->field_alloc,
(uint) field_count,0,
mysql->server_capabilities)))
DBUG_RETURN(1);
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index df75bb49c89..fbcf52dbf19 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -104,6 +104,103 @@ my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
return FALSE;
}
+static int get_number(uint *val, uint *number_of_fields, const char **str,
+ const char *end)
+{
+ const char *s = *str;
+
+ if (s >= end)
+ return 0;
+
+ if (!my_isdigit(&my_charset_latin1, *s))
+ return 1;
+ *val= *s++ - '0';
+
+ for (; s < end && my_isdigit(&my_charset_latin1, *s); s++)
+ *val= *val * 10 + *s - '0';
+ *str = s;
+ (*number_of_fields)++;
+ return 0;
+}
+
+static int get_digits(uint *val, uint *number_of_fields, const char **str,
+ const char *end, uint length)
+{
+ return get_number(val, number_of_fields, str, min(end, *str + length));
+}
+
+static int get_punct(const char **str, const char *end)
+{
+ if (*str >= end)
+ return 0;
+ if (my_ispunct(&my_charset_latin1, **str))
+ {
+ (*str)++;
+ return 0;
+ }
+ return 1;
+}
+
+static int get_date_time_separator(uint *number_of_fields, ulonglong flags,
+ const char **str, const char *end)
+{
+ const char *s= *str;
+ if (s >= end)
+ return 0;
+
+ if (*s == 'T')
+ {
+ (*str)++;
+ return 0;
+ }
+
+ /*
+ now, this is tricky, for backward compatibility reasons.
+ cast("11:11:11.12.12.12" as datetime) should give 2011-11-11 12:12:12
+ but
+ cast("11:11:11.12.12.12" as time) should give 11:11:11.12
+ that is, a punctuation character can be accepted as a date/time separator
+ only if TIME_DATETIME_ONLY (see str_to_time) is not set.
+ */
+ if (my_ispunct(&my_charset_latin1, *s))
+ {
+ if (flags & TIME_DATETIME_ONLY)
+ {
+ /* see above, returning 1 is not enough, we need hard abort here */
+ *number_of_fields= 0;
+ return 1;
+ }
+
+ (*str)++;
+ return 0;
+ }
+
+ if (!my_isspace(&my_charset_latin1, *s))
+ return 1;
+
+ do
+ {
+ s++;
+ } while (my_isspace(&my_charset_latin1, *s));
+ *str= s;
+ return 0;
+}
+
+static int get_maybe_T(const char **str, const char *end)
+{
+ if (*str < end && **str == 'T')
+ (*str)++;
+ return 0;
+}
+
+static uint skip_digits(const char **str, const char *end)
+{
+ const char *start= *str, *s= *str;
+ while (s < end && my_isdigit(&my_charset_latin1, *s))
+ s++;
+ *str= s;
+ return s - start;
+}
/*
Convert a timestamp string to a MYSQL_TIME value.
@@ -132,24 +229,9 @@ my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
The second part may have an optional .###### fraction part.
- NOTES
- This function should work with a format position vector as long as the
- following things holds:
- - All date are kept together and all time parts are kept together
- - Date and time parts must be separated by blank
- - Second fractions must come after second part and be separated
- by a '.'. (The second fractions are optional)
- - AM/PM must come after second fractions (or after seconds if no fractions)
- - Year must always been specified.
- - If time is before date, then we will use datetime format only if
- the argument consist of two parts, separated by space.
- Otherwise we will assume the argument is a date.
- - The hour part must be specified in hour-minute-second order.
-
RETURN VALUES
MYSQL_TIMESTAMP_NONE String wasn't a timestamp, like
[DD [HH:[MM:[SS]]]].fraction.
- l_time is not changed.
MYSQL_TIMESTAMP_DATE DATE string (YY MM and DD parts ok)
MYSQL_TIMESTAMP_DATETIME Full timestamp
MYSQL_TIMESTAMP_ERROR Timestamp with wrong values.
@@ -162,18 +244,10 @@ enum enum_mysql_timestamp_type
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
ulonglong flags, int *was_cut)
{
- uint UNINIT_VAR(field_length), UNINIT_VAR(year_length), digits, i, number_of_fields;
- uint date[MAX_DATE_PARTS], date_len[MAX_DATE_PARTS];
- uint add_hours= 0, start_loop;
- ulong not_zero_date, allow_space;
- my_bool is_internal_format;
- const char *pos, *UNINIT_VAR(last_field_pos);
- const char *end=str+length;
- const uchar *format_position;
- my_bool found_delimitier= 0, found_space= 0;
- uint frac_pos, frac_len;
+ const char *end=str+length, *pos;
+ uint number_of_fields= 0, digits, year_length, not_zero_date;
DBUG_ENTER("str_to_datetime");
- DBUG_PRINT("enter",("str: %.*s",length,str));
+ bzero(l_time, sizeof(*l_time));
if (flags & TIME_TIME_ONLY)
{
@@ -181,7 +255,6 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
ret= str_to_time(str, length, l_time, flags, was_cut);
DBUG_RETURN(ret);
}
-
*was_cut= 0;
/* Skip space at start */
@@ -193,254 +266,93 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
DBUG_RETURN(MYSQL_TIMESTAMP_NONE);
}
- is_internal_format= 0;
- /* This has to be changed if want to activate different timestamp formats */
- format_position= internal_format_positions;
-
/*
Calculate number of digits in first part.
If length= 8 or >= 14 then year is of format YYYY.
(YYYY-MM-DD, YYYYMMDD, YYYYYMMDDHHMMSS)
*/
- for (pos=str;
- pos != end && (my_isdigit(&my_charset_latin1,*pos) || *pos == 'T');
- pos++)
- ;
+ pos= str;
+ digits= skip_digits(&pos, end);
- digits= (uint) (pos-str);
- start_loop= 0; /* Start of scan loop */
- date_len[format_position[0]]= 0; /* Length of year field */
- if (pos == end || *pos == '.')
+ if (pos < end && *pos == 'T') /* YYYYYMMDDHHMMSSThhmmss is supported too */
{
- /* Found date in internal format (only numbers like YYYYMMDD) */
- year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2;
- field_length= year_length;
- is_internal_format= 1;
- format_position= internal_format_positions;
+ pos++;
+ digits+= skip_digits(&pos, end);
}
- else
+ if (pos < end && *pos == '.' && digits >= 12) /* YYYYYMMDDHHMMSShhmmss.uuuuuu is supported too */
{
- if (format_position[0] >= 3) /* If year is after HHMMDD */
- {
- /*
- If year is not in first part then we have to determinate if we got
- a date field or a datetime field.
- We do this by checking if there is two numbers separated by
- space in the input.
- */
- while (pos < end && !my_isspace(&my_charset_latin1, *pos))
- pos++;
- while (pos < end && !my_isdigit(&my_charset_latin1, *pos))
- pos++;
- if (pos == end)
- {
- if (flags & TIME_DATETIME_ONLY)
- {
- *was_cut= 1;
- DBUG_RETURN(MYSQL_TIMESTAMP_NONE); /* Can't be a full datetime */
- }
- /* Date field. Set hour, minutes and seconds to 0 */
- date[0]= date[1]= date[2]= date[3]= date[4]= 0;
- start_loop= 5; /* Start with first date part */
- }
- }
-
- field_length= format_position[0] == 0 ? 4 : 2;
+ pos++;
+ skip_digits(&pos, end); // ignore the return value
}
- /*
- Only allow space in the first "part" of the datetime field and:
- - after days, part seconds
- - before and after AM/PM (handled by code later)
-
- 2003-03-03 20:00:20 AM
- 20:00:20.000000 AM 03-03-2000
- */
- i= max((uint) format_position[0], (uint) format_position[1]);
- set_if_bigger(i, (uint) format_position[2]);
- allow_space= ((1 << i) | (1 << format_position[6]));
- allow_space&= (1 | 2 | 4 | 8);
-
- not_zero_date= 0;
- for (i = start_loop;
- i < MAX_DATE_PARTS-1 && str != end &&
- my_isdigit(&my_charset_latin1,*str);
- i++)
+ if (pos == end)
{
- const char *start= str;
- ulong tmp_value= (uint) (uchar) (*str++ - '0');
-
/*
- Internal format means no delimiters; every field has a fixed
- width. Otherwise, we scan until we find a delimiter and discard
- leading zeroes -- except for the microsecond part, where leading
- zeroes are significant, and where we never process more than six
- digits.
+ Found date in internal format
+ (only numbers like [YY]YYMMDD[T][hhmmss[.uuuuuu]])
*/
- my_bool scan_until_delim= !is_internal_format &&
- ((i != format_position[6]));
-
- while (str != end && my_isdigit(&my_charset_latin1,str[0]) &&
- (scan_until_delim || --field_length))
- {
- tmp_value=tmp_value*10 + (ulong) (uchar) (*str - '0');
- str++;
- }
- date_len[i]= (uint) (str - start);
- if (tmp_value > 999999) /* Impossible date part */
- {
- *was_cut= 1;
- DBUG_RETURN(MYSQL_TIMESTAMP_NONE);
- }
- date[i]=tmp_value;
- not_zero_date|= tmp_value;
-
- /* Length of next field */
- field_length= format_position[i+1] == 0 ? 4 : 2;
-
- if ((last_field_pos= str) == end)
- {
- i++; /* Register last found part */
- break;
- }
- /* Allow a 'T' after day to allow CCYYMMDDT type of fields */
- if (i == format_position[2] && *str == 'T')
- {
- str++; /* ISO8601: CCYYMMDDThhmmss */
- continue;
- }
- if (i == format_position[5]) /* Seconds */
- {
- if (*str == '.') /* Followed by part seconds */
- {
- str++;
- field_length= 6; /* 6 digits */
- }
- continue;
- }
- while (str != end &&
- (my_ispunct(&my_charset_latin1,*str) ||
- my_isspace(&my_charset_latin1,*str)))
- {
- if (my_isspace(&my_charset_latin1,*str))
- {
- if (!(allow_space & (1 << i)))
- {
- *was_cut= 1;
- DBUG_RETURN(MYSQL_TIMESTAMP_NONE);
- }
- found_space= 1;
- }
- str++;
- found_delimitier= 1; /* Should be a 'normal' date */
- }
- /* Check if next position is AM/PM */
- if (i == format_position[6]) /* Seconds, time for AM/PM */
- {
- i++; /* Skip AM/PM part */
- if (format_position[7] != 255) /* If using AM/PM */
- {
- if (str+2 <= end && (str[1] == 'M' || str[1] == 'm'))
- {
- if (str[0] == 'p' || str[0] == 'P')
- add_hours= 12;
- else if (str[0] != 'a' && str[0] != 'A')
- continue; /* Not AM/PM */
- str+= 2; /* Skip AM/PM */
- /* Skip space after AM/PM */
- while (str != end && my_isspace(&my_charset_latin1,*str))
- str++;
- }
- }
- }
- last_field_pos= str;
+ year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2;
+ *was_cut= get_digits(&l_time->year, &number_of_fields, &str, end, year_length)
+ || get_digits(&l_time->month, &number_of_fields, &str, end, 2)
+ || get_digits(&l_time->day, &number_of_fields, &str, end, 2)
+ || get_maybe_T(&str, end)
+ || get_digits(&l_time->hour, &number_of_fields, &str, end, 2)
+ || get_digits(&l_time->minute, &number_of_fields, &str, end, 2)
+ || get_digits(&l_time->second, &number_of_fields, &str, end, 2);
}
- if (found_delimitier && !found_space && (flags & TIME_DATETIME_ONLY))
+ else
{
- *was_cut= 1;
- DBUG_RETURN(MYSQL_TIMESTAMP_NONE); /* Can't be a datetime */
+ const char *start= str;
+ *was_cut = get_number(&l_time->year, &number_of_fields, &str, end);
+ year_length= str - start;
+
+ if (!*was_cut)
+ *was_cut= get_punct(&str, end)
+ || get_number(&l_time->month, &number_of_fields, &str, end)
+ || get_punct(&str, end)
+ || get_number(&l_time->day, &number_of_fields, &str, end)
+ || get_date_time_separator(&number_of_fields, flags, &str, end)
+ || get_number(&l_time->hour, &number_of_fields, &str, end)
+ || get_punct(&str, end)
+ || get_number(&l_time->minute, &number_of_fields, &str, end)
+ || get_punct(&str, end)
+ || get_number(&l_time->second, &number_of_fields, &str, end);
}
- str= last_field_pos;
+ if (number_of_fields < 3)
+ *was_cut= 1;
- number_of_fields= i - start_loop;
- while (i < MAX_DATE_PARTS)
- {
- date_len[i]= 0;
- date[i++]= 0;
- }
+ /* we're ok if date part is correct. even if the rest is truncated */
+ if (*was_cut && number_of_fields < 3)
+ DBUG_RETURN(MYSQL_TIMESTAMP_NONE);
- if (!is_internal_format)
+ if (!*was_cut && str < end && *str == '.')
{
- year_length= date_len[(uint) format_position[0]];
- if (!year_length) /* Year must be specified */
- {
+ uint second_part;
+ const char *start= ++str;
+ *was_cut= get_digits(&second_part, &number_of_fields, &str, end, 6);
+ if (str - start < 6)
+ second_part*= log_10_int[6 - (str - start)];
+ l_time->second_part= second_part;
+ if (skip_digits(&str, end))
*was_cut= 1;
- DBUG_RETURN(MYSQL_TIMESTAMP_NONE);
- }
-
- l_time->year= date[(uint) format_position[0]];
- l_time->month= date[(uint) format_position[1]];
- l_time->day= date[(uint) format_position[2]];
- l_time->hour= date[(uint) format_position[3]];
- l_time->minute= date[(uint) format_position[4]];
- l_time->second= date[(uint) format_position[5]];
-
- frac_pos= (uint) format_position[6];
- frac_len= date_len[frac_pos];
- if (frac_len < 6)
- date[frac_pos]*= (uint) log_10_int[6 - frac_len];
- l_time->second_part= date[frac_pos];
-
- if (format_position[7] != (uchar) 255)
- {
- if (l_time->hour > 12)
- {
- *was_cut= 1;
- goto err;
- }
- l_time->hour= l_time->hour%12 + add_hours;
- }
- }
- else
- {
- l_time->year= date[0];
- l_time->month= date[1];
- l_time->day= date[2];
- l_time->hour= date[3];
- l_time->minute= date[4];
- l_time->second= date[5];
- if (date_len[6] < 6)
- date[6]*= (uint) log_10_int[6 - date_len[6]];
- l_time->second_part=date[6];
}
- l_time->neg= 0;
+
+ not_zero_date = l_time->year || l_time->month || l_time->day ||
+ l_time->hour || l_time->minute || l_time->second ||
+ l_time->second_part;
if (year_length == 2 && not_zero_date)
l_time->year+= (l_time->year < YY_PART_YEAR ? 2000 : 1900);
- if (number_of_fields < 3 ||
- l_time->year > 9999 || l_time->month > 12 ||
- l_time->day > 31 || l_time->hour > 23 ||
- l_time->minute > 59 || l_time->second > 59)
+ if (l_time->year > 9999 || l_time->month > 12 || l_time->day > 31 ||
+ l_time->hour > 23 || l_time->minute > 59 || l_time->second > 59)
{
- /* Only give warning for a zero date if there is some garbage after */
- if (!not_zero_date) /* If zero date */
- {
- for (; str != end ; str++)
- {
- if (!my_isspace(&my_charset_latin1, *str))
- {
- not_zero_date= 1; /* Give warning */
- break;
- }
- }
- }
- *was_cut= test(not_zero_date);
+ *was_cut= 1;
goto err;
}
- if (check_date(l_time, not_zero_date != 0, flags, was_cut))
+ if (check_date(l_time, not_zero_date, flags, was_cut))
goto err;
l_time->time_type= (number_of_fields <= 3 ?
@@ -495,16 +407,15 @@ str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
ulong date[5];
ulonglong value;
const char *end=str+length, *end_of_days;
- my_bool found_days,found_hours;
- uint state;
+ my_bool found_days,found_hours, neg= 0;
+ uint UNINIT_VAR(state);
- l_time->neg=0;
*warning= 0;
for (; str != end && my_isspace(&my_charset_latin1,*str) ; str++)
length--;
if (str != end && *str == '-')
{
- l_time->neg=1;
+ neg=1;
str++;
length--;
}
@@ -527,6 +438,7 @@ str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
}
}
+ l_time->neg= neg;
/* Not a timestamp. Try to get this as a DAYS_TO_SECOND string */
for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++)
value=value*10L + (long) (*str - '0');
@@ -536,7 +448,6 @@ str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
for (; str != end && my_isspace(&my_charset_latin1, str[0]) ; str++)
;
- LINT_INIT(state);
found_days=found_hours=0;
if ((uint) (end-str) > 1 && str != end_of_days &&
my_isdigit(&my_charset_latin1, *str))
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 6c53930f23d..0174ff822f3 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -39,6 +39,7 @@ ENDIF()
SET (SQL_SOURCE
../sql-common/client.c derror.cc des_key_file.cc
discover.cc ../libmysql/errmsg.c field.cc field_conv.cc
+ filesort_utils.cc
filesort.cc gstream.cc sha2.cc
signal_handler.cc
handler.cc hash_filo.h sql_plugin_services.h
@@ -86,6 +87,7 @@ SET (SQL_SOURCE
gcalc_slicescan.cc gcalc_tools.cc
threadpool_common.cc
../sql-common/mysql_async.c
+ my_apc.cc my_apc.h
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)
diff --git a/sql/bounded_queue.h b/sql/bounded_queue.h
new file mode 100644
index 00000000000..2d4e6cff96d
--- /dev/null
+++ b/sql/bounded_queue.h
@@ -0,0 +1,195 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef BOUNDED_QUEUE_INCLUDED
+#define BOUNDED_QUEUE_INCLUDED
+
+#include <string.h>
+#include "my_global.h"
+#include "my_base.h"
+#include "my_sys.h"
+#include "queues.h"
+
+class Sort_param;
+
+/**
+ A priority queue with a fixed, limited size.
+
+ This is a wrapper on top of QUEUE and the queue_xxx() functions.
+ It keeps the top-N elements which are inserted.
+
+ Elements of type Element_type are pushed into the queue.
+ For each element, we call a user-supplied keymaker_function,
+ to generate a key of type Key_type for the element.
+ Instances of Key_type are compared with the user-supplied compare_function.
+
+ The underlying QUEUE implementation needs one extra element for replacing
+ the lowest/highest element when pushing into a full queue.
+ */
+template<typename Element_type, typename Key_type>
+class Bounded_queue
+{
+public:
+ Bounded_queue()
+ {
+ memset(&m_queue, 0, sizeof(m_queue));
+ }
+
+ ~Bounded_queue()
+ {
+ delete_queue(&m_queue);
+ }
+
+ /**
+ Function for making sort-key from input data.
+ @param param Sort parameters.
+ @param to Where to put the key.
+ @param from The input data.
+ */
+ typedef void (*keymaker_function)(Sort_param *param,
+ Key_type *to,
+ Element_type *from);
+
+ /**
+ Function for comparing two keys.
+ @param n Pointer to number of bytes to compare.
+ @param a First key.
+ @param b Second key.
+ @retval -1, 0, or 1 depending on whether the left argument is
+ less than, equal to, or greater than the right argument.
+ */
+ typedef int (*compare_function)(size_t *n, Key_type **a, Key_type **b);
+
+ /**
+ Initialize the queue.
+
+ @param max_elements The size of the queue.
+ @param max_at_top Set to true if you want biggest element on top.
+ false: We keep the n largest elements.
+ pop() will return the smallest key in the result set.
+ true: We keep the n smallest elements.
+ pop() will return the largest key in the result set.
+ @param compare Compare function for elements, takes 3 arguments.
+ If NULL, we use get_ptr_compare(compare_length).
+ @param compare_length Length of the data (i.e. the keys) used for sorting.
+ @param keymaker Function which generates keys for elements.
+ @param sort_param Sort parameters.
+ @param sort_keys Array of pointers to keys to sort.
+
+ @retval 0 OK, 1 Could not allocate memory.
+
+ We do *not* take ownership of any of the input pointer arguments.
+ */
+ int init(ha_rows max_elements, bool max_at_top,
+ compare_function compare, size_t compare_length,
+ keymaker_function keymaker, Sort_param *sort_param,
+ Key_type **sort_keys);
+
+ /**
+ Pushes an element on the queue.
+ If the queue is already full, we discard one element.
+ Calls keymaker_function to generate a key for the element.
+
+ @param element The element to be pushed.
+ */
+ void push(Element_type *element);
+
+ /**
+ Removes the top element from the queue.
+
+ @retval Pointer to the (key of the) removed element.
+
+ @note This function is for unit testing, where we push elements into to the
+ queue, and test that the appropriate keys are retained.
+ Interleaving of push() and pop() operations has not been tested.
+ */
+ Key_type **pop()
+ {
+ // Don't return the extra element to the client code.
+ if (queue_is_full((&m_queue)))
+ queue_remove(&m_queue, 0);
+ DBUG_ASSERT(m_queue.elements > 0);
+ if (m_queue.elements == 0)
+ return NULL;
+ return reinterpret_cast<Key_type**>(queue_remove(&m_queue, 0));
+ }
+
+ /**
+ The number of elements in the queue.
+ */
+ uint num_elements() const { return m_queue.elements; }
+
+ /**
+ Is the queue initialized?
+ */
+ bool is_initialized() const { return m_queue.max_elements > 0; }
+
+private:
+ Key_type **m_sort_keys;
+ size_t m_compare_length;
+ keymaker_function m_keymaker;
+ Sort_param *m_sort_param;
+ st_queue m_queue;
+};
+
+
+template<typename Element_type, typename Key_type>
+int Bounded_queue<Element_type, Key_type>::init(ha_rows max_elements,
+ bool max_at_top,
+ compare_function compare,
+ size_t compare_length,
+ keymaker_function keymaker,
+ Sort_param *sort_param,
+ Key_type **sort_keys)
+{
+ DBUG_ASSERT(sort_keys != NULL);
+
+ m_sort_keys= sort_keys;
+ m_compare_length= compare_length;
+ m_keymaker= keymaker;
+ m_sort_param= sort_param;
+ // init_queue() takes an uint, and also does (max_elements + 1)
+ if (max_elements >= (UINT_MAX - 1))
+ return 1;
+ if (compare == NULL)
+ compare=
+ reinterpret_cast<compare_function>(get_ptr_compare(compare_length));
+ // We allocate space for one extra element, for replace when queue is full.
+ return init_queue(&m_queue, (uint) max_elements + 1,
+ 0, max_at_top,
+ reinterpret_cast<queue_compare>(compare),
+ &m_compare_length, 0, 0);
+}
+
+
+template<typename Element_type, typename Key_type>
+void Bounded_queue<Element_type, Key_type>::push(Element_type *element)
+{
+ DBUG_ASSERT(is_initialized());
+ if (queue_is_full((&m_queue)))
+ {
+ // Replace top element with new key, and re-order the queue.
+ Key_type **pq_top= reinterpret_cast<Key_type **>(queue_top(&m_queue));
+ (*m_keymaker)(m_sort_param, *pq_top, element);
+ queue_replace_top(&m_queue);
+ } else {
+ // Insert new key into the queue.
+ (*m_keymaker)(m_sort_param, m_sort_keys[m_queue.elements], element);
+ queue_insert(&m_queue,
+ reinterpret_cast<uchar*>(&m_sort_keys[m_queue.elements]));
+ }
+}
+
+#endif // BOUNDED_QUEUE_INCLUDED
diff --git a/sql/create_options.cc b/sql/create_options.cc
index 9a6f6b5cf7c..e4881388688 100644
--- a/sql/create_options.cc
+++ b/sql/create_options.cc
@@ -137,7 +137,10 @@ static bool set_one_value(ha_create_table_option *opt,
my_option optp=
{ opt->name, 1, 0, (uchar **)val, 0, 0, GET_ULL,
- REQUIRED_ARG, opt->def_value, opt->min_value, opt->max_value,
+ REQUIRED_ARG,
+ (longlong) opt->def_value,
+ (longlong) opt->min_value,
+ opt->max_value,
0, (long) opt->block_size, 0};
ulonglong orig_val= strtoull(value->str, NULL, 10);
diff --git a/sql/derror.cc b/sql/derror.cc
index b0cf80fdd08..665427f45bc 100644
--- a/sql/derror.cc
+++ b/sql/derror.cc
@@ -177,8 +177,8 @@ bool read_texts(const char *file_name, const char *language,
O_RDONLY | O_SHARE | O_BINARY,
MYF(0))) < 0)
goto err;
- sql_print_error("An old style --language value with language specific part detected: %s", lc_messages_dir);
- sql_print_error("Use --lc-messages-dir without language specific part instead.");
+ sql_print_warning("An old style --language or -lc-message-dir value with language specific part detected: %s", lc_messages_dir);
+ sql_print_warning("Use --lc-messages-dir without language specific part instead.");
}
funktpos=1;
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index 7da6d4f83b6..d77c6e3a683 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -1113,17 +1113,15 @@ update_timing_fields_for_event(THD *thd,
TABLE *table= NULL;
Field **fields;
int ret= 1;
- bool save_binlog_row_based;
+ enum_binlog_format save_binlog_format;
MYSQL_TIME time;
-
DBUG_ENTER("Event_db_repository::update_timing_fields_for_event");
/*
Turn off row binlogging of event timing updates. These are not used
for RBR of events replicated to the slave.
*/
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
+ save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
DBUG_ASSERT(thd->security_ctx->master_access & SUPER_ACL);
@@ -1158,10 +1156,7 @@ end:
if (table)
close_mysql_tables(thd);
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
+ thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(test(ret));
}
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index bef422e9734..c340384f068 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -42,7 +42,7 @@
cond_wait(mythd, abstime, stage, SCHED_FUNC, __FILE__, __LINE__)
extern pthread_attr_t connection_attrib;
-
+extern ulong event_executed;
Event_db_repository *Event_worker_thread::db_repository;
@@ -190,7 +190,6 @@ pre_init_event_thread(THD* thd)
my_net_init(&thd->net, NULL);
thd->security_ctx->set_user((char*)"event_scheduler");
thd->net.read_timeout= slave_net_timeout;
- thd->slave_thread= 0;
thd->variables.option_bits|= OPTION_AUTO_IS_NULL;
thd->client_capabilities|= CLIENT_MULTI_RESULTS;
mysql_mutex_lock(&LOCK_thread_count);
@@ -561,7 +560,8 @@ Event_scheduler::execute_top(Event_queue_element_for_exec *event_name)
event_name)))
goto error;
- ++started_events;
+ started_events++;
+ executed_events++; // For SHOW STATUS
DBUG_PRINT("info", ("Event is in THD: 0x%lx", (long) new_thd));
DBUG_RETURN(FALSE);
diff --git a/sql/events.cc b/sql/events.cc
index 54ad76e40d4..cac71697300 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -306,7 +306,8 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
bool if_not_exists)
{
bool ret;
- bool save_binlog_row_based, event_already_exists;
+ bool event_already_exists;
+ enum_binlog_format save_binlog_format;
DBUG_ENTER("Events::create_event");
if (check_if_system_tables_error())
@@ -338,8 +339,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
Turn off row binlogging of this statement and use statement-based
so that all supporting tables are updated for CREATE EVENT command.
*/
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
+ save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
if (lock_object_name(thd, MDL_key::EVENT,
parse_data->dbname.str, parse_data->name.str))
@@ -398,10 +398,8 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
}
}
}
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
+
+ thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
}
@@ -431,7 +429,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
LEX_STRING *new_dbname, LEX_STRING *new_name)
{
int ret;
- bool save_binlog_row_based;
+ enum_binlog_format save_binlog_format;
Event_queue_element *new_element;
DBUG_ENTER("Events::update_event");
@@ -478,8 +476,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
Turn off row binlogging of this statement and use statement-based
so that all supporting tables are updated for UPDATE EVENT command.
*/
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
+ save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
if (lock_object_name(thd, MDL_key::EVENT,
parse_data->dbname.str, parse_data->name.str))
@@ -513,11 +510,8 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
ret= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
}
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
+ thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
}
@@ -550,7 +544,7 @@ bool
Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
{
int ret;
- bool save_binlog_row_based;
+ enum_binlog_format save_binlog_format;
DBUG_ENTER("Events::drop_event");
if (check_if_system_tables_error())
@@ -563,8 +557,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
Turn off row binlogging of this statement and use statement-based so
that all supporting tables are updated for DROP EVENT command.
*/
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
+ save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
if (lock_object_name(thd, MDL_key::EVENT,
dbname.str, name.str))
@@ -578,10 +571,8 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
DBUG_ASSERT(thd->query() && thd->query_length());
ret= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
+
+ thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
}
diff --git a/sql/field.cc b/sql/field.cc
index 13bdec3a881..0ca3f1b6ad6 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5675,7 +5675,7 @@ bool Field_newdate::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
if (!tmp)
return fuzzydate & TIME_NO_ZERO_DATE;
if (!ltime->month || !ltime->day)
- return !(fuzzydate & TIME_FUZZY_DATE);
+ return fuzzydate & TIME_NO_ZERO_IN_DATE;
return 0;
}
@@ -9393,9 +9393,12 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
#ifdef HAVE_SPATIAL
if (f_is_geom(pack_flag))
+ {
+ status_var_increment(current_thd->status_var.feature_gis);
return new Field_geom(ptr,null_pos,null_bit,
unireg_check, field_name, share,
pack_length, geom_type);
+ }
#endif
if (f_is_blob(pack_flag))
return new Field_blob(ptr,null_pos,null_bit,
@@ -9565,6 +9568,17 @@ Create_field::Create_field(Field *old_field,Field *orig_field)
geom_type= ((Field_geom*)old_field)->geom_type;
break;
#endif
+ case MYSQL_TYPE_YEAR:
+ if (length != 4)
+ {
+ char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
+ my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_WARN_DEPRECATED_SYNTAX,
+ ER(ER_WARN_DEPRECATED_SYNTAX),
+ buff, "YEAR(4)");
+ }
+ break;
default:
break;
}
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 7ee4dc52557..103d3600559 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -34,6 +34,9 @@
#include "sql_base.h" // update_virtual_fields
#include "sql_test.h" // TEST_filesort
#include "opt_range.h" // SQL_SELECT
+#include "bounded_queue.h"
+#include "filesort_utils.h"
+#include "sql_select.h"
#include "log_slow.h"
#include "debug_sync.h"
@@ -42,26 +45,72 @@
if (my_b_write((file),(uchar*) (from),param->ref_length)) \
DBUG_RETURN(1);
+#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
+template class Bounded_queue<uchar, uchar>;
+#endif
+
/* functions defined in this file */
static uchar *read_buffpek_from_file(IO_CACHE *buffer_file, uint count,
uchar *buf);
-static ha_rows find_all_keys(SORTPARAM *param,SQL_SELECT *select,
- uchar * *sort_keys, uchar *sort_keys_buf,
- IO_CACHE *buffer_file, IO_CACHE *tempfile);
-static int write_keys(SORTPARAM *param,uchar * *sort_keys,
- uint count, IO_CACHE *buffer_file, IO_CACHE *tempfile);
-static void make_sortkey(SORTPARAM *param,uchar *to, uchar *ref_pos);
-static void register_used_fields(SORTPARAM *param);
-static bool save_index(SORTPARAM *param,uchar **sort_keys, uint count,
- FILESORT_INFO *table_sort);
+static ha_rows find_all_keys(Sort_param *param,SQL_SELECT *select,
+ Filesort_info *fs_info,
+ IO_CACHE *buffer_file,
+ IO_CACHE *tempfile,
+ Bounded_queue<uchar, uchar> *pq,
+ ha_rows *found_rows);
+static int write_keys(Sort_param *param, Filesort_info *fs_info,
+ uint count, IO_CACHE *buffer_file, IO_CACHE *tempfile);
+static void make_sortkey(Sort_param *param, uchar *to, uchar *ref_pos);
+static void register_used_fields(Sort_param *param);
+static bool save_index(Sort_param *param, uint count,
+ Filesort_info *table_sort);
+static void make_sortkey(Sort_param *param, uchar *to, uchar *ref_pos);
static uint suffix_length(ulong string_length);
static uint sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
bool *multi_byte_charset);
-static SORT_ADDON_FIELD *get_addon_fields(THD *thd, Field **ptabfield,
+static SORT_ADDON_FIELD *get_addon_fields(ulong max_length_for_sort_data,
+ Field **ptabfield,
uint sortlength, uint *plength);
static void unpack_addon_fields(struct st_sort_addon_field *addon_field,
uchar *buff, uchar *buff_end);
+static bool check_if_pq_applicable(Sort_param *param, Filesort_info *info,
+ TABLE *table,
+ ha_rows records, ulong memory_available);
+
+
+void Sort_param::init_for_filesort(uint sortlen, TABLE *table,
+ ulong max_length_for_sort_data,
+ ha_rows maxrows, bool sort_positions)
+{
+ sort_length= sortlen;
+ ref_length= table->file->ref_length;
+ if (!(table->file->ha_table_flags() & HA_FAST_KEY_READ) &&
+ !table->fulltext_searched && !sort_positions)
+ {
+ /*
+ Get the descriptors of all fields whose values are appended
+ to sorted fields and get its total length in addon_length.
+ */
+ addon_field= get_addon_fields(max_length_for_sort_data,
+ table->field, sort_length, &addon_length);
+ }
+ if (addon_field)
+ res_length= addon_length;
+ else
+ {
+ res_length= ref_length;
+ /*
+ The reference to the record is considered
+ as an additional sorted field
+ */
+ sort_length+= ref_length;
+ }
+ rec_length= sort_length + addon_length;
+ max_rows= maxrows;
+}
+
+
/**
Sort a table.
Creates a set of pointers that can be used to read the rows
@@ -74,15 +123,17 @@ static void unpack_addon_fields(struct st_sort_addon_field *addon_field,
The result set is stored in table->io_cache or
table->record_pointers.
- @param thd Current thread
- @param table Table to sort
- @param sortorder How to sort the table
- @param s_length Number of elements in sortorder
- @param select condition to apply to the rows
- @param max_rows Return only this many rows
- @param sort_positions Set to 1 if we want to force sorting by position
- (Needed by UPDATE/INSERT or ALTER TABLE)
- @param examined_rows Store number of examined rows here
+ @param thd Current thread
+ @param table Table to sort
+ @param sortorder How to sort the table
+ @param s_length Number of elements in sortorder
+ @param select Condition to apply to the rows
+ @param max_rows Return only this many rows
+ @param sort_positions Set to TRUE if we want to force sorting by position
+ (Needed by UPDATE/INSERT or ALTER TABLE or
+ when rowids are required by executor)
+ @param[out] examined_rows Store number of examined rows here
+ @param[out] found_rows Store the number of found rows here
@note
If we sort by position (like if sort_positions is 1) filesort() will
@@ -92,30 +143,30 @@ static void unpack_addon_fields(struct st_sort_addon_field *addon_field,
HA_POS_ERROR Error
@retval
\# Number of rows
- @retval
- examined_rows will be set to number of examined rows
*/
ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
SQL_SELECT *select, ha_rows max_rows,
- bool sort_positions, ha_rows *examined_rows)
+ bool sort_positions,
+ ha_rows *examined_rows,
+ ha_rows *found_rows)
{
int error;
ulong memory_available= thd->variables.sortbuff_size;
- ulong min_sort_memory;
uint maxbuffer;
BUFFPEK *buffpek;
ha_rows num_rows= HA_POS_ERROR;
- uchar **sort_keys= 0;
IO_CACHE tempfile, buffpek_pointers, *outfile;
- SORTPARAM param;
+ Sort_param param;
bool multi_byte_charset;
+ Bounded_queue<uchar, uchar> pq;
+
DBUG_ENTER("filesort");
DBUG_EXECUTE("info",TEST_filesort(sortorder,s_length););
#ifdef SKIP_DBUG_IN_FILESORT
DBUG_PUSH(""); /* No DBUG here */
#endif
- FILESORT_INFO table_sort;
+ Filesort_info table_sort= table->sort;
TABLE_LIST *tab= table->pos_in_table_list;
Item_subselect *subselect= tab ? tab->containing_subselect() : 0;
@@ -133,7 +184,6 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
QUICK_INDEX_MERGE_SELECT. Work with a copy and put it back at the end
when index_merge select has finished with it.
*/
- memcpy(&table_sort, &table->sort, sizeof(FILESORT_INFO));
table->sort.io_cache= NULL;
outfile= table_sort.io_cache;
@@ -141,43 +191,21 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
my_b_clear(&buffpek_pointers);
buffpek=0;
error= 1;
- bzero((char*) &param,sizeof(param));
- param.sort_length= sortlength(thd, sortorder, s_length, &multi_byte_charset);
- param.ref_length= table->file->ref_length;
- if (!(table->file->ha_table_flags() & HA_FAST_KEY_READ) &&
- !table->fulltext_searched && !sort_positions)
- {
- /*
- Get the descriptors of all fields whose values are appended
- to sorted fields and get its total length in param.spack_length.
- */
- param.addon_field= get_addon_fields(thd, table->field,
- param.sort_length,
- &param.addon_length);
- }
+
+ param.init_for_filesort(sortlength(thd, sortorder, s_length,
+ &multi_byte_charset),
+ table,
+ thd->variables.max_length_for_sort_data,
+ max_rows, sort_positions);
table_sort.addon_buf= 0;
table_sort.addon_length= param.addon_length;
table_sort.addon_field= param.addon_field;
table_sort.unpack= unpack_addon_fields;
- if (param.addon_field)
- {
- param.res_length= param.addon_length;
- if (!(table_sort.addon_buf= (uchar *) my_malloc(param.addon_length,
- MYF(MY_WME))))
- goto err;
- }
- else
- {
- param.res_length= param.ref_length;
- /*
- The reference to the record is considered
- as an additional sorted field
- */
- param.sort_length+= param.ref_length;
- }
- param.rec_length= param.sort_length+param.addon_length;
- param.max_rows= max_rows;
+ if (param.addon_field &&
+ !(table_sort.addon_buf=
+ (uchar *) my_malloc(param.addon_length, MYF(MY_WME))))
+ goto err;
if (select && select->quick)
thd->inc_status_sort_range();
@@ -192,20 +220,54 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
!(param.tmp_buffer= (char*) my_malloc(param.sort_length,MYF(MY_WME))))
goto err;
- min_sort_memory= max(MIN_SORT_MEMORY, param.sort_length * MERGEBUFF2);
- if (!table_sort.sort_keys)
+ if (check_if_pq_applicable(&param, &table_sort,
+ table, num_rows, memory_available))
+ {
+ DBUG_PRINT("info", ("filesort PQ is applicable"));
+ const size_t compare_length= param.sort_length;
+ if (pq.init(param.max_rows,
+ true, // max_at_top
+ NULL, // compare_function
+ compare_length,
+ &make_sortkey, &param, table_sort.get_sort_keys()))
+ {
+ /*
+ If we fail to init pq, we have to give up:
+ out of memory means my_malloc() will call my_error().
+ */
+ DBUG_PRINT("info", ("failed to allocate PQ"));
+ table_sort.free_sort_buffer();
+ DBUG_ASSERT(thd->is_error());
+ goto err;
+ }
+ // For PQ queries (with limit) we initialize all pointers.
+ table_sort.init_record_pointers();
+ }
+ else
{
+ DBUG_PRINT("info", ("filesort PQ is not applicable"));
+
+ ulong min_sort_memory= max(MIN_SORT_MEMORY, param.sort_length*MERGEBUFF2);
+ set_if_bigger(min_sort_memory, sizeof(BUFFPEK*)*MERGEBUFF2);
while (memory_available >= min_sort_memory)
{
ulong keys= memory_available / (param.rec_length + sizeof(char*));
- table_sort.keys= (uint) min(num_rows, keys);
-
- DBUG_EXECUTE_IF("make_sort_keys_alloc_fail",
- DBUG_SET("+d,simulate_out_of_memory"););
-
- if ((table_sort.sort_keys=
- (uchar**) my_malloc(table_sort.keys*(param.rec_length+sizeof(char*)),
- MYF(0))))
+ param.max_keys_per_buffer= (uint) min(num_rows, keys);
+ if (table_sort.get_sort_keys())
+ {
+ // If we have already allocated a buffer, it better have same size!
+ if (!table_sort.check_sort_buffer_properties(param.max_keys_per_buffer,
+ param.rec_length))
+ {
+ /*
+ table->sort will still have a pointer to the same buffer,
+ but that will be overwritten by the assignment below.
+ */
+ table_sort.free_sort_buffer();
+ }
+ }
+ table_sort.alloc_sort_buffer(param.max_keys_per_buffer, param.rec_length);
+ if (table_sort.get_sort_keys())
break;
ulong old_memory_available= memory_available;
memory_available= memory_available/4*3;
@@ -213,40 +275,37 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
old_memory_available > min_sort_memory)
memory_available= min_sort_memory;
}
+ if (memory_available < min_sort_memory)
+ {
+ my_error(ER_OUT_OF_SORTMEMORY,MYF(ME_ERROR + ME_FATALERROR));
+ goto err;
+ }
}
- sort_keys= table_sort.sort_keys;
- param.keys= table_sort.keys;
- if (memory_available < min_sort_memory)
- {
- my_error(ER_OUT_OF_SORTMEMORY,MYF(ME_ERROR + ME_FATALERROR));
- goto err;
- }
if (open_cached_file(&buffpek_pointers,mysql_tmpdir,TEMP_PREFIX,
- DISK_BUFFER_SIZE, MYF(ME_ERROR | MY_WME)))
+ DISK_BUFFER_SIZE, MYF(MY_WME)))
goto err;
param.sort_form= table;
param.end=(param.local_sortorder=sortorder)+s_length;
- num_rows= find_all_keys(&param,
- select,
- sort_keys,
- (uchar *)(sort_keys+param.keys),
+ num_rows= find_all_keys(&param, select,
+ &table_sort,
&buffpek_pointers,
- &tempfile);
+ &tempfile,
+ pq.is_initialized() ? &pq : NULL,
+ found_rows);
if (num_rows == HA_POS_ERROR)
goto err;
+
maxbuffer= (uint) (my_b_tell(&buffpek_pointers)/sizeof(*buffpek));
if (maxbuffer == 0) // The whole set is in memory
{
- if (save_index(&param,sort_keys,(uint) num_rows, &table_sort))
+ if (save_index(&param, (uint) num_rows, &table_sort))
goto err;
}
else
{
- thd->query_plan_flags|= QPLAN_FILESORT_DISK;
-
/* filesort cannot handle zero-length records during merge. */
DBUG_ASSERT(param.sort_length != 0);
@@ -265,7 +324,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
/* Open cached file if it isn't open */
if (! my_b_inited(outfile) &&
open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER,
- MYF(ME_ERROR | MY_WME)))
+ MYF(MY_WME)))
goto err;
if (reinit_io_cache(outfile,WRITE_CACHE,0L,0,0))
goto err;
@@ -274,18 +333,20 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
Use also the space previously used by string pointers in sort_buffer
for temporary key storage.
*/
- param.keys=((param.keys *
- (param.rec_length+sizeof(char*))) /
- param.rec_length - 1);
+ param.max_keys_per_buffer=((param.max_keys_per_buffer *
+ (param.rec_length + sizeof(char*))) /
+ param.rec_length - 1);
maxbuffer--; // Offset from 0
- if (merge_many_buff(&param,(uchar*) sort_keys,buffpek,&maxbuffer,
+ if (merge_many_buff(&param,
+ (uchar*) table_sort.get_sort_keys(),
+ buffpek,&maxbuffer,
&tempfile))
goto err;
if (flush_io_cache(&tempfile) ||
reinit_io_cache(&tempfile,READ_CACHE,0L,0,0))
goto err;
if (merge_index(&param,
- (uchar*) sort_keys,
+ (uchar*) table_sort.get_sort_keys(),
buffpek,
maxbuffer,
&tempfile,
@@ -300,12 +361,11 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
}
error= 0;
- err:
+ err:
my_free(param.tmp_buffer);
if (!subselect || !subselect->is_uncacheable())
{
- my_free(sort_keys);
- table_sort.sort_keys= 0;
+ table_sort.free_sort_buffer();
my_free(buffpek);
table_sort.buffpek= 0;
table_sort.buffpek_len= 0;
@@ -336,7 +396,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
thd->killed == ABORT_QUERY ? "" : thd->stmt_da->message());
if (global_system_variables.log_warnings > 1)
- {
+ {
sql_print_warning("%s, host: %s, user: %s, thread: %lu, query: %-.4096s",
ER_THD(thd, ER_FILSORT_ABORT),
thd->security_ctx->host_or_ip,
@@ -351,8 +411,13 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
#ifdef SKIP_DBUG_IN_FILESORT
DBUG_POP(); /* Ok to DBUG */
#endif
- memcpy(&table->sort, &table_sort, sizeof(FILESORT_INFO));
- DBUG_PRINT("exit",("num_rows: %ld", (long) num_rows));
+
+ // Assign the copy back!
+ table->sort= table_sort;
+
+ DBUG_PRINT("exit",
+ ("num_rows: %ld examined_rows: %ld found_rows: %ld",
+ (long) num_rows, (long) *examined_rows, (long) *found_rows));
MYSQL_FILESORT_DONE(error, num_rows);
DBUG_RETURN(error ? HA_POS_ERROR : num_rows);
} /* filesort */
@@ -360,13 +425,13 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
void filesort_free_buffers(TABLE *table, bool full)
{
+ DBUG_ENTER("filesort_free_buffers");
my_free(table->sort.record_pointers);
table->sort.record_pointers= NULL;
if (full)
{
- my_free(table->sort.sort_keys);
- table->sort.sort_keys= NULL;
+ table->sort.free_sort_buffer();
my_free(table->sort.buffpek);
table->sort.buffpek= NULL;
table->sort.buffpek_len= 0;
@@ -376,6 +441,7 @@ void filesort_free_buffers(TABLE *table, bool full)
my_free(table->sort.addon_field);
table->sort.addon_buf= NULL;
table->sort.addon_field= NULL;
+ DBUG_VOID_RETURN;
}
@@ -454,8 +520,10 @@ static void dbug_print_record(TABLE *table, bool print_rowid)
}
#endif
+
/**
- Search after sort_keys and write them into tempfile.
+ Search after sort_keys, and write them into tempfile
+ (if we run out of space in the sort_keys buffer).
All produced sequences are guaranteed to be non-empty.
@param param Sorting parameter
@@ -464,19 +532,28 @@ static void dbug_print_record(TABLE *table, bool print_rowid)
@param buffpek_pointers File to write BUFFPEKs describing sorted segments
in tempfile.
@param tempfile File to write sorted sequences of sortkeys to.
+ @param pq If !NULL, use it for keeping top N elements
+ @param [out] found_rows The number of FOUND_ROWS().
+ For a query with LIMIT, this value will typically
+ be larger than the function return value.
@note
Basic idea:
@verbatim
while (get_next_sortkey())
{
- if (no free space in sort_keys buffers)
+ if (using priority queue)
+ push sort key into queue
+ else
{
- sort sort_keys buffer;
- dump sorted sequence to 'tempfile';
- dump BUFFPEK describing sequence location into 'buffpek_pointers';
+ if (no free space in sort_keys buffers)
+ {
+ sort sort_keys buffer;
+ dump sorted sequence to 'tempfile';
+ dump BUFFPEK describing sequence location into 'buffpek_pointers';
+ }
+ put sort key into 'sort_keys';
}
- put sort key into 'sort_keys';
}
if (sort_keys has some elements && dumped at least once)
sort-dump-dump as above;
@@ -490,10 +567,12 @@ static void dbug_print_record(TABLE *table, bool print_rowid)
HA_POS_ERROR on error.
*/
-static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
- uchar **sort_keys, uchar *sort_keys_buf,
+static ha_rows find_all_keys(Sort_param *param, SQL_SELECT *select,
+ Filesort_info *fs_info,
IO_CACHE *buffpek_pointers,
- IO_CACHE *tempfile)
+ IO_CACHE *tempfile,
+ Bounded_queue<uchar, uchar> *pq,
+ ha_rows *found_rows)
{
int error,flag,quick_select;
uint idx,indexpos,ref_length;
@@ -501,10 +580,9 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
my_off_t record;
TABLE *sort_form;
THD *thd= current_thd;
- volatile killed_state *killed= &thd->killed;
handler *file;
MY_BITMAP *save_read_set, *save_write_set, *save_vcol_set;
- uchar *next_sort_key= sort_keys_buf;
+
DBUG_ENTER("find_all_keys");
DBUG_PRINT("info",("using: %s",
(select ? select->quick ? "ranges" : "where":
@@ -518,10 +596,16 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
ref_pos= ref_buff;
quick_select=select && select->quick;
record=0;
+ *found_rows= 0;
flag= ((file->ha_table_flags() & HA_REC_NOT_IN_SEQ) || quick_select);
if (flag)
ref_pos= &file->ref[0];
next_pos=ref_pos;
+
+ DBUG_EXECUTE_IF("show_explain_in_find_all_keys",
+ dbug_serve_apcs(thd, 1);
+ );
+
if (!quick_select)
{
next_pos=(uchar*) 0; /* Find records in sequence */
@@ -531,7 +615,6 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
current_thd->variables.read_buff_size);
}
-
/* Remember original bitmaps */
save_read_set= sort_form->read_set;
save_write_set= sort_form->write_set;
@@ -585,7 +668,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
break;
}
- if (*killed)
+ if (thd->check_killed())
{
DBUG_PRINT("info",("Sort killed by user"));
if (!quick_select)
@@ -630,18 +713,23 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
if (write_record)
{
- if (idx == param->keys)
+ ++(*found_rows);
+ if (pq)
{
- if (write_keys(param, sort_keys,
- idx, buffpek_pointers, tempfile))
- DBUG_RETURN(HA_POS_ERROR);
- idx= 0;
- next_sort_key= sort_keys_buf;
- indexpos++;
+ pq->push(ref_pos);
+ idx= pq->num_elements();
+ }
+ else
+ {
+ if (idx == param->max_keys_per_buffer)
+ {
+ if (write_keys(param, fs_info, idx, buffpek_pointers, tempfile))
+ DBUG_RETURN(HA_POS_ERROR);
+ idx= 0;
+ indexpos++;
+ }
+ make_sortkey(param, fs_info->get_record_buffer(idx++), ref_pos);
}
- sort_keys[idx++]= next_sort_key;
- make_sortkey(param, next_sort_key, ref_pos);
- next_sort_key+= param->rec_length;
}
else
file->unlock_row();
@@ -670,12 +758,12 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
}
if (indexpos && idx &&
- write_keys(param, sort_keys,
- idx, buffpek_pointers, tempfile))
+ write_keys(param, fs_info, idx, buffpek_pointers, tempfile))
DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
const ha_rows retval=
my_b_inited(tempfile) ?
(ha_rows) (my_b_tell(tempfile)/param->rec_length) : idx;
+ DBUG_PRINT("info", ("find_all_keys return %u", (uint) retval));
DBUG_RETURN(retval);
} /* find_all_keys */
@@ -703,21 +791,19 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
*/
static int
-write_keys(SORTPARAM *param, register uchar **sort_keys, uint count,
+write_keys(Sort_param *param, Filesort_info *fs_info, uint count,
IO_CACHE *buffpek_pointers, IO_CACHE *tempfile)
{
- size_t sort_length, rec_length;
+ size_t rec_length;
uchar **end;
BUFFPEK buffpek;
DBUG_ENTER("write_keys");
- sort_length= param->sort_length;
rec_length= param->rec_length;
-#ifdef MC68000
- quicksort(sort_keys,count,sort_length);
-#else
- my_string_ptr_sort((uchar*) sort_keys, (uint) count, sort_length);
-#endif
+ uchar **sort_keys= fs_info->get_sort_keys();
+
+ fs_info->sort_buffer(param, count);
+
if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, mysql_tmpdir, TEMP_PREFIX, DISK_BUFFER_SIZE,
MYF(MY_WME)))
@@ -766,8 +852,8 @@ static inline void store_length(uchar *to, uint length, uint pack_length)
/** Make a sort-key from record. */
-static void make_sortkey(register SORTPARAM *param,
- register uchar *to, uchar *ref_pos)
+static void make_sortkey(register Sort_param *param,
+ register uchar *to, uchar *ref_pos)
{
reg3 Field *field;
reg1 SORT_FIELD *sort_field;
@@ -785,9 +871,9 @@ static void make_sortkey(register SORTPARAM *param,
if (field->is_null())
{
if (sort_field->reverse)
- bfill(to,sort_field->length+1,(char) 255);
+ memset(to, 255, sort_field->length+1);
else
- bzero((char*) to,sort_field->length+1);
+ memset(to, 0, sort_field->length+1);
to+= sort_field->length+1;
continue;
}
@@ -803,7 +889,7 @@ static void make_sortkey(register SORTPARAM *param,
switch (sort_field->result_type) {
case STRING_RESULT:
{
- CHARSET_INFO *cs=item->collation.collation;
+ const CHARSET_INFO *cs=item->collation.collation;
char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
int diff;
uint sort_field_length;
@@ -816,7 +902,7 @@ static void make_sortkey(register SORTPARAM *param,
if (!res)
{
if (maybe_null)
- bzero((char*) to-1,sort_field->length+1);
+ memset(to-1, 0, sort_field->length+1);
else
{
/* purecov: begin deadcode */
@@ -828,7 +914,7 @@ static void make_sortkey(register SORTPARAM *param,
DBUG_ASSERT(0);
DBUG_PRINT("warning",
("Got null on something that shouldn't be null"));
- bzero((char*) to,sort_field->length); // Avoid crash
+ memset(to, 0, sort_field->length); // Avoid crash
/* purecov: end */
}
break;
@@ -884,12 +970,19 @@ static void make_sortkey(register SORTPARAM *param,
}
if (maybe_null)
{
+ *to++=1; /* purecov: inspected */
if (item->null_value)
{
- bzero((char*) to++, sort_field->length+1);
+ if (maybe_null)
+ memset(to-1, 0, sort_field->length+1);
+ else
+ {
+ DBUG_PRINT("warning",
+ ("Got null on something that shouldn't be null"));
+ memset(to, 0, sort_field->length);
+ }
break;
}
- *to++=1; /* purecov: inspected */
}
to[7]= (uchar) value;
to[6]= (uchar) (value >> 8);
@@ -911,7 +1004,8 @@ static void make_sortkey(register SORTPARAM *param,
{
if (item->null_value)
{
- bzero((char*) to++, sort_field->length+1);
+ memset(to, 0, sort_field->length+1);
+ to++;
break;
}
*to++=1;
@@ -928,7 +1022,7 @@ static void make_sortkey(register SORTPARAM *param,
{
if (item->null_value)
{
- bzero((char*) to,sort_field->length+1);
+ memset(to, 0, sort_field->length+1);
to++;
break;
}
@@ -970,7 +1064,7 @@ static void make_sortkey(register SORTPARAM *param,
SORT_ADDON_FIELD *addonf= param->addon_field;
uchar *nulls= to;
DBUG_ASSERT(addonf != 0);
- bzero((char *) nulls, addonf->offset);
+ memset(nulls, 0, addonf->offset);
to+= addonf->offset;
for ( ; (field= addonf->field) ; addonf++)
{
@@ -1009,7 +1103,7 @@ static void make_sortkey(register SORTPARAM *param,
Register fields used by sorting in the sorted table's read set
*/
-static void register_used_fields(SORTPARAM *param)
+static void register_used_fields(Sort_param *param)
{
reg1 SORT_FIELD *sort_field;
TABLE *table=param->sort_form;
@@ -1054,21 +1148,19 @@ static void register_used_fields(SORTPARAM *param)
}
-static bool save_index(SORTPARAM *param, uchar **sort_keys, uint count,
- FILESORT_INFO *table_sort)
+static bool save_index(Sort_param *param, uint count, Filesort_info *table_sort)
{
uint offset,res_length;
uchar *to;
DBUG_ENTER("save_index");
- my_string_ptr_sort((uchar*) sort_keys, (uint) count, param->sort_length);
+ table_sort->sort_buffer(param, count);
res_length= param->res_length;
offset= param->rec_length-res_length;
- if ((ha_rows) count > param->max_rows)
- count=(uint) param->max_rows;
if (!(to= table_sort->record_pointers=
(uchar*) my_malloc(res_length*count, MYF(MY_WME))))
DBUG_RETURN(1); /* purecov: inspected */
+ uchar **sort_keys= table_sort->get_sort_keys();
for (uchar **end= sort_keys+count ; sort_keys != end ; sort_keys++)
{
memcpy(to, *sort_keys+offset, res_length);
@@ -1078,10 +1170,150 @@ static bool save_index(SORTPARAM *param, uchar **sort_keys, uint count,
}
+/**
+ Test whether priority queue is worth using to get top elements of an
+ ordered result set. If it is, then allocates buffer for required amount of
+ records
+
+ @param param Sort parameters.
+ @param filesort_info Filesort information.
+ @param table Table to sort.
+ @param num_rows Estimate of number of rows in source record set.
+ @param memory_available Memory available for sorting.
+
+ DESCRIPTION
+ Given a query like this:
+ SELECT ... FROM t ORDER BY a1,...,an LIMIT max_rows;
+ This function tests whether a priority queue should be used to keep
+ the result. Necessary conditions are:
+ - estimate that it is actually cheaper than merge-sort
+ - enough memory to store the <max_rows> records.
+
+ If we don't have space for <max_rows> records, but we *do* have
+ space for <max_rows> keys, we may rewrite 'table' to sort with
+ references to records instead of additional data.
+ (again, based on estimates that it will actually be cheaper).
+
+ @retval
+ true - if it's ok to use PQ
+ false - PQ will be slower than merge-sort, or there is not enough memory.
+*/
+
+bool check_if_pq_applicable(Sort_param *param,
+ Filesort_info *filesort_info,
+ TABLE *table, ha_rows num_rows,
+ ulong memory_available)
+{
+ DBUG_ENTER("check_if_pq_applicable");
+
+ /*
+ How much Priority Queue sort is slower than qsort.
+ Measurements (see unit test) indicate that PQ is roughly 3 times slower.
+ */
+ const double PQ_slowness= 3.0;
+
+ if (param->max_rows == HA_POS_ERROR)
+ {
+ DBUG_PRINT("info", ("No LIMIT"));
+ DBUG_RETURN(NULL);
+ }
+
+ if (param->max_rows + 2 >= UINT_MAX)
+ {
+ DBUG_PRINT("info", ("Too large LIMIT"));
+ DBUG_RETURN(NULL);
+ }
+
+ ulong num_available_keys=
+ memory_available / (param->rec_length + sizeof(char*));
+ // We need 1 extra record in the buffer, when using PQ.
+ param->max_keys_per_buffer= (uint) param->max_rows + 1;
+
+ if (num_rows < num_available_keys)
+ {
+ // The whole source set fits into memory.
+ if (param->max_rows < num_rows/PQ_slowness )
+ {
+ filesort_info->alloc_sort_buffer(param->max_keys_per_buffer,
+ param->rec_length);
+ DBUG_RETURN(filesort_info->get_sort_keys() != NULL);
+ }
+ else
+ {
+ // PQ will be slower.
+ DBUG_RETURN(false);
+ }
+ }
+
+ // Do we have space for LIMIT rows in memory?
+ if (param->max_keys_per_buffer < num_available_keys)
+ {
+ filesort_info->alloc_sort_buffer(param->max_keys_per_buffer,
+ param->rec_length);
+ DBUG_RETURN(filesort_info->get_sort_keys() != NULL);
+ }
+
+ // Try to strip off addon fields.
+ if (param->addon_field)
+ {
+ const ulong row_length=
+ param->sort_length + param->ref_length + sizeof(char*);
+ num_available_keys= memory_available / row_length;
+
+ // Can we fit all the keys in memory?
+ if (param->max_keys_per_buffer < num_available_keys)
+ {
+ const double sort_merge_cost=
+ get_merge_many_buffs_cost_fast(num_rows,
+ num_available_keys,
+ row_length);
+ /*
+ PQ has cost:
+ (insert + qsort) * log(queue size) / TIME_FOR_COMPARE_ROWID +
+ cost of file lookup afterwards.
+ The lookup cost is a bit pessimistic: we take scan_time and assume
+ that on average we find the row after scanning half of the file.
+ A better estimate would be lookup cost, but note that we are doing
+ random lookups here, rather than sequential scan.
+ */
+ const double pq_cpu_cost=
+ (PQ_slowness * num_rows + param->max_keys_per_buffer) *
+ log((double) param->max_keys_per_buffer) / TIME_FOR_COMPARE_ROWID;
+ const double pq_io_cost=
+ param->max_rows * table->file->scan_time() / 2.0;
+ const double pq_cost= pq_cpu_cost + pq_io_cost;
+
+ if (sort_merge_cost < pq_cost)
+ DBUG_RETURN(false);
+
+ filesort_info->alloc_sort_buffer(param->max_keys_per_buffer,
+ param->sort_length + param->ref_length);
+ if (filesort_info->get_sort_keys())
+ {
+ // Make attached data to be references instead of fields.
+ my_free(filesort_info->addon_buf);
+ my_free(filesort_info->addon_field);
+ filesort_info->addon_buf= NULL;
+ filesort_info->addon_field= NULL;
+ param->addon_field= NULL;
+ param->addon_length= 0;
+
+ param->res_length= param->ref_length;
+ param->sort_length+= param->ref_length;
+ param->rec_length= param->sort_length;
+
+ DBUG_RETURN(true);
+ }
+ }
+ }
+ DBUG_RETURN(false);
+}
+
+
/** Merge buffers to make < MERGEBUFF2 buffers. */
-int merge_many_buff(SORTPARAM *param, uchar *sort_buffer,
- BUFFPEK *buffpek, uint *maxbuffer, IO_CACHE *t_file)
+int merge_many_buff(Sort_param *param, uchar *sort_buffer,
+ BUFFPEK *buffpek, uint *maxbuffer, IO_CACHE *t_file)
{
register uint i;
IO_CACHE t_file2,*from_file,*to_file,*temp;
@@ -1212,12 +1444,11 @@ void reuse_freed_buff(QUEUE *queue, BUFFPEK *reuse, uint key_length)
other error
*/
-int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
+int merge_buffers(Sort_param *param, IO_CACHE *from_file,
IO_CACHE *to_file, uchar *sort_buffer,
BUFFPEK *lastbuff, BUFFPEK *Fb, BUFFPEK *Tb,
int flag)
{
- THD *thd= current_thd;
int error;
uint rec_length,res_length,offset;
size_t sort_length;
@@ -1231,18 +1462,13 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
void *first_cmp_arg;
element_count dupl_count= 0;
uchar *src;
- killed_state not_killable;
uchar *unique_buff= param->unique_buff;
- volatile killed_state *killed= &thd->killed;
+ const bool killable= !param->not_killable;
+ THD* const thd=current_thd;
DBUG_ENTER("merge_buffers");
thd->inc_status_sort_merge_passes();
thd->query_plan_fsort_passes++;
- if (param->not_killable)
- {
- killed= &not_killable;
- not_killable= NOT_KILLED;
- }
error=0;
rec_length= param->rec_length;
@@ -1255,13 +1481,12 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
(flag && min_dupl_count ? sizeof(dupl_count) : 0)-res_length);
uint wr_len= flag ? res_length : rec_length;
uint wr_offset= flag ? offset : 0;
- maxcount= (ulong) (param->keys/((uint) (Tb-Fb) +1));
+ maxcount= (ulong) (param->max_keys_per_buffer/((uint) (Tb-Fb) +1));
to_start_filepos= my_b_tell(to_file);
strpos= sort_buffer;
org_max_rows=max_rows= param->max_rows;
-
- /* The following will fire if there is not enough space in sort_buffer */
- DBUG_ASSERT(maxcount!=0);
+
+ set_if_bigger(maxcount, 1);
if (unique_buff)
{
@@ -1320,7 +1545,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
while (queue.elements > 1)
{
- if (*killed)
+ if (killable && thd->check_killed())
{
error= 1; goto err; /* purecov: inspected */
}
@@ -1396,7 +1621,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
}
buffpek= (BUFFPEK*) queue_top(&queue);
buffpek->base= (uchar*) sort_buffer;
- buffpek->max_keys= param->keys;
+ buffpek->max_keys= param->max_keys_per_buffer;
/*
As we know all entries in the buffer are unique, we only have to
@@ -1486,9 +1711,9 @@ err:
/* Do a merge to output-file (save only positions) */
-int merge_index(SORTPARAM *param, uchar *sort_buffer,
- BUFFPEK *buffpek, uint maxbuffer,
- IO_CACHE *tempfile, IO_CACHE *outfile)
+int merge_index(Sort_param *param, uchar *sort_buffer,
+ BUFFPEK *buffpek, uint maxbuffer,
+ IO_CACHE *tempfile, IO_CACHE *outfile)
{
DBUG_ENTER("merge_index");
if (merge_buffers(param,tempfile,outfile,sort_buffer,buffpek,buffpek,
@@ -1534,7 +1759,7 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
bool *multi_byte_charset)
{
reg2 uint length;
- CHARSET_INFO *cs;
+ const CHARSET_INFO *cs;
*multi_byte_charset= 0;
length=0;
@@ -1635,7 +1860,8 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
*/
static SORT_ADDON_FIELD *
-get_addon_fields(THD *thd, Field **ptabfield, uint sortlength, uint *plength)
+get_addon_fields(ulong max_length_for_sort_data,
+ Field **ptabfield, uint sortlength, uint *plength)
{
Field **pfield;
Field *field;
@@ -1672,7 +1898,7 @@ get_addon_fields(THD *thd, Field **ptabfield, uint sortlength, uint *plength)
return 0;
length+= (null_fields+7)/8;
- if (length+sortlength > thd->variables.max_length_for_sort_data ||
+ if (length+sortlength > max_length_for_sort_data ||
!(addonf= (SORT_ADDON_FIELD *) my_malloc(sizeof(SORT_ADDON_FIELD)*
(fields+1), MYF(MY_WME))))
return 0;
@@ -1755,7 +1981,7 @@ void change_double_for_sort(double nr,uchar *to)
if (nr == 0.0)
{ /* Change to zero string */
tmp[0]=(uchar) 128;
- bzero((char*) tmp+1,sizeof(nr)-1);
+ memset(tmp+1, 0, sizeof(nr)-1);
}
else
{
diff --git a/sql/filesort.h b/sql/filesort.h
index 8ee8999d055..8960fa6cb66 100644
--- a/sql/filesort.h
+++ b/sql/filesort.h
@@ -29,10 +29,8 @@ typedef struct st_sort_field SORT_FIELD;
ha_rows filesort(THD *thd, TABLE *table, st_sort_field *sortorder,
uint s_length, SQL_SELECT *select,
ha_rows max_rows, bool sort_positions,
- ha_rows *examined_rows);
+ ha_rows *examined_rows, ha_rows *found_rows);
void filesort_free_buffers(TABLE *table, bool full);
-double get_merge_many_buffs_cost(uint *buffer, uint last_n_elems,
- int elem_size);
void change_double_for_sort(double nr,uchar *to);
#endif /* FILESORT_INCLUDED */
diff --git a/sql/filesort_utils.cc b/sql/filesort_utils.cc
new file mode 100644
index 00000000000..c4480a6376d
--- /dev/null
+++ b/sql/filesort_utils.cc
@@ -0,0 +1,143 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "filesort_utils.h"
+#include "sql_const.h"
+#include "sql_sort.h"
+#include "table.h"
+#include "my_sys.h"
+
+
+namespace {
+/**
+ A local helper function. See comments for get_merge_buffers_cost().
+ */
+double get_merge_cost(ha_rows num_elements, ha_rows num_buffers, uint elem_size)
+{
+ return
+ 2.0 * ((double) num_elements * elem_size) / IO_SIZE
+ + (double) num_elements * log((double) num_buffers) /
+ (TIME_FOR_COMPARE_ROWID * M_LN2);
+}
+}
+
+/**
+ This is a simplified, and faster version of @see get_merge_many_buffs_cost().
+ We calculate the cost of merging buffers, by simulating the actions
+ of @see merge_many_buff. For explanations of formulas below,
+ see comments for get_merge_buffers_cost().
+ TODO: Use this function for Unique::get_use_cost().
+*/
+double get_merge_many_buffs_cost_fast(ha_rows num_rows,
+ ha_rows num_keys_per_buffer,
+ uint elem_size)
+{
+ ha_rows num_buffers= num_rows / num_keys_per_buffer;
+ ha_rows last_n_elems= num_rows % num_keys_per_buffer;
+ double total_cost;
+
+ // Calculate CPU cost of sorting buffers.
+ total_cost=
+ ( num_buffers * num_keys_per_buffer * log(1.0 + num_keys_per_buffer) +
+ last_n_elems * log(1.0 + last_n_elems) )
+ / TIME_FOR_COMPARE_ROWID;
+
+ // Simulate behavior of merge_many_buff().
+ while (num_buffers >= MERGEBUFF2)
+ {
+ // Calculate # of calls to merge_buffers().
+ const ha_rows loop_limit= num_buffers - MERGEBUFF*3/2;
+ const ha_rows num_merge_calls= 1 + loop_limit/MERGEBUFF;
+ const ha_rows num_remaining_buffs=
+ num_buffers - num_merge_calls * MERGEBUFF;
+
+ // Cost of merge sort 'num_merge_calls'.
+ total_cost+=
+ num_merge_calls *
+ get_merge_cost(num_keys_per_buffer * MERGEBUFF, MERGEBUFF, elem_size);
+
+ // # of records in remaining buffers.
+ last_n_elems+= num_remaining_buffs * num_keys_per_buffer;
+
+ // Cost of merge sort of remaining buffers.
+ total_cost+=
+ get_merge_cost(last_n_elems, 1 + num_remaining_buffs, elem_size);
+
+ num_buffers= num_merge_calls;
+ num_keys_per_buffer*= MERGEBUFF;
+ }
+
+ // Simulate final merge_buff call.
+ last_n_elems+= num_keys_per_buffer * num_buffers;
+ total_cost+= get_merge_cost(last_n_elems, 1 + num_buffers, elem_size);
+ return total_cost;
+}
+
+uchar **Filesort_buffer::alloc_sort_buffer(uint num_records, uint record_length)
+{
+ ulong sort_buff_sz;
+
+ DBUG_ENTER("alloc_sort_buffer");
+
+ DBUG_EXECUTE_IF("alloc_sort_buffer_fail",
+ DBUG_SET("+d,simulate_out_of_memory"););
+
+ if (m_idx_array.is_null())
+ {
+ sort_buff_sz= num_records * (record_length + sizeof(uchar*));
+ set_if_bigger(sort_buff_sz, record_length * MERGEBUFF2);
+ uchar **sort_keys=
+ (uchar**) my_malloc(sort_buff_sz, MYF(0));
+ m_idx_array= Idx_array(sort_keys, num_records);
+ m_record_length= record_length;
+ uchar **start_of_data= m_idx_array.array() + m_idx_array.size();
+ m_start_of_data= reinterpret_cast<uchar*>(start_of_data);
+ }
+ else
+ {
+ DBUG_ASSERT(num_records == m_idx_array.size());
+ DBUG_ASSERT(record_length == m_record_length);
+ }
+ DBUG_RETURN(m_idx_array.array());
+}
+
+
+void Filesort_buffer::free_sort_buffer()
+{
+ my_free(m_idx_array.array());
+ m_idx_array= Idx_array();
+ m_record_length= 0;
+ m_start_of_data= NULL;
+}
+
+
+void Filesort_buffer::sort_buffer(const Sort_param *param, uint count)
+{
+ if (count <= 1)
+ return;
+ uchar **keys= get_sort_keys();
+ uchar **buffer= NULL;
+ if (radixsort_is_appliccable(count, param->sort_length) &&
+ (buffer= (uchar**) my_malloc(count*sizeof(char*), MYF(0))))
+ {
+ radixsort_for_str_ptr(keys, count, param->sort_length, buffer);
+ my_free(buffer);
+ return;
+ }
+
+ size_t size= param->sort_length;
+ my_qsort2(keys, count, sizeof(uchar*), get_ptr_compare(size), &size);
+}
+
diff --git a/sql/filesort_utils.h b/sql/filesort_utils.h
new file mode 100644
index 00000000000..4cccf8ffa02
--- /dev/null
+++ b/sql/filesort_utils.h
@@ -0,0 +1,129 @@
+/* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef FILESORT_UTILS_INCLUDED
+#define FILESORT_UTILS_INCLUDED
+
+#include "my_global.h"
+#include "my_base.h"
+#include "sql_array.h"
+
+class Sort_param;
+/*
+ Calculate cost of merge sort
+
+ @param num_rows Total number of rows.
+ @param num_keys_per_buffer Number of keys per buffer.
+ @param elem_size Size of each element.
+
+ Calculates cost of merge sort by simulating call to merge_many_buff().
+
+ @retval
+ Computed cost of merge sort in disk seeks.
+
+ @note
+ Declared here in order to be able to unit test it,
+ since library dependencies have not been sorted out yet.
+
+ See also comments get_merge_many_buffs_cost().
+*/
+
+double get_merge_many_buffs_cost_fast(ha_rows num_rows,
+ ha_rows num_keys_per_buffer,
+ uint elem_size);
+
+
+/**
+ A wrapper class around the buffer used by filesort().
+ The buffer is a contiguous chunk of memory,
+ where the first part is <num_records> pointers to the actual data.
+
+ We wrap the buffer in order to be able to do lazy initialization of the
+ pointers: the buffer is often much larger than what we actually need.
+
+ The buffer must be kept available for multiple executions of the
+ same sort operation, so we have explicit allocate and free functions,
+ rather than doing alloc/free in CTOR/DTOR.
+*/
+class Filesort_buffer
+{
+public:
+ Filesort_buffer() :
+ m_idx_array(), m_record_length(0), m_start_of_data(NULL)
+ {}
+
+ /** Sort me... */
+ void sort_buffer(const Sort_param *param, uint count);
+
+ /// Initializes a record pointer.
+ uchar *get_record_buffer(uint idx)
+ {
+ m_idx_array[idx]= m_start_of_data + (idx * m_record_length);
+ return m_idx_array[idx];
+ }
+
+ /// Initializes all the record pointers.
+ void init_record_pointers()
+ {
+ for (uint ix= 0; ix < m_idx_array.size(); ++ix)
+ (void) get_record_buffer(ix);
+ }
+
+ /// Returns total size: pointer array + record buffers.
+ size_t sort_buffer_size() const
+ {
+ return m_idx_array.size() * (m_record_length + sizeof(uchar*));
+ }
+
+ /// Allocates the buffer, but does *not* initialize pointers.
+ uchar **alloc_sort_buffer(uint num_records, uint record_length);
+
+
+ /// Check <num_records, record_length> for the buffer
+ bool check_sort_buffer_properties(uint num_records, uint record_length)
+ {
+ return (static_cast<uint>(m_idx_array.size()) == num_records &&
+ m_record_length == m_record_length);
+ }
+
+ /// Frees the buffer.
+ void free_sort_buffer();
+
+ /// Getter, for calling routines which still use the uchar** interface.
+ uchar **get_sort_keys() { return m_idx_array.array(); }
+
+ /**
+ We need an assignment operator, see filesort().
+ This happens to have the same semantics as the one that would be
+ generated by the compiler. We still implement it here, to show shallow
+ assignment explicitly: we have two objects sharing the same array.
+ */
+ Filesort_buffer &operator=(const Filesort_buffer &rhs)
+ {
+ m_idx_array= rhs.m_idx_array;
+ m_record_length= rhs.m_record_length;
+ m_start_of_data= rhs.m_start_of_data;
+ return *this;
+ }
+
+private:
+ typedef Bounds_checked_array<uchar*> Idx_array;
+
+ Idx_array m_idx_array;
+ uint m_record_length;
+ uchar *m_start_of_data;
+};
+
+#endif // FILESORT_UTILS_INCLUDED
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index f91e19df08e..59b9d6eab6b 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -1295,7 +1295,9 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
DBUG_RETURN(0);
}
- char tmp_buf2[FN_REFLEN];
+ char tmp_buf2_mem[FN_REFLEN];
+ String tmp_buf2(tmp_buf2_mem, sizeof(tmp_buf2_mem), system_charset_info);
+ tmp_buf2.length(0);
const char *type_str;
switch (type)
{
@@ -1304,17 +1306,24 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
if (thd->lex->sql_command == SQLCOM_DROP_DB)
DBUG_RETURN(0);
/* redo the drop table query as is may contain several tables */
- query= tmp_buf2;
- query_length= (uint) (strxmov(tmp_buf2, "drop table `",
- table_name, "`", NullS) - tmp_buf2);
+ tmp_buf2.append(STRING_WITH_LEN("drop table "));
+ append_identifier(thd, &tmp_buf2, table_name, strlen(table_name));
+ query= tmp_buf2.c_ptr_safe();
+ query_length= tmp_buf2.length();
type_str= "drop table";
break;
case SOT_RENAME_TABLE:
/* redo the rename table query as is may contain several tables */
- query= tmp_buf2;
- query_length= (uint) (strxmov(tmp_buf2, "rename table `",
- db, ".", table_name, "` to `",
- new_db, ".", new_table_name, "`", NullS) - tmp_buf2);
+ tmp_buf2.append(STRING_WITH_LEN("rename table "));
+ append_identifier(thd, &tmp_buf2, db, strlen(db));
+ tmp_buf2.append(STRING_WITH_LEN("."));
+ append_identifier(thd, &tmp_buf2, table_name, strlen(table_name));
+ tmp_buf2.append(STRING_WITH_LEN(" to "));
+ append_identifier(thd, &tmp_buf2, new_db, strlen(new_db));
+ tmp_buf2.append(STRING_WITH_LEN("."));
+ append_identifier(thd, &tmp_buf2, new_table_name, strlen(new_table_name));
+ query= tmp_buf2.c_ptr_safe();
+ query_length= tmp_buf2.length();
type_str= "rename table";
break;
case SOT_CREATE_TABLE:
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 0b46ca4123c..4bc2b2439b4 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -2076,6 +2076,133 @@ partition_element *ha_partition::find_partition_element(uint part_id)
return NULL;
}
+uint ha_partition::count_query_cache_dependant_tables(uint8 *tables_type)
+{
+ DBUG_ENTER("ha_partition::count_query_cache_dependant_tables");
+ /* Here we rely on the fact that all tables are of the same type */
+ uint8 type= m_file[0]->table_cache_type();
+ (*tables_type)|= type;
+ DBUG_PRINT("info", ("cnt: %u", (uint)m_tot_parts));
+ /*
+ We need save underlying tables only for HA_CACHE_TBL_ASKTRANSACT:
+ HA_CACHE_TBL_NONTRANSACT - because all changes goes through partition table
+ HA_CACHE_TBL_NOCACHE - because will not be cached
+ HA_CACHE_TBL_TRANSACT - QC need to know that such type present
+ */
+ DBUG_RETURN(type == HA_CACHE_TBL_ASKTRANSACT ? m_tot_parts : 0);
+}
+
+my_bool ha_partition::reg_query_cache_dependant_table(THD *thd,
+ char *key, uint key_len,
+ uint8 type,
+ Query_cache *cache,
+ Query_cache_block_table **block_table,
+ handler *file,
+ uint *n)
+{
+ DBUG_ENTER("ha_partition::reg_query_cache_dependant_table");
+ qc_engine_callback engine_callback;
+ ulonglong engine_data;
+ /* ask undelying engine */
+ if (!file->register_query_cache_table(thd, key,
+ key_len,
+ &engine_callback,
+ &engine_data))
+ {
+ DBUG_PRINT("qcache", ("Handler does not allow caching for %s.%s",
+ key,
+ key + table_share->db.length + 1));
+ /*
+ As this can change from call to call, don't reset set
+ thd->lex->safe_to_cache_query
+ */
+ thd->query_cache_is_applicable= 0; // Query can't be cached
+ DBUG_RETURN(TRUE);
+ }
+ (++(*block_table))->n= ++(*n);
+ if (!cache->insert_table(key_len,
+ key, (*block_table),
+ table_share->db.length,
+ type,
+ engine_callback, engine_data,
+ FALSE))
+ DBUG_RETURN(TRUE);
+ DBUG_RETURN(FALSE);
+}
+
+
+my_bool ha_partition::register_query_cache_dependant_tables(THD *thd,
+ Query_cache *cache,
+ Query_cache_block_table **block_table,
+ uint *n)
+{
+ char *name;
+ uint prefix_length= table_share->table_cache_key.length + 3;
+ uint num_parts= m_part_info->num_parts;
+ uint num_subparts= m_part_info->num_subparts;
+ uint i= 0;
+ List_iterator<partition_element> part_it(m_part_info->partitions);
+ char key[FN_REFLEN];
+
+ DBUG_ENTER("ha_partition::register_query_cache_dependant_tables");
+
+ /* see ha_partition::count_query_cache_dependant_tables */
+ if (m_file[0]->table_cache_type() != HA_CACHE_TBL_ASKTRANSACT)
+ DBUG_RETURN(FALSE); // nothing to register
+
+ /* prepare static part of the key */
+ memmove(key, table_share->table_cache_key.str,
+ table_share->table_cache_key.length);
+
+ name= key + table_share->table_cache_key.length - 1;
+ name[0]= name[2]= '#';
+ name[1]= 'P';
+ name+= 3;
+
+ do
+ {
+ partition_element *part_elem= part_it++;
+ uint part_len= strmov(name, part_elem->partition_name) - name;
+ if (m_is_sub_partitioned)
+ {
+ List_iterator<partition_element> subpart_it(part_elem->subpartitions);
+ partition_element *sub_elem;
+ char *sname= name + part_len;
+ uint j= 0, part;
+ sname[0]= sname[3]= '#';
+ sname[1]= 'S';
+ sname[2]= 'P';
+ sname += 4;
+ do
+ {
+ sub_elem= subpart_it++;
+ part= i * num_subparts + j;
+ uint spart_len= strmov(sname, sub_elem->partition_name) - name + 1;
+ if (reg_query_cache_dependant_table(thd, key,
+ prefix_length + part_len + 4 +
+ spart_len,
+ m_file[part]->table_cache_type(),
+ cache,
+ block_table, m_file[part],
+ n))
+ DBUG_RETURN(TRUE);
+ } while (++j < num_subparts);
+ }
+ else
+ {
+ if (reg_query_cache_dependant_table(thd, key,
+ prefix_length + part_len + 1,
+ m_file[i]->table_cache_type(),
+ cache,
+ block_table, m_file[i],
+ n))
+ DBUG_RETURN(TRUE);
+ }
+ } while (++i < num_parts);
+ DBUG_PRINT("info", ("cnt: %u", (uint)m_tot_parts));
+ DBUG_RETURN(FALSE);
+}
+
/*
Set up table share object before calling create on underlying handler
@@ -3739,7 +3866,7 @@ int ha_partition::truncate_partition(Alter_info *alter_info, bool *binlog_stmt)
{
List_iterator<partition_element>
subpart_it(part_elem->subpartitions);
- partition_element __attribute__((unused)) *sub_elem;
+ partition_element *sub_elem __attribute__((unused));
uint j= 0, part;
do
{
@@ -6392,7 +6519,17 @@ ha_rows ha_partition::min_rows_for_estimate()
DBUG_ENTER("ha_partition::min_rows_for_estimate");
tot_used_partitions= bitmap_bits_set(&m_part_info->used_partitions);
- DBUG_ASSERT(tot_used_partitions);
+
+ /*
+ All partitions might have been left as unused during partition pruning
+ due to, for example, an impossible WHERE condition. Nonetheless, the
+ optimizer might still attempt to perform (e.g. range) analysis where an
+ estimate of the the number of rows is calculated using records_in_range.
+ Hence, to handle this and other possible cases, use zero as the minimum
+ number of rows to base the estimate on if no partition is being used.
+ */
+ if (!tot_used_partitions)
+ DBUG_RETURN(0);
/*
Allow O(log2(tot_partitions)) increase in number of used partitions.
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index b6b0e2a015d..ee2bd0e39b9 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -546,22 +546,20 @@ public:
virtual int extra(enum ha_extra_function operation);
virtual int extra_opt(enum ha_extra_function operation, ulong cachesize);
virtual int reset(void);
- /*
- Do not allow caching of partitioned tables, since we cannot return
- a callback or engine_data that would work for a generic engine.
- */
- virtual my_bool register_query_cache_table(THD *thd, char *table_key,
- uint key_length,
- qc_engine_callback
- *engine_callback,
- ulonglong *engine_data)
- {
- *engine_callback= NULL;
- *engine_data= 0;
- return FALSE;
- }
+ virtual uint count_query_cache_dependant_tables(uint8 *tables_type);
+ virtual my_bool
+ register_query_cache_dependant_tables(THD *thd,
+ Query_cache *cache,
+ Query_cache_block_table **block,
+ uint *n);
private:
+ my_bool reg_query_cache_dependant_table(THD *thd,
+ char *key, uint key_len, uint8 type,
+ Query_cache *cache,
+ Query_cache_block_table
+ **block_table,
+ handler *file, uint *n);
static const uint NO_CURRENT_PART_ID;
int loop_extra(enum ha_extra_function operation);
void late_extra_cache(uint partition_id);
diff --git a/sql/handler.cc b/sql/handler.cc
index ae9345d7673..7471fd8247d 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -642,6 +642,43 @@ void ha_checkpoint_state(bool disable)
}
+struct st_commit_checkpoint_request {
+ void *cookie;
+ void (*pre_hook)(void *);
+};
+
+static my_bool commit_checkpoint_request_handlerton(THD *unused1, plugin_ref plugin,
+ void *data)
+{
+ st_commit_checkpoint_request *st= (st_commit_checkpoint_request *)data;
+ handlerton *hton= plugin_data(plugin, handlerton *);
+ if (hton->state == SHOW_OPTION_YES && hton->commit_checkpoint_request)
+ {
+ void *cookie= st->cookie;
+ if (st->pre_hook)
+ (*st->pre_hook)(cookie);
+ (*hton->commit_checkpoint_request)(hton, cookie);
+ }
+ return FALSE;
+}
+
+
+/*
+ Invoke commit_checkpoint_request() in all storage engines that implement it.
+
+ If pre_hook is non-NULL, the hook will be called prior to each invocation.
+*/
+void
+ha_commit_checkpoint_request(void *cookie, void (*pre_hook)(void *))
+{
+ st_commit_checkpoint_request st;
+ st.cookie= cookie;
+ st.pre_hook= pre_hook;
+ plugin_foreach(NULL, commit_checkpoint_request_handlerton,
+ MYSQL_STORAGE_ENGINE_PLUGIN, &st);
+}
+
+
static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
void *unused)
@@ -1287,11 +1324,13 @@ int ha_commit_trans(THD *thd, bool all)
goto done;
}
+ DEBUG_SYNC(thd, "ha_commit_trans_before_log_and_order");
cookie= tc_log->log_and_order(thd, xid, all, need_prepare_ordered,
need_commit_ordered);
if (!cookie)
goto err;
+ DEBUG_SYNC(thd, "ha_commit_trans_after_log_and_order");
DBUG_EXECUTE_IF("crash_commit_after_log", DBUG_SUICIDE(););
error= commit_one_phase_2(thd, all, trans, is_real_trans) ? 2 : 0;
@@ -1783,6 +1822,17 @@ bool mysql_xa_recover(THD *thd)
DBUG_RETURN(0);
}
+/*
+ Called by engine to notify TC that a new commit checkpoint has been reached.
+ See comments on handlerton method commit_checkpoint_request() for details.
+*/
+void
+commit_checkpoint_notify_ha(handlerton *hton, void *cookie)
+{
+ tc_log->commit_checkpoint_notify(cookie);
+}
+
+
/**
@details
This function should be called when MySQL sends rows of a SELECT result set
@@ -2698,6 +2748,8 @@ int handler::update_auto_increment()
bool append= FALSE;
THD *thd= table->in_use;
struct system_variables *variables= &thd->variables;
+ int result=0, tmp;
+ enum enum_check_fields save_count_cuted_fields;
DBUG_ENTER("handler::update_auto_increment");
/*
@@ -2715,8 +2767,10 @@ int handler::update_auto_increment()
statement (case of INSERT VALUES(null),(3763),(null):
the last NULL needs to insert 3764, not the value of the first NULL plus
1).
+ Ignore negative values.
*/
- adjust_next_insert_id_after_explicit_value(nr);
+ if ((longlong) nr > 0 || (table->next_number_field->flags & UNSIGNED_FLAG))
+ adjust_next_insert_id_after_explicit_value(nr);
insert_id_for_cur_row= 0; // didn't generate anything
DBUG_RETURN(0);
}
@@ -2750,8 +2804,19 @@ int handler::update_auto_increment()
reservation means potentially losing unused values).
Note that in prelocked mode no estimation is given.
*/
+
if ((auto_inc_intervals_count == 0) && (estimation_rows_to_insert > 0))
nb_desired_values= estimation_rows_to_insert;
+ else if ((auto_inc_intervals_count == 0) &&
+ (thd->lex->many_values.elements > 0))
+ {
+ /*
+ For multi-row inserts, if the bulk inserts cannot be started, the
+ handler::estimation_rows_to_insert will not be set. But we still
+ want to reserve the autoinc values.
+ */
+ nb_desired_values= thd->lex->many_values.elements;
+ }
else /* go with the increasing defaults */
{
/* avoid overflow in formula, with this if() */
@@ -2764,7 +2829,6 @@ int handler::update_auto_increment()
else
nb_desired_values= AUTO_INC_DEFAULT_NB_MAX;
}
- /* This call ignores all its parameters but nr, currently */
get_auto_increment(variables->auto_increment_offset,
variables->auto_increment_increment,
nb_desired_values, &nr,
@@ -2801,29 +2865,24 @@ int handler::update_auto_increment()
}
if (unlikely(nr == ULONGLONG_MAX))
- DBUG_RETURN(HA_ERR_AUTOINC_ERANGE);
+ DBUG_RETURN(HA_ERR_AUTOINC_ERANGE);
- DBUG_PRINT("info",("auto_increment: %lu", (ulong) nr));
+ DBUG_PRINT("info",("auto_increment: %llu nb_reserved_values: %llu",
+ nr, nb_reserved_values));
- if (unlikely(table->next_number_field->store((longlong) nr, TRUE)))
- {
- /*
- first test if the query was aborted due to strict mode constraints
- */
- if (killed_mask_hard(thd->killed) == KILL_BAD_DATA)
- DBUG_RETURN(HA_ERR_AUTOINC_ERANGE);
+ /* Store field without warning (Warning will be printed by insert) */
+ save_count_cuted_fields= thd->count_cuted_fields;
+ thd->count_cuted_fields= CHECK_FIELD_IGNORE;
+ tmp= table->next_number_field->store((longlong) nr, TRUE);
+ thd->count_cuted_fields= save_count_cuted_fields;
+ if (unlikely(tmp)) // Out of range value in store
+ {
/*
- field refused this value (overflow) and truncated it, use the result of
- the truncation (which is going to be inserted); however we try to
- decrease it to honour auto_increment_* variables.
- That will shift the left bound of the reserved interval, we don't
- bother shifting the right bound (anyway any other value from this
- interval will cause a duplicate key).
+ It's better to return an error here than getting a confusing
+ 'duplicate key error' later.
*/
- nr= prev_insert_id(table->next_number_field->val_int(), variables);
- if (unlikely(table->next_number_field->store((longlong) nr, TRUE)))
- nr= table->next_number_field->val_int();
+ result= HA_ERR_AUTOINC_ERANGE;
}
if (append)
{
@@ -2845,6 +2904,10 @@ int handler::update_auto_increment()
already set.
*/
insert_id_for_cur_row= nr;
+
+ if (result) // overflow
+ DBUG_RETURN(result);
+
/*
Set next insert id to point to next auto-increment value to be able to
handle multi-row statements.
@@ -2968,7 +3031,7 @@ void handler::ha_release_auto_increment()
}
-void handler::print_keydup_error(uint key_nr, const char *msg)
+void handler::print_keydup_error(uint key_nr, const char *msg, myf errflag)
{
/* Write the duplicated key in the error message */
char key[MAX_KEY_LENGTH];
@@ -2978,7 +3041,7 @@ void handler::print_keydup_error(uint key_nr, const char *msg)
{
/* Key is unknown */
str.copy("", 0, system_charset_info);
- my_printf_error(ER_DUP_ENTRY, msg, MYF(0), str.c_ptr(), "*UNKNOWN*");
+ my_printf_error(ER_DUP_ENTRY, msg, errflag, str.c_ptr(), "*UNKNOWN*");
}
else
{
@@ -2991,7 +3054,7 @@ void handler::print_keydup_error(uint key_nr, const char *msg)
str.append(STRING_WITH_LEN("..."));
}
my_printf_error(ER_DUP_ENTRY, msg,
- MYF(0), str.c_ptr_safe(), table->key_info[key_nr].name);
+ errflag, str.c_ptr_safe(), table->key_info[key_nr].name);
}
}
@@ -3059,7 +3122,7 @@ void handler::print_error(int error, myf errflag)
uint key_nr=get_dup_key(error);
if ((int) key_nr >= 0)
{
- print_keydup_error(key_nr, ER(ER_DUP_ENTRY_WITH_KEY_NAME));
+ print_keydup_error(key_nr, ER(ER_DUP_ENTRY_WITH_KEY_NAME), errflag);
DBUG_VOID_RETURN;
}
}
@@ -3178,7 +3241,7 @@ void handler::print_error(int error, myf errflag)
textno=ER_TABLE_DEF_CHANGED;
break;
case HA_ERR_NO_SUCH_TABLE:
- my_error(ER_NO_SUCH_TABLE, errflag, table_share->db.str,
+ my_error(ER_NO_SUCH_TABLE_IN_ENGINE, errflag, table_share->db.str,
table_share->table_name.str);
DBUG_VOID_RETURN;
case HA_ERR_RBR_LOGGING_FAILED:
@@ -3206,7 +3269,10 @@ void handler::print_error(int error, myf errflag)
textno= ER_AUTOINC_READ_FAILED;
break;
case HA_ERR_AUTOINC_ERANGE:
- textno= ER_WARN_DATA_OUT_OF_RANGE;
+ textno= error;
+ my_error(textno, errflag, table->next_number_field->field_name,
+ table->in_use->warning_info->current_row_for_warning());
+ DBUG_VOID_RETURN;
break;
case HA_ERR_TOO_MANY_CONCURRENT_TRXS:
textno= ER_TOO_MANY_CONCURRENT_TRXS;
@@ -4991,10 +5057,14 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
db_type->show_status(db_type, thd, stat_print, stat) ? 1 : 0;
}
- if (!result)
+ /*
+ We also check thd->is_error() as Innodb may return 0 even if
+ there was an error.
+ */
+ if (!result && !thd->is_error())
my_eof(thd);
else if (!thd->is_error())
- my_error(ER_GET_ERRNO, MYF(0), 0);
+ my_error(ER_GET_ERRNO, MYF(0), errno);
return result;
}
@@ -5283,6 +5353,8 @@ int handler::ha_write_row(uchar *buf)
rows_changed++;
if (unlikely(error= binlog_log_row(table, 0, buf, log_func)))
DBUG_RETURN(error); /* purecov: inspected */
+
+ DEBUG_SYNC_C("ha_write_row_end");
DBUG_RETURN(0);
}
diff --git a/sql/handler.h b/sql/handler.h
index 3a6f0070567..f043f1b44cd 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -616,6 +616,7 @@ enum enum_schema_tables
SCH_COLUMN_PRIVILEGES,
SCH_ENGINES,
SCH_EVENTS,
+ SCH_EXPLAIN,
SCH_FILES,
SCH_GLOBAL_STATUS,
SCH_GLOBAL_VARIABLES,
@@ -992,6 +993,46 @@ struct handlerton
int (*recover)(handlerton *hton, XID *xid_list, uint len);
int (*commit_by_xid)(handlerton *hton, XID *xid);
int (*rollback_by_xid)(handlerton *hton, XID *xid);
+ /*
+ The commit_checkpoint_request() handlerton method is used to checkpoint
+ the XA recovery process for storage engines that support two-phase
+ commit.
+
+ The method is optional - an engine that does not implemented is expected
+ to work the traditional way, where every commit() durably flushes the
+ transaction to disk in the engine before completion, so XA recovery will
+ no longer be needed for that transaction.
+
+ An engine that does implement commit_checkpoint_request() is also
+ expected to implement commit_ordered(), so that ordering of commits is
+ consistent between 2pc participants. Such engine is no longer required to
+ durably flush to disk transactions in commit(), provided that the
+ transaction has been successfully prepare()d and commit_ordered(); thus
+ potentionally saving one fsync() call. (Engine must still durably flush
+ to disk in commit() when no prepare()/commit_ordered() steps took place,
+ at least if durable commits are wanted; this happens eg. if binlog is
+ disabled).
+
+ The TC will periodically (eg. once per binlog rotation) call
+ commit_checkpoint_request(). When this happens, the engine must arrange
+ for all transaction that have completed commit_ordered() to be durably
+ flushed to disk (this does not include transactions that might be in the
+ middle of executing commit_ordered()). When such flush has completed, the
+ engine must call commit_checkpoint_notify_ha(), passing back the opaque
+ "cookie".
+
+ The flush and call of commit_checkpoint_notify_ha() need not happen
+ immediately - it can be scheduled and performed asynchroneously (ie. as
+ part of next prepare(), or sync every second, or whatever), but should
+ not be postponed indefinitely. It is however also permissible to do it
+ immediately, before returning from commit_checkpoint_request().
+
+ When commit_checkpoint_notify_ha() is called, the TC will know that the
+ transactions are durably committed, and thus no longer require XA
+ recovery. It uses that to reduce the work needed for any subsequent XA
+ recovery process.
+ */
+ void (*commit_checkpoint_request)(handlerton *hton, void *cookie);
/*
"Disable or enable checkpointing internal to the storage engine. This is
used for FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT to ensure that
@@ -1742,6 +1783,8 @@ public:
virtual ~handler_add_index() {}
};
+class Query_cache;
+struct Query_cache_block_table;
/**
The handler class is the interface for dynamically loadable
storage engines. Do not add ifdefs and take care when adding or
@@ -2011,7 +2054,7 @@ public:
void adjust_next_insert_id_after_explicit_value(ulonglong nr);
int update_auto_increment();
- void print_keydup_error(uint key_nr, const char *msg);
+ void print_keydup_error(uint key_nr, const char *msg, myf errflag);
virtual void print_error(int error, myf errflag);
virtual bool get_error_message(int error, String *buf);
uint get_dup_key(int error);
@@ -2083,7 +2126,8 @@ public:
if (!error ||
((flags & HA_CHECK_DUP_KEY) &&
(error == HA_ERR_FOUND_DUPP_KEY ||
- error == HA_ERR_FOUND_DUPP_UNIQUE)))
+ error == HA_ERR_FOUND_DUPP_UNIQUE)) ||
+ error == HA_ERR_AUTOINC_ERANGE)
return FALSE;
return TRUE;
}
@@ -2601,6 +2645,46 @@ public:
return TRUE;
}
+ /*
+ Count tables invisible from all tables list on which current one built
+ (like myisammrg and partitioned tables)
+
+ tables_type mask for the tables should be added herdde
+
+ returns number of such tables
+ */
+
+ virtual uint count_query_cache_dependant_tables(uint8 *tables_type
+ __attribute__((unused)))
+ {
+ return 0;
+ }
+
+ /*
+ register tables invisible from all tables list on which current one built
+ (like myisammrg and partitioned tables).
+
+ @note they should be counted by method above
+
+ cache Query cache pointer
+ block Query cache block to write the table
+ n Number of the table
+
+ @retval FALSE - OK
+ @retval TRUE - Error
+ */
+
+ virtual my_bool
+ register_query_cache_dependant_tables(THD *thd
+ __attribute__((unused)),
+ Query_cache *cache
+ __attribute__((unused)),
+ Query_cache_block_table **block
+ __attribute__((unused)),
+ uint *n __attribute__((unused)))
+ {
+ return FALSE;
+ }
/*
Check if the primary key (if there is one) is a clustered and a
@@ -3014,6 +3098,7 @@ void ha_close_connection(THD* thd);
bool ha_flush_logs(handlerton *db_type);
void ha_drop_database(char* path);
void ha_checkpoint_state(bool disable);
+void ha_commit_checkpoint_request(void *cookie, void (*pre_hook)(void *));
int ha_create_table(THD *thd, const char *path,
const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
@@ -3094,6 +3179,7 @@ int ha_binlog_end(THD *thd);
const char *get_canonical_filename(handler *file, const char *path,
char *tmp_path);
bool mysql_xa_recover(THD *thd);
+void commit_checkpoint_notify_ha(handlerton *hton, void *cookie);
inline const char *table_case_name(HA_CREATE_INFO *info, const char *name)
{
diff --git a/sql/item.cc b/sql/item.cc
index 367e603c6e7..13a4524f131 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -503,8 +503,8 @@ Item::Item(THD *thd, Item *item):
orig_name(item->orig_name),
max_length(item->max_length),
name_length(item->name_length),
- marker(item->marker),
decimals(item->decimals),
+ marker(item->marker),
maybe_null(item->maybe_null),
in_rollup(item->in_rollup),
null_value(item->null_value),
@@ -992,15 +992,31 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
if (!my_charset_same(cs, system_charset_info))
{
size_t res_length;
- name= sql_strmake_with_convert(str, name_length= length, cs,
+ name= sql_strmake_with_convert(str, length, cs,
MAX_ALIAS_NAME, system_charset_info,
&res_length);
+ name_length= res_length;
}
else
name= sql_strmake(str, (name_length= min(length,MAX_ALIAS_NAME)));
}
+void Item::set_name_no_truncate(const char *str, uint length, CHARSET_INFO *cs)
+{
+ if (!my_charset_same(cs, system_charset_info))
+ {
+ size_t res_length;
+ name= sql_strmake_with_convert(str, length, cs,
+ UINT_MAX, system_charset_info,
+ &res_length);
+ name_length= res_length;
+ }
+ else
+ name= sql_strmake(str, (name_length= length));
+}
+
+
void Item::set_name_for_rollback(THD *thd, const char *str, uint length,
CHARSET_INFO *cs)
{
@@ -6821,7 +6837,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
if (from_field != not_found_field)
{
Item_field* fld;
- if (!(fld= new Item_field(from_field)))
+ if (!(fld= new Item_field(thd, last_checked_context, from_field)))
goto error;
thd->change_item_tree(reference, fld);
mark_as_dependent(thd, last_checked_context->select_lex,
@@ -7741,6 +7757,13 @@ Item* Item_cache_wrapper::get_tmp_table_item(THD *thd_arg)
}
+bool Item_direct_view_ref::send(Protocol *protocol, String *buffer)
+{
+ if (check_null_ref())
+ return protocol->store_null();
+ return Item_direct_ref::send(protocol, buffer);
+}
+
/**
Prepare referenced field then call usual Item_direct_ref::fix_fields .
@@ -7755,6 +7778,7 @@ Item* Item_cache_wrapper::get_tmp_table_item(THD *thd_arg)
bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
{
+ DBUG_ASSERT(1);
/* view fild reference must be defined */
DBUG_ASSERT(*ref);
/* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */
@@ -9267,7 +9291,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
item->max_length, item->decimals));
fld_type= Field::field_type_merge(fld_type, get_real_type(item));
{
- int item_decimals= item->decimals;
+ uint item_decimals= item->decimals;
/* fix variable decimals which always is NOT_FIXED_DEC */
if (Field::result_merge_type(fld_type) == INT_RESULT)
item_decimals= 0;
diff --git a/sql/item.h b/sql/item.h
index 1f79f833f97..c76b443fe09 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -618,8 +618,8 @@ public:
calls.
*/
uint name_length; /* Length of name */
+ uint decimals;
int8 marker;
- uint8 decimals;
bool maybe_null; /* If item may be null */
bool in_rollup; /* If used in GROUP BY list
of a query with ROLLUP */
@@ -656,6 +656,7 @@ public:
#endif
} /*lint -e1509 */
void set_name(const char *str, uint length, CHARSET_INFO *cs);
+ void set_name_no_truncate(const char *str, uint length, CHARSET_INFO *cs);
void set_name_for_rollback(THD *thd, const char *str, uint length,
CHARSET_INFO *cs);
void rename(char *new_name);
@@ -3159,20 +3160,29 @@ class Item_direct_view_ref :public Item_direct_ref
{
Item_equal *item_equal;
TABLE_LIST *view;
+ TABLE *null_ref_table;
+
+ bool check_null_ref()
+ {
+ if (null_ref_table == NULL)
+ {
+ null_ref_table= view->get_real_join_table();
+ }
+ if (null_ref_table->null_row)
+ {
+ null_value= 1;
+ return TRUE;
+ }
+ return FALSE;
+ }
public:
Item_direct_view_ref(Name_resolution_context *context_arg, Item **item,
const char *table_name_arg,
const char *field_name_arg,
TABLE_LIST *view_arg)
:Item_direct_ref(context_arg, item, table_name_arg, field_name_arg),
- item_equal(0), view(view_arg) {}
- /* Constructor need to process subselect with temporary tables (see Item) */
- Item_direct_view_ref(THD *thd, Item_direct_ref *item)
- :Item_direct_ref(thd, item), item_equal(0) {}
- Item_direct_view_ref(TABLE_LIST *view_arg, Item **item,
- const char *field_name_arg)
- :Item_direct_ref(view_arg, item, field_name_arg), item_equal(0)
- {}
+ item_equal(0), view(view_arg),
+ null_ref_table(NULL) {}
bool fix_fields(THD *, Item **);
bool eq(const Item *item, bool binary_cmp) const;
@@ -3203,6 +3213,85 @@ public:
view_arg->view_used_tables|= (*ref)->used_tables();
return 0;
}
+ void save_val(Field *to)
+ {
+ if (check_null_ref())
+ to->set_null();
+ else
+ Item_direct_ref::save_val(to);
+ }
+ double val_real()
+ {
+ if (check_null_ref())
+ return 0;
+ else
+ return Item_direct_ref::val_real();
+ }
+ longlong val_int()
+ {
+ if (check_null_ref())
+ return 0;
+ else
+ return Item_direct_ref::val_int();
+ }
+ String *val_str(String* tmp)
+ {
+ if (check_null_ref())
+ return NULL;
+ else
+ return Item_direct_ref::val_str(tmp);
+ }
+ my_decimal *val_decimal(my_decimal *tmp)
+ {
+ if (check_null_ref())
+ return NULL;
+ else
+ return Item_direct_ref::val_decimal(tmp);
+ }
+ bool val_bool()
+ {
+ if (check_null_ref())
+ return 0;
+ else
+ return Item_direct_ref::val_bool();
+ }
+ bool is_null()
+ {
+ if (check_null_ref())
+ return 1;
+ else
+ return Item_direct_ref::is_null();
+ }
+ bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+ {
+ if (check_null_ref())
+ {
+ bzero((char*) ltime,sizeof(*ltime));
+ return 1;
+ }
+ return Item_direct_ref::get_date(ltime, fuzzydate);
+ }
+ bool send(Protocol *protocol, String *buffer);
+ void save_org_in_field(Field *field)
+ {
+ if (check_null_ref())
+ field->set_null();
+ else
+ Item_direct_ref::save_val(field);
+ }
+ void save_in_result_field(bool no_conversions)
+ {
+ if (check_null_ref())
+ result_field->set_null();
+ else
+ Item_direct_ref::save_in_result_field(no_conversions);
+ }
+
+ void cleanup()
+ {
+ null_ref_table= NULL;
+ Item_direct_ref::cleanup();
+ }
};
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 2a0ca19a4e9..d950c0c1443 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -3089,6 +3089,15 @@ void Item_func_case::fix_length_and_dec()
return;
}
}
+ /*
+ Set cmp_context of all WHEN arguments. This prevents
+ Item_field::equal_fields_propagator() from transforming a
+ zerofill argument into a string constant. Such a change would
+ require rebuilding cmp_items.
+ */
+ for (i= 0; i < ncases; i+= 2)
+ args[i]->cmp_context= item_cmp_type(left_result_type,
+ args[i]->result_type());
}
if (else_expr_num == -1 || args[else_expr_num]->maybe_null)
@@ -4069,6 +4078,16 @@ void Item_func_in::fix_length_and_dec()
}
}
}
+ /*
+ Set cmp_context of all arguments. This prevents
+ Item_field::equal_fields_propagator() from transforming a zerofill integer
+ argument into a string constant. Such a change would require rebuilding
+ cmp_itmes.
+ */
+ for (arg= args + 1, arg_end= args + arg_count; arg != arg_end ; arg++)
+ {
+ arg[0]->cmp_context= item_cmp_type(left_result_type, arg[0]->result_type());
+ }
max_length= 1;
}
@@ -4866,8 +4885,8 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
}
if (canDoTurboBM)
{
- pattern = first + 1;
pattern_len = (int) len - 2;
+ pattern = thd->strmake(first + 1, pattern_len);
DBUG_PRINT("info", ("Initializing pattern: '%s'", first));
int *suff = (int*) thd->alloc((int) (sizeof(int)*
((pattern_len + 1)*2+
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 96837a8f262..07e7f7b7ff9 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -4393,27 +4393,34 @@ Create_func_master_pos_wait::create_native(THD *thd, LEX_STRING name,
if (item_list != NULL)
arg_count= item_list->elements;
+ if (arg_count < 2 || arg_count > 4)
+ {
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
+ return func;
+ }
+
+ thd->lex->safe_to_cache_query= 0;
+
+ Item *param_1= item_list->pop();
+ Item *param_2= item_list->pop();
switch (arg_count) {
case 2:
{
- Item *param_1= item_list->pop();
- Item *param_2= item_list->pop();
func= new (thd->mem_root) Item_master_pos_wait(param_1, param_2);
- thd->lex->safe_to_cache_query= 0;
break;
}
case 3:
{
- Item *param_1= item_list->pop();
- Item *param_2= item_list->pop();
Item *param_3= item_list->pop();
func= new (thd->mem_root) Item_master_pos_wait(param_1, param_2, param_3);
- thd->lex->safe_to_cache_query= 0;
break;
}
- default:
+ case 4:
{
- my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
+ Item *param_3= item_list->pop();
+ Item *param_4= item_list->pop();
+ func= new (thd->mem_root) Item_master_pos_wait(param_1, param_2, param_3,
+ param_4);
break;
}
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 922d980074a..4c9f0a65d8a 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3866,13 +3866,45 @@ longlong Item_master_pos_wait::val_int()
#ifdef HAVE_REPLICATION
longlong pos = (ulong)args[1]->val_int();
longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ;
- if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2)
+ String connection_name_buff;
+ LEX_STRING connection_name;
+ Master_info *mi;
+ if (arg_count == 4)
+ {
+ String *con;
+ if (!(con= args[3]->val_str(&connection_name_buff)))
+ goto err;
+
+ connection_name.str= (char*) con->ptr();
+ connection_name.length= con->length();
+ if (check_master_connection_name(&connection_name))
+ {
+ my_error(ER_WRONG_ARGUMENTS, MYF(ME_JUST_WARNING),
+ "MASTER_CONNECTION_NAME");
+ goto err;
+ }
+ }
+ else
+ connection_name= thd->variables.default_master_connection;
+
+ if (!(mi= master_info_index->get_master_info(&connection_name,
+ MYSQL_ERROR::WARN_LEVEL_WARN)))
+ goto err;
+ if ((event_count = mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2)
{
null_value = 1;
event_count=0;
}
#endif
return event_count;
+
+#ifdef HAVE_REPLICATION
+err:
+ {
+ null_value = 1;
+ return 0;
+ }
+#endif
}
@@ -4297,7 +4329,7 @@ longlong Item_func_sleep::val_int()
#define extra_size sizeof(double)
-static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
+user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
bool create_if_not_exists)
{
user_var_entry *entry;
@@ -5441,10 +5473,10 @@ my_decimal* Item_user_var_as_out_param::val_decimal(my_decimal *decimal_buffer)
}
-void Item_user_var_as_out_param::print(String *str, enum_query_type query_type)
+void Item_user_var_as_out_param::print_for_load(THD *thd, String *str)
{
str->append('@');
- str->append(name.str,name.length);
+ append_identifier(thd, str, name.str, name.length);
}
@@ -6044,6 +6076,8 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
DBUG_ASSERT(fixed == 0);
Item *UNINIT_VAR(item); // Safe as arg_count is > 1
+ status_var_increment(thd->status_var.feature_fulltext);
+
maybe_null=1;
join_key=0;
@@ -6814,3 +6848,62 @@ longlong Item_func_uuid_short::val_int()
mysql_mutex_unlock(&LOCK_short_uuid_generator);
return (longlong) val;
}
+
+
+/**
+ Last_value - return last argument.
+*/
+
+void Item_func_last_value::evaluate_sideeffects()
+{
+ DBUG_ASSERT(fixed == 1 && arg_count > 0);
+ for (uint i= 0; i < arg_count-1 ; i++)
+ args[i]->val_int();
+}
+
+String *Item_func_last_value::val_str(String *str)
+{
+ String *tmp;
+ evaluate_sideeffects();
+ tmp= last_value->val_str(str);
+ null_value= last_value->null_value;
+ return tmp;
+}
+
+longlong Item_func_last_value::val_int()
+{
+ longlong tmp;
+ evaluate_sideeffects();
+ tmp= last_value->val_int();
+ null_value= last_value->null_value;
+ return tmp;
+}
+
+double Item_func_last_value::val_real()
+{
+ double tmp;
+ evaluate_sideeffects();
+ tmp= last_value->val_real();
+ null_value= last_value->null_value;
+ return tmp;
+}
+
+my_decimal *Item_func_last_value::val_decimal(my_decimal *decimal_value)
+{
+ my_decimal *tmp;
+ evaluate_sideeffects();
+ tmp= last_value->val_decimal(decimal_value);
+ null_value= last_value->null_value;
+ return tmp;
+}
+
+
+void Item_func_last_value::fix_length_and_dec()
+{
+ last_value= args[arg_count -1];
+ decimals= last_value->decimals;
+ max_length= last_value->max_length;
+ collation.set(last_value->collation.collation);
+ maybe_null= last_value->maybe_null;
+ unsigned_flag= last_value->unsigned_flag;
+}
diff --git a/sql/item_func.h b/sql/item_func.h
index cb9c1929d7d..07b246b3ccd 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -496,6 +496,8 @@ public:
{ collation.set_numeric(); fix_char_length(21); }
Item_int_func(Item *a,Item *b,Item *c) :Item_func(a,b,c)
{ collation.set_numeric(); fix_char_length(21); }
+ Item_int_func(Item *a,Item *b,Item *c, Item *d) :Item_func(a,b,c,d)
+ { collation.set_numeric(); fix_char_length(21); }
Item_int_func(List<Item> &list) :Item_func(list)
{ collation.set_numeric(); fix_char_length(21); }
Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item)
@@ -1522,6 +1524,7 @@ class Item_master_pos_wait :public Item_int_func
public:
Item_master_pos_wait(Item *a,Item *b) :Item_int_func(a,b) {}
Item_master_pos_wait(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {}
+ Item_master_pos_wait(Item *a,Item *b, Item *c, Item *d) :Item_int_func(a,b,c,d) {}
longlong val_int();
const char *func_name() const { return "master_pos_wait"; }
void fix_length_and_dec() { max_length=21; maybe_null=1;}
@@ -1670,7 +1673,7 @@ public:
my_decimal *val_decimal(my_decimal *decimal_buffer);
/* fix_fields() binds variable name with its entry structure */
bool fix_fields(THD *thd, Item **ref);
- virtual void print(String *str, enum_query_type query_type);
+ void print_for_load(THD *thd, String *str);
void set_null_value(CHARSET_INFO* cs);
void set_value(const char *str, uint length, CHARSET_INFO* cs);
};
@@ -2003,6 +2006,27 @@ public:
}
};
+
+class Item_func_last_value :public Item_func
+{
+protected:
+ Item *last_value;
+public:
+ Item_func_last_value(List<Item> &list) :Item_func(list) {}
+ double val_real();
+ longlong val_int();
+ String *val_str(String *);
+ my_decimal *val_decimal(my_decimal *);
+ void fix_length_and_dec();
+ enum Item_result result_type () const { return last_value->result_type(); }
+ const char *func_name() const { return "last_value"; }
+ table_map not_null_tables() const { return 0; }
+ enum_field_types field_type() const { return last_value->field_type(); }
+ bool const_item() const { return 0; }
+ void evaluate_sideeffects();
+};
+
+
Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
LEX_STRING component);
extern bool check_reserved_words(LEX_STRING *name);
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index fdd3cab8273..bc89a6c14b3 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -135,6 +135,7 @@ String *Item_func_as_wkt::val_str_ascii(String *str)
return 0;
str->length(0);
+ str->set_charset(&my_charset_latin1);
if ((null_value= geom->as_wkt(str, &dummy)))
return 0;
@@ -182,7 +183,7 @@ String *Item_func_geometry_type::val_str_ascii(String *str)
/* String will not move */
str->copy(geom->get_class_info()->m_name.str,
geom->get_class_info()->m_name.length,
- default_charset());
+ &my_charset_latin1);
return str;
}
@@ -1694,7 +1695,8 @@ count_distance:
for (dist_point= collector.get_first(); dist_point; dist_point= dist_point->get_next())
{
/* We only check vertices of object 2 */
- if (dist_point->shape < obj2_si)
+ if (dist_point->type != Gcalc_heap::nt_shape_node ||
+ dist_point->shape < obj2_si)
continue;
/* if we have an edge to check */
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index cb7b2841cfb..4c0c81aa8c6 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -3775,6 +3775,7 @@ bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref)
(arg_count / 2));
nums= (uint *) alloc_root(thd->mem_root,
sizeof(uint) * (arg_count / 2));
+ status_var_increment(thd->status_var.feature_dynamic_columns);
return res || vals == 0 || nums == 0;
}
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index c7a3ca445d6..83c7e3e1529 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -220,6 +220,8 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref)
uint8 uncacheable;
bool res;
+ status_var_increment(thd_param->status_var.feature_subquery);
+
DBUG_ASSERT(fixed == 0);
engine->set_thd((thd= thd_param));
if (!done_first_fix_fields)
@@ -287,7 +289,7 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref)
else
goto end;
- if ((uncacheable= engine->uncacheable()))
+ if ((uncacheable= engine->uncacheable() & ~UNCACHEABLE_EXPLAIN))
{
const_item_cache= 0;
if (uncacheable & UNCACHEABLE_RAND)
@@ -733,6 +735,19 @@ bool Item_subselect::expr_cache_is_needed(THD *thd)
/**
+ Check if the left IN argument contains NULL values.
+
+ @retval TRUE there are NULLs
+ @retval FALSE otherwise
+*/
+
+inline bool Item_in_subselect::left_expr_has_null()
+{
+ return (*(optimizer->get_cache()))->null_value;
+}
+
+
+/**
Check if an expression cache is needed for this subquery
@param thd Thread handle
@@ -819,7 +834,9 @@ table_map Item_subselect::used_tables() const
bool Item_subselect::const_item() const
{
- return thd->lex->context_analysis_only ? FALSE : const_item_cache;
+ return (thd->lex->context_analysis_only ?
+ FALSE :
+ forced_const || const_item_cache);
}
Item *Item_subselect::get_tmp_table_item(THD *thd_arg)
@@ -1272,7 +1289,7 @@ bool Item_singlerow_subselect::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
else
{
reset();
- return 0;
+ return 1;
}
}
@@ -1538,6 +1555,10 @@ double Item_in_subselect::val_real()
*/
DBUG_ASSERT(0);
DBUG_ASSERT(fixed == 1);
+ if (forced_const)
+ return value;
+ DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ ! engine->is_executed());
null_value= was_null= FALSE;
if (exec())
{
@@ -1558,6 +1579,10 @@ longlong Item_in_subselect::val_int()
*/
DBUG_ASSERT(0);
DBUG_ASSERT(fixed == 1);
+ if (forced_const)
+ return value;
+ DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ ! engine->is_executed());
null_value= was_null= FALSE;
if (exec())
{
@@ -1578,6 +1603,10 @@ String *Item_in_subselect::val_str(String *str)
*/
DBUG_ASSERT(0);
DBUG_ASSERT(fixed == 1);
+ if (forced_const)
+ goto value_is_ready;
+ DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ ! engine->is_executed());
null_value= was_null= FALSE;
if (exec())
{
@@ -1589,6 +1618,7 @@ String *Item_in_subselect::val_str(String *str)
null_value= TRUE;
return 0;
}
+value_is_ready:
str->set((ulonglong)value, &my_charset_bin);
return str;
}
@@ -1599,6 +1629,8 @@ bool Item_in_subselect::val_bool()
DBUG_ASSERT(fixed == 1);
if (forced_const)
return value;
+ DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ ! engine->is_executed());
null_value= was_null= FALSE;
if (exec())
{
@@ -1617,6 +1649,10 @@ my_decimal *Item_in_subselect::val_decimal(my_decimal *decimal_value)
method should not be used
*/
DBUG_ASSERT(0);
+ if (forced_const)
+ goto value_is_ready;
+ DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ ! engine->is_executed());
null_value= was_null= FALSE;
DBUG_ASSERT(fixed == 1);
if (exec())
@@ -1626,6 +1662,7 @@ my_decimal *Item_in_subselect::val_decimal(my_decimal *decimal_value)
}
if (was_null && !value)
null_value= TRUE;
+value_is_ready:
int2my_decimal(E_DEC_FATAL_ERROR, value, 0, decimal_value);
return decimal_value;
}
@@ -1882,7 +1919,7 @@ bool Item_allany_subselect::is_maxmin_applicable(JOIN *join)
WHERE condition.
*/
return (abort_on_null || (upper_item && upper_item->is_top_level_item())) &&
- !join->select_lex->master_unit()->uncacheable && !func->eqne_op();
+ !(join->select_lex->master_unit()->uncacheable & ~UNCACHEABLE_EXPLAIN) && !func->eqne_op();
}
@@ -3176,6 +3213,8 @@ int subselect_single_select_engine::exec()
tab->read_record.read_record= tab->save_read_record;
}
executed= 1;
+ if (!(uncacheable() & ~UNCACHEABLE_EXPLAIN))
+ item->make_const();
thd->where= save_where;
thd->lex->current_select= save_select;
DBUG_RETURN(join->error || thd->is_fatal_error || thd->is_error());
@@ -3259,161 +3298,51 @@ int subselect_uniquesubquery_engine::scan_table()
}
-/*
- Copy ref key and check for null parts in it
-
- SYNOPSIS
- subselect_uniquesubquery_engine::copy_ref_key()
-
- DESCRIPTION
- Copy ref key and check for null parts in it.
- Depending on the nullability and conversion problems this function
- recognizes and processes the following states :
- 1. Partial match on top level. This means IN has a value of FALSE
- regardless of the data in the subquery table.
- Detected by finding a NULL in the left IN operand of a top level
- expression.
- We may actually skip reading the subquery, so return TRUE to skip
- the table scan in subselect_uniquesubquery_engine::exec and make
- the value of the IN predicate a NULL (that is equal to FALSE on
- top level).
- 2. No exact match when IN is nested inside another predicate.
- Detected by finding a NULL in the left IN operand when IN is not
- a top level predicate.
- We cannot have an exact match. But we must proceed further with a
- table scan to find out if it's a partial match (and IN has a value
- of NULL) or no match (and IN has a value of FALSE).
- So we return FALSE to continue with the scan and see if there are
- any record that would constitute a partial match (as we cannot
- determine that from the index).
- 3. Error converting the left IN operand to the column type of the
- right IN operand. This counts as no match (and IN has the value of
- FALSE). We mark the subquery table cursor as having no more rows
- (to ensure that the processing that follows will not find a match)
- and return FALSE, so IN is not treated as returning NULL.
+/**
+ Copy ref key for index access into the only subquery table.
+ @details
+ Copy ref key and check for conversion problems.
+ If there is an error converting the left IN operand to the column type of
+ the right IN operand count it as no match. In this case IN has the value of
+ FALSE. We mark the subquery table cursor as having no more rows (to ensure
+ that the processing that follows will not find a match) and return FALSE,
+ so IN is not treated as returning NULL.
- RETURN
- FALSE - The value of the IN predicate is not known. Proceed to find the
- value of the IN predicate using the determined values of
- null_keypart and table->status.
- TRUE - IN predicate has a value of NULL. Stop the processing right there
- and return NULL to the outer predicates.
+ @returns
+ @retval FALSE The outer ref was copied into an index lookup key.
+ @retval TRUE The outer ref cannot possibly match any row, IN is FALSE.
*/
-bool subselect_uniquesubquery_engine::copy_ref_key()
+bool subselect_uniquesubquery_engine::copy_ref_key(bool skip_constants)
{
DBUG_ENTER("subselect_uniquesubquery_engine::copy_ref_key");
for (store_key **copy= tab->ref.key_copy ; *copy ; copy++)
{
- if ((*copy)->store_key_is_const())
- continue;
- tab->ref.key_err= (*copy)->copy();
-
- /*
- When there is a NULL part in the key we don't need to make index
- lookup for such key thus we don't need to copy whole key.
- If we later should do a sequential scan return OK. Fail otherwise.
-
- See also the comment for the subselect_uniquesubquery_engine::exec()
- function.
- */
- null_keypart= (*copy)->null_key;
- if (null_keypart)
- {
- bool top_level= ((Item_in_subselect *) item)->is_top_level_item();
- if (top_level)
- {
- /* Partial match on top level */
- DBUG_RETURN(1);
- }
- else
- {
- /* No exact match when IN is nested inside another predicate */
- break;
- }
- }
-
- /*
- Check if the error is equal to STORE_KEY_FATAL. This is not expressed
- using the store_key::store_key_result enum because ref.key_err is a
- boolean and we want to detect both TRUE and STORE_KEY_FATAL from the
- space of the union of the values of [TRUE, FALSE] and
- store_key::store_key_result.
- TODO: fix the variable an return types.
- */
- if (tab->ref.key_err & 1)
- {
- /*
- Error converting the left IN operand to the column type of the right
- IN operand.
- */
- tab->table->status= STATUS_NOT_FOUND;
- break;
- }
- }
- DBUG_RETURN(0);
-}
-
-
-/*
- @retval 1 A NULL was found in the outer reference, index lookup is
- not applicable, the outer ref is unsusable as a lookup key,
- use some other method to find a match.
- @retval 0 The outer ref was copied into an index lookup key.
- @retval -1 The outer ref cannot possibly match any row, IN is FALSE.
-*/
-/* TIMOUR: this method is a variant of copy_ref_key(), needs refactoring. */
-
-int subselect_uniquesubquery_engine::copy_ref_key_simple()
-{
- for (store_key **copy= tab->ref.key_copy ; *copy ; copy++)
- {
enum store_key::store_key_result store_res;
+ if (skip_constants && (*copy)->store_key_is_const())
+ continue;
store_res= (*copy)->copy();
tab->ref.key_err= store_res;
- /*
- When there is a NULL part in the key we don't need to make index
- lookup for such key thus we don't need to copy whole key.
- If we later should do a sequential scan return OK. Fail otherwise.
-
- See also the comment for the subselect_uniquesubquery_engine::exec()
- function.
- */
- null_keypart= (*copy)->null_key;
- if (null_keypart)
- return 1;
-
- /*
- Check if the error is equal to STORE_KEY_FATAL. This is not expressed
- using the store_key::store_key_result enum because ref.key_err is a
- boolean and we want to detect both TRUE and STORE_KEY_FATAL from the
- space of the union of the values of [TRUE, FALSE] and
- store_key::store_key_result.
- TODO: fix the variable an return types.
- */
if (store_res == store_key::STORE_KEY_FATAL)
{
/*
Error converting the left IN operand to the column type of the right
IN operand.
*/
- return -1;
+ DBUG_RETURN(true);
}
}
- return 0;
+ DBUG_RETURN(false);
}
-/*
- Execute subselect
-
- SYNOPSIS
- subselect_uniquesubquery_engine::exec()
+/**
+ Execute subselect via unique index lookup
- DESCRIPTION
+ @details
Find rows corresponding to the ref key using index access.
If some part of the lookup key is NULL, then we're evaluating
NULL IN (SELECT ... )
@@ -3430,11 +3359,11 @@ int subselect_uniquesubquery_engine::copy_ref_key_simple()
The result of this function (info about whether a row was found) is
stored in this->empty_result_set.
- NOTE
- RETURN
- FALSE - ok
- TRUE - an error occured while scanning
+ @returns
+ @retval 0 OK
+ @retval 1 notify caller to call Item_subselect::reset(),
+ in most cases reset() sets the result to NULL
*/
int subselect_uniquesubquery_engine::exec()
@@ -3444,32 +3373,30 @@ int subselect_uniquesubquery_engine::exec()
TABLE *table= tab->table;
empty_result_set= TRUE;
table->status= 0;
+ Item_in_subselect *in_subs= (Item_in_subselect *) item;
+
+ if (!tab->preread_init_done && tab->preread_init())
+ DBUG_RETURN(1);
- /* TODO: change to use of 'full_scan' here? */
- if (copy_ref_key())
+ if (in_subs->left_expr_has_null())
{
/*
- TIMOUR: copy_ref_key() == 1 means NULL result, not error, why return 1?
- Check who reiles on this result.
+ The case when all values in left_expr are NULL is handled by
+ Item_in_optimizer::val_int().
*/
- DBUG_RETURN(1);
+ if (in_subs->is_top_level_item())
+ DBUG_RETURN(1); /* notify caller to call reset() and set NULL value. */
+ else
+ DBUG_RETURN(scan_table());
}
- if (table->status)
+
+ if (copy_ref_key(true))
{
- /*
- We know that there will be no rows even if we scan.
- Can be set in copy_ref_key.
- */
- ((Item_in_subselect *) item)->value= 0;
+ /* We know that there will be no rows even if we scan. */
+ in_subs->value= 0;
DBUG_RETURN(0);
}
- if (!tab->preread_init_done && tab->preread_init())
- DBUG_RETURN(1);
-
- if (null_keypart)
- DBUG_RETURN(scan_table());
-
if (!table->file->inited)
table->file->ha_index_init(tab->ref.key, 0);
error= table->file->ha_index_read_map(table->record[0],
@@ -3545,14 +3472,10 @@ subselect_uniquesubquery_engine::~subselect_uniquesubquery_engine()
}
-/*
- Index-lookup subselect 'engine' - run the subquery
-
- SYNOPSIS
- subselect_indexsubquery_engine:exec()
- full_scan
+/**
+ Execute subselect via unique index lookup
- DESCRIPTION
+ @details
The engine is used to resolve subqueries in form
oe IN (SELECT key FROM tbl WHERE subq_where)
@@ -3567,7 +3490,7 @@ subselect_uniquesubquery_engine::~subselect_uniquesubquery_engine()
row that satisfies subq_where. If found, return NULL, otherwise
return FALSE.
- TODO
+ @todo
The step #1 can be optimized further when the index has several key
parts. Consider a subquery:
@@ -3592,9 +3515,10 @@ subselect_uniquesubquery_engine::~subselect_uniquesubquery_engine()
cheaper. We can use index statistics to quickly check whether "ref" scan
will be cheaper than full table scan.
- RETURN
- 0
- 1
+ @returns
+ @retval 0 OK
+ @retval 1 notify caller to call Item_subselect::reset(),
+ in most cases reset() sets the result to NULL
*/
int subselect_indexsubquery_engine::exec()
@@ -3603,10 +3527,10 @@ int subselect_indexsubquery_engine::exec()
int error;
bool null_finding= 0;
TABLE *table= tab->table;
+ Item_in_subselect *in_subs= (Item_in_subselect *) item;
((Item_in_subselect *) item)->value= 0;
empty_result_set= TRUE;
- null_keypart= 0;
table->status= 0;
if (check_null)
@@ -3616,25 +3540,27 @@ int subselect_indexsubquery_engine::exec()
((Item_in_subselect *) item)->was_null= 0;
}
- /* Copy the ref key and check for nulls... */
- if (copy_ref_key())
+ if (!tab->preread_init_done && tab->preread_init())
DBUG_RETURN(1);
- if (table->status)
+ if (in_subs->left_expr_has_null())
{
- /*
- We know that there will be no rows even if we scan.
- Can be set in copy_ref_key.
+ /*
+ The case when all values in left_expr are NULL is handled by
+ Item_in_optimizer::val_int().
*/
- ((Item_in_subselect *) item)->value= 0;
- DBUG_RETURN(0);
+ if (in_subs->is_top_level_item())
+ DBUG_RETURN(1); /* notify caller to call reset() and set NULL value. */
+ else
+ DBUG_RETURN(scan_table());
}
- if (!tab->preread_init_done && tab->preread_init())
- DBUG_RETURN(1);
-
- if (null_keypart)
- DBUG_RETURN(scan_table());
+ if (copy_ref_key(true))
+ {
+ /* We know that there will be no rows even if we scan. */
+ in_subs->value= 0;
+ DBUG_RETURN(0);
+ }
if (!table->file->inited)
table->file->ha_index_init(tab->ref.key, 1);
@@ -5168,10 +5094,20 @@ Ordered_key::cmp_keys_by_row_data(ha_rows a, ha_rows b)
rowid_a= row_num_to_rowid + a * rowid_length;
rowid_b= row_num_to_rowid + b * rowid_length;
/* Fetch the rows for comparison. */
- error= tbl->file->ha_rnd_pos(tbl->record[0], rowid_a);
- DBUG_ASSERT(!error);
- error= tbl->file->ha_rnd_pos(tbl->record[1], rowid_b);
- DBUG_ASSERT(!error);
+ if ((error= tbl->file->ha_rnd_pos(tbl->record[0], rowid_a)))
+ {
+ /* purecov: begin inspected */
+ tbl->file->print_error(error, MYF(ME_FATALERROR)); // Sets fatal_error
+ return 0;
+ /* purecov: end */
+ }
+ if ((error= tbl->file->ha_rnd_pos(tbl->record[1], rowid_b)))
+ {
+ /* purecov: begin inspected */
+ tbl->file->print_error(error, MYF(ME_FATALERROR)); // Sets fatal_error
+ return 0;
+ /* purecov: end */
+ }
/*
Compare the two rows by the corresponding values of the indexed
columns.
@@ -5247,8 +5183,13 @@ int Ordered_key::cmp_key_with_search_key(rownum_t row_num)
int __attribute__((unused)) error;
int cmp_res;
- error= tbl->file->ha_rnd_pos(tbl->record[0], cur_rowid);
- DBUG_ASSERT(!error);
+ if ((error= tbl->file->ha_rnd_pos(tbl->record[0], cur_rowid)))
+ {
+ /* purecov: begin inspected */
+ tbl->file->print_error(error, MYF(ME_FATALERROR)); // Sets fatal_error
+ return 0;
+ /* purecov: end */
+ }
for (uint i= 0; i < key_column_count; i++)
{
@@ -5390,37 +5331,42 @@ subselect_partial_match_engine::subselect_partial_match_engine(
int subselect_partial_match_engine::exec()
{
Item_in_subselect *item_in= (Item_in_subselect *) item;
- int copy_res, lookup_res;
+ int lookup_res;
- /* Try to find a matching row by index lookup. */
- copy_res= lookup_engine->copy_ref_key_simple();
- if (copy_res == -1)
- {
- /* The result is FALSE based on the outer reference. */
- item_in->value= 0;
- item_in->null_value= 0;
- return 0;
- }
- else if (copy_res == 0)
+ DBUG_ASSERT(!(item_in->left_expr_has_null() &&
+ item_in->is_top_level_item()));
+
+ if (!item_in->left_expr_has_null())
{
- /* Search for a complete match. */
- if ((lookup_res= lookup_engine->index_lookup()))
+ /* Try to find a matching row by index lookup. */
+ if (lookup_engine->copy_ref_key(false))
{
- /* An error occured during lookup(). */
+ /* The result is FALSE based on the outer reference. */
item_in->value= 0;
item_in->null_value= 0;
- return lookup_res;
+ return 0;
}
- else if (item_in->value || !count_columns_with_nulls)
+ else
{
- /*
- A complete match was found, the result of IN is TRUE.
- If no match was found, and there are no NULLs in the materialized
- subquery, then the result is guaranteed to be false because this
- branch is executed when the outer reference has no NULLs as well.
- Notice: (this->item == lookup_engine->item)
- */
- return 0;
+ /* Search for a complete match. */
+ if ((lookup_res= lookup_engine->index_lookup()))
+ {
+ /* An error occured during lookup(). */
+ item_in->value= 0;
+ item_in->null_value= 0;
+ return lookup_res;
+ }
+ else if (item_in->value || !count_columns_with_nulls)
+ {
+ /*
+ A complete match was found, the result of IN is TRUE.
+ If no match was found, and there are no NULLs in the materialized
+ subquery, then the result is guaranteed to be false because this
+ branch is executed when the outer reference has no NULLs as well.
+ Notice: (this->item == lookup_engine->item)
+ */
+ return 0;
+ }
}
}
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 05c4528490f..2a64c63a1be 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -591,6 +591,7 @@ public:
/* Inform 'this' that it was computed, and contains a valid result. */
void set_first_execution() { if (first_execution) first_execution= FALSE; }
bool expr_cache_is_needed(THD *thd);
+ inline bool left_expr_has_null();
int optimize(double *out_rows, double *cost);
/*
@@ -869,7 +870,6 @@ protected:
expression is NULL.
*/
bool empty_result_set;
- bool null_keypart; /* TRUE <=> constructed search tuple has a NULL */
public:
// constructor can assign THD because it will be called after JOIN::prepare
@@ -893,8 +893,7 @@ public:
bool no_tables();
int index_lookup(); /* TIMOUR: this method needs refactoring. */
int scan_table();
- bool copy_ref_key();
- int copy_ref_key_simple(); /* TIMOUR: this method needs refactoring. */
+ bool copy_ref_key(bool skip_constants);
bool no_rows() { return empty_result_set; }
virtual enum_engine_type engine_type() { return UNIQUESUBQUERY_ENGINE; }
};
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 857d9bc2080..117276e488b 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -361,9 +361,8 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
{
uint days;
days= calc_daynr(l_time->year,1,1) + yearday - 1;
- if (days <= 0 || days > MAX_DAY_NUMBER)
+ if (get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day))
goto err;
- get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day);
}
if (week_number >= 0 && weekday)
@@ -408,9 +407,8 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
(weekday - 1);
}
- if (days <= 0 || days > MAX_DAY_NUMBER)
+ if (get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day))
goto err;
- get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day);
}
if (l_time->month > 12 || l_time->day > 31 || l_time->hour > 23 ||
@@ -768,7 +766,7 @@ longlong Item_func_to_days::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE))
+ if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE))
return 0;
return (longlong) calc_daynr(ltime.year,ltime.month,ltime.day);
}
@@ -808,7 +806,7 @@ longlong Item_func_to_seconds::val_int()
MYSQL_TIME ltime;
longlong seconds;
longlong days;
- if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE))
+ if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE))
return 0;
seconds= ltime.hour * 3600L + ltime.minute * 60 + ltime.second;
seconds=ltime.neg ? -seconds : seconds;
@@ -1501,10 +1499,11 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
if ((fuzzy_date & TIME_NO_ZERO_DATE) && value == 0)
return (null_value= 1);
bzero(ltime, sizeof(MYSQL_TIME));
- get_date_from_daynr((long) value, &ltime->year, &ltime->month, &ltime->day);
+ if (get_date_from_daynr((long) value, &ltime->year, &ltime->month,
+ &ltime->day))
+ return (null_value= 1);
- if ((fuzzy_date & TIME_NO_ZERO_DATE) &&
- (ltime->year == 0 || ltime->month == 0 || ltime->day == 0))
+ if ((fuzzy_date & TIME_NO_ZERO_DATE) && ltime->year == 0)
return (null_value= 1);
ltime->time_type= MYSQL_TIMESTAMP_DATE;
@@ -2043,7 +2042,7 @@ bool Item_date_add_interval::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
{
INTERVAL interval;
- if (args[0]->get_date(ltime, TIME_NO_ZERO_DATE | TIME_FUZZY_DATE) ||
+ if (args[0]->get_date(ltime, TIME_NO_ZERO_DATE | TIME_FUZZY_DATE | TIME_NO_ZERO_IN_DATE) ||
get_interval_value(args[1], int_type, &interval))
return (null_value=1);
@@ -2514,14 +2513,12 @@ bool Item_func_makedate::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
year= year_2000_handling(year);
days= calc_daynr(year,1,1) + daynr - 1;
- /* Day number from year 0 to 9999-12-31 */
- if (days >= 0 && days <= MAX_DAY_NUMBER)
- {
- bzero(ltime, sizeof(*ltime));
- ltime->time_type= MYSQL_TIMESTAMP_DATE;
- get_date_from_daynr(days, &ltime->year, &ltime->month, &ltime->day);
- return (null_value= 0);
- }
+ if (get_date_from_daynr(days, &ltime->year, &ltime->month, &ltime->day))
+ goto err;
+ ltime->time_type= MYSQL_TIMESTAMP_DATE;
+ ltime->neg= 0;
+ ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
+ return (null_value= 0);
err:
return (null_value= 1);
@@ -2615,8 +2612,8 @@ bool Item_func_add_time::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
if (!is_time)
{
- get_date_from_daynr(days,&ltime->year,&ltime->month,&ltime->day);
- if (!ltime->day)
+ if (get_date_from_daynr(days,&ltime->year,&ltime->month,&ltime->day) ||
+ !ltime->day)
return (null_value= 1);
return (null_value= 0);
}
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 0fa2d39aea9..ae0a74c5ba6 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -2601,6 +2601,8 @@ void Item_xml_str_func::fix_length_and_dec()
MY_XPATH xpath;
int rc;
+ status_var_increment(current_thd->status_var.feature_xml);
+
nodeset_func= 0;
if (agg_arg_charsets_for_comparison(collation, args, arg_count))
diff --git a/sql/lex.h b/sql/lex.h
index 9756d5bc7cc..0af44234fca 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -302,6 +302,7 @@ static SYMBOL symbols[] = {
{ "KILL", SYM(KILL_SYM)},
{ "LANGUAGE", SYM(LANGUAGE_SYM)},
{ "LAST", SYM(LAST_SYM)},
+ { "LAST_VALUE", SYM(LAST_VALUE)},
{ "LEADING", SYM(LEADING)},
{ "LEAVE", SYM(LEAVE_SYM)},
{ "LEAVES", SYM(LEAVES)},
@@ -515,6 +516,7 @@ static SYMBOL symbols[] = {
{ "SIGNED", SYM(SIGNED_SYM)},
{ "SIMPLE", SYM(SIMPLE_SYM)},
{ "SLAVE", SYM(SLAVE)},
+ { "SLAVES", SYM(SLAVES)},
{ "SLOW", SYM(SLOW)},
{ "SNAPSHOT", SYM(SNAPSHOT_SYM)},
{ "SMALLINT", SYM(SMALLINT)},
diff --git a/sql/log.cc b/sql/log.cc
index 527ea133eae..5c21fa21f97 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -40,6 +40,7 @@
#include "rpl_rli.h"
#include "sql_audit.h"
#include "log_slow.h"
+#include "mysqld.h"
#include <my_dir.h>
#include <stdarg.h>
@@ -52,6 +53,7 @@
#include "sql_plugin.h"
#include "rpl_handler.h"
#include "debug_sync.h"
+#include "sql_show.h"
/* max size of the log message */
#define MAX_LOG_BUFFER_SIZE 1024
@@ -478,6 +480,14 @@ public:
*/
bool using_xa;
my_xid xa_xid;
+ bool need_unlog;
+ /*
+ Id of binlog that transaction was written to; only needed if need_unlog is
+ true.
+ */
+ ulong binlog_id;
+ /* Set if we get an error during commit that must be returned from unlog(). */
+ bool delayed_error;
private:
@@ -1664,6 +1674,20 @@ binlog_flush_cache(THD *thd, binlog_cache_mngr *cache_mngr,
end_ev, all,
using_stmt, using_trx);
}
+ else
+ {
+ /*
+ This can happen in row-format binlog with something like
+ BEGIN; INSERT INTO nontrans_table; INSERT IGNORE INTO trans_table;
+ The nontrans_table is written directly into the binlog before commit,
+ and if the trans_table is ignored there will be no rows to write when
+ we get here.
+
+ So there is no work to do. Therefore, we will not increment any XID
+ count, so we must not decrement any XID count in unlog().
+ */
+ cache_mngr->need_unlog= 0;
+ }
cache_mngr->reset(using_stmt, using_trx);
DBUG_ASSERT((!using_stmt || cache_mngr->stmt_cache.empty()) &&
@@ -2071,9 +2095,8 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv)
String log_query;
if (log_query.append(STRING_WITH_LEN("SAVEPOINT ")) ||
- log_query.append("`") ||
- log_query.append(thd->lex->ident.str, thd->lex->ident.length) ||
- log_query.append("`"))
+ append_identifier(thd, &log_query,
+ thd->lex->ident.str, thd->lex->ident.length))
DBUG_RETURN(1);
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(),
@@ -2111,9 +2134,8 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
{
String log_query;
if (log_query.append(STRING_WITH_LEN("ROLLBACK TO ")) ||
- log_query.append("`") ||
- log_query.append(thd->lex->ident.str, thd->lex->ident.length) ||
- log_query.append("`"))
+ append_identifier(thd, &log_query,
+ thd->lex->ident.str, thd->lex->ident.length))
DBUG_RETURN(1);
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
Query_log_event qinfo(thd, log_query.ptr(), log_query.length(),
@@ -2850,7 +2872,10 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
{
end= strxmov(buff, "# administrator command: ", NullS);
buff_len= (ulong) (end - buff);
- my_b_write(&log_file, (uchar*) buff, buff_len);
+ DBUG_EXECUTE_IF("simulate_slow_log_write_error",
+ {DBUG_SET("+d,simulate_file_write_error");});
+ if(my_b_write(&log_file, (uchar*) buff, buff_len))
+ tmp_errno= errno;
}
if (my_b_write(&log_file, (uchar*) sql_text, sql_text_len) ||
my_b_write(&log_file, (uchar*) ";\n",2) ||
@@ -2900,15 +2925,16 @@ const char *MYSQL_LOG::generate_name(const char *log_name,
MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period)
- :bytes_written(0), prepared_xids(0), file_id(1), open_count(1),
- need_start_event(TRUE),
+ :reset_master_pending(false),
+ bytes_written(0), file_id(1), open_count(1),
group_commit_queue(0), group_commit_queue_busy(FALSE),
num_commits(0), num_group_commits(0),
- sync_period_ptr(sync_period),
+ sync_period_ptr(sync_period), sync_counter(0),
is_relay_log(0), signal_cnt(0),
checksum_alg_reset(BINLOG_CHECKSUM_ALG_UNDEF),
relay_log_checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF),
- description_event_for_exec(0), description_event_for_queue(0)
+ description_event_for_exec(0), description_event_for_queue(0),
+ current_binlog_id(0)
{
/*
We don't want to initialize locks here as such initialization depends on
@@ -2928,23 +2954,39 @@ void MYSQL_BIN_LOG::cleanup()
DBUG_ENTER("cleanup");
if (inited)
{
+ xid_count_per_binlog *b;
+
inited= 0;
close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT);
delete description_event_for_queue;
delete description_event_for_exec;
+
+ while ((b= binlog_xid_count_list.get()))
+ {
+ /*
+ There should be no pending XIDs at shutdown, and only one entry (for
+ the active binlog file) in the list.
+ */
+ DBUG_ASSERT(b->xid_count == 0);
+ DBUG_ASSERT(!binlog_xid_count_list.head());
+ my_free(b);
+ }
+
mysql_mutex_destroy(&LOCK_log);
mysql_mutex_destroy(&LOCK_index);
+ mysql_mutex_destroy(&LOCK_xid_list);
mysql_cond_destroy(&update_cond);
+ mysql_cond_destroy(&COND_queue_busy);
+ mysql_cond_destroy(&COND_xid_list);
}
DBUG_VOID_RETURN;
}
/* Init binlog-specific vars */
-void MYSQL_BIN_LOG::init(bool no_auto_events_arg, ulong max_size_arg)
+void MYSQL_BIN_LOG::init(ulong max_size_arg)
{
DBUG_ENTER("MYSQL_BIN_LOG::init");
- no_auto_events= no_auto_events_arg;
max_size= max_size_arg;
DBUG_PRINT("info",("max_size: %lu", max_size));
DBUG_VOID_RETURN;
@@ -2956,8 +2998,11 @@ void MYSQL_BIN_LOG::init_pthread_objects()
MYSQL_LOG::init_pthread_objects();
mysql_mutex_init(m_key_LOCK_index, &LOCK_index, MY_MUTEX_INIT_SLOW);
mysql_mutex_setflags(&LOCK_index, MYF_NO_DEADLOCK_DETECTION);
+ mysql_mutex_init(key_BINLOG_LOCK_xid_list,
+ &LOCK_xid_list, MY_MUTEX_INIT_FAST);
mysql_cond_init(m_key_update_cond, &update_cond, 0);
mysql_cond_init(m_key_COND_queue_busy, &COND_queue_busy, 0);
+ mysql_cond_init(key_BINLOG_COND_xid_list, &COND_xid_list, 0);
}
@@ -3045,12 +3090,12 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
enum_log_type log_type_arg,
const char *new_name,
enum cache_type io_cache_type_arg,
- bool no_auto_events_arg,
ulong max_size_arg,
bool null_created_arg,
bool need_mutex)
{
File file= -1;
+ xid_count_per_binlog *new_xid_list_entry= NULL, *b;
DBUG_ENTER("MYSQL_BIN_LOG::open");
DBUG_PRINT("enter",("log_type: %d",(int) log_type_arg));
@@ -3106,7 +3151,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
DBUG_RETURN(1); /* all warnings issued */
}
- init(no_auto_events_arg, max_size_arg);
+ init(max_size_arg);
open_count++;
@@ -3130,11 +3175,10 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
write_file_name_to_index_file= 1;
}
- if (need_start_event && !no_auto_events)
{
/*
- In 4.x we set need_start_event=0 here, but in 5.0 we want a Start event
- even if this is not the very first binlog.
+ In 4.x we put Start event only in the first binlog. But from 5.0 we
+ want a Start event even if this is not the very first binlog.
*/
Format_description_log_event s(BINLOG_VERSION);
/*
@@ -3161,6 +3205,60 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
if (s.write(&log_file))
goto err;
bytes_written+= s.data_written;
+
+ if (!is_relay_log)
+ {
+ char buf[FN_REFLEN];
+ /*
+ Construct an entry in the binlog_xid_count_list for the new binlog
+ file (we will not link it into the list until we know the new file
+ is successfully created; otherwise we would have to remove it again
+ if creation failed, which gets tricky since other threads may have
+ seen the entry in the meantime - and we do not want to hold
+ LOCK_xid_list for long periods of time).
+
+ Write the current binlog checkpoint into the log, so XA recovery will
+ know from where to start recovery.
+ */
+ uint off= dirname_length(log_file_name);
+ uint len= strlen(log_file_name) - off;
+ char *entry_mem, *name_mem;
+ if (!(new_xid_list_entry = (xid_count_per_binlog *)
+ my_multi_malloc(MYF(MY_WME),
+ &entry_mem, sizeof(xid_count_per_binlog),
+ &name_mem, len,
+ NULL)))
+ goto err;
+ memcpy(name_mem, log_file_name+off, len);
+ new_xid_list_entry->binlog_name= name_mem;
+ new_xid_list_entry->binlog_name_len= len;
+ new_xid_list_entry->xid_count= 0;
+
+ /*
+ Find the name for the Initial binlog checkpoint.
+
+ Normally this will just be the first entry, as we delete entries
+ when their count drops to zero. But we scan the list to handle any
+ corner case, eg. for the first binlog file opened after startup, the
+ list will be empty.
+ */
+ mysql_mutex_lock(&LOCK_xid_list);
+ I_List_iterator<xid_count_per_binlog> it(binlog_xid_count_list);
+ while ((b= it++) && b->xid_count == 0)
+ ;
+ mysql_mutex_unlock(&LOCK_xid_list);
+ if (!b)
+ b= new_xid_list_entry;
+ strmake(buf, b->binlog_name, b->binlog_name_len);
+ Binlog_checkpoint_log_event ev(buf, len);
+ DBUG_EXECUTE_IF("crash_before_write_checkpoint_event",
+ flush_io_cache(&log_file);
+ mysql_file_sync(log_file.file, MYF(MY_WME));
+ DBUG_SUICIDE(););
+ if (ev.write(&log_file))
+ goto err;
+ bytes_written+= ev.data_written;
+ }
}
if (description_event_for_queue &&
description_event_for_queue->binlog_version>=4)
@@ -3194,7 +3292,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
bytes_written+= description_event_for_queue->data_written;
}
if (flush_io_cache(&log_file) ||
- mysql_file_sync(log_file.file, MYF(MY_WME)))
+ mysql_file_sync(log_file.file, MYF(MY_WME|MY_SYNC_FILESIZE)))
goto err;
mysql_mutex_lock(&LOCK_commit_ordered);
strmake(last_commit_pos_file, log_file_name,
@@ -3224,7 +3322,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
strlen(log_file_name)) ||
my_b_write(&index_file, (uchar*) "\n", 1) ||
flush_io_cache(&index_file) ||
- mysql_file_sync(index_file.file, MYF(MY_WME)))
+ mysql_file_sync(index_file.file, MYF(MY_WME|MY_SYNC_FILESIZE)))
goto err;
#ifdef HAVE_REPLICATION
@@ -3232,6 +3330,23 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
#endif
}
}
+
+ if (!is_relay_log)
+ {
+ /*
+ Now the file was created successfully, so we can link in the entry for
+ the new binlog file in binlog_xid_count_list.
+ */
+ mysql_mutex_lock(&LOCK_xid_list);
+ ++current_binlog_id;
+ new_xid_list_entry->binlog_id= current_binlog_id;
+ /* Remove any initial entries with no pending XIDs. */
+ while ((b= binlog_xid_count_list.head()) && b->xid_count == 0)
+ my_free(binlog_xid_count_list.get());
+ binlog_xid_count_list.push_back(new_xid_list_entry);
+ mysql_mutex_unlock(&LOCK_xid_list);
+ }
+
log_state= LOG_OPENED;
#ifdef HAVE_REPLICATION
@@ -3250,6 +3365,8 @@ err:
Turning logging off for the whole duration of the MySQL server process. \
To turn it on again: fix the cause, \
shutdown the MySQL server and restart it.", name, errno);
+ if (new_xid_list_entry)
+ my_free(new_xid_list_entry);
if (file >= 0)
mysql_file_close(file, MYF(0));
close(LOG_CLOSE_INDEX);
@@ -3314,7 +3431,7 @@ static bool copy_up_file_and_fill(IO_CACHE *index_file, my_off_t offset)
}
/* The following will either truncate the file or fill the end with \n' */
if (mysql_file_chsize(file, offset - init_offset, '\n', MYF(MY_WME)) ||
- mysql_file_sync(file, MYF(MY_WME)))
+ mysql_file_sync(file, MYF(MY_WME|MY_SYNC_FILESIZE)))
goto err;
/* Reset data in old index cache */
@@ -3495,11 +3612,11 @@ err:
/**
Delete all logs refered to in the index file.
- Start writing to a new log file.
The new index file will only contain this file.
- @param thd Thread
+ @param thd Thread
+ @param create_new_log 1 if we should start writing to a new log file
@note
If not called from slave thread, write start event to new log
@@ -3510,7 +3627,7 @@ err:
1 error
*/
-bool MYSQL_BIN_LOG::reset_logs(THD* thd)
+bool MYSQL_BIN_LOG::reset_logs(THD* thd, bool create_new_log)
{
LOG_INFO linfo;
bool error=0;
@@ -3526,6 +3643,67 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
mysql_mutex_lock(&LOCK_log);
mysql_mutex_lock(&LOCK_index);
+ if (!is_relay_log)
+ {
+ /*
+ Mark that a RESET MASTER is in progress.
+ This ensures that a binlog checkpoint will not try to write binlog
+ checkpoint events, which would be useless (as we are deleting the binlog
+ anyway) and could deadlock, as we are holding LOCK_log.
+ */
+ mysql_mutex_lock(&LOCK_xid_list);
+ reset_master_pending= true;
+ mysql_mutex_unlock(&LOCK_xid_list);
+
+ /*
+ We are going to nuke all binary log files.
+ Without binlog, we cannot XA recover prepared-but-not-committed
+ transactions in engines. So force a commit checkpoint first.
+
+ Note that we take and immediately release LOCK_commit_ordered. This has
+ the effect to ensure that any on-going group commit (in
+ trx_group_commit_leader()) has completed before we request the checkpoint,
+ due to the chaining of LOCK_log and LOCK_commit_ordered in that function.
+ (We are holding LOCK_log, so no new group commit can start).
+
+ Without this, it is possible (though perhaps unlikely) that the RESET
+ MASTER could run in-between the write to the binlog and the
+ commit_ordered() in the engine of some transaction, and then a crash
+ later would leave such transaction not recoverable.
+ */
+ mysql_mutex_lock(&LOCK_commit_ordered);
+ mysql_mutex_unlock(&LOCK_commit_ordered);
+
+ mark_xids_active(current_binlog_id, 1);
+ do_checkpoint_request(current_binlog_id);
+
+ /* Now wait for all checkpoint requests and pending unlog() to complete. */
+ mysql_mutex_lock(&LOCK_xid_list);
+ xid_count_per_binlog *b;
+ for (;;)
+ {
+ I_List_iterator<xid_count_per_binlog> it(binlog_xid_count_list);
+ while ((b= it++))
+ {
+ if (b->xid_count > 0)
+ break;
+ }
+ if (!b)
+ break; /* No more pending XIDs */
+ /*
+ Wait until signalled that one more binlog dropped to zero, then check
+ again.
+ */
+ mysql_cond_wait(&COND_xid_list, &LOCK_xid_list);
+ }
+
+ /*
+ Now all XIDs are fully flushed to disk, and we are holding LOCK_log so
+ no new ones will be written. So we can proceed to delete the logs.
+ */
+ mysql_mutex_unlock(&LOCK_xid_list);
+ }
+
/*
The following mutex is needed to ensure that no threads call
'delete thd' as we would then risk missing a 'rollback' from this
@@ -3616,10 +3794,8 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
goto err;
}
}
- if (!thd->slave_thread)
- need_start_event=1;
- if (!open_index_file(index_file_name, 0, FALSE))
- if ((error= open(save_name, log_type, 0, io_cache_type, no_auto_events, max_size, 0, FALSE)))
+ if (create_new_log && !open_index_file(index_file_name, 0, FALSE))
+ if ((error= open(save_name, log_type, 0, io_cache_type, max_size, 0, FALSE)))
goto err;
my_free((void *) save_name);
@@ -3627,6 +3803,31 @@ err:
if (error == 1)
name= const_cast<char*>(save_name);
mysql_mutex_unlock(&LOCK_thread_count);
+
+ if (!is_relay_log)
+ {
+ xid_count_per_binlog *b;
+ /*
+ Remove all entries in the xid_count list except the last.
+ Normally we will just be deleting all the entries that we waited for to
+ drop to zero above. But if we fail during RESET MASTER for some reason
+ then we will not have created any new log file, and we may keep the last
+ of the old entries.
+ */
+ mysql_mutex_lock(&LOCK_xid_list);
+ for (;;)
+ {
+ b= binlog_xid_count_list.head();
+ DBUG_ASSERT(b /* List can never become empty. */);
+ if (b->binlog_id == current_binlog_id)
+ break;
+ DBUG_ASSERT(b->xid_count == 0);
+ my_free(binlog_xid_count_list.get());
+ }
+ reset_master_pending= false;
+ mysql_mutex_unlock(&LOCK_xid_list);
+ }
+
mysql_mutex_unlock(&LOCK_index);
mysql_mutex_unlock(&LOCK_log);
DBUG_RETURN(error);
@@ -3679,7 +3880,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
DBUG_ENTER("purge_first_log");
DBUG_ASSERT(is_open());
- DBUG_ASSERT(rli->slave_running == 1);
+ DBUG_ASSERT(rli->slave_running == MYSQL_SLAVE_RUN_NOT_CONNECT);
DBUG_ASSERT(!strcmp(rli->linfo.log_file_name,rli->event_relay_log_name));
mysql_mutex_lock(&LOCK_index);
@@ -3836,8 +4037,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
if ((error=find_log_pos(&log_info, NullS, 0 /*no mutex*/)))
goto err;
while ((strcmp(to_log,log_info.log_file_name) || (exit_loop=included)) &&
- !is_active(log_info.log_file_name) &&
- !log_in_use(log_info.log_file_name))
+ can_purge_log(log_info.log_file_name))
{
if ((error= register_purge_index_entry(log_info.log_file_name)))
{
@@ -3951,7 +4151,7 @@ int MYSQL_BIN_LOG::sync_purge_index_file()
DBUG_ENTER("MYSQL_BIN_LOG::sync_purge_index_file");
if ((error= flush_io_cache(&purge_index_file)) ||
- (error= my_sync(purge_index_file.file, MYF(MY_WME))))
+ (error= my_sync(purge_index_file.file, MYF(MY_WME|MY_SYNC_FILESIZE))))
DBUG_RETURN(error);
DBUG_RETURN(error);
@@ -4187,8 +4387,7 @@ int MYSQL_BIN_LOG::purge_logs_before_date(time_t purge_time)
goto err;
while (strcmp(log_file_name, log_info.log_file_name) &&
- !is_active(log_info.log_file_name) &&
- !log_in_use(log_info.log_file_name))
+ can_purge_log(log_info.log_file_name))
{
if (!mysql_file_stat(m_key_file_log,
log_info.log_file_name, &stat_area, MYF(0)))
@@ -4243,6 +4442,28 @@ err:
mysql_mutex_unlock(&LOCK_index);
DBUG_RETURN(error);
}
+
+
+bool
+MYSQL_BIN_LOG::can_purge_log(const char *log_file_name)
+{
+ xid_count_per_binlog *b;
+
+ if (is_active(log_file_name))
+ return false;
+ mysql_mutex_lock(&LOCK_xid_list);
+ {
+ I_List_iterator<xid_count_per_binlog> it(binlog_xid_count_list);
+ while ((b= it++) &&
+ 0 != strncmp(log_file_name+dirname_length(log_file_name),
+ b->binlog_name, b->binlog_name_len))
+ ;
+ }
+ mysql_mutex_unlock(&LOCK_xid_list);
+ if (b)
+ return false;
+ return !log_in_use(log_file_name);
+}
#endif /* HAVE_REPLICATION */
@@ -4336,26 +4557,6 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
mysql_mutex_assert_owner(&LOCK_log);
mysql_mutex_assert_owner(&LOCK_index);
- /*
- if binlog is used as tc log, be sure all xids are "unlogged",
- so that on recover we only need to scan one - latest - binlog file
- for prepared xids. As this is expected to be a rare event,
- simple wait strategy is enough. We're locking LOCK_log to be sure no
- new Xid_log_event's are added to the log (and prepared_xids is not
- increased), and waiting on COND_prep_xids for late threads to
- catch up.
- */
- if (prepared_xids)
- {
- tc_log_page_waits++;
- mysql_mutex_lock(&LOCK_prep_xids);
- while (prepared_xids) {
- DBUG_PRINT("info", ("prepared_xids=%lu", prepared_xids));
- mysql_cond_wait(&COND_prep_xids, &LOCK_prep_xids);
- }
- mysql_mutex_unlock(&LOCK_prep_xids);
- }
-
/* Reuse old name if not binlog and not update log */
new_name_ptr= name;
@@ -4370,7 +4571,6 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
if (log_type == LOG_BIN)
{
- if (!no_auto_events)
{
/*
We log the whole file name for log file as the user may decide
@@ -4445,7 +4645,7 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
/* reopen the binary log file. */
file_to_open= new_name_ptr;
error= open(old_name, log_type, new_name_ptr, io_cache_type,
- no_auto_events, max_size, 1, FALSE);
+ max_size, 1, FALSE);
}
/* handle reopening errors */
@@ -4517,7 +4717,7 @@ bool MYSQL_BIN_LOG::append(Log_event* ev)
DBUG_PRINT("info",("max_size: %lu",max_size));
if (flush_and_sync(0))
goto err;
- if ((uint) my_b_append_tell(&log_file) > max_size)
+ if (my_b_append_tell(&log_file) > max_size)
error= new_file_without_locking();
err:
mysql_mutex_unlock(&LOCK_log);
@@ -4548,7 +4748,7 @@ bool MYSQL_BIN_LOG::appendv(const char* buf, uint len,...)
DBUG_PRINT("info",("max_size: %lu",max_size));
if (flush_and_sync(0))
goto err;
- if ((uint) my_b_append_tell(&log_file) > max_size)
+ if (my_b_append_tell(&log_file) > max_size)
error= new_file_without_locking();
err:
if (!error)
@@ -4568,7 +4768,7 @@ bool MYSQL_BIN_LOG::flush_and_sync(bool *synced)
if (sync_period && ++sync_counter >= sync_period)
{
sync_counter= 0;
- err= mysql_file_sync(fd, MYF(MY_WME));
+ err= mysql_file_sync(fd, MYF(MY_WME|MY_SYNC_FILESIZE));
if (synced)
*synced= 1;
#ifndef DBUG_OFF
@@ -5070,6 +5270,8 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
bool is_trans_cache= FALSE;
bool using_trans= event_info->use_trans_cache();
bool direct= event_info->use_direct_logging();
+ ulong prev_binlog_id;
+ LINT_INIT(prev_binlog_id);
if (thd->binlog_evt_union.do_union)
{
@@ -5121,6 +5323,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
file= &log_file;
my_org_b_tell= my_b_tell(file);
mysql_mutex_lock(&LOCK_log);
+ prev_binlog_id= current_binlog_id;
}
else
{
@@ -5266,7 +5469,7 @@ err:
mysql_mutex_unlock(&LOCK_log);
if (check_purge)
- purge();
+ checkpoint_and_purge(prev_binlog_id);
}
if (error)
@@ -5351,6 +5554,64 @@ bool general_log_write(THD *thd, enum enum_server_command command,
return FALSE;
}
+
+/*
+ I would like to make this function static, but this causes compiler warnings
+ when it is declared as friend function in log.h.
+*/
+void
+binlog_checkpoint_callback(void *cookie)
+{
+ MYSQL_BIN_LOG::xid_count_per_binlog *entry=
+ (MYSQL_BIN_LOG::xid_count_per_binlog *)cookie;
+ /*
+ For every supporting engine, we increment the xid_count and issue a
+ commit_checkpoint_request(). Then we can count when all
+ commit_checkpoint_notify() callbacks have occured, and then log a new
+ binlog checkpoint event.
+ */
+ mysql_bin_log.mark_xids_active(entry->binlog_id, 1);
+}
+
+
+/*
+ Request a commit checkpoint from each supporting engine.
+ This must be called after each binlog rotate, and after LOCK_log has been
+ released. The xid_count value in the xid_count_per_binlog entry was
+ incremented by 1 and will be decremented in this function; this ensures
+ that the entry will not go away early despite LOCK_log not being held.
+*/
+void
+MYSQL_BIN_LOG::do_checkpoint_request(ulong binlog_id)
+{
+ xid_count_per_binlog *entry;
+
+ /*
+ Find the binlog entry, and invoke commit_checkpoint_request() on it in
+ each supporting storage engine.
+ */
+ mysql_mutex_lock(&LOCK_xid_list);
+ I_List_iterator<xid_count_per_binlog> it(binlog_xid_count_list);
+ do {
+ entry= it++;
+ DBUG_ASSERT(entry /* binlog_id is always somewhere in the list. */);
+ } while (entry->binlog_id != binlog_id);
+ mysql_mutex_unlock(&LOCK_xid_list);
+
+ ha_commit_checkpoint_request(entry, binlog_checkpoint_callback);
+ /*
+ When we rotated the binlog, we incremented xid_count to make sure the
+ entry would not go away until this point, where we have done all necessary
+ commit_checkpoint_request() calls.
+ So now we can (and must) decrease the count - when it reaches zero, we
+ will know that both all pending unlog() and all pending
+ commit_checkpoint_notify() calls are done, and we can log a new binlog
+ checkpoint.
+ */
+ mark_xid_done(binlog_id, true);
+}
+
+
/**
The method executes rotation when LOCK_log is already acquired
by the caller.
@@ -5359,6 +5620,15 @@ bool general_log_write(THD *thd, enum enum_server_command command,
@param check_purge is set to true if rotation took place
@note
+ Caller _must_ check the check_purge variable. If this is set, it means
+ that the binlog was rotated, and caller _must_ ensure that
+ do_checkpoint_request() is called later with the binlog_id of the rotated
+ binlog file. The call to do_checkpoint_request() must happen after
+ LOCK_log is released (which is why we cannot simply do it here).
+ Usually, checkpoint_and_purge() is appropriate, as it will both handle
+ the checkpointing and any needed purging of old logs.
+
+ @note
If rotation fails, for instance the server was unable
to create a new log file, we still try to write an
incident event to the current log.
@@ -5376,7 +5646,27 @@ int MYSQL_BIN_LOG::rotate(bool force_rotate, bool* check_purge)
if (force_rotate || (my_b_tell(&log_file) >= (my_off_t) max_size))
{
+ ulong binlog_id= current_binlog_id;
+ /*
+ We rotate the binlog, so we need to start a commit checkpoint in all
+ supporting engines - when it finishes, we can log a new binlog checkpoint
+ event.
+
+ But we cannot start the checkpoint here - there could be a group commit
+ still in progress which needs to be included in the checkpoint, and
+ besides we do not want to do the (possibly expensive) checkpoint while
+ LOCK_log is held.
+
+ On the other hand, we must be sure that the xid_count entry for the
+ previous log does not go away until we start the checkpoint - which it
+ could do as it is no longer the most recent. So we increment xid_count
+ (to count the pending checkpoint request) - this will fix the entry in
+ place until we decrement again in do_checkpoint_request().
+ */
+ mark_xids_active(binlog_id, 1);
+
if ((error= new_file_without_locking()))
+ {
/**
Be conservative... There are possible lost events (eg,
failing to log the Execute_load_query_log_event
@@ -5389,7 +5679,14 @@ int MYSQL_BIN_LOG::rotate(bool force_rotate, bool* check_purge)
if (!write_incident_already_locked(current_thd))
flush_and_sync(0);
- *check_purge= true;
+ /*
+ We failed to rotate - so we have to decrement the xid_count back that
+ we incremented before attempting the rotate.
+ */
+ mark_xid_done(binlog_id, false);
+ }
+ else
+ *check_purge= true;
}
DBUG_RETURN(error);
}
@@ -5417,6 +5714,13 @@ void MYSQL_BIN_LOG::purge()
#endif
}
+
+void MYSQL_BIN_LOG::checkpoint_and_purge(ulong binlog_id)
+{
+ do_checkpoint_request(binlog_id);
+ purge();
+}
+
/**
The method is a shortcut of @c rotate() and @c purge().
LOCK_log is acquired prior to rotate and is released after it.
@@ -5429,11 +5733,13 @@ void MYSQL_BIN_LOG::purge()
int MYSQL_BIN_LOG::rotate_and_purge(bool force_rotate)
{
int error= 0;
+ ulong prev_binlog_id;
DBUG_ENTER("MYSQL_BIN_LOG::rotate_and_purge");
bool check_purge= false;
//todo: fix the macro def and restore safe_mutex_assert_not_owner(&LOCK_log);
mysql_mutex_lock(&LOCK_log);
+ prev_binlog_id= current_binlog_id;
if ((error= rotate(force_rotate, &check_purge)))
check_purge= false;
/*
@@ -5443,7 +5749,7 @@ int MYSQL_BIN_LOG::rotate_and_purge(bool force_rotate)
mysql_mutex_unlock(&LOCK_log);
if (check_purge)
- purge();
+ checkpoint_and_purge(prev_binlog_id);
DBUG_RETURN(error);
}
@@ -5774,11 +6080,13 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd)
uint error= 0;
my_off_t offset;
bool check_purge= false;
+ ulong prev_binlog_id;
DBUG_ENTER("MYSQL_BIN_LOG::write_incident");
mysql_mutex_lock(&LOCK_log);
if (likely(is_open()))
{
+ prev_binlog_id= current_binlog_id;
if (!(error= write_incident_already_locked(thd)) &&
!(error= flush_and_sync(0)))
{
@@ -5798,12 +6106,51 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd)
mysql_mutex_unlock(&LOCK_log);
if (check_purge)
- purge();
+ checkpoint_and_purge(prev_binlog_id);
}
DBUG_RETURN(error);
}
+void
+MYSQL_BIN_LOG::write_binlog_checkpoint_event_already_locked(const char *name,
+ uint len)
+{
+ my_off_t offset;
+ Binlog_checkpoint_log_event ev(name, len);
+ /*
+ Note that we must sync the binlog checkpoint to disk.
+ Otherwise a subsequent log purge could delete binlogs that XA recovery
+ thinks are needed (even though they are not really).
+ */
+ if (!ev.write(&log_file) && !flush_and_sync(0))
+ {
+ signal_update();
+ }
+ else
+ {
+ /*
+ If we fail to write the checkpoint event, something is probably really
+ bad with the binlog. We complain in the error log.
+
+ Note that failure to write binlog checkpoint does not compromise the
+ ability to do crash recovery - crash recovery will just have to scan a
+ bit more of the binlog than strictly necessary.
+ */
+ sql_print_error("Failed to write binlog checkpoint event to binary log\n");
+ }
+
+ offset= my_b_tell(&log_file);
+ /*
+ Take mutex to protect against a reader seeing partial writes of 64-bit
+ offset on 32-bit CPUs.
+ */
+ mysql_mutex_lock(&LOCK_commit_ordered);
+ last_commit_pos_offset= offset;
+ mysql_mutex_unlock(&LOCK_commit_ordered);
+}
+
+
/**
Write a cached log entry to the binary log.
- To support transaction over replication, we wrap the transaction
@@ -5836,6 +6183,7 @@ MYSQL_BIN_LOG::write_transaction_to_binlog(THD *thd,
bool using_trx_cache)
{
group_commit_entry entry;
+ Ha_trx_info *ha_info;
DBUG_ENTER("MYSQL_BIN_LOG::write_transaction_to_binlog");
entry.thd= thd;
@@ -5844,6 +6192,15 @@ MYSQL_BIN_LOG::write_transaction_to_binlog(THD *thd,
entry.all= all;
entry.using_stmt_cache= using_stmt_cache;
entry.using_trx_cache= using_trx_cache;
+ entry.need_unlog= false;
+ ha_info= all ? thd->transaction.all.ha_list : thd->transaction.stmt.ha_list;
+ for (; ha_info; ha_info= ha_info->next())
+ {
+ if (ha_info->is_started() && ha_info->ht() != binlog_hton &&
+ !ha_info->ht()->commit_checkpoint_request)
+ entry.need_unlog= true;
+ break;
+ }
/*
Log "BEGIN" at the beginning of every transaction. Here, a transaction is
@@ -5932,6 +6289,18 @@ MYSQL_BIN_LOG::write_transaction_to_binlog_events(group_commit_entry *entry)
{
next->thd->signal_wakeup_ready();
}
+ else
+ {
+ /*
+ If we rotated the binlog, and if we are using the unoptimized thread
+ scheduling where every thread runs its own commit_ordered(), then we
+ must do the commit checkpoint and log purge here, after all
+ commit_ordered() calls have finished, and locks have been released.
+ */
+ if (entry->check_purge)
+ checkpoint_and_purge(entry->binlog_id);
+ }
+
}
if (likely(!entry->error))
@@ -5962,8 +6331,9 @@ MYSQL_BIN_LOG::write_transaction_to_binlog_events(group_commit_entry *entry)
we need to mark it as not needed for recovery (unlog() is not called
for a transaction if log_xid() fails).
*/
- if (entry->cache_mngr->using_xa && entry->cache_mngr->xa_xid)
- mark_xid_done();
+ if (entry->cache_mngr->using_xa && entry->cache_mngr->xa_xid &&
+ entry->cache_mngr->need_unlog)
+ mark_xid_done(entry->cache_mngr->binlog_id, true);
return 1;
}
@@ -5983,11 +6353,12 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
{
uint xid_count= 0;
my_off_t UNINIT_VAR(commit_offset);
- group_commit_entry *current;
- group_commit_entry *last_in_queue;
+ group_commit_entry *current, *last_in_queue;
group_commit_entry *queue= NULL;
bool check_purge= false;
+ ulong binlog_id;
DBUG_ENTER("MYSQL_BIN_LOG::trx_group_commit_leader");
+ LINT_INIT(binlog_id);
DBUG_ASSERT(is_open());
if (likely(is_open())) // Should always be true
@@ -5998,6 +6369,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
*/
mysql_mutex_lock(&LOCK_log);
DEBUG_SYNC(leader->thd, "commit_after_get_LOCK_log");
+ binlog_id= current_binlog_id;
mysql_mutex_lock(&LOCK_prepare_ordered);
current= group_commit_queue;
@@ -6044,7 +6416,24 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
commit_offset= my_b_write_tell(&log_file);
cache_mngr->last_commit_pos_offset= commit_offset;
if (cache_mngr->using_xa && cache_mngr->xa_xid)
- xid_count++;
+ {
+ /*
+ If all storage engines support commit_checkpoint_request(), then we
+ do not need to keep track of when this XID is durably committed.
+ Instead we will just ask the storage engine to durably commit all its
+ XIDs when we rotate a binlog file.
+ */
+ if (current->need_unlog)
+ {
+ xid_count++;
+ cache_mngr->need_unlog= true;
+ cache_mngr->binlog_id= binlog_id;
+ }
+ else
+ cache_mngr->need_unlog= false;
+
+ cache_mngr->delayed_error= false;
+ }
}
bool synced= 0;
@@ -6087,30 +6476,34 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
}
/*
- if any commit_events are Xid_log_event, increase the number of
- prepared_xids (it's decreased in ::unlog()). Binlog cannot be rotated
- if there're prepared xids in it - see the comment in new_file() for
- an explanation.
- If no Xid_log_events (then it's all Query_log_event) rotate binlog,
- if necessary.
+ If any commit_events are Xid_log_event, increase the number of pending
+ XIDs in current binlog (it's decreased in ::unlog()). When the count in
+ a (not active) binlog file reaches zero, we know that it is no longer
+ needed in XA recovery, and we can log a new binlog checkpoint event.
*/
if (xid_count > 0)
{
- mark_xids_active(xid_count);
+ mark_xids_active(binlog_id, xid_count);
}
- else
+
+ if (rotate(false, &check_purge))
{
- if (rotate(false, &check_purge))
- {
- /*
- If we fail to rotate, which thread should get the error?
- We give the error to the *last* transaction thread; that seems to
- make the most sense, as it was the last to write to the log.
- */
- last_in_queue->error= ER_ERROR_ON_WRITE;
- last_in_queue->commit_errno= errno;
- check_purge= false;
- }
+ /*
+ If we fail to rotate, which thread should get the error?
+ We give the error to the leader, as any my_error() thrown inside
+ rotate() will have been registered for the leader THD.
+
+ However we must not return error from here - that would cause
+ ha_commit_trans() to abort and rollback the transaction, which would
+ leave an inconsistent state with the transaction committed in the
+ binlog but rolled back in the engine.
+
+ Instead set a flag so that we can return error later, from unlog(),
+ when the transaction has been safely committed in the engine.
+ */
+ leader->cache_mngr->delayed_error= true;
+ my_error(ER_ERROR_ON_WRITE, MYF(ME_NOREFRESH), name, errno);
+ check_purge= false;
}
}
@@ -6125,9 +6518,6 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
*/
mysql_mutex_unlock(&LOCK_log);
- if (check_purge)
- purge();
-
DEBUG_SYNC(leader->thd, "commit_after_release_LOCK_log");
++num_group_commits;
@@ -6145,6 +6535,15 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
mysql_cond_wait(&COND_queue_busy, &LOCK_commit_ordered);
group_commit_queue_busy= TRUE;
+ /*
+ Set these so parent can run checkpoint_and_purge() in last thread.
+ (When using optimized thread scheduling, we run checkpoint_and_purge()
+ in this function, so parent does not need to and we need not set these
+ values).
+ */
+ last_in_queue->check_purge= check_purge;
+ last_in_queue->binlog_id= binlog_id;
+
/* Note that we return with LOCK_commit_ordered locked! */
DBUG_VOID_RETURN;
}
@@ -6160,7 +6559,8 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
DEBUG_SYNC(leader->thd, "commit_loop_entry_commit_ordered");
++num_commits;
- if (current->cache_mngr->using_xa && !current->error)
+ if (current->cache_mngr->using_xa && !current->error &&
+ DBUG_EVALUATE_IF("skip_commit_ordered", 0, 1))
run_commit_ordered(current->thd, current->all);
/*
@@ -6174,6 +6574,10 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
}
DEBUG_SYNC(leader->thd, "commit_after_group_run_commit_ordered");
mysql_mutex_unlock(&LOCK_commit_ordered);
+ DEBUG_SYNC(leader->thd, "commit_after_group_release_commit_ordered");
+
+ if (check_purge)
+ checkpoint_and_purge(binlog_id);
DBUG_VOID_RETURN;
}
@@ -6332,7 +6736,7 @@ void MYSQL_BIN_LOG::close(uint exiting)
if (log_state == LOG_OPENED)
{
#ifdef HAVE_REPLICATION
- if (log_type == LOG_BIN && !no_auto_events &&
+ if (log_type == LOG_BIN &&
(exiting & LOG_CLOSE_STOP_EVENT))
{
Stop_log_event s;
@@ -6590,16 +6994,33 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer,
time_t skr;
struct tm tm_tmp;
struct tm *start;
+ THD *thd;
+ int tag_length= 0;
+ char tag[NAME_LEN];
DBUG_ENTER("print_buffer_to_file");
DBUG_PRINT("enter",("buffer: %s", buffer));
+ if (mysqld_server_initialized && (thd= current_thd))
+ {
+ if (thd->connection_name.length)
+ {
+ /*
+ Add tag for slaves so that the user can see from which connection
+ the error originates.
+ */
+ tag_length= my_snprintf(tag, sizeof(tag), ER(ER_MASTER_LOG_PREFIX),
+ (int) thd->connection_name.length,
+ thd->connection_name.str);
+ }
+ }
+
mysql_mutex_lock(&LOCK_error_log);
skr= my_time(0);
localtime_r(&skr, &tm_tmp);
start=&tm_tmp;
- fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %.*s\n",
+ fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %.*s%.*s\n",
start->tm_year % 100,
start->tm_mon+1,
start->tm_mday,
@@ -6608,6 +7029,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer,
start->tm_sec,
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
"Warning" : "Note"),
+ tag_length, tag,
(int) length, buffer);
fflush(stderr);
@@ -6966,6 +7388,8 @@ int TC_LOG_MMAP::open(const char *opt_name)
mysql_mutex_init(key_LOCK_sync, &LOCK_sync, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_active, &LOCK_active, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_pool, &LOCK_pool, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(key_LOCK_pending_checkpoint, &LOCK_pending_checkpoint,
+ MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_active, &COND_active, 0);
mysql_cond_init(key_COND_pool, &COND_pool, 0);
mysql_cond_init(key_TC_LOG_MMAP_COND_queue_busy, &COND_queue_busy, 0);
@@ -7218,17 +7642,93 @@ int TC_LOG_MMAP::sync()
return err;
}
+static void
+mmap_do_checkpoint_callback(void *data)
+{
+ TC_LOG_MMAP::pending_cookies *pending=
+ static_cast<TC_LOG_MMAP::pending_cookies *>(data);
+ ++pending->pending_count;
+}
+
+int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
+{
+ pending_cookies *full_buffer= NULL;
+ DBUG_ASSERT(*(my_xid *)(data+cookie) == xid);
+
+ /*
+ Do not delete the entry immediately, as there may be participating storage
+ engines which implement commit_checkpoint_request(), and thus have not yet
+ flushed the commit durably to disk.
+
+ Instead put it in a queue - and periodically, we will request a checkpoint
+ from all engines and delete a whole batch at once.
+ */
+ mysql_mutex_lock(&LOCK_pending_checkpoint);
+ if (pending_checkpoint == NULL)
+ {
+ uint32 size= sizeof(*pending_checkpoint);
+ if (!(pending_checkpoint=
+ (pending_cookies *)my_malloc(size, MYF(MY_ZEROFILL))))
+ {
+ my_error(ER_OUTOFMEMORY, MYF(0), size);
+ mysql_mutex_unlock(&LOCK_pending_checkpoint);
+ return 1;
+ }
+ }
+
+ pending_checkpoint->cookies[pending_checkpoint->count++]= cookie;
+ if (pending_checkpoint->count == sizeof(pending_checkpoint->cookies) /
+ sizeof(pending_checkpoint->cookies[0]))
+ {
+ full_buffer= pending_checkpoint;
+ pending_checkpoint= NULL;
+ }
+ mysql_mutex_unlock(&LOCK_pending_checkpoint);
+
+ if (full_buffer)
+ {
+ /*
+ We do an extra increment and notify here - this ensures that
+ things work also if there are no engines at all that support
+ commit_checkpoint_request.
+ */
+ ++full_buffer->pending_count;
+ ha_commit_checkpoint_request(full_buffer, mmap_do_checkpoint_callback);
+ commit_checkpoint_notify(full_buffer);
+ }
+ return 0;
+}
+
+
+void
+TC_LOG_MMAP::commit_checkpoint_notify(void *cookie)
+{
+ uint count;
+ pending_cookies *pending= static_cast<pending_cookies *>(cookie);
+ mysql_mutex_lock(&LOCK_pending_checkpoint);
+ DBUG_ASSERT(pending->pending_count > 0);
+ count= --pending->pending_count;
+ mysql_mutex_unlock(&LOCK_pending_checkpoint);
+ if (count == 0)
+ {
+ uint i;
+ for (i= 0; i < sizeof(pending->cookies)/sizeof(pending->cookies[0]); ++i)
+ delete_entry(pending->cookies[i]);
+ my_free(pending);
+ }
+}
+
+
/**
erase xid from the page, update page free space counters/pointers.
cookie points directly to the memory where xid was logged.
*/
-int TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
+int TC_LOG_MMAP::delete_entry(ulong cookie)
{
PAGE *p=pages+(cookie/tc_log_page_size);
my_xid *x=(my_xid *)(data+cookie);
- DBUG_ASSERT(*x == xid);
DBUG_ASSERT(x >= p->start && x < p->end);
mysql_mutex_lock(&p->lock);
@@ -7252,6 +7752,7 @@ void TC_LOG_MMAP::close()
mysql_mutex_destroy(&LOCK_sync);
mysql_mutex_destroy(&LOCK_active);
mysql_mutex_destroy(&LOCK_pool);
+ mysql_mutex_destroy(&LOCK_pending_checkpoint);
mysql_cond_destroy(&COND_pool);
mysql_cond_destroy(&COND_active);
mysql_cond_destroy(&COND_queue_busy);
@@ -7274,9 +7775,12 @@ void TC_LOG_MMAP::close()
}
if (inited>=5) // cannot do in the switch because of Windows
mysql_file_delete(key_file_tclog, logname, MYF(MY_WME));
+ if (pending_checkpoint)
+ my_free(pending_checkpoint);
inited=0;
}
+
int TC_LOG_MMAP::recover()
{
HASH xids;
@@ -7362,14 +7866,6 @@ int TC_LOG::using_heuristic_recover()
/****** transaction coordinator log for 2pc - binlog() based solution ******/
#define TC_LOG_BINLOG MYSQL_BIN_LOG
-/**
- @todo
- keep in-memory list of prepared transactions
- (add to list in log(), remove on unlog())
- and copy it to the new binlog if rotated
- but let's check the behaviour of tc_log_page_waits first!
-*/
-
int TC_LOG_BINLOG::open(const char *opt_name)
{
LOG_INFO log_info;
@@ -7378,10 +7874,6 @@ int TC_LOG_BINLOG::open(const char *opt_name)
DBUG_ASSERT(total_ha_2pc > 1);
DBUG_ASSERT(opt_name && opt_name[0]);
- mysql_mutex_init(key_BINLOG_LOCK_prep_xids,
- &LOCK_prep_xids, MY_MUTEX_INIT_FAST);
- mysql_cond_init(key_BINLOG_COND_prep_xids, &COND_prep_xids, 0);
-
if (!my_b_inited(&index_file))
{
/* There was a failure to open the index file, can't open the binlog */
@@ -7392,7 +7884,7 @@ int TC_LOG_BINLOG::open(const char *opt_name)
if (using_heuristic_recover())
{
/* generate a new binlog to mask a corrupted one */
- open(opt_name, LOG_BIN, 0, WRITE_CACHE, 0, max_binlog_size, 0, TRUE);
+ open(opt_name, LOG_BIN, 0, WRITE_CACHE, max_binlog_size, 0, TRUE);
cleanup();
return 1;
}
@@ -7440,7 +7932,8 @@ int TC_LOG_BINLOG::open(const char *opt_name)
ev->flags & LOG_EVENT_BINLOG_IN_USE_F)
{
sql_print_information("Recovering after a crash using %s", opt_name);
- error= recover(&log, (Format_description_log_event *)ev);
+ error= recover(&log_info, log_name, &log,
+ (Format_description_log_event *)ev);
}
else
error=0;
@@ -7460,9 +7953,6 @@ err:
/** This is called on shutdown, after ha_panic. */
void TC_LOG_BINLOG::close()
{
- DBUG_ASSERT(prepared_xids==0);
- mysql_mutex_destroy(&LOCK_prep_xids);
- mysql_cond_destroy(&COND_prep_xids);
}
/*
@@ -7486,7 +7976,17 @@ TC_LOG_BINLOG::log_and_order(THD *thd, my_xid xid, bool all,
DEBUG_SYNC(thd, "binlog_after_log_and_order");
- DBUG_RETURN(!err);
+ if (err)
+ DBUG_RETURN(0);
+ /*
+ If using explicit user XA, we will not have XID. We must still return a
+ non-zero cookie (as zero cookie signals error).
+ */
+ if (!xid || !cache_mngr->need_unlog)
+ DBUG_RETURN(BINLOG_COOKIE_DUMMY(cache_mngr->delayed_error));
+ else
+ DBUG_RETURN(BINLOG_COOKIE_MAKE(cache_mngr->binlog_id,
+ cache_mngr->delayed_error));
}
/*
@@ -7501,57 +8001,169 @@ TC_LOG_BINLOG::log_and_order(THD *thd, my_xid xid, bool all,
binary log.
*/
void
-TC_LOG_BINLOG::mark_xids_active(uint xid_count)
+TC_LOG_BINLOG::mark_xids_active(ulong binlog_id, uint xid_count)
{
+ xid_count_per_binlog *b;
+
DBUG_ENTER("TC_LOG_BINLOG::mark_xids_active");
- DBUG_PRINT("info", ("xid_count=%u", xid_count));
- mysql_mutex_lock(&LOCK_prep_xids);
- prepared_xids+= xid_count;
- mysql_mutex_unlock(&LOCK_prep_xids);
+ DBUG_PRINT("info", ("binlog_id=%lu xid_count=%u", binlog_id, xid_count));
+
+ mysql_mutex_lock(&LOCK_xid_list);
+ I_List_iterator<xid_count_per_binlog> it(binlog_xid_count_list);
+ while ((b= it++))
+ {
+ if (b->binlog_id == binlog_id)
+ {
+ b->xid_count += xid_count;
+ break;
+ }
+ }
+ /*
+ As we do not delete elements until count reach zero, elements should always
+ be found.
+ */
+ DBUG_ASSERT(b);
+ mysql_mutex_unlock(&LOCK_xid_list);
DBUG_VOID_RETURN;
}
/*
- Once an XID is committed, it is safe to rotate the binary log, as it can no
- longer be needed during crash recovery.
+ Once an XID is committed, it can no longer be needed during crash recovery,
+ as it has been durably recorded on disk as "committed".
This function is called to mark an XID this way. It needs to decrease the
- count of pending XIDs, and signal the log rotator thread when it reaches zero.
+ count of pending XIDs in the corresponding binlog. When the count reaches
+ zero (for an "old" binlog that is not the active one), that binlog file no
+ longer need to be scanned during crash recovery, so we can log a new binlog
+ checkpoint.
*/
void
-TC_LOG_BINLOG::mark_xid_done()
+TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint)
{
- my_bool send_signal;
+ xid_count_per_binlog *b;
+ bool first;
+ ulong current;
DBUG_ENTER("TC_LOG_BINLOG::mark_xid_done");
- mysql_mutex_lock(&LOCK_prep_xids);
- // prepared_xids can be 0 if the transaction had ignorable errors.
- DBUG_ASSERT(prepared_xids >= 0);
- if (prepared_xids > 0)
- prepared_xids--;
- send_signal= (prepared_xids == 0);
- mysql_mutex_unlock(&LOCK_prep_xids);
- if (send_signal) {
- DBUG_PRINT("info", ("prepared_xids=%lu", prepared_xids));
- mysql_cond_signal(&COND_prep_xids);
+
+ mysql_mutex_lock(&LOCK_xid_list);
+ current= current_binlog_id;
+ I_List_iterator<xid_count_per_binlog> it(binlog_xid_count_list);
+ first= true;
+ while ((b= it++))
+ {
+ if (b->binlog_id == binlog_id)
+ {
+ --b->xid_count;
+ break;
+ }
+ first= false;
+ }
+ /* Binlog is always found, as we do not remove until count reaches 0 */
+ DBUG_ASSERT(b);
+ /*
+ If a RESET MASTER is pending, we are about to remove all log files, and
+ the RESET MASTER thread is waiting for all pending unlog() calls to
+ complete while holding LOCK_log. In this case we should not log a binlog
+ checkpoint event (it would be deleted immediately anyway and we would
+ deadlock on LOCK_log) but just signal the thread.
+ */
+ if (unlikely(reset_master_pending))
+ {
+ mysql_cond_signal(&COND_xid_list);
+ mysql_mutex_unlock(&LOCK_xid_list);
+ DBUG_VOID_RETURN;
+ }
+
+ if (likely(binlog_id == current) || b->xid_count != 0 || !first ||
+ !write_checkpoint)
+ {
+ /* No new binlog checkpoint reached yet. */
+ mysql_mutex_unlock(&LOCK_xid_list);
+ DBUG_VOID_RETURN;
+ }
+
+ /*
+ Now log a binlog checkpoint for the first binlog file with a non-zero count.
+
+ Note that it is possible (though perhaps unlikely) that when count of
+ binlog (N-2) drops to zero, binlog (N-1) is already at zero. So we may
+ need to skip several entries before we find the one to log in the binlog
+ checkpoint event.
+
+ We chain the locking of LOCK_xid_list and LOCK_log, so that we ensure that
+ Binlog_checkpoint_events are logged in order. This simplifies recovery a
+ bit, as it can just take the last binlog checkpoint in the log, rather
+ than compare all found against each other to find the one pointing to the
+ most recent binlog.
+
+ Note also that we need to first release LOCK_xid_list, then aquire
+ LOCK_log, then re-aquire LOCK_xid_list. If we were to take LOCK_log while
+ holding LOCK_xid_list, we might deadlock with other threads that take the
+ locks in the opposite order.
+ */
+
+ mysql_mutex_unlock(&LOCK_xid_list);
+ mysql_mutex_lock(&LOCK_log);
+ mysql_mutex_lock(&LOCK_xid_list);
+ /* We need to reload current_binlog_id due to release/re-take of lock. */
+ current= current_binlog_id;
+
+ for (;;)
+ {
+ /* Remove initial element(s) with zero count. */
+ b= binlog_xid_count_list.head();
+ /*
+ We must not remove all elements in the list - the entry for the current
+ binlog must be present always.
+ */
+ DBUG_ASSERT(b);
+ if (b->binlog_id == current || b->xid_count > 0)
+ break;
+ my_free(binlog_xid_count_list.get());
}
+
+ mysql_mutex_unlock(&LOCK_xid_list);
+ write_binlog_checkpoint_event_already_locked(b->binlog_name,
+ b->binlog_name_len);
+ mysql_mutex_unlock(&LOCK_log);
DBUG_VOID_RETURN;
}
int TC_LOG_BINLOG::unlog(ulong cookie, my_xid xid)
{
DBUG_ENTER("TC_LOG_BINLOG::unlog");
- if (xid)
- mark_xid_done();
- /* As ::write_transaction_to_binlog() did not rotate, do it here. */
- DBUG_RETURN(rotate_and_purge(0));
+ if (!xid)
+ DBUG_RETURN(0);
+
+ if (!BINLOG_COOKIE_IS_DUMMY(cookie))
+ mark_xid_done(BINLOG_COOKIE_GET_ID(cookie), true);
+ /*
+ See comment in trx_group_commit_leader() - if rotate() gave a failure,
+ we delay the return of error code to here.
+ */
+ DBUG_RETURN(BINLOG_COOKIE_GET_ERROR_FLAG(cookie));
+}
+
+void
+TC_LOG_BINLOG::commit_checkpoint_notify(void *cookie)
+{
+ mark_xid_done(((xid_count_per_binlog *)cookie)->binlog_id, true);
}
-int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle)
+int TC_LOG_BINLOG::recover(LOG_INFO *linfo, const char *last_log_name,
+ IO_CACHE *first_log,
+ Format_description_log_event *fdle)
{
Log_event *ev;
HASH xids;
MEM_ROOT mem_root;
+ char binlog_checkpoint_name[FN_REFLEN];
+ bool binlog_checkpoint_found;
+ bool first_round;
+ IO_CACHE log;
+ File file= -1;
+ const char *errmsg;
if (! fdle->is_valid() ||
my_hash_init(&xids, &my_charset_bin, TC_LOG_PAGE_SIZE/3, 0,
@@ -7562,19 +8174,114 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle)
fdle->flags&= ~LOG_EVENT_BINLOG_IN_USE_F; // abort on the first error
- while ((ev= Log_event::read_log_event(log, 0, fdle,
- opt_master_verify_checksum))
- && ev->is_valid())
+ /*
+ Scan the binlog for XIDs that need to be committed if still in the
+ prepared stage.
+
+ Start with the latest binlog file, then continue with any other binlog
+ files if the last found binlog checkpoint indicates it is needed.
+ */
+
+ binlog_checkpoint_found= false;
+ first_round= true;
+ for (;;)
{
- if (ev->get_type_code() == XID_EVENT)
+ while ((ev= Log_event::read_log_event(first_round ? first_log : &log,
+ 0, fdle, opt_master_verify_checksum))
+ && ev->is_valid())
+ {
+ switch (ev->get_type_code())
+ {
+ case XID_EVENT:
+ {
+ Xid_log_event *xev=(Xid_log_event *)ev;
+ uchar *x= (uchar *) memdup_root(&mem_root, (uchar*) &xev->xid,
+ sizeof(xev->xid));
+ if (!x || my_hash_insert(&xids, x))
+ {
+ delete ev;
+ goto err2;
+ }
+ break;
+ }
+ case BINLOG_CHECKPOINT_EVENT:
+ if (first_round)
+ {
+ uint dir_len;
+ Binlog_checkpoint_log_event *cev= (Binlog_checkpoint_log_event *)ev;
+ if (cev->binlog_file_len >= FN_REFLEN)
+ sql_print_warning("Incorrect binlog checkpoint event with too "
+ "long file name found.");
+ else
+ {
+ /*
+ Note that we cannot use make_log_name() here, as we have not yet
+ initialised MYSQL_BIN_LOG::log_file_name.
+ */
+ dir_len= dirname_length(last_log_name);
+ strmake(strnmov(binlog_checkpoint_name, last_log_name, dir_len),
+ cev->binlog_file_name, FN_REFLEN - 1 - dir_len);
+ binlog_checkpoint_found= true;
+ }
+ break;
+ }
+ default:
+ /* Nothing. */
+ break;
+ }
+ delete ev;
+ }
+
+ /*
+ If the last binlog checkpoint event points to an older log, we have to
+ scan all logs from there also, to get all possible XIDs to recover.
+
+ If there was no binlog checkpoint event at all, this means the log was
+ written by an older version of MariaDB (or MySQL) - these always have an
+ (implicit) binlog checkpoint event at the start of the last binlog file.
+ */
+ if (first_round)
{
- Xid_log_event *xev=(Xid_log_event *)ev;
- uchar *x= (uchar *) memdup_root(&mem_root, (uchar*) &xev->xid,
- sizeof(xev->xid));
- if (!x || my_hash_insert(&xids, x))
+ if (!binlog_checkpoint_found)
+ break;
+ first_round= false;
+ DBUG_EXECUTE_IF("xa_recover_expect_master_bin_000004",
+ if (0 != strcmp("./master-bin.000004", binlog_checkpoint_name) &&
+ 0 != strcmp(".\\master-bin.000004", binlog_checkpoint_name))
+ DBUG_SUICIDE();
+ );
+ if (find_log_pos(linfo, binlog_checkpoint_name, 1))
+ {
+ sql_print_error("Binlog file '%s' not found in binlog index, needed "
+ "for recovery. Aborting.", binlog_checkpoint_name);
goto err2;
+ }
+ }
+ else
+ {
+ end_io_cache(&log);
+ mysql_file_close(file, MYF(MY_WME));
+ file= -1;
+ }
+
+ if (0 == strcmp(linfo->log_file_name, last_log_name))
+ break; // No more files to do
+ if ((file= open_binlog(&log, linfo->log_file_name, &errmsg)) < 0)
+ {
+ sql_print_error("%s", errmsg);
+ goto err2;
+ }
+ /*
+ We do not need to read the Format_description_log_event of other binlog
+ files. It is not possible for a binlog checkpoint to span multiple
+ binlog files written by different versions of the server. So we can use
+ the first one read for reading from all binlog files.
+ */
+ if (find_next_log(linfo, 1))
+ {
+ sql_print_error("Error reading binlog files during recovery. Aborting.");
+ goto err2;
}
- delete ev;
}
if (ha_recover(&xids))
@@ -7585,6 +8292,11 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle)
return 0;
err2:
+ if (file >= 0)
+ {
+ end_io_cache(&log);
+ mysql_file_close(file, MYF(MY_WME));
+ }
free_root(&mem_root, MYF(0));
my_hash_free(&xids);
err1:
@@ -7650,10 +8362,13 @@ binlog_checksum_update(MYSQL_THD thd, struct st_mysql_sys_var *var,
{
ulong value= *((ulong *)save);
bool check_purge= false;
+ ulong prev_binlog_id;
+ LINT_INIT(prev_binlog_id);
mysql_mutex_lock(mysql_bin_log.get_log_lock());
if(mysql_bin_log.is_open())
{
+ prev_binlog_id= mysql_bin_log.current_binlog_id;
if (binlog_checksum_options != value)
mysql_bin_log.checksum_alg_reset= (uint8) value;
if (mysql_bin_log.rotate(true, &check_purge))
@@ -7667,7 +8382,7 @@ binlog_checksum_update(MYSQL_THD thd, struct st_mysql_sys_var *var,
mysql_bin_log.checksum_alg_reset= BINLOG_CHECKSUM_ALG_UNDEF;
mysql_mutex_unlock(mysql_bin_log.get_log_lock());
if (check_purge)
- mysql_bin_log.purge();
+ mysql_bin_log.checkpoint_and_purge(prev_binlog_id);
}
diff --git a/sql/log.h b/sql/log.h
index b350f3882fa..0e887b48462 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -1,5 +1,5 @@
-/*
- Copyright (c) 2005, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2005, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -49,6 +49,7 @@ class TC_LOG
bool need_prepare_ordered,
bool need_commit_ordered) = 0;
virtual int unlog(ulong cookie, my_xid xid)=0;
+ virtual void commit_checkpoint_notify(void *cookie)= 0;
protected:
/*
@@ -98,8 +99,12 @@ public:
return 1;
}
int unlog(ulong cookie, my_xid xid) { return 0; }
+ void commit_checkpoint_notify(void *cookie) { DBUG_ASSERT(0); };
};
+#define TC_LOG_PAGE_SIZE 8192
+#define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE)
+
#ifdef HAVE_MMAP
class TC_LOG_MMAP: public TC_LOG
{
@@ -110,6 +115,12 @@ class TC_LOG_MMAP: public TC_LOG
PS_DIRTY // new xids added since last sync
} PAGE_STATE;
+ struct pending_cookies {
+ uint count;
+ uint pending_count;
+ ulong cookies[TC_LOG_PAGE_SIZE];
+ };
+
private:
typedef struct st_page {
struct st_page *next; // page a linked in a fifo queue
@@ -141,7 +152,7 @@ class TC_LOG_MMAP: public TC_LOG
one has to use active->lock.
Same for LOCK_pool and LOCK_sync
*/
- mysql_mutex_t LOCK_active, LOCK_pool, LOCK_sync;
+ mysql_mutex_t LOCK_active, LOCK_pool, LOCK_sync, LOCK_pending_checkpoint;
mysql_cond_t COND_pool, COND_active;
/*
Queue of threads that need to call commit_ordered().
@@ -163,14 +174,16 @@ class TC_LOG_MMAP: public TC_LOG
*/
mysql_cond_t COND_queue_busy;
my_bool commit_ordered_queue_busy;
+ pending_cookies* pending_checkpoint;
public:
- TC_LOG_MMAP(): inited(0) {}
+ TC_LOG_MMAP(): inited(0), pending_checkpoint(0) {}
int open(const char *opt_name);
void close();
int log_and_order(THD *thd, my_xid xid, bool all,
bool need_prepare_ordered, bool need_commit_ordered);
int unlog(ulong cookie, my_xid xid);
+ void commit_checkpoint_notify(void *cookie);
int recover();
private:
@@ -178,6 +191,7 @@ class TC_LOG_MMAP: public TC_LOG
void get_active_from_pool();
int sync();
int overflow();
+ int delete_entry(ulong cookie);
};
#else
#define TC_LOG_MMAP TC_LOG_DUMMY
@@ -354,6 +368,35 @@ private:
time_t last_time;
};
+/*
+ We assign each binlog file an internal ID, used to identify them for unlog().
+ The IDs start from 0 and increment for each new binlog created.
+
+ In unlog() we need to know the ID of the binlog file that the corresponding
+ transaction was written into. We also need a special value for a corner
+ case where there is no corresponding binlog id (since nothing was logged).
+ And we need an error flag to mark that unlog() must return failure.
+
+ We use the following macros to pack all of this information into the single
+ ulong available with log_and_order() / unlog().
+
+ Note that we cannot use the value 0 for cookie, as that is reserved as error
+ return value from log_and_order().
+ */
+#define BINLOG_COOKIE_ERROR_RETURN 0
+#define BINLOG_COOKIE_DUMMY_ID 1
+#define BINLOG_COOKIE_BASE 2
+#define BINLOG_COOKIE_DUMMY(error_flag) \
+ ( (BINLOG_COOKIE_DUMMY_ID<<1) | ((error_flag)&1) )
+#define BINLOG_COOKIE_MAKE(id, error_flag) \
+ ( (((id)+BINLOG_COOKIE_BASE)<<1) | ((error_flag)&1) )
+#define BINLOG_COOKIE_GET_ERROR_FLAG(c) ((c) & 1)
+#define BINLOG_COOKIE_GET_ID(c) ( ((ulong)(c)>>1) - BINLOG_COOKIE_BASE )
+#define BINLOG_COOKIE_IS_DUMMY(c) \
+ ( ((ulong)(c)>>1) == BINLOG_COOKIE_DUMMY_ID )
+
+void binlog_checkpoint_callback(void *cookie);
+
class binlog_cache_mngr;
class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
{
@@ -392,12 +435,57 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
IO_CACHE *error_cache;
/* This is the `all' parameter for ha_commit_ordered(). */
bool all;
+ /*
+ True if we need to increment xid_count in trx_group_commit_leader() and
+ decrement in unlog() (this is needed if there is a participating engine
+ that does not implement the commit_checkpoint_request() handlerton
+ method).
+ */
+ bool need_unlog;
+ /*
+ Fields used to pass the necessary information to the last thread in a
+ group commit, only used when opt_optimize_thread_scheduling is not set.
+ */
+ bool check_purge;
+ ulong binlog_id;
};
+ /*
+ A list of struct xid_count_per_binlog is used to keep track of how many
+ XIDs are in prepared, but not committed, state in each binlog. And how
+ many commit_checkpoint_request()'s are pending.
+
+ When count drops to zero in a binlog after rotation, it means that there
+ are no more XIDs in prepared state, so that binlog is no longer needed
+ for XA crash recovery, and we can log a new binlog checkpoint event.
+
+ The list is protected against simultaneous access from multiple
+ threads by LOCK_xid_list.
+ */
+ struct xid_count_per_binlog : public ilink {
+ char *binlog_name;
+ uint binlog_name_len;
+ ulong binlog_id;
+ /* Total prepared XIDs and pending checkpoint requests in this binlog. */
+ long xid_count;
+ xid_count_per_binlog(); /* Give link error if constructor used. */
+ };
+ I_List<xid_count_per_binlog> binlog_xid_count_list;
+ /*
+ When this is set, a RESET MASTER is in progress.
+
+ Then we should not write any binlog checkpoints into the binlog (that
+ could result in deadlock on LOCK_log, and we will delete all binlog files
+ anyway). Instead we should signal COND_xid_list whenever a new binlog
+ checkpoint arrives - when all have arrived, RESET MASTER will complete.
+ */
+ bool reset_master_pending;
+ friend void binlog_checkpoint_callback(void *cookie);
+
/* LOCK_log and LOCK_index are inited by init_pthread_objects() */
mysql_mutex_t LOCK_index;
- mysql_mutex_t LOCK_prep_xids;
- mysql_cond_t COND_prep_xids;
+ mysql_mutex_t LOCK_xid_list;
+ mysql_cond_t COND_xid_list;
mysql_cond_t update_cond;
ulonglong bytes_written;
IO_CACHE index_file;
@@ -414,27 +502,14 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
The max size before rotation (usable only if log_type == LOG_BIN: binary
logs and relay logs).
For a binlog, max_size should be max_binlog_size.
- For a relay log, it should be max_relay_log_size if this is non-zero,
- max_binlog_size otherwise.
max_size is set in init(), and dynamically changed (when one does SET
- GLOBAL MAX_BINLOG_SIZE|MAX_RELAY_LOG_SIZE) by fix_max_binlog_size and
- fix_max_relay_log_size).
+ GLOBAL MAX_BINLOG_SIZE|MAX_RELAY_LOG_SIZE) from sys_vars.cc
*/
ulong max_size;
- long prepared_xids; /* for tc log - number of xids to remember */
// current file sequence number for load data infile binary logging
uint file_id;
uint open_count; // For replication
int readers_count;
- bool need_start_event;
- /*
- no_auto_events means we don't want any of these automatic events :
- Start/Rotate/Stop. That is, in 4.x when we rotate a relay log, we don't
- want a Rotate_log event to be written to the relay log. When we start a
- relay log etc. So in 4.x this is 1 for relay logs, 0 for binlogs.
- In 5.0 it's 0 for relay logs too!
- */
- bool no_auto_events;
/* Queue of transactions queued up to participate in group commit. */
group_commit_entry *group_commit_queue;
/*
@@ -470,15 +545,17 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
*/
int new_file_without_locking();
int new_file_impl(bool need_lock);
+ void do_checkpoint_request(ulong binlog_id);
+ void purge();
int write_transaction_or_stmt(group_commit_entry *entry);
bool write_transaction_to_binlog_events(group_commit_entry *entry);
void trx_group_commit_leader(group_commit_entry *leader);
- void mark_xid_done();
- void mark_xids_active(uint xid_count);
+ void mark_xid_done(ulong cookie, bool write_checkpoint);
+ void mark_xids_active(ulong cookie, uint xid_count);
public:
- MYSQL_LOG::generate_name;
- MYSQL_LOG::is_open;
+ using MYSQL_LOG::generate_name;
+ using MYSQL_LOG::is_open;
/* This is relay log */
bool is_relay_log;
@@ -534,6 +611,7 @@ public:
*/
char last_commit_pos_file[FN_REFLEN];
my_off_t last_commit_pos_offset;
+ ulong current_binlog_id;
MYSQL_BIN_LOG(uint *sync_period);
/*
@@ -562,7 +640,9 @@ public:
int log_and_order(THD *thd, my_xid xid, bool all,
bool need_prepare_ordered, bool need_commit_ordered);
int unlog(ulong cookie, my_xid xid);
- int recover(IO_CACHE *log, Format_description_log_event *fdle);
+ void commit_checkpoint_notify(void *cookie);
+ int recover(LOG_INFO *linfo, const char *last_log_name, IO_CACHE *first_log,
+ Format_description_log_event *fdle);
#if !defined(MYSQL_CLIENT)
int flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event,
@@ -590,15 +670,14 @@ public:
void signal_update();
void wait_for_update_relay_log(THD* thd);
int wait_for_update_bin_log(THD* thd, const struct timespec * timeout);
- void set_need_start_event() { need_start_event = 1; }
- void init(bool no_auto_events_arg, ulong max_size);
+ void init(ulong max_size);
void init_pthread_objects();
void cleanup();
bool open(const char *log_name,
enum_log_type log_type,
const char *new_name,
enum cache_type io_cache_type_arg,
- bool no_auto_events_arg, ulong max_size,
+ ulong max_size,
bool null_created,
bool need_mutex);
bool open_index_file(const char *index_file_name_arg,
@@ -614,6 +693,7 @@ public:
bool write_incident_already_locked(THD *thd);
bool write_incident(THD *thd);
+ void write_binlog_checkpoint_event_already_locked(const char *name, uint len);
int write_cache(THD *thd, IO_CACHE *cache);
void set_write_error(THD *thd, bool is_transactional);
bool check_write_error(THD *thd);
@@ -631,9 +711,10 @@ public:
void make_log_name(char* buf, const char* log_ident);
bool is_active(const char* log_file_name);
+ bool can_purge_log(const char *log_file_name);
int update_log_index(LOG_INFO* linfo, bool need_update_threads);
int rotate(bool force_rotate, bool* check_purge);
- void purge();
+ void checkpoint_and_purge(ulong binlog_id);
int rotate_and_purge(bool force_rotate);
/**
Flush binlog cache and synchronize to disk.
@@ -664,7 +745,7 @@ public:
int register_create_index_entry(const char* entry);
int purge_index_entry(THD *thd, ulonglong *decrease_log_space,
bool need_mutex);
- bool reset_logs(THD* thd);
+ bool reset_logs(THD* thd, bool create_new_log);
void close(uint exiting);
void clear_inuse_flag_when_closing(File file);
@@ -863,7 +944,7 @@ int query_error_code(THD *thd, bool not_killed);
uint purge_log_get_error_code(int res);
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
-void sql_print_error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
+void sql_print_error(const char *format, ...);
void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void sql_print_information(const char *format, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index f884b2996f0..13de7523054 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -46,6 +46,7 @@
#include "rpl_record.h"
#include "transaction.h"
#include <my_dir.h>
+#include "sql_show.h"
#endif /* MYSQL_CLIENT */
@@ -471,29 +472,28 @@ inline bool unexpected_error_code(int unexpected_error)
pretty_print_str()
*/
-static char *pretty_print_str(char *packet, const char *str, int len)
+static void
+pretty_print_str(String *packet, const char *str, int len)
{
const char *end= str + len;
- char *pos= packet;
- *pos++= '\'';
+ packet->append(STRING_WITH_LEN("'"));
while (str < end)
{
char c;
switch ((c=*str++)) {
- case '\n': *pos++= '\\'; *pos++= 'n'; break;
- case '\r': *pos++= '\\'; *pos++= 'r'; break;
- case '\\': *pos++= '\\'; *pos++= '\\'; break;
- case '\b': *pos++= '\\'; *pos++= 'b'; break;
- case '\t': *pos++= '\\'; *pos++= 't'; break;
- case '\'': *pos++= '\\'; *pos++= '\''; break;
- case 0 : *pos++= '\\'; *pos++= '0'; break;
+ case '\n': packet->append(STRING_WITH_LEN("\\n")); break;
+ case '\r': packet->append(STRING_WITH_LEN("\\r")); break;
+ case '\\': packet->append(STRING_WITH_LEN("\\\\")); break;
+ case '\b': packet->append(STRING_WITH_LEN("\\b")); break;
+ case '\t': packet->append(STRING_WITH_LEN("\\t")); break;
+ case '\'': packet->append(STRING_WITH_LEN("\\'")); break;
+ case 0 : packet->append(STRING_WITH_LEN("\\0")); break;
default:
- *pos++= c;
+ packet->append(&c, 1);
break;
}
}
- *pos++= '\'';
- return pos;
+ packet->append(STRING_WITH_LEN("'"));
}
#endif /* !MYSQL_CLIENT */
@@ -731,6 +731,7 @@ const char* Log_event::get_type_str(Log_event_type type)
case EXECUTE_LOAD_QUERY_EVENT: return "Execute_load_query";
case INCIDENT_EVENT: return "Incident";
case ANNOTATE_ROWS_EVENT: return "Annotate_rows";
+ case BINLOG_CHECKPOINT_EVENT: return "Binlog_checkpoint";
default: return "Unknown"; /* impossible */
}
}
@@ -905,9 +906,9 @@ int Log_event::do_update_pos(Relay_log_info *rli)
Log_event::enum_skip_reason
Log_event::do_shall_skip(Relay_log_info *rli)
{
- DBUG_PRINT("info", ("ev->server_id=%lu, ::server_id=%lu,"
- " rli->replicate_same_server_id=%d,"
- " rli->slave_skip_counter=%d",
+ DBUG_PRINT("info", ("ev->server_id: %lu, ::server_id: %lu,"
+ " rli->replicate_same_server_id: %d,"
+ " rli->slave_skip_counter: %lu",
(ulong) server_id, (ulong) ::server_id,
rli->replicate_same_server_id,
rli->slave_skip_counter));
@@ -926,7 +927,7 @@ Log_event::do_shall_skip(Relay_log_info *rli)
Log_event::pack_info()
*/
-void Log_event::pack_info(Protocol *protocol)
+void Log_event::pack_info(THD *thd, Protocol *protocol)
{
protocol->store("", &my_charset_bin);
}
@@ -935,7 +936,8 @@ void Log_event::pack_info(Protocol *protocol)
/**
Only called by SHOW BINLOG EVENTS
*/
-int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
+int Log_event::net_send(THD *thd, Protocol *protocol, const char* log_name,
+ my_off_t pos)
{
const char *p= strrchr(log_name, FN_LIBCHAR);
const char *event_type;
@@ -949,7 +951,7 @@ int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
protocol->store(event_type, strlen(event_type), &my_charset_bin);
protocol->store((uint32) server_id);
protocol->store((ulonglong) log_pos);
- pack_info(protocol);
+ pack_info(thd, protocol);
return protocol->write();
}
#endif /* HAVE_REPLICATION */
@@ -1085,6 +1087,9 @@ bool Log_event::write_header(IO_CACHE* file, ulong event_data_length)
ulong now;
bool ret;
DBUG_ENTER("Log_event::write_header");
+ DBUG_PRINT("enter", ("filepos: %lld length: %lu type: %d",
+ (longlong) my_b_tell(file), event_data_length,
+ (int) get_type_code()));
/* Store number of bytes that will be written by this event */
data_written= event_data_length + sizeof(header);
@@ -1348,7 +1353,7 @@ failed my_b_read"));
Log_event *res= 0;
#ifndef max_allowed_packet
THD *thd=current_thd;
- uint max_allowed_packet= thd ? thd->variables.max_allowed_packet : ~(ulong)0;
+ uint max_allowed_packet= thd ? slave_max_allowed_packet:~(ulong)0;
#endif
if (data_len > max_allowed_packet)
@@ -1386,7 +1391,7 @@ err:
DBUG_ASSERT(error != 0);
sql_print_error("Error in Log_event::read_log_event(): "
"'%s', data_len: %d, event_type: %d",
- error,data_len,head[EVENT_TYPE_OFFSET]);
+ error,data_len,(uchar)(head[EVENT_TYPE_OFFSET]));
my_free(buf);
/*
The SQL slave thread will check if file->error<0 to know
@@ -1535,6 +1540,9 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
case ROTATE_EVENT:
ev = new Rotate_log_event(buf, event_len, description_event);
break;
+ case BINLOG_CHECKPOINT_EVENT:
+ ev = new Binlog_checkpoint_log_event(buf, event_len, description_event);
+ break;
#ifdef HAVE_REPLICATION
case SLAVE_EVENT: /* can never happen (unused event) */
ev = new Slave_log_event(buf, event_len, description_event);
@@ -2448,27 +2456,22 @@ Log_event::continue_group(Relay_log_info *rli)
show the catalog ??
*/
-void Query_log_event::pack_info(Protocol *protocol)
+void Query_log_event::pack_info(THD *thd, Protocol *protocol)
{
// TODO: show the catalog ??
- char *buf, *pos;
- if (!(buf= (char*) my_malloc(9 + db_len + q_len, MYF(MY_WME))))
- return;
- pos= buf;
+ char buf_mem[1024];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ buf.real_alloc(9 + db_len + q_len);
if (!(flags & LOG_EVENT_SUPPRESS_USE_F)
&& db && db_len)
{
- pos= strmov(buf, "use `");
- memcpy(pos, db, db_len);
- pos= strmov(pos+db_len, "`; ");
+ buf.append(STRING_WITH_LEN("use "));
+ append_identifier(thd, &buf, db, db_len);
+ buf.append("; ");
}
if (query && q_len)
- {
- memcpy(pos, query, q_len);
- pos+= q_len;
- }
- protocol->store(buf, pos-buf, &my_charset_bin);
- my_free(buf);
+ buf.append(query, q_len);
+ protocol->store(&buf);
}
#endif
@@ -3218,24 +3221,41 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
pos= (const uchar*) end; // Break loop
}
}
-
+
+ /**
+ Layout for the data buffer is as follows
+ +--------+-----------+------+------+---------+----+-------+
+ | catlog | time_zone | user | host | db name | \0 | Query |
+ +--------+-----------+------+------+---------+----+-------+
+
+ To support the query cache we append the following buffer to the above
+ +-------+----------------------------------------+-------+
+ |db len | uninitiatlized space of size of db len | FLAGS |
+ +-------+----------------------------------------+-------+
+
+ The area of buffer starting from Query field all the way to the end belongs
+ to the Query buffer and its structure is described in alloc_query() in
+ sql_parse.cc
+ */
+
#if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE)
- if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 +
- time_zone_len + 1 +
- data_len + 1 +
- QUERY_CACHE_DB_LENGTH_SIZE +
- QUERY_CACHE_FLAGS_SIZE +
- user.length + 1 +
- host.length + 1 +
- db_len + 1,
- MYF(MY_WME))))
+ if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1
+ + time_zone_len + 1
+ + user.length + 1
+ + host.length + 1
+ + data_len + 1
+ + sizeof(size_t)//for db_len
+ + db_len + 1
+ + QUERY_CACHE_DB_LENGTH_SIZE
+ + QUERY_CACHE_FLAGS_SIZE,
+ MYF(MY_WME))))
#else
- if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 +
- time_zone_len + 1 +
- data_len + 1 +
- user.length + 1 +
- host.length + 1,
- MYF(MY_WME))))
+ if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1
+ + time_zone_len + 1
+ + user.length + 1
+ + host.length + 1
+ + data_len + 1,
+ MYF(MY_WME))))
#endif
DBUG_VOID_RETURN;
if (catalog_len) // If catalog is given
@@ -3275,10 +3295,127 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
db= (char *)start;
query= (char *)(start + db_len + 1);
q_len= data_len - db_len -1;
+ /**
+ Append the db length at the end of the buffer. This will be used by
+ Query_cache::send_result_to_client() in case the query cache is On.
+ */
+#if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE)
+ size_t db_length= (size_t)db_len;
+ memcpy(start + data_len + 1, &db_length, sizeof(size_t));
+#endif
DBUG_VOID_RETURN;
}
+/*
+ Replace a binlog event read into a packet with a dummy event. Either a
+ Query_log_event that has just a comment, or if that will not fit in the
+ space used for the event to be replaced, then a NULL user_var event.
+
+ This is used when sending binlog data to a slave which does not understand
+ this particular event and which is too old to support informational events
+ or holes in the event stream.
+
+ This allows to write such events into the binlog on the master and still be
+ able to replicate against old slaves without them breaking.
+
+ Clears the flag LOG_EVENT_THREAD_SPECIFIC_F and set LOG_EVENT_SUPPRESS_USE_F.
+ Overwrites the type with QUERY_EVENT (or USER_VAR_EVENT), and replaces the
+ body with a minimal query / NULL user var.
+
+ Returns zero on success, -1 if error due to too little space in original
+ event. A minimum of 25 bytes (19 bytes fixed header + 6 bytes in the body)
+ is needed in any event to be replaced with a dummy event.
+*/
+int
+Query_log_event::dummy_event(String *packet, ulong ev_offset,
+ uint8 checksum_alg)
+{
+ uchar *p= (uchar *)packet->ptr() + ev_offset;
+ size_t data_len= packet->length() - ev_offset;
+ uint16 flags;
+ static const size_t min_user_var_event_len=
+ LOG_EVENT_HEADER_LEN + UV_NAME_LEN_SIZE + 1 + UV_VAL_IS_NULL; // 25
+ static const size_t min_query_event_len=
+ LOG_EVENT_HEADER_LEN + QUERY_HEADER_LEN + 1 + 1; // 34
+
+ if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
+ data_len-= BINLOG_CHECKSUM_LEN;
+ else
+ DBUG_ASSERT(checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF ||
+ checksum_alg == BINLOG_CHECKSUM_ALG_OFF);
+
+ if (data_len < min_user_var_event_len)
+ /* Cannot replace with dummy, event too short. */
+ return -1;
+
+ flags= uint2korr(p + FLAGS_OFFSET);
+ flags&= ~LOG_EVENT_THREAD_SPECIFIC_F;
+ flags|= LOG_EVENT_SUPPRESS_USE_F;
+ int2store(p + FLAGS_OFFSET, flags);
+
+ if (data_len < min_query_event_len)
+ {
+ /*
+ Have to use dummy user_var event for such a short packet.
+
+ This works, but the event will be considered part of an event group with
+ the following event. So for example @@global.sql_slave_skip_counter=1
+ will skip not only the dummy event, but also the immediately following
+ event.
+
+ We write a NULL user var with the name @`!dummyvar` (or as much
+ as that as will fit within the size of the original event - so
+ possibly just @`!`).
+ */
+ static const char var_name[]= "!dummyvar";
+ uint name_len= data_len - (min_user_var_event_len - 1);
+
+ p[EVENT_TYPE_OFFSET]= USER_VAR_EVENT;
+ int4store(p + LOG_EVENT_HEADER_LEN, name_len);
+ memcpy(p + LOG_EVENT_HEADER_LEN + UV_NAME_LEN_SIZE, var_name, name_len);
+ p[LOG_EVENT_HEADER_LEN + UV_NAME_LEN_SIZE + name_len]= 1; // indicates NULL
+ }
+ else
+ {
+ /*
+ Use a dummy query event, just a comment.
+ */
+ static const char message[]=
+ "# Dummy event replacing event type %u that slave cannot handle.";
+ char buf[sizeof(message)+1]; /* +1, as %u can expand to 3 digits. */
+ uchar old_type= p[EVENT_TYPE_OFFSET];
+ uchar *q= p + LOG_EVENT_HEADER_LEN;
+ size_t comment_len, len;
+
+ p[EVENT_TYPE_OFFSET]= QUERY_EVENT;
+ int4store(q + Q_THREAD_ID_OFFSET, 0);
+ int4store(q + Q_EXEC_TIME_OFFSET, 0);
+ q[Q_DB_LEN_OFFSET]= 0;
+ int2store(q + Q_ERR_CODE_OFFSET, 0);
+ int2store(q + Q_STATUS_VARS_LEN_OFFSET, 0);
+ q[Q_DATA_OFFSET]= 0; /* Zero terminator for empty db */
+ q+= Q_DATA_OFFSET + 1;
+ len= my_snprintf(buf, sizeof(buf), message, old_type);
+ comment_len= data_len - (min_query_event_len - 1);
+ if (comment_len <= len)
+ memcpy(q, buf, comment_len);
+ else
+ {
+ memcpy(q, buf, len);
+ memset(q+len, ' ', comment_len - len);
+ }
+ }
+
+ if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
+ {
+ ha_checksum crc= my_checksum(0L, p, data_len);
+ int4store(p + data_len, crc);
+ }
+ return 0;
+}
+
+
#ifdef MYSQL_CLIENT
/**
Query_log_event::print().
@@ -3309,11 +3446,17 @@ void Query_log_event::print_query_header(IO_CACHE* file,
}
else if (db)
{
+ /* Room for expand ` to `` + initial/final ` + \0 */
+ char buf[FN_REFLEN*2+3];
+
different_db= memcmp(print_event_info->db, db, db_len + 1);
if (different_db)
memcpy(print_event_info->db, db, db_len + 1);
if (db[0] && different_db)
- my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter);
+ {
+ my_snprintf(buf, sizeof(buf), "%`s", db);
+ my_b_printf(file, "use %s%s\n", buf, print_event_info->delimiter);
+ }
}
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
@@ -3461,6 +3604,12 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
{
Write_on_release_cache cache(&print_event_info->head_cache, file);
+ /**
+ reduce the size of io cache so that the write function is called
+ for every call to my_b_write().
+ */
+ DBUG_EXECUTE_IF ("simulate_file_write_error",
+ {(&cache)->write_pos= (&cache)->write_end- 500;});
print_query_header(&cache, print_event_info);
my_b_write(&cache, (uchar*) query, q_len);
my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
@@ -3479,6 +3628,34 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli)
return do_apply_event(rli, query, q_len);
}
+/**
+ Compare if two errors should be regarded as equal.
+ This is to handle the case when you can get slightly different errors
+ on master and slave for the same thing.
+ @param
+ expected_error Error we got on master
+ actual_error Error we got on slave
+
+ @return
+ 1 Errors are equal
+ 0 Errors are different
+*/
+
+bool test_if_equal_repl_errors(int expected_error, int actual_error)
+{
+ if (expected_error == actual_error)
+ return 1;
+ switch (expected_error) {
+ case ER_DUP_ENTRY:
+ case ER_AUTOINC_READ_FAILED:
+ return (actual_error == ER_AUTOINC_READ_FAILED ||
+ actual_error == HA_ERR_AUTOINC_ERANGE);
+ default:
+ break;
+ }
+ return 0;
+}
+
/**
@todo
@@ -3503,6 +3680,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
LEX_STRING new_db;
int expected_error,actual_error= 0;
HA_CREATE_INFO db_options;
+ DBUG_ENTER("Query_log_event::do_apply_event");
/*
Colleagues: please never free(thd->catalog) in MySQL. This would
@@ -3790,7 +3968,8 @@ compare_errors:
DBUG_PRINT("info",("expected_error: %d sql_errno: %d",
expected_error, actual_error));
- if ((expected_error && expected_error != actual_error &&
+ if ((expected_error &&
+ !test_if_equal_repl_errors(expected_error, actual_error) &&
!concurrency_error_code(expected_error)) &&
!ignored_error_code(actual_error) &&
!ignored_error_code(expected_error))
@@ -3812,7 +3991,7 @@ Default database: '%s'. Query: '%s'",
If we get the same error code as expected and it is not a concurrency
issue, or should be ignored.
*/
- else if ((expected_error == actual_error &&
+ else if ((test_if_equal_repl_errors(expected_error, actual_error) &&
!concurrency_error_code(expected_error)) ||
ignored_error_code(actual_error))
{
@@ -3898,7 +4077,7 @@ end:
thd->first_successful_insert_id_in_prev_stmt= 0;
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
- return thd->is_slave_error;
+ DBUG_RETURN(thd->is_slave_error);
}
int Query_log_event::do_update_pos(Relay_log_info *rli)
@@ -3971,7 +4150,7 @@ Start_log_event_v3::Start_log_event_v3()
*/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Start_log_event_v3::pack_info(Protocol *protocol)
+void Start_log_event_v3::pack_info(THD *thd, Protocol *protocol)
{
char buf[12 + ST_SERVER_VER_LEN + 14 + 22], *pos;
pos= strmov(buf, "Server ver: ");
@@ -4262,6 +4441,8 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver)
// Set header lengths of Maria events
post_header_len[ANNOTATE_ROWS_EVENT-1]= ANNOTATE_ROWS_HEADER_LEN;
+ post_header_len[BINLOG_CHECKPOINT_EVENT-1]=
+ BINLOG_CHECKPOINT_HEADER_LEN;
// Sanity-check that all post header lengths are initialized.
int i;
@@ -4747,131 +4928,113 @@ uint8 get_checksum_alg(const char* buf, ulong len)
*/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-uint Load_log_event::get_query_buffer_length()
+void Load_log_event::print_query(THD *thd, bool need_db, const char *cs,
+ String *buf, my_off_t *fn_start,
+ my_off_t *fn_end, const char *qualify_db)
{
- return
- 5 + db_len + 3 + // "use DB; "
- 18 + fname_len + 2 + // "LOAD DATA INFILE 'file''"
- 11 + // "CONCURRENT "
- 7 + // LOCAL
- 9 + // " REPLACE or IGNORE "
- 13 + table_name_len*2 + // "INTO TABLE `table`"
- 21 + sql_ex.field_term_len*4 + 2 + // " FIELDS TERMINATED BY 'str'"
- 23 + sql_ex.enclosed_len*4 + 2 + // " OPTIONALLY ENCLOSED BY 'str'"
- 12 + sql_ex.escaped_len*4 + 2 + // " ESCAPED BY 'str'"
- 21 + sql_ex.line_term_len*4 + 2 + // " LINES TERMINATED BY 'str'"
- 19 + sql_ex.line_start_len*4 + 2 + // " LINES STARTING BY 'str'"
- 15 + 22 + // " IGNORE xxx LINES"
- 3 + (num_fields-1)*2 + field_block_len; // " (field1, field2, ...)"
-}
-
-
-void Load_log_event::print_query(bool need_db, const char *cs, char *buf,
- char **end, char **fn_start, char **fn_end)
-{
- char *pos= buf;
-
if (need_db && db && db_len)
{
- pos= strmov(pos, "use `");
- memcpy(pos, db, db_len);
- pos= strmov(pos+db_len, "`; ");
+ buf->append(STRING_WITH_LEN("use "));
+ append_identifier(thd, buf, db, db_len);
+ buf->append(STRING_WITH_LEN("; "));
}
- pos= strmov(pos, "LOAD DATA ");
+ buf->append(STRING_WITH_LEN("LOAD DATA "));
if (is_concurrent)
- pos= strmov(pos, "CONCURRENT ");
+ buf->append(STRING_WITH_LEN("CONCURRENT "));
if (fn_start)
- *fn_start= pos;
+ *fn_start= buf->length();
if (check_fname_outside_temp_buf())
- pos= strmov(pos, "LOCAL ");
- pos= strmov(pos, "INFILE '");
- memcpy(pos, fname, fname_len);
- pos= strmov(pos+fname_len, "' ");
+ buf->append(STRING_WITH_LEN("LOCAL "));
+ buf->append(STRING_WITH_LEN("INFILE '"));
+ buf->append_for_single_quote(fname, fname_len);
+ buf->append(STRING_WITH_LEN("' "));
if (sql_ex.opt_flags & REPLACE_FLAG)
- pos= strmov(pos, "REPLACE ");
+ buf->append(STRING_WITH_LEN("REPLACE "));
else if (sql_ex.opt_flags & IGNORE_FLAG)
- pos= strmov(pos, "IGNORE ");
+ buf->append(STRING_WITH_LEN("IGNORE "));
- pos= strmov(pos ,"INTO");
+ buf->append(STRING_WITH_LEN("INTO"));
if (fn_end)
- *fn_end= pos;
+ *fn_end= buf->length();
- pos= strmov(pos ," TABLE `");
- memcpy(pos, table_name, table_name_len);
- pos+= table_name_len;
+ buf->append(STRING_WITH_LEN(" TABLE "));
+ if (qualify_db)
+ {
+ append_identifier(thd, buf, qualify_db, strlen(qualify_db));
+ buf->append(STRING_WITH_LEN("."));
+ }
+ append_identifier(thd, buf, table_name, table_name_len);
if (cs != NULL)
{
- pos= strmov(pos ,"` CHARACTER SET ");
- pos= strmov(pos , cs);
+ buf->append(STRING_WITH_LEN(" CHARACTER SET "));
+ buf->append(cs, strlen(cs));
}
- else
- pos= strmov(pos, "`");
/* We have to create all optional fields as the default is not empty */
- pos= strmov(pos, " FIELDS TERMINATED BY ");
- pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
+ buf->append(STRING_WITH_LEN(" FIELDS TERMINATED BY "));
+ pretty_print_str(buf, sql_ex.field_term, sql_ex.field_term_len);
if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
- pos= strmov(pos, " OPTIONALLY ");
- pos= strmov(pos, " ENCLOSED BY ");
- pos= pretty_print_str(pos, sql_ex.enclosed, sql_ex.enclosed_len);
+ buf->append(STRING_WITH_LEN(" OPTIONALLY "));
+ buf->append(STRING_WITH_LEN(" ENCLOSED BY "));
+ pretty_print_str(buf, sql_ex.enclosed, sql_ex.enclosed_len);
- pos= strmov(pos, " ESCAPED BY ");
- pos= pretty_print_str(pos, sql_ex.escaped, sql_ex.escaped_len);
+ buf->append(STRING_WITH_LEN(" ESCAPED BY "));
+ pretty_print_str(buf, sql_ex.escaped, sql_ex.escaped_len);
- pos= strmov(pos, " LINES TERMINATED BY ");
- pos= pretty_print_str(pos, sql_ex.line_term, sql_ex.line_term_len);
+ buf->append(STRING_WITH_LEN(" LINES TERMINATED BY "));
+ pretty_print_str(buf, sql_ex.line_term, sql_ex.line_term_len);
if (sql_ex.line_start_len)
{
- pos= strmov(pos, " STARTING BY ");
- pos= pretty_print_str(pos, sql_ex.line_start, sql_ex.line_start_len);
+ buf->append(STRING_WITH_LEN(" STARTING BY "));
+ pretty_print_str(buf, sql_ex.line_start, sql_ex.line_start_len);
}
if ((long) skip_lines > 0)
{
- pos= strmov(pos, " IGNORE ");
- pos= longlong10_to_str((longlong) skip_lines, pos, 10);
- pos= strmov(pos," LINES ");
+ buf->append(STRING_WITH_LEN(" IGNORE "));
+ buf->append_ulonglong(skip_lines);
+ buf->append(STRING_WITH_LEN(" LINES "));
}
if (num_fields)
{
uint i;
const char *field= fields;
- pos= strmov(pos, " (");
+ buf->append(STRING_WITH_LEN(" ("));
for (i = 0; i < num_fields; i++)
{
if (i)
{
- *pos++= ' ';
- *pos++= ',';
+ /*
+ Yes, the space and comma is reversed here. But this is mostly dead
+ code, at most used when reading really old binlogs from old servers,
+ so better just leave it as is...
+ */
+ buf->append(STRING_WITH_LEN(" ,"));
}
- memcpy(pos, field, field_lens[i]);
- pos+= field_lens[i];
+ append_identifier(thd, buf, field, field_lens[i]);
field+= field_lens[i] + 1;
}
- *pos++= ')';
+ buf->append(STRING_WITH_LEN(")"));
}
-
- *end= pos;
}
-void Load_log_event::pack_info(Protocol *protocol)
+void Load_log_event::pack_info(THD *thd, Protocol *protocol)
{
- char *buf, *end;
+ char query_buffer[1024];
+ String query_str(query_buffer, sizeof(query_buffer), system_charset_info);
- if (!(buf= (char*) my_malloc(get_query_buffer_length(), MYF(MY_WME))))
- return;
- print_query(TRUE, NULL, buf, &end, 0, 0);
- protocol->store(buf, end-buf, &my_charset_bin);
- my_free(buf);
+ query_str.length(0);
+ print_query(thd, TRUE, NULL, &query_str, 0, 0, NULL);
+ protocol->store(query_str.ptr(), query_str.length(), &my_charset_bin);
}
#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
@@ -5253,6 +5416,8 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
bool use_rli_only_for_errors)
{
LEX_STRING new_db;
+ DBUG_ENTER("Load_log_event::do_apply_event");
+
new_db.length= db_len;
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
thd->set_db(new_db.str, new_db.length);
@@ -5327,16 +5492,20 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
else
{
char llbuff[22];
- char *end;
enum enum_duplicates handle_dup;
bool ignore= 0;
+ char query_buffer[1024];
+ String query_str(query_buffer, sizeof(query_buffer), system_charset_info);
char *load_data_query;
+ query_str.length(0);
/*
Forge LOAD DATA INFILE query which will be used in SHOW PROCESS LIST
and written to slave's binlog if binlogging is on.
*/
- if (!(load_data_query= (char *)thd->alloc(get_query_buffer_length() + 1)))
+ print_query(thd, FALSE, NULL, &query_str, NULL, NULL, NULL);
+ if (!(load_data_query= (char *)thd->strmake(query_str.ptr(),
+ query_str.length())))
{
/*
This will set thd->fatal_error in case of OOM. So we surely will notice
@@ -5345,9 +5514,7 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
goto error;
}
- print_query(FALSE, NULL, load_data_query, &end, NULL, NULL);
- *end= 0;
- thd->set_query(load_data_query, (uint) (end - load_data_query));
+ thd->set_query(load_data_query, (uint) (query_str.length()));
if (sql_ex.opt_flags & REPLACE_FLAG)
handle_dup= DUP_REPLACE;
@@ -5493,7 +5660,7 @@ error:
Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
err, (char*)table_name, print_slave_db_safe(remember_db));
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
- return 1;
+ DBUG_RETURN(1);
}
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
@@ -5508,10 +5675,10 @@ Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER(ER_SLAVE_FATAL_ERROR), buf);
- return 1;
+ DBUG_RETURN(1);
}
- return ( use_rli_only_for_errors ? 0 : Log_event::do_apply_event(rli) );
+ DBUG_RETURN( use_rli_only_for_errors ? 0 : Log_event::do_apply_event(rli) );
}
#endif
@@ -5525,7 +5692,7 @@ Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
*/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Rotate_log_event::pack_info(Protocol *protocol)
+void Rotate_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf1[256], buf[22];
String tmp(buf1, sizeof(buf1), log_cs);
@@ -5735,6 +5902,86 @@ Rotate_log_event::do_shall_skip(Relay_log_info *rli)
/**************************************************************************
+ Binlog_checkpoint_log_event methods
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+void Binlog_checkpoint_log_event::pack_info(THD *thd, Protocol *protocol)
+{
+ protocol->store(binlog_file_name, binlog_file_len, &my_charset_bin);
+}
+#endif
+
+
+#ifdef MYSQL_CLIENT
+void Binlog_checkpoint_log_event::print(FILE *file,
+ PRINT_EVENT_INFO *print_event_info)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F);
+
+ if (print_event_info->short_form)
+ return;
+ print_header(&cache, print_event_info, FALSE);
+ my_b_printf(&cache, "\tBinlog checkpoint ");
+ my_b_write(&cache, (uchar*)binlog_file_name, binlog_file_len);
+ my_b_printf(&cache, "\n");
+}
+#endif /* MYSQL_CLIENT */
+
+
+#ifdef MYSQL_SERVER
+Binlog_checkpoint_log_event::Binlog_checkpoint_log_event(
+ const char *binlog_file_name_arg,
+ uint binlog_file_len_arg)
+ :Log_event(),
+ binlog_file_name(my_strndup(binlog_file_name_arg, binlog_file_len_arg,
+ MYF(MY_WME))),
+ binlog_file_len(binlog_file_len_arg)
+{
+ cache_type= EVENT_NO_CACHE;
+}
+#endif /* MYSQL_SERVER */
+
+
+Binlog_checkpoint_log_event::Binlog_checkpoint_log_event(
+ const char *buf, uint event_len,
+ const Format_description_log_event *description_event)
+ :Log_event(buf, description_event), binlog_file_name(0)
+{
+ uint8 header_size= description_event->common_header_len;
+ uint8 post_header_len=
+ description_event->post_header_len[BINLOG_CHECKPOINT_EVENT-1];
+ if (event_len < header_size + post_header_len ||
+ post_header_len < BINLOG_CHECKPOINT_HEADER_LEN)
+ return;
+ buf+= header_size;
+ /* See uint4korr and int4store below */
+ compile_time_assert(BINLOG_CHECKPOINT_HEADER_LEN == 4);
+ binlog_file_len= uint4korr(buf);
+ if (event_len - (header_size + post_header_len) < binlog_file_len)
+ return;
+ binlog_file_name= my_strndup(buf + post_header_len, binlog_file_len,
+ MYF(MY_WME));
+ return;
+}
+
+
+#ifndef MYSQL_CLIENT
+bool Binlog_checkpoint_log_event::write(IO_CACHE *file)
+{
+ uchar buf[BINLOG_CHECKPOINT_HEADER_LEN];
+ int4store(buf, binlog_file_len);
+ return write_header(file, BINLOG_CHECKPOINT_HEADER_LEN + binlog_file_len) ||
+ wrapper_my_b_safe_write(file, buf, BINLOG_CHECKPOINT_HEADER_LEN) ||
+ wrapper_my_b_safe_write(file, (const uchar *)binlog_file_name,
+ binlog_file_len) ||
+ write_footer(file);
+}
+#endif /* MYSQL_CLIENT */
+
+
+/**************************************************************************
Intvar_log_event methods
**************************************************************************/
@@ -5743,7 +5990,7 @@ Rotate_log_event::do_shall_skip(Relay_log_info *rli)
*/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Intvar_log_event::pack_info(Protocol *protocol)
+void Intvar_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[256], *pos;
pos= strmake(buf, get_var_type_name(), sizeof(buf)-23);
@@ -5897,7 +6144,7 @@ Intvar_log_event::do_shall_skip(Relay_log_info *rli)
**************************************************************************/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Rand_log_event::pack_info(Protocol *protocol)
+void Rand_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf1[256], *pos;
pos= strmov(buf1,"rand_seed1=");
@@ -6022,7 +6269,7 @@ bool slave_execute_deferred_events(THD *thd)
**************************************************************************/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Xid_log_event::pack_info(Protocol *protocol)
+void Xid_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[128], *pos;
pos= strmov(buf, "COMMIT /* xid=");
@@ -6119,84 +6366,117 @@ Xid_log_event::do_shall_skip(Relay_log_info *rli)
**************************************************************************/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void User_var_log_event::pack_info(Protocol* protocol)
+static bool
+user_var_append_name_part(THD *thd, String *buf,
+ const char *name, size_t name_len)
{
- char *buf= 0;
- uint val_offset= 4 + name_len;
- uint event_len= val_offset;
+ return buf->append("@") ||
+ append_identifier(thd, buf, name, name_len) ||
+ buf->append("=");
+}
+void User_var_log_event::pack_info(THD *thd, Protocol* protocol)
+{
if (is_null)
{
- if (!(buf= (char*) my_malloc(val_offset + 5, MYF(MY_WME))))
+ char buf_mem[FN_REFLEN+7];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ buf.length(0);
+ if (user_var_append_name_part(thd, &buf, name, name_len) ||
+ buf.append("NULL"))
return;
- strmov(buf + val_offset, "NULL");
- event_len= val_offset + 4;
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
}
else
{
switch (type) {
case REAL_RESULT:
+ {
double real_val;
+ char buf2[MY_GCVT_MAX_FIELD_WIDTH+1];
+ char buf_mem[FN_REFLEN + MY_GCVT_MAX_FIELD_WIDTH + 1];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
float8get(real_val, val);
- if (!(buf= (char*) my_malloc(val_offset + MY_GCVT_MAX_FIELD_WIDTH + 1,
- MYF(MY_WME))))
+ buf.length(0);
+ if (user_var_append_name_part(thd, &buf, name, name_len) ||
+ buf.append(buf2, my_gcvt(real_val, MY_GCVT_ARG_DOUBLE,
+ MY_GCVT_MAX_FIELD_WIDTH, buf2, NULL)))
return;
- event_len+= my_gcvt(real_val, MY_GCVT_ARG_DOUBLE, MY_GCVT_MAX_FIELD_WIDTH,
- buf + val_offset, NULL);
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
break;
+ }
case INT_RESULT:
- if (!(buf= (char*) my_malloc(val_offset + 22, MYF(MY_WME))))
+ {
+ char buf2[22];
+ char buf_mem[FN_REFLEN + 22];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ buf.length(0);
+ if (user_var_append_name_part(thd, &buf, name, name_len) ||
+ buf.append(buf2,
+ longlong10_to_str(uint8korr(val), buf2,
+ ((flags & User_var_log_event::UNSIGNED_F) ? 10 : -10))-buf2))
return;
- event_len= longlong10_to_str(uint8korr(val), buf + val_offset,
- ((flags & User_var_log_event::UNSIGNED_F) ?
- 10 : -10))-buf;
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
break;
+ }
case DECIMAL_RESULT:
{
- if (!(buf= (char*) my_malloc(val_offset + DECIMAL_MAX_STR_LENGTH,
- MYF(MY_WME))))
- return;
- String str(buf+val_offset, DECIMAL_MAX_STR_LENGTH, &my_charset_bin);
+ char buf_mem[FN_REFLEN + DECIMAL_MAX_STR_LENGTH];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ char buf2[DECIMAL_MAX_STR_LENGTH+1];
+ String str(buf2, sizeof(buf2), &my_charset_bin);
my_decimal dec;
+ buf.length(0);
binary2my_decimal(E_DEC_FATAL_ERROR, (uchar*) (val+2), &dec, val[0],
val[1]);
my_decimal2string(E_DEC_FATAL_ERROR, &dec, 0, 0, 0, &str);
- event_len= str.length() + val_offset;
+ if (user_var_append_name_part(thd, &buf, name, name_len) ||
+ buf.append(buf2))
+ return;
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
break;
- }
+ }
case STRING_RESULT:
+ {
/* 15 is for 'COLLATE' and other chars */
- buf= (char*) my_malloc(event_len+val_len*2+1+2*MY_CS_NAME_SIZE+15,
- MYF(MY_WME));
+ char buf_mem[FN_REFLEN + 512 + 1 + 2*MY_CS_NAME_SIZE+15];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
CHARSET_INFO *cs;
- if (!buf)
- return;
+ buf.length(0);
if (!(cs= get_charset(charset_number, MYF(0))))
{
- strmov(buf+val_offset, "???");
- event_len+= 3;
+ if (buf.append("???"))
+ return;
}
else
{
- char *p= strxmov(buf + val_offset, "_", cs->csname, " ", NullS);
- p= str_to_hex(p, val, val_len);
- p= strxmov(p, " COLLATE ", cs->name, NullS);
- event_len= p-buf;
+ size_t old_len;
+ char *beg, *end;
+ if (user_var_append_name_part(thd, &buf, name, name_len) ||
+ buf.append("_") ||
+ buf.append(cs->csname) ||
+ buf.append(" "))
+ return;
+ old_len= buf.length();
+ if (buf.reserve(old_len + val_len*2 + 2 + sizeof(" COLLATE ") +
+ MY_CS_NAME_SIZE))
+ return;
+ beg= const_cast<char *>(buf.ptr()) + old_len;
+ end= str_to_hex(beg, val, val_len);
+ buf.length(old_len + (end - beg));
+ if (buf.append(" COLLATE ") ||
+ buf.append(cs->name))
+ return;
}
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
break;
+ }
case ROW_RESULT:
default:
DBUG_ASSERT(0);
return;
}
}
- buf[0]= '@';
- buf[1]= '`';
- memcpy(buf+2, name, name_len);
- buf[2+name_len]= '`';
- buf[3+name_len]= '=';
- protocol->store(buf, event_len, &my_charset_bin);
- my_free(buf);
}
#endif /* !MYSQL_CLIENT */
@@ -6205,6 +6485,9 @@ User_var_log_event::
User_var_log_event(const char* buf,
const Format_description_log_event* description_event)
:Log_event(buf, description_event)
+#ifndef MYSQL_CLIENT
+ , deferred(false)
+#endif
{
/* The Post-Header is empty. The Variable Data part begins immediately. */
const char *start= buf;
@@ -6351,9 +6634,8 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
my_b_printf(&cache, "\tUser_var\n");
}
- my_b_printf(&cache, "SET @`");
- my_b_write(&cache, (uchar*) name, (uint) (name_len));
- my_b_printf(&cache, "`");
+ my_b_printf(&cache, "SET @");
+ my_b_write_backtick_quote(&cache, name, name_len);
if (is_null)
{
@@ -6452,12 +6734,16 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
{
Item *it= 0;
CHARSET_INFO *charset;
+ DBUG_ENTER("User_var_log_event::do_apply_event");
if (rli->deferred_events_collecting)
- return rli->deferred_events->add(this);
+ {
+ set_deferred();
+ DBUG_RETURN(rli->deferred_events->add(this));
+ }
if (!(charset= get_charset(charset_number, MYF(MY_WME))))
- return 1;
+ DBUG_RETURN(1);
LEX_STRING user_var_name;
user_var_name.str= name;
user_var_name.length= name_len;
@@ -6503,10 +6789,11 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
case ROW_RESULT:
default:
DBUG_ASSERT(0);
- return 0;
+ DBUG_RETURN(0);
}
}
- Item_func_set_user_var e(user_var_name, it);
+
+ Item_func_set_user_var *e= new Item_func_set_user_var(user_var_name, it);
/*
Item_func_set_user_var can't substitute something else on its place =>
0 can be passed as last argument (reference on item)
@@ -6515,19 +6802,20 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
crash the server, so if fix fields fails, we just return with an
error.
*/
- if (e.fix_fields(thd, 0))
- return 1;
+ if (e->fix_fields(thd, 0))
+ DBUG_RETURN(1);
/*
A variable can just be considered as a table with
a single record and with a single column. Thus, like
a column value, it could always have IMPLICIT derivation.
*/
- e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT,
- (flags & User_var_log_event::UNSIGNED_F));
- free_root(thd->mem_root,0);
+ e->update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT,
+ (flags & User_var_log_event::UNSIGNED_F));
+ if (!is_deferred())
+ free_root(thd->mem_root, 0);
- return 0;
+ DBUG_RETURN(0);
}
int User_var_log_event::do_update_pos(Relay_log_info *rli)
@@ -6570,7 +6858,7 @@ void Unknown_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info
#endif
#ifndef MYSQL_CLIENT
-void Slave_log_event::pack_info(Protocol *protocol)
+void Slave_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[256+HOSTNAME_LENGTH], *pos;
pos= strmov(buf, "host=");
@@ -6922,11 +7210,18 @@ void Create_file_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info
{
Load_log_event::print(file, print_event_info,
!check_fname_outside_temp_buf());
- /*
- That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
- SHOW BINLOG EVENTS we don't.
- */
- my_b_printf(&cache, "#");
+ /**
+ reduce the size of io cache so that the write function is called
+ for every call to my_b_printf().
+ */
+ DBUG_EXECUTE_IF ("simulate_create_event_write_error",
+ {(&cache)->write_pos= (&cache)->write_end;
+ DBUG_SET("+d,simulate_file_write_error");});
+ /*
+ That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
+ SHOW BINLOG EVENTS we don't.
+ */
+ my_b_printf(&cache, "#");
}
my_b_printf(&cache, " file_id: %d block_len: %d\n", file_id, block_len);
@@ -6945,7 +7240,7 @@ void Create_file_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info
*/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Create_file_log_event::pack_info(Protocol *protocol)
+void Create_file_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[SAFE_NAME_LEN*2 + 30 + 21*2], *pos;
pos= strmov(buf, "db=");
@@ -7129,7 +7424,7 @@ void Append_block_log_event::print(FILE* file,
*/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Append_block_log_event::pack_info(Protocol *protocol)
+void Append_block_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[256];
uint length;
@@ -7284,7 +7579,7 @@ void Delete_file_log_event::print(FILE* file,
*/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Delete_file_log_event::pack_info(Protocol *protocol)
+void Delete_file_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[64];
uint length;
@@ -7383,7 +7678,7 @@ void Execute_load_log_event::print(FILE* file,
*/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Execute_load_log_event::pack_info(Protocol *protocol)
+void Execute_load_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[64];
uint length;
@@ -7612,6 +7907,13 @@ void Execute_load_query_log_event::print(FILE* file,
Write_on_release_cache cache(&print_event_info->head_cache, file);
print_query_header(&cache, print_event_info);
+ /**
+ reduce the size of io cache so that the write function is called
+ for every call to my_b_printf().
+ */
+ DBUG_EXECUTE_IF ("simulate_execute_event_write_error",
+ {(&cache)->write_pos= (&cache)->write_end;
+ DBUG_SET("+d,simulate_file_write_error");});
if (local_fname)
{
@@ -7638,27 +7940,24 @@ void Execute_load_query_log_event::print(FILE* file,
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Execute_load_query_log_event::pack_info(Protocol *protocol)
+void Execute_load_query_log_event::pack_info(THD *thd, Protocol *protocol)
{
- char *buf, *pos;
- if (!(buf= (char*) my_malloc(9 + db_len + q_len + 10 + 21, MYF(MY_WME))))
- return;
- pos= buf;
+ char buf_mem[1024];
+ String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+ buf.real_alloc(9 + db_len + q_len + 10 + 21);
if (db && db_len)
{
- pos= strmov(buf, "use `");
- memcpy(pos, db, db_len);
- pos= strmov(pos+db_len, "`; ");
- }
- if (query && q_len)
- {
- memcpy(pos, query, q_len);
- pos+= q_len;
+ if (buf.append("use ") ||
+ append_identifier(thd, &buf, db, db_len) ||
+ buf.append("; "))
+ return;
}
- pos= strmov(pos, " ;file_id=");
- pos= int10_to_str((long) file_id, pos, 10);
- protocol->store(buf, pos-buf, &my_charset_bin);
- my_free(buf);
+ if (query && q_len && buf.append(query, q_len))
+ return;
+ if (buf.append(" ;file_id=") ||
+ buf.append_ulonglong(file_id))
+ return;
+ protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
}
@@ -8621,7 +8920,7 @@ bool Rows_log_event::write_data_body(IO_CACHE*file)
#endif
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Rows_log_event::pack_info(Protocol *protocol)
+void Rows_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[256];
char const *const flagstr=
@@ -8725,7 +9024,7 @@ bool Annotate_rows_log_event::write_data_body(IO_CACHE *file)
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-void Annotate_rows_log_event::pack_info(Protocol* protocol)
+void Annotate_rows_log_event::pack_info(THD *thd, Protocol* protocol)
{
if (m_query_txt && m_query_len)
protocol->store(m_query_txt, m_query_len, &my_charset_bin);
@@ -9469,7 +9768,7 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file)
*/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Table_map_log_event::pack_info(Protocol *protocol)
+void Table_map_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[256];
size_t bytes= my_snprintf(buf, sizeof(buf),
@@ -9490,7 +9789,7 @@ void Table_map_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info)
{
print_header(&print_event_info->head_cache, print_event_info, TRUE);
my_b_printf(&print_event_info->head_cache,
- "\tTable_map: `%s`.`%s` mapped to number %lu\n",
+ "\tTable_map: %`s.%`s mapped to number %lu\n",
m_dbnam, m_tblnam, m_table_id);
print_base64(&print_event_info->body_cache, print_event_info, TRUE);
}
@@ -10829,7 +11128,7 @@ Incident_log_event::description() const
#ifndef MYSQL_CLIENT
-void Incident_log_event::pack_info(Protocol *protocol)
+void Incident_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[256];
size_t bytes;
@@ -10950,6 +11249,9 @@ Heartbeat_log_event::Heartbeat_log_event(const char* buf, uint event_len,
There is a dummy replacement for this in the embedded library that returns
FALSE; this is used by XtraDB to allow it to access replication stuff while
still being able to use the same plugin in both stand-alone and embedded.
+
+ In this function it's ok to use active_mi, as this is only called for
+ the main replication server.
*/
bool rpl_get_position_info(const char **log_file_name, ulonglong *log_pos,
const char **group_relay_log_name,
diff --git a/sql/log_event.h b/sql/log_event.h
index cccab93e0d5..dfbefdb359e 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -259,6 +259,7 @@ struct sql_ex_info
#define INCIDENT_HEADER_LEN 2
#define HEARTBEAT_HEADER_LEN 0
#define ANNOTATE_ROWS_HEADER_LEN 0
+#define BINLOG_CHECKPOINT_HEADER_LEN 4
/*
Max number of possible extra bytes in a replication event compared to a
@@ -284,6 +285,13 @@ struct sql_ex_info
MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
NAME_LEN + 1)
+/*
+ The new option is added to handle large packets that are sent from the master
+ to the slave. It is used to increase the thd(max_allowed) for both the
+ DUMP thread on the master and the SQL/IO thread on the slave.
+*/
+#define MAX_MAX_ALLOWED_PACKET 1024*1024*1024
+
/*
Event header offsets;
these point to places inside the fixed header.
@@ -566,6 +574,43 @@ enum enum_binlog_checksum_alg {
#define BINLOG_CHECKSUM_LEN CHECKSUM_CRC32_SIGNATURE_LEN
#define BINLOG_CHECKSUM_ALG_DESC_LEN 1 /* 1 byte checksum alg descriptor */
+/*
+ These are capability numbers for MariaDB slave servers.
+
+ Newer MariaDB slaves set this to inform the master about their capabilities.
+ This allows the master to decide which events it can send to the slave
+ without breaking replication on old slaves that maybe do not understand
+ all events from newer masters.
+
+ As new releases are backwards compatible, a given capability implies also
+ all capabilities with smaller number.
+
+ Older MariaDB slaves and other MySQL slave servers do not set this, so they
+ are recorded with capability 0.
+*/
+
+/* MySQL or old MariaDB slave with no announced capability. */
+#define MARIA_SLAVE_CAPABILITY_UNKNOWN 0
+/* MariaDB >= 5.3, which understands ANNOTATE_ROWS_EVENT. */
+#define MARIA_SLAVE_CAPABILITY_ANNOTATE 1
+/*
+ MariaDB >= 5.5. This version has the capability to tolerate events omitted
+ from the binlog stream without breaking replication (MySQL slaves fail
+ because they mis-compute the offsets into the master's binlog).
+*/
+#define MARIA_SLAVE_CAPABILITY_TOLERATE_HOLES 2
+/* MariaDB > 5.5, which knows about binlog_checkpoint_log_event. */
+#define MARIA_SLAVE_CAPABILITY_BINLOG_CHECKPOINT 3
+/*
+ MariaDB server which understands MySQL 5.6 ignorable events. This server
+ can tolerate receiving any event with the LOG_EVENT_IGNORABLE_F flag set.
+*/
+#define MARIA_SLAVE_CAPABILITY_IGNORABLE 4
+
+/* Our capability. */
+#define MARIA_SLAVE_CAPABILITY_MINE MARIA_SLAVE_CAPABILITY_BINLOG_CHECKPOINT
+
+
/**
@enum Log_event_type
@@ -641,6 +686,14 @@ enum Log_event_type
MARIA_EVENTS_BEGIN= 160,
/* New Maria event numbers start from here */
ANNOTATE_ROWS_EVENT= 160,
+ /*
+ Binlog checkpoint event. Used for XA crash recovery on the master, not used
+ in replication.
+ A binlog checkpoint event specifies a binlog file such that XA crash
+ recovery can start from that file - and it is guaranteed to find all XIDs
+ that are prepared in storage engines but not yet committed.
+ */
+ BINLOG_CHECKPOINT_EVENT= 161,
/* Add new MariaDB events here - right above this comment! */
@@ -1058,14 +1111,15 @@ public:
*/
static void init_show_field_list(List<Item>* field_list);
#ifdef HAVE_REPLICATION
- int net_send(Protocol *protocol, const char* log_name, my_off_t pos);
+ int net_send(THD *thd, Protocol *protocol, const char* log_name,
+ my_off_t pos);
/*
pack_info() is used by SHOW BINLOG EVENTS; as print() it prepares and sends
a string to display to the user, so it resembles print().
*/
- virtual void pack_info(Protocol *protocol);
+ virtual void pack_info(THD *thd, Protocol *protocol);
#endif /* HAVE_REPLICATION */
virtual const char* get_db()
@@ -1802,7 +1856,7 @@ public:
bool using_trans, bool direct, bool suppress_use, int error);
const char* get_db() { return db; }
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
void print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info);
@@ -1819,6 +1873,7 @@ public:
my_free(data_buf);
}
Log_event_type get_type_code() { return QUERY_EVENT; }
+ static int dummy_event(String *packet, ulong ev_offset, uint8 checksum_alg);
#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
virtual bool write_post_header_for_derived(IO_CACHE* file) { return FALSE; }
@@ -1932,7 +1987,7 @@ public:
#ifdef MYSQL_SERVER
Slave_log_event(THD* thd_arg, Relay_log_info* rli);
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
#endif
@@ -2165,9 +2220,9 @@ protected:
const Format_description_log_event* description_event);
public:
- uint get_query_buffer_length();
- void print_query(bool need_db, const char *cs, char *buf, char **end,
- char **fn_start, char **fn_end);
+ void print_query(THD *thd, bool need_db, const char *cs, String *buf,
+ my_off_t *fn_start, my_off_t *fn_end,
+ const char *qualify_db);
ulong thread_id;
ulong slave_proxy_id;
uint32 table_name_len;
@@ -2228,7 +2283,7 @@ public:
Name_resolution_context *context);
const char* get_db() { return db; }
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2325,7 +2380,7 @@ public:
#ifdef MYSQL_SERVER
Start_log_event_v3();
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
Start_log_event_v3() {}
@@ -2489,7 +2544,7 @@ Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg,
cache_type= Log_event::EVENT_NO_CACHE;
}
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2569,7 +2624,7 @@ class Rand_log_event: public Log_event
cache_type= Log_event::EVENT_NO_CACHE;
}
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2618,7 +2673,7 @@ class Xid_log_event: public Log_event
cache_type= Log_event::EVENT_NO_CACHE;
}
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2666,6 +2721,7 @@ public:
bool is_null;
uchar flags;
#ifdef MYSQL_SERVER
+ bool deferred;
User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg,
char *val_arg, ulong val_len_arg, Item_result type_arg,
uint charset_number_arg, uchar flags_arg,
@@ -2673,13 +2729,13 @@ public:
:Log_event(thd_arg, 0, using_trans),
name(name_arg), name_len(name_len_arg), val(val_arg),
val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg),
- flags(flags_arg)
+ flags(flags_arg), deferred(false)
{
is_null= !val;
if (direct)
cache_type= Log_event::EVENT_NO_CACHE;
}
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
#endif
@@ -2690,6 +2746,13 @@ public:
Log_event_type get_type_code() { return USER_VAR_EVENT;}
#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
+ /*
+ Getter and setter for deferred User-event.
+ Returns true if the event is not applied directly
+ and which case the applier adjusts execution path.
+ */
+ bool is_deferred() { return deferred; }
+ void set_deferred() { deferred= val; }
#endif
bool is_valid() const { return 1; }
@@ -2810,7 +2873,7 @@ public:
uint ident_len_arg,
ulonglong pos_arg, uint flags);
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2838,6 +2901,32 @@ private:
};
+class Binlog_checkpoint_log_event: public Log_event
+{
+public:
+ char *binlog_file_name;
+ uint binlog_file_len;
+
+#ifdef MYSQL_SERVER
+ Binlog_checkpoint_log_event(const char *binlog_file_name_arg,
+ uint binlog_file_len_arg);
+#ifdef HAVE_REPLICATION
+ void pack_info(THD *thd, Protocol *protocol);
+#endif
+#else
+ void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
+#endif
+ Binlog_checkpoint_log_event(const char *buf, uint event_len,
+ const Format_description_log_event *description_event);
+ ~Binlog_checkpoint_log_event() { my_free(binlog_file_name); }
+ Log_event_type get_type_code() { return BINLOG_CHECKPOINT_EVENT;}
+ int get_data_size() { return binlog_file_len + BINLOG_CHECKPOINT_HEADER_LEN;}
+ bool is_valid() const { return binlog_file_name != 0; }
+#ifdef MYSQL_SERVER
+ bool write(IO_CACHE* file);
+#endif
+};
+
/* the classes below are for the new LOAD DATA INFILE logging */
/**
@@ -2871,7 +2960,7 @@ public:
uchar* block_arg, uint block_len_arg,
bool using_trans);
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2943,7 +3032,7 @@ public:
Append_block_log_event(THD* thd, const char* db_arg, uchar* block_arg,
uint block_len_arg, bool using_trans);
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
virtual int get_create_or_append() const;
#endif /* HAVE_REPLICATION */
#else
@@ -2984,7 +3073,7 @@ public:
#ifdef MYSQL_SERVER
Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans);
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -3025,7 +3114,7 @@ public:
#ifdef MYSQL_SERVER
Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans);
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -3121,7 +3210,7 @@ public:
bool using_trans, bool direct,
bool suppress_use, int errcode);
#ifdef HAVE_REPLICATION
- void pack_info(Protocol* protocol);
+ void pack_info(THD *thd, Protocol* protocol);
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -3207,7 +3296,7 @@ public:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual void pack_info(Protocol*);
+ virtual void pack_info(THD *thd, Protocol*);
#endif
#ifdef MYSQL_CLIENT
@@ -3621,7 +3710,7 @@ public:
#endif
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
- virtual void pack_info(Protocol *protocol);
+ virtual void pack_info(THD *thd, Protocol *protocol);
#endif
#ifdef MYSQL_CLIENT
@@ -3733,7 +3822,7 @@ public:
flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
- virtual void pack_info(Protocol *protocol);
+ virtual void pack_info(THD *thd, Protocol *protocol);
#endif
#ifdef MYSQL_CLIENT
@@ -4180,7 +4269,7 @@ public:
#endif
#ifdef MYSQL_SERVER
- void pack_info(Protocol*);
+ void pack_info(THD *thd, Protocol*);
#endif
Incident_log_event(const char *buf, uint event_len,
@@ -4279,6 +4368,16 @@ bool event_checksum_test(uchar *buf, ulong event_len, uint8 alg);
uint8 get_checksum_alg(const char* buf, ulong len);
extern TYPELIB binlog_checksum_typelib;
+#ifndef MYSQL_CLIENT
+/**
+ The function is called by slave applier in case there are
+ active table filtering rules to force gathering events associated
+ with Query-log-event into an array to execute
+ them once the fate of the Query is determined for execution.
+*/
+bool slave_execute_deferred_events(THD *thd);
+#endif
+
/**
@} (end of group Replication)
*/
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 8f2c515e11c..d7c66af769a 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -1935,7 +1935,7 @@ bool Old_rows_log_event::write_data_body(IO_CACHE*file)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Old_rows_log_event::pack_info(Protocol *protocol)
+void Old_rows_log_event::pack_info(THD *thd, Protocol *protocol)
{
char buf[256];
char const *const flagstr=
diff --git a/sql/log_event_old.h b/sql/log_event_old.h
index 8fe2e9e0a75..3e1efd8e2c0 100644
--- a/sql/log_event_old.h
+++ b/sql/log_event_old.h
@@ -108,7 +108,7 @@ public:
flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual void pack_info(Protocol *protocol);
+ virtual void pack_info(THD *thd, Protocol *protocol);
#endif
#ifdef MYSQL_CLIENT
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index ac44ba7288b..12f1f7c5519 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -1404,7 +1404,7 @@ ha_rows DsMrr_impl::dsmrr_info(uint keyno, uint n_ranges, uint rows,
uint key_parts,
uint *bufsz, uint *flags, Cost_estimate *cost)
{
- ha_rows __attribute__((unused)) res;
+ ha_rows res __attribute__((unused));
uint def_flags= *flags;
uint def_bufsz= *bufsz;
diff --git a/sql/my_apc.cc b/sql/my_apc.cc
new file mode 100644
index 00000000000..5d1adb6bca7
--- /dev/null
+++ b/sql/my_apc.cc
@@ -0,0 +1,270 @@
+/*
+ Copyright (c) 2011 - 2012, Monty Program Ab
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+#ifndef MY_APC_STANDALONE
+
+#include "sql_priv.h"
+#include "sql_class.h"
+
+#endif
+
+/* For standalone testing of APC system, see unittest/sql/my_apc-t.cc */
+
+/*
+ Initialize the target.
+
+ @note
+ Initialization must be done prior to enabling/disabling the target, or making
+ any call requests to it.
+ Initial state after initialization is 'disabled'.
+*/
+void Apc_target::init(mysql_mutex_t *target_mutex)
+{
+ DBUG_ASSERT(!enabled);
+ LOCK_thd_data_ptr= target_mutex;
+#ifndef DBUG_OFF
+ n_calls_processed= 0;
+#endif
+}
+
+
+/*
+ Destroy the target. The target must be disabled when this call is made.
+*/
+void Apc_target::destroy()
+{
+ DBUG_ASSERT(!enabled);
+}
+
+
+/*
+ Enter ther state where the target is available for serving APC requests
+*/
+void Apc_target::enable()
+{
+ /* Ok to do without getting/releasing the mutex: */
+ enabled++;
+}
+
+
+/*
+ Make the target unavailable for serving APC requests.
+
+ @note
+ This call will serve all requests that were already enqueued
+*/
+
+void Apc_target::disable()
+{
+ bool process= FALSE;
+ mysql_mutex_lock(LOCK_thd_data_ptr);
+ if (!(--enabled))
+ process= TRUE;
+ mysql_mutex_unlock(LOCK_thd_data_ptr);
+ if (process)
+ process_apc_requests();
+}
+
+
+/* [internal] Put request qe into the request list */
+
+void Apc_target::enqueue_request(Call_request *qe)
+{
+ mysql_mutex_assert_owner(LOCK_thd_data_ptr);
+ if (apc_calls)
+ {
+ Call_request *after= apc_calls->prev;
+ qe->next= apc_calls;
+ apc_calls->prev= qe;
+
+ qe->prev= after;
+ after->next= qe;
+ }
+ else
+ {
+ apc_calls= qe;
+ qe->next= qe->prev= qe;
+ }
+}
+
+
+/*
+ [internal] Remove request qe from the request queue.
+
+ The request is not necessarily first in the queue.
+*/
+
+void Apc_target::dequeue_request(Call_request *qe)
+{
+ mysql_mutex_assert_owner(LOCK_thd_data_ptr);
+ if (apc_calls == qe)
+ {
+ if ((apc_calls= apc_calls->next) == qe)
+ {
+ apc_calls= NULL;
+ }
+ }
+
+ qe->prev->next= qe->next;
+ qe->next->prev= qe->prev;
+}
+
+#ifdef HAVE_PSI_INTERFACE
+
+/* One key for all conds */
+PSI_cond_key key_show_explain_request_COND;
+
+static PSI_cond_info show_explain_psi_conds[]=
+{
+ { &key_show_explain_request_COND, "show_explain", 0 /* not using PSI_FLAG_GLOBAL*/ }
+};
+
+void init_show_explain_psi_keys(void)
+{
+ if (PSI_server == NULL)
+ return;
+
+ PSI_server->register_cond("sql", show_explain_psi_conds,
+ array_elements(show_explain_psi_conds));
+}
+#endif
+
+
+/*
+ Make an APC (Async Procedure Call) to another thread.
+
+ @detail
+ Make an APC call: schedule it for execution and wait until the target
+ thread has executed it.
+
+ - The caller is responsible for making sure he's not posting request
+ to the thread he's calling this function from.
+
+ - The caller must have locked target_mutex. The function will release it.
+
+ @retval FALSE - Ok, the call has been made
+ @retval TRUE - Call wasnt made (either the target is in disabled state or
+ timeout occured)
+*/
+
+bool Apc_target::make_apc_call(THD *caller_thd, Apc_call *call,
+ int timeout_sec, bool *timed_out)
+{
+ bool res= TRUE;
+ *timed_out= FALSE;
+
+ if (enabled)
+ {
+ /* Create and post the request */
+ Call_request apc_request;
+ apc_request.call= call;
+ apc_request.processed= FALSE;
+ mysql_cond_init(key_show_explain_request_COND, &apc_request.COND_request,
+ NULL);
+ enqueue_request(&apc_request);
+ apc_request.what="enqueued by make_apc_call";
+
+ struct timespec abstime;
+ const int timeout= timeout_sec;
+ set_timespec(abstime, timeout);
+
+ int wait_res= 0;
+ PSI_stage_info old_stage;
+ caller_thd->ENTER_COND(&apc_request.COND_request, LOCK_thd_data_ptr,
+ &stage_show_explain, &old_stage);
+ /* todo: how about processing other errors here? */
+ while (!apc_request.processed && (wait_res != ETIMEDOUT))
+ {
+ /* We own LOCK_thd_data_ptr */
+ wait_res= mysql_cond_timedwait(&apc_request.COND_request,
+ LOCK_thd_data_ptr, &abstime);
+ // &apc_request.LOCK_request, &abstime);
+ if (caller_thd->killed)
+ break;
+ }
+
+ if (!apc_request.processed)
+ {
+ /*
+ The wait has timed out, or this thread was KILLed.
+ Remove the request from the queue (ok to do because we own
+ LOCK_thd_data_ptr)
+ */
+ apc_request.processed= TRUE;
+ dequeue_request(&apc_request);
+ *timed_out= TRUE;
+ res= TRUE;
+ }
+ else
+ {
+ /* Request was successfully executed and dequeued by the target thread */
+ res= FALSE;
+ }
+ /*
+ exit_cond() will call mysql_mutex_unlock(LOCK_thd_data_ptr) for us:
+ */
+ caller_thd->EXIT_COND(&old_stage);
+
+ /* Destroy all APC request data */
+ mysql_cond_destroy(&apc_request.COND_request);
+ }
+ else
+ {
+ mysql_mutex_unlock(LOCK_thd_data_ptr);
+ }
+ return res;
+}
+
+
+/*
+ Process all APC requests.
+ This should be called periodically by the APC target thread.
+*/
+
+void Apc_target::process_apc_requests()
+{
+ while (1)
+ {
+ Call_request *request;
+
+ mysql_mutex_lock(LOCK_thd_data_ptr);
+ if (!(request= get_first_in_queue()))
+ {
+ /* No requests in the queue */
+ mysql_mutex_unlock(LOCK_thd_data_ptr);
+ break;
+ }
+
+ /*
+ Remove the request from the queue (we're holding queue lock so we can be
+ sure that request owner won't try to remove it)
+ */
+ request->what="dequeued by process_apc_requests";
+ dequeue_request(request);
+ request->processed= TRUE;
+
+ request->call->call_in_target_thread();
+ request->what="func called by process_apc_requests";
+
+#ifndef DBUG_OFF
+ n_calls_processed++;
+#endif
+ mysql_cond_signal(&request->COND_request);
+ mysql_mutex_unlock(LOCK_thd_data_ptr);
+ }
+}
+
diff --git a/sql/my_apc.h b/sql/my_apc.h
new file mode 100644
index 00000000000..7f19809c082
--- /dev/null
+++ b/sql/my_apc.h
@@ -0,0 +1,138 @@
+#ifndef INCLUDES_MY_APC_H
+#define INCLUDES_MY_APC_H
+/*
+ Copyright (c) 2011 - 2012, Monty Program Ab
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/*
+ Interface
+ ~~~~~~~~~
+ (
+ - This is an APC request queue
+ - We assume there is a particular owner thread which periodically calls
+ process_apc_requests() to serve the call requests.
+ - Other threads can post call requests, and block until they are exectued.
+ )
+
+ Implementation
+ ~~~~~~~~~~~~~~
+ - The target has a mutex-guarded request queue.
+
+ - After the request has been put into queue, the requestor waits for request
+ to be satisfied. The worker satisifes the request and signals the
+ requestor.
+*/
+
+class THD;
+
+/*
+ Target for asynchronous procedure calls (APCs).
+ - A target is running in some particular thread,
+ - One can make calls to it from other threads.
+*/
+class Apc_target
+{
+ mysql_mutex_t *LOCK_thd_data_ptr;
+public:
+ Apc_target() : enabled(0), apc_calls(NULL) {}
+ ~Apc_target() { DBUG_ASSERT(!enabled && !apc_calls);}
+
+ void init(mysql_mutex_t *target_mutex);
+ void destroy();
+ void enable();
+ void disable();
+
+ void process_apc_requests();
+ /*
+ A lightweight function, intended to be used in frequent checks like this:
+
+ if (apc_target.have_requests()) apc_target.process_apc_requests()
+ */
+ inline bool have_apc_requests()
+ {
+ return test(apc_calls);
+ }
+
+ /* Functor class for calls you can schedule */
+ class Apc_call
+ {
+ public:
+ /* This function will be called in the target thread */
+ virtual void call_in_target_thread()= 0;
+ virtual ~Apc_call() {}
+ };
+
+ /* Make a call in the target thread (see function definition for details) */
+ bool make_apc_call(THD *caller_thd, Apc_call *call, int timeout_sec, bool *timed_out);
+
+#ifndef DBUG_OFF
+ int n_calls_processed; /* Number of calls served by this target */
+#endif
+private:
+ class Call_request;
+
+ /*
+ Non-zero value means we're enabled. It's an int, not bool, because one can
+ call enable() N times (and then needs to call disable() N times before the
+ target is really disabled)
+ */
+ int enabled;
+
+ /*
+ Circular, double-linked list of all enqueued call requests.
+ We use this structure, because we
+ - process requests sequentially: requests are added at the end of the
+ list and removed from the front. With circular list, we can keep one
+ pointer, and access both front an back of the list with it.
+ - a thread that has posted a request may time out (or be KILLed) and
+ cancel the request, which means we need a fast request-removal
+ operation.
+ */
+ Call_request *apc_calls;
+
+ class Call_request
+ {
+ public:
+ Apc_call *call; /* Functor to be called */
+
+ /* The caller will actually wait for "processed==TRUE" */
+ bool processed;
+
+ /* Condition that will be signalled when the request has been served */
+ mysql_cond_t COND_request;
+
+ /* Double linked-list linkage */
+ Call_request *next;
+ Call_request *prev;
+
+ const char *what; /* (debug) state of the request */
+ };
+
+ void enqueue_request(Call_request *qe);
+ void dequeue_request(Call_request *qe);
+
+ /* return the first call request in queue, or NULL if there are none enqueued */
+ Call_request *get_first_in_queue()
+ {
+ return apc_calls;
+ }
+};
+
+#ifdef HAVE_PSI_INTERFACE
+void init_show_explain_psi_keys(void);
+#endif
+
+#endif //INCLUDES_MY_APC_H
+
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b259565d6e0..3cfa9fab02b 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -52,6 +52,7 @@
#include "des_key_file.h" // load_des_key_file
#include "sql_manager.h" // stop_handle_manager, start_handle_manager
#include "sql_expression_cache.h" // subquery_cache_miss, subquery_cache_hit
+#include "sys_vars_shared.h"
#include <m_ctype.h>
#include <my_dir.h>
@@ -110,7 +111,7 @@
/* We have HAVE_valgrind below as this speeds up the shutdown of MySQL */
-#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ) || defined(HAVE_valgrind) && defined(__linux__)
+#if defined(SIGNALS_DONT_BREAK_READ) || defined(HAVE_valgrind) && defined(__linux__)
#define HAVE_CLOSE_SERVER_SOCK 1
#endif
@@ -364,7 +365,7 @@ static DYNAMIC_ARRAY all_options;
/* Global variables */
-bool opt_bin_log, opt_ignore_builtin_innodb= 0;
+bool opt_bin_log, opt_bin_log_used=0, opt_ignore_builtin_innodb= 0;
my_bool opt_log, opt_slow_log, debug_assert_if_crashed_table= 0, opt_help= 0, opt_abort;
ulonglong log_output_options;
my_bool opt_userstat_running;
@@ -473,7 +474,7 @@ ulong back_log, connect_timeout, concurrency, server_id;
ulong table_cache_size, table_def_size;
ulong what_to_log;
ulong slow_launch_time, slave_open_temp_tables;
-ulong open_files_limit, max_binlog_size, max_relay_log_size;
+ulong open_files_limit, max_binlog_size;
ulong slave_trans_retries;
uint slave_net_timeout;
ulong slave_exec_mode_options;
@@ -481,10 +482,12 @@ ulonglong slave_type_conversions_options;
ulong thread_cache_size=0;
ulonglong binlog_cache_size=0;
ulonglong max_binlog_cache_size=0;
+ulong slave_max_allowed_packet= 0;
ulonglong binlog_stmt_cache_size=0;
ulonglong max_binlog_stmt_cache_size=0;
ulonglong query_cache_size=0;
ulong refresh_version; /* Increments on each reload */
+ulong executed_events=0;
query_id_t global_query_id;
my_atomic_rwlock_t global_query_id_lock;
my_atomic_rwlock_t thread_running_lock;
@@ -497,6 +500,7 @@ ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
ulong max_connections, max_connect_errors;
ulong extra_max_connections;
+ulong slave_retried_transactions;
ulonglong denied_connections;
my_decimal decimal_zero;
@@ -582,7 +586,7 @@ char mysql_real_data_home[FN_REFLEN],
lc_messages_dir[FN_REFLEN], reg_ext[FN_EXTLEN],
mysql_charsets_dir[FN_REFLEN],
*opt_init_file, *opt_tc_log_file;
-char *lc_messages_dir_ptr, *log_error_file_ptr;
+char *lc_messages_dir_ptr= lc_messages_dir, *log_error_file_ptr;
char mysql_unpacked_real_data_home[FN_REFLEN];
int mysql_unpacked_real_data_home_len;
uint mysql_real_data_home_len, mysql_data_home_len= 1;
@@ -675,8 +679,7 @@ pthread_attr_t connection_attrib;
mysql_mutex_t LOCK_server_started;
mysql_cond_t COND_server_started;
-int mysqld_server_started= 0;
-
+int mysqld_server_started=0, mysqld_server_initialized= 0;
File_parser_dummy_hook file_parser_dummy_hook;
/* replication parameters, if master_host is not NULL, we are a slave */
@@ -718,14 +721,15 @@ char **orig_argv;
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_MMAP
-PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, key_LOCK_pool;
+PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, key_LOCK_pool,
+ key_LOCK_pending_checkpoint;
#endif /* HAVE_MMAP */
#ifdef HAVE_OPENSSL
PSI_mutex_key key_LOCK_des_key_file;
#endif /* HAVE_OPENSSL */
-PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
+PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
@@ -759,6 +763,7 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_sync, "TC_LOG_MMAP::LOCK_sync", 0},
{ &key_LOCK_active, "TC_LOG_MMAP::LOCK_active", 0},
{ &key_LOCK_pool, "TC_LOG_MMAP::LOCK_pool", 0},
+ { &key_LOCK_pool, "TC_LOG_MMAP::LOCK_pending_checkpoint", 0},
#endif /* HAVE_MMAP */
#ifdef HAVE_OPENSSL
@@ -766,7 +771,7 @@ static PSI_mutex_info all_server_mutexes[]=
#endif /* HAVE_OPENSSL */
{ &key_BINLOG_LOCK_index, "MYSQL_BIN_LOG::LOCK_index", 0},
- { &key_BINLOG_LOCK_prep_xids, "MYSQL_BIN_LOG::LOCK_prep_xids", 0},
+ { &key_BINLOG_LOCK_xid_list, "MYSQL_BIN_LOG::LOCK_xid_list", 0},
{ &key_RELAYLOG_LOCK_index, "MYSQL_RELAY_LOG::LOCK_index", 0},
{ &key_delayed_insert_mutex, "Delayed_insert::mutex", 0},
{ &key_hash_filo_lock, "hash_filo::lock", 0},
@@ -834,7 +839,7 @@ static PSI_rwlock_info all_server_rwlocks[]=
PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool;
#endif /* HAVE_MMAP */
-PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond,
+PSI_cond_key key_BINLOG_COND_xid_list, key_BINLOG_update_cond,
key_COND_cache_status_changed, key_COND_manager,
key_COND_rpl_status, key_COND_server_started,
key_delayed_insert_cond, key_delayed_insert_cond_client,
@@ -862,7 +867,7 @@ static PSI_cond_info all_server_conds[]=
{ &key_COND_pool, "TC_LOG_MMAP::COND_pool", 0},
{ &key_TC_LOG_MMAP_COND_queue_busy, "TC_LOG_MMAP::COND_queue_busy", 0},
#endif /* HAVE_MMAP */
- { &key_BINLOG_COND_prep_xids, "MYSQL_BIN_LOG::COND_prep_xids", 0},
+ { &key_BINLOG_COND_xid_list, "MYSQL_BIN_LOG::COND_xid_list", 0},
{ &key_BINLOG_update_cond, "MYSQL_BIN_LOG::update_cond", 0},
{ &key_BINLOG_COND_queue_busy, "MYSQL_BIN_LOG::COND_queue_busy", 0},
{ &key_RELAYLOG_update_cond, "MYSQL_RELAY_LOG::update_cond", 0},
@@ -1782,7 +1787,12 @@ void clean_up(bool print_message)
if (cleanup_done++)
return; /* purecov: inspected */
- close_active_mi();
+#ifdef HAVE_REPLICATION
+ // We must call end_slave() as clean_up may have been called during startup
+ end_slave();
+ if (use_slave_mask)
+ bitmap_free(&slave_error_mask);
+#endif
stop_handle_manager();
release_ddl_log();
@@ -1797,10 +1807,6 @@ void clean_up(bool print_message)
injector::free_instance();
mysql_bin_log.cleanup();
-#ifdef HAVE_REPLICATION
- if (use_slave_mask)
- bitmap_free(&slave_error_mask);
-#endif
my_tz_free();
my_dboptions_cache_free();
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -2049,13 +2055,19 @@ static struct passwd *check_user(const char *user)
if (!(tmp_user_info= getpwuid(atoi(user))))
goto err;
}
+
return tmp_user_info;
/* purecov: end */
err:
sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user);
unireg_abort(1);
+#endif
+ return NULL;
+}
+static inline void allow_coredumps()
+{
#ifdef PR_SET_DUMPABLE
if (test_flags & TEST_CORE_ON_SIGNAL)
{
@@ -2063,11 +2075,9 @@ err:
(void) prctl(PR_SET_DUMPABLE, 1);
}
#endif
-
-#endif
- return NULL;
}
+
static void set_user(const char *user, struct passwd *user_info_arg)
{
/* purecov: begin tested */
@@ -2094,6 +2104,7 @@ static void set_user(const char *user, struct passwd *user_info_arg)
sql_perror("setuid");
unireg_abort(1);
}
+ allow_coredumps();
#endif
/* purecov: end */
}
@@ -2113,6 +2124,7 @@ static void set_effective_user(struct passwd *user_info_arg)
sql_perror("setreuid");
unireg_abort(1);
}
+ allow_coredumps();
#endif
}
@@ -2955,11 +2967,9 @@ static void start_signal_handler(void)
DBUG_ENTER("start_signal_handler");
(void) pthread_attr_init(&thr_attr);
-#if !defined(HAVE_DEC_3_2_THREADS)
pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_SYSTEM);
(void) pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
(void) my_setstacksize(&thr_attr,my_thread_stack_size);
-#endif
mysql_mutex_lock(&LOCK_thread_count);
if ((error= mysql_thread_create(key_thread_signal_hand,
@@ -3366,6 +3376,7 @@ SHOW_VAR com_status_vars[]= {
{"show_engine_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ENGINE_STATUS]), SHOW_LONG_STATUS},
{"show_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_EVENTS]), SHOW_LONG_STATUS},
{"show_errors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ERRORS]), SHOW_LONG_STATUS},
+ {"show_explain", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_EXPLAIN]), SHOW_LONG_STATUS},
{"show_fields", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FIELDS]), SHOW_LONG_STATUS},
#ifndef DBUG_OFF
{"show_function_code", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FUNC_CODE]), SHOW_LONG_STATUS},
@@ -3397,8 +3408,8 @@ SHOW_VAR com_status_vars[]= {
{"show_user_statistics", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_USER_STATS]), SHOW_LONG_STATUS},
{"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
{"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
- {"slave_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
- {"slave_stop", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS},
+ {"start_all_slaves", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_ALL_START]), SHOW_LONG_STATUS},
+ {"start_slave", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
{"stmt_close", (char*) offsetof(STATUS_VAR, com_stmt_close), SHOW_LONG_STATUS},
{"stmt_execute", (char*) offsetof(STATUS_VAR, com_stmt_execute), SHOW_LONG_STATUS},
{"stmt_fetch", (char*) offsetof(STATUS_VAR, com_stmt_fetch), SHOW_LONG_STATUS},
@@ -3406,6 +3417,8 @@ SHOW_VAR com_status_vars[]= {
{"stmt_reprepare", (char*) offsetof(STATUS_VAR, com_stmt_reprepare), SHOW_LONG_STATUS},
{"stmt_reset", (char*) offsetof(STATUS_VAR, com_stmt_reset), SHOW_LONG_STATUS},
{"stmt_send_long_data", (char*) offsetof(STATUS_VAR, com_stmt_send_long_data), SHOW_LONG_STATUS},
+ {"stop_all_slaves", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_ALL_STOP]), SHOW_LONG_STATUS},
+ {"stop_slave", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS},
{"truncate", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_TRUNCATE]), SHOW_LONG_STATUS},
{"uninstall_plugin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNINSTALL_PLUGIN]), SHOW_LONG_STATUS},
{"unlock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS},
@@ -4011,6 +4024,7 @@ static int init_thread_environment()
#ifdef HAVE_EVENT_SCHEDULER
Events::init_mutexes();
#endif
+ init_show_explain_psi_keys();
/* Parameter for threads created for connections */
(void) pthread_attr_init(&connection_attrib);
(void) pthread_attr_setdetachstate(&connection_attrib,
@@ -4261,14 +4275,15 @@ static int init_server_components()
unireg_abort(1);
/* need to configure logging before initializing storage engines */
- if (opt_log_slave_updates && !opt_bin_log)
+ if (!opt_bin_log_used)
{
- sql_print_warning("You need to use --log-bin to make "
- "--log-slave-updates work.");
+ if (opt_log_slave_updates)
+ sql_print_warning("You need to use --log-bin to make "
+ "--log-slave-updates work.");
+ if (binlog_format_used)
+ sql_print_warning("You need to use --log-bin to make "
+ "--binlog-format work.");
}
- if (!opt_bin_log && binlog_format_used)
- sql_print_warning("You need to use --log-bin to make "
- "--binlog-format work.");
/* Check that we have not let the format to unspecified at this point */
DBUG_ASSERT((uint)global_system_variables.binlog_format <=
@@ -4513,7 +4528,7 @@ a file name for --log-bin-index option", opt_binlog_index_name);
}
if (opt_bin_log && mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0,
- WRITE_CACHE, 0, max_binlog_size, 0, TRUE))
+ WRITE_CACHE, max_binlog_size, 0, TRUE))
unireg_abort(1);
#ifdef HAVE_REPLICATION
@@ -4711,6 +4726,7 @@ int mysqld_main(int argc, char **argv)
}
#endif
+ mysqld_server_started= mysqld_server_initialized= 0;
orig_argc= argc;
orig_argv= argv;
my_getopt_use_args_separator= TRUE;
@@ -4984,16 +5000,6 @@ int mysqld_main(int argc, char **argv)
opt_skip_slave_start= 1;
binlog_unsafe_map_init();
- /*
- init_slave() must be called after the thread keys are created.
- Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and other
- places) assume that active_mi != 0, so let's fail if it's 0 (out of
- memory); a message has already been printed.
- */
- if (init_slave() && !active_mi)
- {
- unireg_abort(1);
- }
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
initialize_performance_schema_acl(opt_bootstrap);
@@ -5011,9 +5017,17 @@ int mysqld_main(int argc, char **argv)
execute_ddl_log_recovery();
+ /*
+ We must have LOCK_open before LOCK_global_system_variables because
+ LOCK_open is held while sql_plugin.c::intern_sys_var_ptr() is called.
+ */
+ mysql_mutex_record_order(&LOCK_open, &LOCK_global_system_variables);
+
if (Events::init(opt_noacl || opt_bootstrap))
unireg_abort(1);
+ mysqld_server_initialized= 1;
+
if (opt_bootstrap)
{
select_thread_in_use= 0; // Allow 'kill' to work
@@ -5026,21 +5040,27 @@ int mysqld_main(int argc, char **argv)
exit(0);
}
}
+
+ create_shutdown_thread();
+ start_handle_manager();
+
+ /*
+ init_slave() must be called after the thread keys are created.
+ Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and other
+ places) assume that active_mi != 0, so let's fail if it's 0 (out of
+ memory); a message has already been printed.
+ */
+ if (init_slave() && !active_mi)
+ {
+ unireg_abort(1);
+ }
+
if (opt_init_file && *opt_init_file)
{
if (read_init_file(opt_init_file))
unireg_abort(1);
}
- /*
- We must have LOCK_open before LOCK_global_system_variables because
- LOCK_open is hold while sql_plugin.c::intern_sys_var_ptr() is called.
- */
- mysql_mutex_record_order(&LOCK_open, &LOCK_global_system_variables);
-
- create_shutdown_thread();
- start_handle_manager();
-
sql_print_information(ER_DEFAULT(ER_STARTUP),my_progname,server_version,
((mysql_socket_getfd(unix_sock) == INVALID_SOCKET) ?
(char*) "" : mysqld_unix_port),
@@ -6337,7 +6357,7 @@ struct my_option my_long_options[]=
{"language", 'L',
"Client error messages in given language. May be given as a full path. "
"Deprecated. Use --lc-messages-dir instead.",
- &lc_messages_dir_ptr, &lc_messages_dir_ptr, 0,
+ 0, 0, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lc-messages", 0,
"Set the language used for the error messages.",
@@ -6486,7 +6506,7 @@ struct my_option my_long_options[]=
"will not do updates to tables in databases that start with foo and whose "
"table names start with bar.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
+ {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing). Deprecated.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"safe-user-create", 0,
"Don't allow new user creation by the user who has no write privileges to the mysql.user table.",
@@ -6634,63 +6654,53 @@ static int show_rpl_status(THD *thd, SHOW_VAR *var, char *buff)
static int show_slave_running(THD *thd, SHOW_VAR *var, char *buff)
{
+ Master_info *mi;
var->type= SHOW_MY_BOOL;
- mysql_mutex_lock(&LOCK_active_mi);
var->value= buff;
- *((my_bool *)buff)= (my_bool) (active_mi &&
- active_mi->slave_running == MYSQL_SLAVE_RUN_CONNECT &&
- active_mi->rli.slave_running);
- mysql_mutex_unlock(&LOCK_active_mi);
- return 0;
-}
-
-static int show_slave_retried_trans(THD *thd, SHOW_VAR *var, char *buff)
-{
- /*
- TODO: with multimaster, have one such counter per line in
- SHOW SLAVE STATUS, and have the sum over all lines here.
- */
mysql_mutex_lock(&LOCK_active_mi);
- if (active_mi)
- {
- var->type= SHOW_LONG;
- var->value= buff;
- mysql_mutex_lock(&active_mi->rli.data_lock);
- *((long *)buff)= (long)active_mi->rli.retried_trans;
- mysql_mutex_unlock(&active_mi->rli.data_lock);
- }
+ mi= master_info_index->
+ get_master_info(&thd->variables.default_master_connection,
+ MYSQL_ERROR::WARN_LEVEL_NOTE);
+ if (mi)
+ *((my_bool *)buff)= (my_bool) (mi->slave_running ==
+ MYSQL_SLAVE_RUN_CONNECT &&
+ mi->rli.slave_running);
else
var->type= SHOW_UNDEF;
mysql_mutex_unlock(&LOCK_active_mi);
return 0;
}
+
static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, char *buff)
{
+ Master_info *mi;
+ var->type= SHOW_LONGLONG;
+ var->value= buff;
mysql_mutex_lock(&LOCK_active_mi);
- if (active_mi)
- {
- var->type= SHOW_LONGLONG;
- var->value= buff;
- mysql_mutex_lock(&active_mi->rli.data_lock);
- *((longlong *)buff)= active_mi->received_heartbeats;
- mysql_mutex_unlock(&active_mi->rli.data_lock);
- }
+ mi= master_info_index->
+ get_master_info(&thd->variables.default_master_connection,
+ MYSQL_ERROR::WARN_LEVEL_NOTE);
+ if (mi)
+ *((longlong *)buff)= mi->received_heartbeats;
else
var->type= SHOW_UNDEF;
mysql_mutex_unlock(&LOCK_active_mi);
return 0;
}
+
static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff)
{
+ Master_info *mi;
+ var->type= SHOW_CHAR;
+ var->value= buff;
mysql_mutex_lock(&LOCK_active_mi);
- if (active_mi)
- {
- var->type= SHOW_CHAR;
- var->value= buff;
- sprintf(buff, "%.3f", active_mi->heartbeat_period);
- }
+ mi= master_info_index->
+ get_master_info(&thd->variables.default_master_connection,
+ MYSQL_ERROR::WARN_LEVEL_NOTE);
+ if (mi)
+ sprintf(buff, "%.3f", mi->heartbeat_period);
else
var->type= SHOW_UNDEF;
mysql_mutex_unlock(&LOCK_active_mi);
@@ -7155,7 +7165,7 @@ SHOW_VAR status_vars[]= {
{"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS},
{"Binlog_bytes_written", (char*) offsetof(STATUS_VAR, binlog_bytes_written), SHOW_LONGLONG_STATUS},
{"Com", (char*) com_status_vars, SHOW_ARRAY},
- {"Compression", (char*) &show_net_compression, SHOW_FUNC},
+ {"Compression", (char*) &show_net_compression, SHOW_SIMPLE_FUNC},
{"Connections", (char*) &thread_id, SHOW_LONG_NOFLUSH},
{"Cpu_time", (char*) offsetof(STATUS_VAR, cpu_time), SHOW_DOUBLE_STATUS},
{"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables_), SHOW_LONG_STATUS},
@@ -7165,6 +7175,16 @@ SHOW_VAR status_vars[]= {
{"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG_NOFLUSH},
{"Delayed_writes", (char*) &delayed_insert_writes, SHOW_LONG},
{"Empty_queries", (char*) offsetof(STATUS_VAR, empty_queries), SHOW_LONG_STATUS},
+ {"Executed_events", (char*) &executed_events, SHOW_LONG_NOFLUSH },
+ {"Executed_triggers", (char*) offsetof(STATUS_VAR, executed_triggers), SHOW_LONG_STATUS},
+ {"Feature_dynamic_columns", (char*) offsetof(STATUS_VAR, feature_dynamic_columns), SHOW_LONG_STATUS},
+ {"Feature_fulltext", (char*) offsetof(STATUS_VAR, feature_fulltext), SHOW_LONG_STATUS},
+ {"Feature_gis", (char*) offsetof(STATUS_VAR, feature_gis), SHOW_LONG_STATUS},
+ {"Feature_locale", (char*) offsetof(STATUS_VAR, feature_locale), SHOW_LONG_STATUS},
+ {"Feature_subquery", (char*) offsetof(STATUS_VAR, feature_subquery), SHOW_LONG_STATUS},
+ {"Feature_timezone", (char*) offsetof(STATUS_VAR, feature_timezone), SHOW_LONG_STATUS},
+ {"Feature_trigger", (char*) offsetof(STATUS_VAR, feature_trigger), SHOW_LONG_STATUS},
+ {"Feature_xml", (char*) offsetof(STATUS_VAR, feature_xml), SHOW_LONG_STATUS},
{"Flush_commands", (char*) &refresh_version, SHOW_LONG_NOFLUSH},
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS},
@@ -7199,12 +7219,13 @@ SHOW_VAR status_vars[]= {
{"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_NOFLUSH},
{"Open_files", (char*) &my_file_opened, SHOW_LONG_NOFLUSH},
{"Open_streams", (char*) &my_stream_opened, SHOW_LONG_NOFLUSH},
- {"Open_table_definitions", (char*) &show_table_definitions, SHOW_FUNC},
- {"Open_tables", (char*) &show_open_tables, SHOW_FUNC},
+ {"Open_table_definitions", (char*) &show_table_definitions, SHOW_SIMPLE_FUNC},
+ {"Open_tables", (char*) &show_open_tables, SHOW_SIMPLE_FUNC},
{"Opened_files", (char*) &my_file_total_opened, SHOW_LONG_NOFLUSH},
- {"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS},
{"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONG_STATUS},
- {"Prepared_stmt_count", (char*) &show_prepared_stmt_count, SHOW_FUNC},
+ {"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS},
+ {"Opened_views", (char*) offsetof(STATUS_VAR, opened_views), SHOW_LONG_STATUS},
+ {"Prepared_stmt_count", (char*) &show_prepared_stmt_count, SHOW_SIMPLE_FUNC},
{"Rows_sent", (char*) offsetof(STATUS_VAR, rows_sent), SHOW_LONGLONG_STATUS},
{"Rows_read", (char*) offsetof(STATUS_VAR, rows_read), SHOW_LONGLONG_STATUS},
{"Rows_tmp_read", (char*) offsetof(STATUS_VAR, rows_tmp_read), SHOW_LONGLONG_STATUS},
@@ -7218,10 +7239,10 @@ SHOW_VAR status_vars[]= {
{"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_NOFLUSH},
{"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_NOFLUSH},
#endif /*HAVE_QUERY_CACHE*/
- {"Queries", (char*) &show_queries, SHOW_FUNC},
+ {"Queries", (char*) &show_queries, SHOW_SIMPLE_FUNC},
{"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS},
#ifdef HAVE_REPLICATION
- {"Rpl_status", (char*) &show_rpl_status, SHOW_FUNC},
+ {"Rpl_status", (char*) &show_rpl_status, SHOW_SIMPLE_FUNC},
#endif
{"Select_full_join", (char*) offsetof(STATUS_VAR, select_full_join_count_), SHOW_LONG_STATUS},
{"Select_full_range_join", (char*) offsetof(STATUS_VAR, select_full_range_join_count_), SHOW_LONG_STATUS},
@@ -7230,10 +7251,10 @@ SHOW_VAR status_vars[]= {
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count_), SHOW_LONG_STATUS},
{"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_LONG},
#ifdef HAVE_REPLICATION
- {"Slave_retried_transactions",(char*) &show_slave_retried_trans, SHOW_FUNC},
- {"Slave_heartbeat_period", (char*) &show_heartbeat_period, SHOW_FUNC},
- {"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats, SHOW_FUNC},
- {"Slave_running", (char*) &show_slave_running, SHOW_FUNC},
+ {"Slave_retried_transactions",(char*)&slave_retried_transactions, SHOW_LONG},
+ {"Slave_heartbeat_period", (char*) &show_heartbeat_period, SHOW_SIMPLE_FUNC},
+ {"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats, SHOW_SIMPLE_FUNC},
+ {"Slave_running", (char*) &show_slave_running, SHOW_SIMPLE_FUNC},
#endif
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG},
{"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS},
@@ -7243,33 +7264,31 @@ SHOW_VAR status_vars[]= {
{"Sort_scan", (char*) offsetof(STATUS_VAR, filesort_scan_count_), SHOW_LONG_STATUS},
#ifdef HAVE_OPENSSL
#ifndef EMBEDDED_LIBRARY
- {"Ssl_accept_renegotiates", (char*) &show_ssl_ctx_sess_accept_renegotiate, SHOW_FUNC},
- {"Ssl_accepts", (char*) &show_ssl_ctx_sess_accept, SHOW_FUNC},
- {"Ssl_callback_cache_hits", (char*) &show_ssl_ctx_sess_cb_hits, SHOW_FUNC},
- {"Ssl_cipher", (char*) &show_ssl_get_cipher, SHOW_FUNC},
- {"Ssl_cipher_list", (char*) &show_ssl_get_cipher_list, SHOW_FUNC},
- {"Ssl_client_connects", (char*) &show_ssl_ctx_sess_connect, SHOW_FUNC},
- {"Ssl_connect_renegotiates", (char*) &show_ssl_ctx_sess_connect_renegotiate, SHOW_FUNC},
- {"Ssl_ctx_verify_depth", (char*) &show_ssl_ctx_get_verify_depth, SHOW_FUNC},
- {"Ssl_ctx_verify_mode", (char*) &show_ssl_ctx_get_verify_mode, SHOW_FUNC},
- {"Ssl_default_timeout", (char*) &show_ssl_get_default_timeout, SHOW_FUNC},
- {"Ssl_finished_accepts", (char*) &show_ssl_ctx_sess_accept_good, SHOW_FUNC},
- {"Ssl_finished_connects", (char*) &show_ssl_ctx_sess_connect_good, SHOW_FUNC},
- {"Ssl_session_cache_hits", (char*) &show_ssl_ctx_sess_hits, SHOW_FUNC},
- {"Ssl_session_cache_misses", (char*) &show_ssl_ctx_sess_misses, SHOW_FUNC},
- {"Ssl_session_cache_mode", (char*) &show_ssl_ctx_get_session_cache_mode, SHOW_FUNC},
- {"Ssl_session_cache_overflows", (char*) &show_ssl_ctx_sess_cache_full, SHOW_FUNC},
- {"Ssl_session_cache_size", (char*) &show_ssl_ctx_sess_get_cache_size, SHOW_FUNC},
- {"Ssl_session_cache_timeouts", (char*) &show_ssl_ctx_sess_timeouts, SHOW_FUNC},
- {"Ssl_sessions_reused", (char*) &show_ssl_session_reused, SHOW_FUNC},
- {"Ssl_used_session_cache_entries",(char*) &show_ssl_ctx_sess_number, SHOW_FUNC},
- {"Ssl_verify_depth", (char*) &show_ssl_get_verify_depth, SHOW_FUNC},
- {"Ssl_verify_mode", (char*) &show_ssl_get_verify_mode, SHOW_FUNC},
- {"Ssl_version", (char*) &show_ssl_get_version, SHOW_FUNC},
- {"Ssl_server_not_before", (char*) &show_ssl_get_server_not_before,
- SHOW_FUNC},
- {"Ssl_server_not_after", (char*) &show_ssl_get_server_not_after,
- SHOW_FUNC},
+ {"Ssl_accept_renegotiates", (char*) &show_ssl_ctx_sess_accept_renegotiate, SHOW_SIMPLE_FUNC},
+ {"Ssl_accepts", (char*) &show_ssl_ctx_sess_accept, SHOW_SIMPLE_FUNC},
+ {"Ssl_callback_cache_hits", (char*) &show_ssl_ctx_sess_cb_hits, SHOW_SIMPLE_FUNC},
+ {"Ssl_cipher", (char*) &show_ssl_get_cipher, SHOW_SIMPLE_FUNC},
+ {"Ssl_cipher_list", (char*) &show_ssl_get_cipher_list, SHOW_SIMPLE_FUNC},
+ {"Ssl_client_connects", (char*) &show_ssl_ctx_sess_connect, SHOW_SIMPLE_FUNC},
+ {"Ssl_connect_renegotiates", (char*) &show_ssl_ctx_sess_connect_renegotiate, SHOW_SIMPLE_FUNC},
+ {"Ssl_ctx_verify_depth", (char*) &show_ssl_ctx_get_verify_depth, SHOW_SIMPLE_FUNC},
+ {"Ssl_ctx_verify_mode", (char*) &show_ssl_ctx_get_verify_mode, SHOW_SIMPLE_FUNC},
+ {"Ssl_default_timeout", (char*) &show_ssl_get_default_timeout, SHOW_SIMPLE_FUNC},
+ {"Ssl_finished_accepts", (char*) &show_ssl_ctx_sess_accept_good, SHOW_SIMPLE_FUNC},
+ {"Ssl_finished_connects", (char*) &show_ssl_ctx_sess_connect_good, SHOW_SIMPLE_FUNC},
+ {"Ssl_server_not_after", (char*) &show_ssl_get_server_not_after, SHOW_SIMPLE_FUNC},
+ {"Ssl_server_not_before", (char*) &show_ssl_get_server_not_before, SHOW_SIMPLE_FUNC},
+ {"Ssl_session_cache_hits", (char*) &show_ssl_ctx_sess_hits, SHOW_SIMPLE_FUNC},
+ {"Ssl_session_cache_misses", (char*) &show_ssl_ctx_sess_misses, SHOW_SIMPLE_FUNC},
+ {"Ssl_session_cache_mode", (char*) &show_ssl_ctx_get_session_cache_mode, SHOW_SIMPLE_FUNC},
+ {"Ssl_session_cache_overflows", (char*) &show_ssl_ctx_sess_cache_full, SHOW_SIMPLE_FUNC},
+ {"Ssl_session_cache_size", (char*) &show_ssl_ctx_sess_get_cache_size, SHOW_SIMPLE_FUNC},
+ {"Ssl_session_cache_timeouts", (char*) &show_ssl_ctx_sess_timeouts, SHOW_SIMPLE_FUNC},
+ {"Ssl_sessions_reused", (char*) &show_ssl_session_reused, SHOW_SIMPLE_FUNC},
+ {"Ssl_used_session_cache_entries",(char*) &show_ssl_ctx_sess_number, SHOW_SIMPLE_FUNC},
+ {"Ssl_verify_depth", (char*) &show_ssl_get_verify_depth, SHOW_SIMPLE_FUNC},
+ {"Ssl_verify_mode", (char*) &show_ssl_get_verify_mode, SHOW_SIMPLE_FUNC},
+ {"Ssl_version", (char*) &show_ssl_get_version, SHOW_SIMPLE_FUNC},
#endif
#endif /* HAVE_OPENSSL */
{"Syncs", (char*) &my_sync_count, SHOW_LONG_NOFLUSH},
@@ -7287,16 +7306,16 @@ SHOW_VAR status_vars[]= {
{"Tc_log_page_waits", (char*) &tc_log_page_waits, SHOW_LONG},
#endif
#ifdef HAVE_POOL_OF_THREADS
- {"Threadpool_idle_threads", (char *) &show_threadpool_idle_threads, SHOW_FUNC},
+ {"Threadpool_idle_threads", (char *) &show_threadpool_idle_threads, SHOW_SIMPLE_FUNC},
{"Threadpool_threads", (char *) &tp_stats.num_worker_threads, SHOW_INT},
#endif
{"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_NOFLUSH},
{"Threads_connected", (char*) &connection_count, SHOW_INT},
{"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH},
{"Threads_running", (char*) &thread_running, SHOW_INT},
- {"Uptime", (char*) &show_starttime, SHOW_FUNC},
+ {"Uptime", (char*) &show_starttime, SHOW_SIMPLE_FUNC},
#ifdef ENABLED_PROFILING
- {"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_FUNC},
+ {"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_SIMPLE_FUNC},
#endif
{NullS, NullS, SHOW_LONG}
};
@@ -7440,7 +7459,7 @@ static int mysql_init_variables(void)
myisam_test_invalid_symlink= test_if_data_home_dir;
#endif
opt_log= opt_slow_log= 0;
- opt_bin_log= 0;
+ opt_bin_log= opt_bin_log_used= 0;
opt_disable_networking= opt_skip_show_db=0;
opt_skip_name_resolve= 0;
opt_ignore_builtin_innodb= 0;
@@ -7492,10 +7511,11 @@ static int mysql_init_variables(void)
mysql_home_ptr= mysql_home;
pidfile_name_ptr= pidfile_name;
log_error_file_ptr= log_error_file;
- lc_messages_dir_ptr= lc_messages_dir;
protocol_version= PROTOCOL_VERSION;
what_to_log= ~ (1L << (uint) COM_TIME);
refresh_version= 1L; /* Increments on each reload */
+ denied_connections= 0;
+ executed_events= 0;
global_query_id= thread_id= 1L;
my_atomic_rwlock_init(&global_query_id_lock);
my_atomic_rwlock_init(&thread_running_lock);
@@ -7522,6 +7542,7 @@ static int mysql_init_variables(void)
relay_log_info_file= (char*) "relay-log.info";
report_user= report_password = report_host= 0; /* TO BE DELETED */
opt_relay_logname= opt_relaylog_index_name= 0;
+ slave_retried_transactions= 0;
/* Variables in libraries */
charsets_dir= 0;
@@ -7681,7 +7702,6 @@ mysqld_get_one_option(int optid,
break;
case 'L':
strmake(lc_messages_dir, argument, sizeof(lc_messages_dir)-1);
- lc_messages_dir_ptr= lc_messages_dir;
break;
case OPT_BINLOG_FORMAT:
binlog_format_used= true;
@@ -7710,6 +7730,7 @@ mysqld_get_one_option(int optid,
break;
case (int) OPT_BIN_LOG:
opt_bin_log= test(argument != disabled_my_option);
+ opt_bin_log_used= 1;
break;
case (int) OPT_LOG_BASENAME:
{
@@ -7841,6 +7862,8 @@ mysqld_get_one_option(int optid,
#ifdef HAVE_QUERY_CACHE
query_cache_size=0;
#endif
+ sql_print_warning("The syntax '--safe-mode' is deprecated and will be "
+ "removed in a future release.");
break;
case (int) OPT_SKIP_PRIOR:
opt_specialflag|= SPECIAL_NO_PRIOR;
@@ -8280,8 +8303,30 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
if (!max_long_data_size_used)
max_long_data_size= global_system_variables.max_allowed_packet;
- /* Rember if max_user_connections was 0 at startup */
+ /* Remember if max_user_connections was 0 at startup */
max_user_connections_checking= global_system_variables.max_user_connections != 0;
+
+ {
+ sys_var *max_relay_log_size_var, *max_binlog_size_var;
+ /* If max_relay_log_size is 0, then set it to max_binlog_size */
+ if (!global_system_variables.max_relay_log_size)
+ global_system_variables.max_relay_log_size= max_binlog_size;
+
+ /*
+ Fix so that DEFAULT and limit checking works with max_relay_log_size
+ (Yes, this is a hack, but it's required as the definition of
+ max_relay_log_size allows it to be set to 0).
+ */
+ max_relay_log_size_var= intern_find_sys_var("max_relay_log_size", 0);
+ max_binlog_size_var= intern_find_sys_var("max_binlog_size", 0);
+ if (max_binlog_size_var && max_relay_log_size_var)
+ {
+ max_relay_log_size_var->option.min_value=
+ max_binlog_size_var->option.min_value;
+ max_relay_log_size_var->option.def_value=
+ max_binlog_size_var->option.def_value;
+ }
+ }
return 0;
}
@@ -8687,6 +8732,7 @@ PSI_stage_info stage_sending_binlog_event_to_slave= { 0, "Sending binlog event t
PSI_stage_info stage_sending_cached_result_to_client= { 0, "sending cached result to client", 0};
PSI_stage_info stage_sending_data= { 0, "Sending data", 0};
PSI_stage_info stage_setup= { 0, "setup", 0};
+PSI_stage_info stage_show_explain= { 0, "show explain", 0};
PSI_stage_info stage_slave_has_read_all_relay_log= { 0, "Slave has read all relay log; waiting for the slave I/O thread to update it", 0};
PSI_stage_info stage_sorting= { 0, "Sorting", 0};
PSI_stage_info stage_sorting_for_group= { 0, "Sorting for group", 0};
@@ -8795,6 +8841,7 @@ PSI_stage_info *all_server_stages[]=
& stage_sending_data,
& stage_setup,
& stage_slave_has_read_all_relay_log,
+ & stage_show_explain,
& stage_sorting,
& stage_sorting_for_group,
& stage_sorting_for_order,
diff --git a/sql/mysqld.h b/sql/mysqld.h
index a5fe2fae7ed..67fa44fe7d9 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -96,6 +96,7 @@ extern my_bool opt_safe_user_create;
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern ulong slave_exec_mode_options;
+extern ulong slave_retried_transactions;
extern ulonglong slave_type_conversions_options;
extern my_bool read_only, opt_readonly;
extern my_bool lower_case_file_system;
@@ -170,11 +171,13 @@ extern ulong max_prepared_stmt_count, prepared_stmt_count;
extern ulong open_files_limit;
extern ulonglong binlog_cache_size, binlog_stmt_cache_size;
extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
-extern ulong max_binlog_size, max_relay_log_size;
+extern ulong max_binlog_size;
+extern ulong slave_max_allowed_packet;
extern ulong opt_binlog_rows_event_max_size;
extern ulong rpl_recovery_rank, thread_cache_size;
extern ulong stored_program_cache_size;
extern ulong back_log;
+extern ulong executed_events;
extern char language[FN_REFLEN];
extern "C" MYSQL_PLUGIN_IMPORT ulong server_id;
extern ulong concurrency;
@@ -197,7 +200,7 @@ extern handlerton *myisam_hton;
extern handlerton *heap_hton;
extern const char *load_default_groups[];
extern struct my_option my_long_options[];
-extern int mysqld_server_started;
+extern int mysqld_server_started, mysqld_server_initialized;
extern "C" MYSQL_PLUGIN_IMPORT int orig_argc;
extern "C" MYSQL_PLUGIN_IMPORT char **orig_argv;
extern pthread_attr_t connection_attrib;
@@ -219,14 +222,14 @@ extern pthread_key(MEM_ROOT**,THR_MALLOC);
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_MMAP
extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active,
- key_LOCK_pool;
+ key_LOCK_pool, key_LOCK_pending_checkpoint;
#endif /* HAVE_MMAP */
#ifdef HAVE_OPENSSL
extern PSI_mutex_key key_LOCK_des_key_file;
#endif
-extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
+extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
@@ -257,7 +260,7 @@ extern PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger,
extern PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool;
#endif /* HAVE_MMAP */
-extern PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond,
+extern PSI_cond_key key_BINLOG_COND_xid_list, key_BINLOG_update_cond,
key_COND_cache_status_changed, key_COND_manager,
key_COND_rpl_status, key_COND_server_started,
key_delayed_insert_cond, key_delayed_insert_cond_client,
@@ -359,6 +362,7 @@ extern PSI_stage_info stage_sending_cached_result_to_client;
extern PSI_stage_info stage_sending_data;
extern PSI_stage_info stage_setup;
extern PSI_stage_info stage_slave_has_read_all_relay_log;
+extern PSI_stage_info stage_show_explain;
extern PSI_stage_info stage_sorting;
extern PSI_stage_info stage_sorting_for_group;
extern PSI_stage_info stage_sorting_for_order;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index a66a6755757..994b3f75989 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2001,14 +2001,14 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
{
handler *save_file= file, *org_file;
my_bool org_key_read;
- THD *thd;
+ THD *thd= head->in_use;
DBUG_ENTER("QUICK_RANGE_SELECT::init_ror_merged_scan");
in_ror_merged_scan= 1;
if (reuse_handler)
{
DBUG_PRINT("info", ("Reusing handler 0x%lx", (long) file));
- if (init() || reset())
+ if (init())
{
DBUG_RETURN(1);
}
@@ -2023,7 +2023,6 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
DBUG_RETURN(0);
}
- thd= head->in_use;
if (!(file= head->file->clone(head->s->normalized_path.str, thd->mem_root)))
{
/*
@@ -2043,7 +2042,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
if (file->ha_external_lock(thd, F_RDLCK))
goto failure;
- if (init() || reset())
+ if (init())
{
file->ha_external_lock(thd, F_UNLCK);
file->ha_close();
@@ -2090,7 +2089,18 @@ end:
head->key_read= org_key_read;
bitmap_copy(&column_bitmap, head->read_set);
head->column_bitmaps_set(&column_bitmap, &column_bitmap);
-
+
+ if (reset())
+ {
+ if (!reuse_handler)
+ {
+ file->ha_external_lock(thd, F_UNLCK);
+ file->ha_close();
+ goto failure;
+ }
+ else
+ DBUG_RETURN(1);
+ }
DBUG_RETURN(0);
failure:
@@ -11793,9 +11803,10 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
have_min= TRUE;
else if (min_max_item->sum_func() == Item_sum::MAX_FUNC)
have_max= TRUE;
- else if (min_max_item->sum_func() == Item_sum::COUNT_DISTINCT_FUNC ||
- min_max_item->sum_func() == Item_sum::SUM_DISTINCT_FUNC ||
- min_max_item->sum_func() == Item_sum::AVG_DISTINCT_FUNC)
+ else if (is_agg_distinct &&
+ (min_max_item->sum_func() == Item_sum::COUNT_DISTINCT_FUNC ||
+ min_max_item->sum_func() == Item_sum::SUM_DISTINCT_FUNC ||
+ min_max_item->sum_func() == Item_sum::AVG_DISTINCT_FUNC))
continue;
else
DBUG_RETURN(NULL);
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index c5b38fd4b1d..da7d3dff74d 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -160,18 +160,18 @@
3.2.1 Non-merged semi-joins and join optimization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For join optimization purposes, non-merged semi-join nests are similar to
- base tables - they've got one JOIN_TAB, which can be accessed with one of
- two methods:
+ base tables. Each such nest is represented by one one JOIN_TAB, which has
+ two possible access strategies:
- full table scan (representing SJ-Materialization-Scan strategy)
- eq_ref-like table lookup (representing SJ-Materialization-Lookup)
Unlike regular base tables, non-merged semi-joins have:
- non-zero JOIN_TAB::startup_cost, and
- join_tab->table->is_filled_at_execution()==TRUE, which means one
- cannot do const table detection or range analysis or other table data-
- dependent inferences
- // instead, get_delayed_table_estimates() runs optimization on the nest so that
- // we get an idea about temptable size
+ cannot do const table detection, range analysis or other dataset-dependent
+ optimizations.
+ Instead, get_delayed_table_estimates() will run optimization for the
+ subquery and produce an E(materialized table size).
3.2.2 Merged semi-joins and join optimization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1657,6 +1657,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
parent_lex->ftfunc_list->push_front(ifm);
}
+ parent_lex->have_merged_subqueries= TRUE;
DBUG_RETURN(FALSE);
}
@@ -1767,6 +1768,8 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
create_subquery_temptable_name(tbl_alias, hash_sj_engine->materialize_join->
select_lex->select_number);
jtbm->alias= tbl_alias;
+
+ parent_lex->have_merged_subqueries= TRUE;
#if 0
/* Inject sj_on_expr into the parent's WHERE or ON */
if (emb_tbl_nest)
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index cbec039b3e4..fa3a07b72c5 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -791,7 +791,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
{
/* Update endpoints for MAX/MIN, see function comment. */
Item *value= args[between && max_fl ? 2 : 1];
- store_val_in_field(part->field, value, CHECK_FIELD_IGNORE);
+ value->save_in_field_no_warnings(part->field, 1);
if (part->null_bit)
*key_ptr++= (uchar) test(part->field->is_null());
part->field->get_key_image(key_ptr, part->length, Field::itRAW);
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 10c85939986..3af7dc88b88 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008, 2011, Monty Program Ab
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -775,6 +775,8 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
/* Store fixed length fields */
pos= (char*) local_packet->ptr()+local_packet->length();
*pos++= 12; // Length of packed fields
+ /* inject a NULL to test the client */
+ DBUG_EXECUTE_IF("poison_rs_fields", pos[-1]= 0xfb;);
if (item->charset_for_protocol() == &my_charset_bin || thd_charset == NULL)
{
/* No conversion */
diff --git a/sql/protocol.h b/sql/protocol.h
index d9bc48ce45d..1c0a28560bd 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -35,6 +35,7 @@ class Protocol
protected:
THD *thd;
String *packet;
+ /* Used by net_store_data() for charset conversions */
String *convert;
uint field_pos;
#ifndef DBUG_OFF
@@ -49,6 +50,10 @@ protected:
MYSQL_FIELD *next_mysql_field;
MEM_ROOT *alloc;
#endif
+ /*
+ The following two are low-level functions that are invoked from
+ higher-level store_xxx() funcs. The data is stored into this->packet.
+ */
bool net_store_data(const uchar *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
bool store_string_aux(const char *from, size_t length,
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 4eac3dcd4f5..86f19f1b28e 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -35,7 +35,6 @@
#include "rpl_mi.h"
#include "rpl_filter.h"
#include "log_event.h"
-#include "sql_db.h" // mysql_create_db
#include <mysql.h>
#define SLAVE_LIST_CHUNK 128
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index a765f851812..2ca700a123a 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -20,6 +20,8 @@
#include "unireg.h" // REQUIRED by other includes
#include "rpl_mi.h"
#include "slave.h" // SLAVE_MAX_HEARTBEAT_PERIOD
+#include "strfunc.h"
+#include "sql_repl.h"
#ifdef HAVE_REPLICATION
@@ -27,7 +29,8 @@
static void init_master_log_pos(Master_info* mi);
-Master_info::Master_info(bool is_slave_recovery)
+Master_info::Master_info(LEX_STRING *connection_name_arg,
+ bool is_slave_recovery)
:Slave_reporting_capability("I/O"),
ssl(0), ssl_verify_server_cert(1), fd(-1), io_thd(0),
rli(is_slave_recovery), port(MYSQL_PORT),
@@ -41,6 +44,24 @@ Master_info::Master_info(bool is_slave_recovery)
ssl_cipher[0]= 0; ssl_key[0]= 0;
ssl_crl[0]= 0; ssl_crlpath[0]= 0;
+ /*
+ Store connection name and lower case connection name
+ It's safe to ignore any OMM errors as this is checked by error()
+ */
+ connection_name.length= cmp_connection_name.length=
+ connection_name_arg->length;
+ if ((connection_name.str= (char*) my_malloc(connection_name_arg->length*2+2,
+ MYF(MY_WME))))
+ {
+ cmp_connection_name.str= (connection_name.str +
+ connection_name_arg->length+1);
+ strmake(connection_name.str, connection_name_arg->str,
+ connection_name.length);
+ memcpy(cmp_connection_name.str, connection_name_arg->str,
+ connection_name.length+1);
+ my_casedn_str(system_charset_info, cmp_connection_name.str);
+ }
+
my_init_dynamic_array(&ignore_server_ids, sizeof(::server_id), 16, 16);
bzero((char*) &file, sizeof(file));
mysql_mutex_init(key_master_info_run_lock, &run_lock, MY_MUTEX_INIT_FAST);
@@ -56,6 +77,7 @@ Master_info::Master_info(bool is_slave_recovery)
Master_info::~Master_info()
{
+ my_free(connection_name.str);
delete_dynamic(&ignore_server_ids);
mysql_mutex_destroy(&run_lock);
mysql_mutex_destroy(&data_lock);
@@ -441,7 +463,7 @@ file '%s')", fname);
mi->master_log_name,
(ulong) mi->master_log_pos));
- mi->rli.mi = mi;
+ mi->rli.mi= mi;
if (init_relay_log_info(&mi->rli, slave_info_fname))
goto err;
@@ -596,5 +618,595 @@ void end_master_info(Master_info* mi)
DBUG_VOID_RETURN;
}
+/* Multi-Master By P.Linux */
+uchar *get_key_master_info(Master_info *mi, size_t *length,
+ my_bool not_used __attribute__((unused)))
+{
+ /* Return lower case name */
+ *length= mi->cmp_connection_name.length;
+ return (uchar*) mi->cmp_connection_name.str;
+}
+
+void free_key_master_info(Master_info *mi)
+{
+ DBUG_ENTER("free_key_master_info");
+ terminate_slave_threads(mi,SLAVE_FORCE_ALL);
+ end_master_info(mi);
+ delete mi;
+ DBUG_VOID_RETURN;
+}
+
+/**
+ Check if connection name for master_info is valid.
+
+ It's valid if it's a valid system name of length less than
+ MAX_CONNECTION_NAME.
+
+ @return
+ 0 ok
+ 1 error
+*/
+
+bool check_master_connection_name(LEX_STRING *name)
+{
+ if (name->length >= MAX_CONNECTION_NAME)
+ return 1;
+ return 0;
+}
+
+
+/**
+ Create a log file with a given suffix.
+
+ @param
+ res_file_name Store result here
+ length Length of res_file_name buffer
+ info_file Original file name (prefix)
+ append 1 if we should add suffix last (not before ext)
+ suffix Suffix
+
+ @note
+ The suffix is added before the extension of the file name prefixed with '-'.
+ The suffix is also converted to lower case and we transform
+ all not safe character, as we do with MySQL table names.
+
+ If suffix is an empty string, then we don't add any suffix.
+ This is to allow one to use this function also to generate old
+ file names without a prefix.
+*/
+
+void create_logfile_name_with_suffix(char *res_file_name, uint length,
+ const char *info_file, bool append,
+ LEX_STRING *suffix)
+{
+ char buff[MAX_CONNECTION_NAME+1], res[MAX_CONNECTION_NAME+1], *p;
+
+ p= strmake(res_file_name, info_file, length);
+ /* If not empty suffix and there is place left for some part of the suffix */
+ if (suffix->length != 0 && p <= res_file_name + length -1)
+ {
+ const char *info_file_end= info_file + (p - res_file_name);
+ const char *ext= append ? info_file_end : fn_ext2(info_file);
+ size_t res_length, ext_pos;
+ uint errors;
+
+ /* Create null terminated string */
+ strmake(buff, suffix->str, suffix->length);
+ /* Convert to lower case */
+ my_casedn_str(system_charset_info, buff);
+ /* Convert to characters usable in a file name */
+ res_length= strconvert(system_charset_info, buff,
+ &my_charset_filename, res, sizeof(res), &errors);
+
+ ext_pos= (size_t) (ext - info_file);
+ length-= (suffix->length - ext_pos); /* Leave place for extension */
+ p= res_file_name + ext_pos;
+ *p++= '-'; /* Add separator */
+ p= strmake(p, res, min((size_t) (length - (p - res_file_name)),
+ res_length));
+ /* Add back extension. We have checked above that there is space for it */
+ strmov(p, ext);
+ }
+}
+
+
+Master_info_index::Master_info_index()
+{
+ size_t filename_length, dir_length;
+ /*
+ Create the Master_info index file by prepending 'multi-' before
+ the master_info_file file name.
+ */
+ fn_format(index_file_name, master_info_file, mysql_data_home,
+ "", MY_UNPACK_FILENAME);
+ filename_length= strlen(index_file_name) + 1; /* Count 0 byte */
+ dir_length= dirname_length(index_file_name);
+ bmove_upp((uchar*) index_file_name + filename_length + 6,
+ (uchar*) index_file_name + filename_length,
+ filename_length - dir_length);
+ memcpy(index_file_name + dir_length, "multi-", 6);
+
+ bzero((char*) &index_file, sizeof(index_file));
+}
+
+Master_info_index::~Master_info_index()
+{
+ /* This will close connection for all objects in the cache */
+ my_hash_free(&master_info_hash);
+ end_io_cache(&index_file);
+ if (index_file.file > 0)
+ my_close(index_file.file, MYF(MY_WME));
+}
+
+
+/* Load All Master_info from master.info.index File
+ * RETURN:
+ * 0 - All Success
+ * 1 - All Fail
+ * 2 - Some Success, Some Fail
+ */
+
+bool Master_info_index::init_all_master_info()
+{
+ int thread_mask;
+ int err_num= 0, succ_num= 0; // The number of success read Master_info
+ char sign[MAX_CONNECTION_NAME];
+ File index_file_nr;
+ DBUG_ENTER("init_all_master_info");
+
+ if ((index_file_nr= my_open(index_file_name,
+ O_RDWR | O_CREAT | O_BINARY ,
+ MYF(MY_WME | ME_NOREFRESH))) < 0 ||
+ my_sync(index_file_nr, MYF(MY_WME)) ||
+ init_io_cache(&index_file, index_file_nr,
+ IO_SIZE, READ_CACHE,
+ my_seek(index_file_nr,0L,MY_SEEK_END,MYF(0)),
+ 0, MYF(MY_WME | MY_WAIT_IF_FULL)))
+ {
+ if (index_file_nr >= 0)
+ my_close(index_file_nr,MYF(0));
+
+ sql_print_error("Creation of Master_info index file '%s' failed",
+ index_file_name);
+ DBUG_RETURN(1);
+ }
+
+ /* Initialize Master_info Hash Table */
+ if (my_hash_init(&master_info_hash, system_charset_info,
+ MAX_REPLICATION_THREAD, 0, 0,
+ (my_hash_get_key) get_key_master_info,
+ (my_hash_free_key)free_key_master_info, HASH_UNIQUE))
+ {
+ sql_print_error("Initializing Master_info hash table failed");
+ DBUG_RETURN(1);
+ }
+
+ reinit_io_cache(&index_file, READ_CACHE, 0L,0,0);
+ while (!init_strvar_from_file(sign, sizeof(sign),
+ &index_file, NULL))
+ {
+ LEX_STRING connection_name;
+ Master_info *mi;
+ char buf_master_info_file[FN_REFLEN];
+ char buf_relay_log_info_file[FN_REFLEN];
+
+ connection_name.str= sign;
+ connection_name.length= strlen(sign);
+ if (!(mi= new Master_info(&connection_name, relay_log_recovery)) ||
+ mi->error())
+ {
+ delete mi;
+ DBUG_RETURN(1);
+ }
+
+ lock_slave_threads(mi);
+ init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
+
+ create_logfile_name_with_suffix(buf_master_info_file, sizeof(buf_master_info_file),
+ master_info_file, 0, &connection_name);
+ create_logfile_name_with_suffix(buf_relay_log_info_file,
+ sizeof(buf_relay_log_info_file),
+ relay_log_info_file, 0, &connection_name);
+ if (global_system_variables.log_warnings > 1)
+ sql_print_information("Reading Master_info: '%s' Relay_info:'%s'",
+ buf_master_info_file, buf_relay_log_info_file);
+
+ if (init_master_info(mi, buf_master_info_file, buf_relay_log_info_file,
+ 0, thread_mask))
+ {
+ err_num++;
+ sql_print_error("Initialized Master_info from '%s' failed",
+ buf_master_info_file);
+ if (!master_info_index->get_master_info(&connection_name,
+ MYSQL_ERROR::WARN_LEVEL_NOTE))
+ {
+ /* Master_info is not in HASH; Add it */
+ if (master_info_index->add_master_info(mi, FALSE))
+ return 1;
+ succ_num++;
+ unlock_slave_threads(mi);
+ }
+ else
+ {
+ /* Master_info already in HASH */
+ sql_print_error(ER(ER_CONNECTION_ALREADY_EXISTS),
+ (int) connection_name.length, connection_name.str);
+ unlock_slave_threads(mi);
+ delete mi;
+ }
+ continue;
+ }
+ else
+ {
+ /* Initialization of Master_info succeded. Add it to HASH */
+ if (global_system_variables.log_warnings > 1)
+ sql_print_information("Initialized Master_info from '%s'",
+ buf_master_info_file);
+ if (master_info_index->get_master_info(&connection_name,
+ MYSQL_ERROR::WARN_LEVEL_NOTE))
+ {
+ /* Master_info was already registered */
+ sql_print_error(ER(ER_CONNECTION_ALREADY_EXISTS),
+ (int) connection_name.length, connection_name.str);
+ unlock_slave_threads(mi);
+ delete mi;
+ continue;
+ }
+
+ /* Master_info was not registered; add it */
+ if (master_info_index->add_master_info(mi, FALSE))
+ return 1;
+ succ_num++;
+ unlock_slave_threads(mi);
+
+ if (!opt_skip_slave_start)
+ {
+ if (start_slave_threads(1 /* need mutex */,
+ 0 /* no wait for start*/,
+ mi,
+ buf_master_info_file,
+ buf_relay_log_info_file,
+ SLAVE_IO | SLAVE_SQL))
+ {
+ sql_print_error("Failed to create slave threads for connection '%.*s'",
+ (int) connection_name.length,
+ connection_name.str);
+ continue;
+ }
+ if (global_system_variables.log_warnings)
+ sql_print_information("Started replication for '%.*s'",
+ (int) connection_name.length,
+ connection_name.str);
+ }
+ }
+ }
+
+ if (!err_num) // No Error on read Master_info
+ {
+ if (global_system_variables.log_warnings > 1)
+ sql_print_information("Reading of all Master_info entries succeded");
+ DBUG_RETURN(0);
+ }
+ else if (succ_num) // Have some Error and some Success
+ {
+ sql_print_warning("Reading of some Master_info entries failed");
+ DBUG_RETURN(2);
+ }
+ else // All failed
+ {
+ sql_print_error("Reading of all Master_info entries failed!");
+ DBUG_RETURN(1);
+ }
+}
+
+
+/* Write new master.info to master.info.index File */
+bool Master_info_index::write_master_name_to_index_file(LEX_STRING *name,
+ bool do_sync)
+{
+ DBUG_ASSERT(my_b_inited(&index_file) != 0);
+ DBUG_ENTER("write_master_name_to_index_file");
+
+ /* Don't write default slave to master_info.index */
+ if (name->length == 0)
+ DBUG_RETURN(0);
+
+ reinit_io_cache(&index_file, WRITE_CACHE,
+ my_b_filelength(&index_file), 0, 0);
+
+ if (my_b_write(&index_file, (uchar*) name->str, name->length) ||
+ my_b_write(&index_file, (uchar*) "\n", 1) ||
+ flush_io_cache(&index_file) ||
+ (do_sync && my_sync(index_file.file, MYF(MY_WME))))
+ {
+ sql_print_error("Write of new Master_info for '%.*s' to index file failed",
+ (int) name->length, name->str);
+ DBUG_RETURN(1);
+ }
+
+ DBUG_RETURN(0);
+}
+
+
+/**
+ Get Master_info for a connection
+
+ @param
+ connection_name Connection name
+ warning WARN_LEVEL_NOTE -> Don't print anything
+ WARN_LEVEL_WARN -> Issue warning if not exists
+ WARN_LEVEL_ERROR-> Issue error if not exists
+*/
+
+Master_info *
+Master_info_index::get_master_info(LEX_STRING *connection_name,
+ MYSQL_ERROR::enum_warning_level warning)
+{
+ Master_info *mi;
+ char buff[MAX_CONNECTION_NAME+1], *res;
+ uint buff_length;
+ DBUG_ENTER("get_master_info");
+ DBUG_PRINT("enter",
+ ("connection_name: '%.*s'", (int) connection_name->length,
+ connection_name->str));
+
+ /* Make name lower case for comparison */
+ res= strmake(buff, connection_name->str, connection_name->length);
+ my_casedn_str(system_charset_info, buff);
+ buff_length= (size_t) (res-buff);
+
+ mi= (Master_info*) my_hash_search(&master_info_hash,
+ (uchar*) buff, buff_length);
+ if (!mi && warning != MYSQL_ERROR::WARN_LEVEL_NOTE)
+ {
+ my_error(WARN_NO_MASTER_INFO,
+ MYF(warning == MYSQL_ERROR::WARN_LEVEL_WARN ? ME_JUST_WARNING :
+ 0),
+ (int) connection_name->length,
+ connection_name->str);
+ }
+ DBUG_RETURN(mi);
+}
+
+
+/* Check Master_host & Master_port is duplicated or not */
+bool Master_info_index::check_duplicate_master_info(LEX_STRING *name_arg,
+ const char *host,
+ uint port)
+{
+ Master_info *mi;
+ DBUG_ENTER("check_duplicate_master_info");
+
+ /* Get full host and port name */
+ if ((mi= master_info_index->get_master_info(name_arg,
+ MYSQL_ERROR::WARN_LEVEL_NOTE)))
+ {
+ if (!host)
+ host= mi->host;
+ if (!port)
+ port= mi->port;
+ }
+ if (!host || !port)
+ DBUG_RETURN(FALSE); // Not comparable yet
+
+ for (uint i= 0; i < master_info_hash.records; ++i)
+ {
+ Master_info *tmp_mi;
+ tmp_mi= (Master_info *) my_hash_element(&master_info_hash, i);
+ if (tmp_mi == mi)
+ continue; // Current connection
+ if (!strcasecmp(host, tmp_mi->host) && port == tmp_mi->port)
+ {
+ my_error(ER_CONNECTION_ALREADY_EXISTS, MYF(0),
+ (int) name_arg->length,
+ name_arg->str,
+ (int) tmp_mi->connection_name.length,
+ tmp_mi->connection_name.str);
+ DBUG_RETURN(TRUE);
+ }
+ }
+ DBUG_RETURN(FALSE);
+}
+
+
+/* Add a Master_info class to Hash Table */
+bool Master_info_index::add_master_info(Master_info *mi, bool write_to_file)
+{
+ if (!my_hash_insert(&master_info_hash, (uchar*) mi))
+ {
+ if (global_system_variables.log_warnings > 1)
+ sql_print_information("Added new Master_info '%.*s' to hash table",
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ if (write_to_file)
+ return write_master_name_to_index_file(&mi->connection_name, 1);
+ return FALSE;
+ }
+
+ /* Impossible error (EOM) ? */
+ sql_print_error("Adding new entry '%.*s' to master_info failed",
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ return TRUE;
+}
+
+
+/**
+ Remove a Master_info class From Hash Table
+
+ TODO: Change this to use my_rename() to make the file name creation
+ atomic
+*/
+
+bool Master_info_index::remove_master_info(LEX_STRING *name)
+{
+ Master_info* mi;
+ DBUG_ENTER("remove_master_info");
+
+ if ((mi= get_master_info(name, MYSQL_ERROR::WARN_LEVEL_WARN)))
+ {
+ // Delete Master_info and rewrite others to file
+ if (!my_hash_delete(&master_info_hash, (uchar*) mi))
+ {
+ File index_file_nr;
+
+ // Close IO_CACHE and FILE handler fisrt
+ end_io_cache(&index_file);
+ my_close(index_file.file, MYF(MY_WME));
+
+ // Reopen File and truncate it
+ if ((index_file_nr= my_open(index_file_name,
+ O_RDWR | O_CREAT | O_TRUNC | O_BINARY ,
+ MYF(MY_WME))) < 0 ||
+ init_io_cache(&index_file, index_file_nr,
+ IO_SIZE, WRITE_CACHE,
+ my_seek(index_file_nr,0L,MY_SEEK_END,MYF(0)),
+ 0, MYF(MY_WME | MY_WAIT_IF_FULL)))
+ {
+ int error= my_errno;
+ if (index_file_nr >= 0)
+ my_close(index_file_nr,MYF(0));
+
+ sql_print_error("Create of Master Info Index file '%s' failed with "
+ "error: %M",
+ index_file_name, error);
+ DBUG_RETURN(TRUE);
+ }
+
+ // Rewrite Master_info.index
+ for (uint i= 0; i< master_info_hash.records; ++i)
+ {
+ Master_info *tmp_mi;
+ tmp_mi= (Master_info *) my_hash_element(&master_info_hash, i);
+ write_master_name_to_index_file(&tmp_mi->connection_name, 0);
+ }
+ my_sync(index_file_nr, MYF(MY_WME));
+ }
+ }
+ DBUG_RETURN(FALSE);
+}
+
+
+/**
+ Master_info_index::give_error_if_slave_running()
+
+ @return
+ TRUE If some slave is running. An error is printed
+ FALSE No slave is running
+*/
+
+bool Master_info_index::give_error_if_slave_running()
+{
+ DBUG_ENTER("warn_if_slave_running");
+ mysql_mutex_assert_owner(&LOCK_active_mi);
+
+ for (uint i= 0; i< master_info_hash.records; ++i)
+ {
+ Master_info *mi;
+ mi= (Master_info *) my_hash_element(&master_info_hash, i);
+ if (mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN)
+ {
+ my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length,
+ mi->connection_name.str);
+ DBUG_RETURN(TRUE);
+ }
+ }
+ DBUG_RETURN(FALSE);
+}
+
+
+/**
+ Master_info_index::start_all_slaves()
+
+ Start all slaves that was not running.
+
+ @return
+ TRUE Error
+ FALSE Everything ok.
+*/
+
+bool Master_info_index::start_all_slaves(THD *thd)
+{
+ bool result= FALSE;
+ DBUG_ENTER("warn_if_slave_running");
+ mysql_mutex_assert_owner(&LOCK_active_mi);
+
+ for (uint i= 0; i< master_info_hash.records; ++i)
+ {
+ int error;
+ Master_info *mi;
+ mi= (Master_info *) my_hash_element(&master_info_hash, i);
+
+ /*
+ Try to start all slaves that are configured (host is defined)
+ and are not already running
+ */
+ if ((mi->slave_running != MYSQL_SLAVE_RUN_CONNECT ||
+ !mi->rli.slave_running) && *mi->host)
+ {
+ if ((error= start_slave(thd, mi, 1)))
+ {
+ my_error(ER_CANT_START_STOP_SLAVE, MYF(0),
+ "START",
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ result= 1;
+ if (error < 0) // fatal error
+ break;
+ }
+ else
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_SLAVE_STARTED, ER(ER_SLAVE_STARTED),
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ }
+ }
+ DBUG_RETURN(result);
+}
+
+
+/**
+ Master_info_index::stop_all_slaves()
+
+ Start all slaves that was not running.
+
+ @return
+ TRUE Error
+ FALSE Everything ok.
+*/
+
+bool Master_info_index::stop_all_slaves(THD *thd)
+{
+ bool result= FALSE;
+ DBUG_ENTER("warn_if_slave_running");
+ mysql_mutex_assert_owner(&LOCK_active_mi);
+
+ for (uint i= 0; i< master_info_hash.records; ++i)
+ {
+ int error;
+ Master_info *mi;
+ mi= (Master_info *) my_hash_element(&master_info_hash, i);
+ if ((mi->slave_running != MYSQL_SLAVE_NOT_RUN ||
+ mi->rli.slave_running))
+ {
+ if ((error= stop_slave(thd, mi, 1)))
+ {
+ my_error(ER_CANT_START_STOP_SLAVE, MYF(0),
+ "STOP",
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ result= 1;
+ if (error < 0) // Fatal error
+ break;
+ }
+ else
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_SLAVE_STOPPED, ER(ER_SLAVE_STOPPED),
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ }
+ }
+ DBUG_RETURN(result);
+}
#endif /* HAVE_REPLICATION */
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 462d0cfe1ed..c91699662c8 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -59,16 +59,23 @@ typedef struct st_mysql MYSQL;
class Master_info : public Slave_reporting_capability
{
public:
- Master_info(bool is_slave_recovery);
+ Master_info(LEX_STRING *connection_name, bool is_slave_recovery);
~Master_info();
bool shall_ignore_server_id(ulong s_id);
void clear_in_memory_info(bool all);
+ bool error()
+ {
+ /* If malloc() in initialization failed */
+ return connection_name.str == 0;
+ }
/* the variables below are needed because we can change masters on the fly */
- char master_log_name[FN_REFLEN];
+ char master_log_name[FN_REFLEN+6]; /* Room for multi-*/
char host[HOSTNAME_LENGTH+1];
char user[USERNAME_LENGTH+1];
char password[MAX_PASSWORD_LENGTH+1];
+ LEX_STRING connection_name; /* User supplied connection name */
+ LEX_STRING cmp_connection_name; /* Connection name in lower case */
bool ssl; // enables use of SSL connection if true
char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN];
char ssl_cipher[FN_REFLEN], ssl_key[FN_REFLEN];
@@ -131,5 +138,48 @@ int flush_master_info(Master_info* mi,
bool need_lock_relay_log);
int change_master_server_id_cmp(ulong *id1, ulong *id2);
+/*
+ Multi master are handled trough this struct.
+ Changes to this needs to be protected by LOCK_active_mi;
+*/
+
+class Master_info_index
+{
+private:
+ IO_CACHE index_file;
+ char index_file_name[FN_REFLEN];
+
+public:
+ Master_info_index();
+ ~Master_info_index();
+
+ HASH master_info_hash;
+
+ bool init_all_master_info();
+ bool write_master_name_to_index_file(LEX_STRING *connection_name,
+ bool do_sync);
+
+ bool check_duplicate_master_info(LEX_STRING *connection_name,
+ const char *host, uint port);
+ bool add_master_info(Master_info *mi, bool write_to_file);
+ bool remove_master_info(LEX_STRING *connection_name);
+ Master_info *get_master_info(LEX_STRING *connection_name,
+ MYSQL_ERROR::enum_warning_level warning);
+ bool give_error_if_slave_running();
+ bool start_all_slaves(THD *thd);
+ bool stop_all_slaves(THD *thd);
+};
+
+bool check_master_connection_name(LEX_STRING *name);
+void create_logfile_name_with_suffix(char *res_file_name, uint length,
+ const char *info_file,
+ bool append,
+ LEX_STRING *suffix);
+
+uchar *get_key_master_info(Master_info *mi, size_t *length,
+ my_bool not_used __attribute__((unused)));
+void free_key_master_info(Master_info *mi);
+
+
#endif /* HAVE_REPLICATION */
#endif /* RPL_MI_H */
diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc
index a49f10db440..99bf8a82004 100644
--- a/sql/rpl_record.cc
+++ b/sql/rpl_record.cc
@@ -314,7 +314,7 @@ unpack_row(Relay_log_info const *rli,
if (!pack_ptr)
{
rli->report(ERROR_LEVEL, ER_SLAVE_CORRUPT_EVENT,
- "Could not read field `%s` of table `%s`.`%s`",
+ "Could not read field '%s' of table '%s.%s'",
f->field_name, table->s->db.str,
table->s->table_name.str);
DBUG_RETURN(ER_SLAVE_CORRUPT_EVENT);
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index d0d190d64dc..8c01e979226 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -51,7 +51,7 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
last_master_timestamp(0), slave_skip_counter(0),
abort_pos_wait(0), slave_run_id(0), sql_thd(0),
inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
- until_log_pos(0), retried_trans(0),
+ until_log_pos(0), retried_trans(0), executed_entries(0),
tables_to_lock(0), tables_to_lock_count(0),
last_event_start_time(0), deferred_events(NULL),m_flags(0),
row_stmt_start_timestamp(0), long_find_row_note_printed(false),
@@ -70,6 +70,7 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
group_relay_log_name[0]= event_relay_log_name[0]=
group_master_log_name[0]= 0;
until_log_name[0]= ign_master_log_name_end[0]= 0;
+ max_relay_log_size= global_system_variables.max_relay_log_size;
bzero((char*) &info_file, sizeof(info_file));
bzero((char*) &cache_buf, sizeof(cache_buf));
cached_charset_invalidate();
@@ -150,15 +151,6 @@ int init_relay_log_info(Relay_log_info* rli,
event, in flush_master_info(mi, 1, ?).
*/
- /*
- For the maximum log size, we choose max_relay_log_size if it is
- non-zero, max_binlog_size otherwise. If later the user does SET
- GLOBAL on one of these variables, fix_max_binlog_size and
- fix_max_relay_log_size will reconsider the choice (for example
- if the user changes max_relay_log_size to zero, we have to
- switch to using max_binlog_size for the relay log) and update
- rli->relay_log.max_size (and mysql_bin_log.max_size).
- */
{
/* Reports an error and returns, if the --relay-log's path
is a directory.*/
@@ -207,19 +199,36 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
name_warning_sent= 1;
}
+ /* For multimaster, add connection name to relay log filenames */
+ Master_info* mi= rli->mi;
+ char buf_relay_logname[FN_REFLEN], buf_relaylog_index_name_buff[FN_REFLEN];
+ char *buf_relaylog_index_name= opt_relaylog_index_name;
+
+ create_logfile_name_with_suffix(buf_relay_logname, sizeof(buf_relay_logname),
+ ln, 1, &mi->connection_name);
+ ln= buf_relay_logname;
+
+ if (opt_relaylog_index_name)
+ {
+ buf_relaylog_index_name= buf_relaylog_index_name_buff;
+ create_logfile_name_with_suffix(buf_relaylog_index_name_buff,
+ sizeof(buf_relaylog_index_name_buff),
+ opt_relaylog_index_name, 0,
+ &mi->connection_name);
+ }
+
rli->relay_log.is_relay_log= TRUE;
/*
note, that if open() fails, we'll still have index file open
but a destructor will take care of that
*/
- if (rli->relay_log.open_index_file(opt_relaylog_index_name, ln, TRUE) ||
- rli->relay_log.open(ln, LOG_BIN, 0, SEQ_READ_APPEND, 0,
- (max_relay_log_size ? max_relay_log_size :
- max_binlog_size), 1, TRUE))
+ if (rli->relay_log.open_index_file(buf_relaylog_index_name, ln, TRUE) ||
+ rli->relay_log.open(ln, LOG_BIN, 0, SEQ_READ_APPEND,
+ mi->rli.max_relay_log_size, 1, TRUE))
{
mysql_mutex_unlock(&rli->data_lock);
- sql_print_error("Failed in open_log() called from init_relay_log_info()");
+ sql_print_error("Failed when trying to open logs for '%s' in init_relay_log_info(). Error: %M", ln, my_errno);
DBUG_RETURN(1);
}
}
@@ -998,28 +1007,37 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
rli->cur_log_fd= -1;
}
- if (rli->relay_log.reset_logs(thd))
+ if (rli->relay_log.reset_logs(thd, !just_reset))
{
*errmsg = "Failed during log reset";
error=1;
goto err;
}
- /* Save name of used relay log file */
- strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(),
- sizeof(rli->group_relay_log_name)-1);
- strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(),
- sizeof(rli->event_relay_log_name)-1);
- rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE;
- if (count_relay_log_space(rli))
- {
- *errmsg= "Error counting relay log space";
- error=1;
- goto err;
- }
if (!just_reset)
+ {
+ /* Save name of used relay log file */
+ strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(),
+ sizeof(rli->group_relay_log_name)-1);
+ strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(),
+ sizeof(rli->event_relay_log_name)-1);
+ rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE;
+ rli->log_space_total= 0;
+
+ if (count_relay_log_space(rli))
+ {
+ *errmsg= "Error counting relay log space";
+ error=1;
+ goto err;
+ }
error= init_relay_log_pos(rli, rli->group_relay_log_name,
rli->group_relay_log_pos,
0 /* do not need data lock */, errmsg, 0);
+ }
+ else
+ {
+ /* Ensure relay log names are not used */
+ rli->group_relay_log_name[0]= rli->event_relay_log_name[0]= 0;
+ }
err:
#ifndef DBUG_OFF
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index b989283deb4..6144d37026b 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -25,7 +25,6 @@
struct RPL_TABLE_LIST;
class Master_info;
-extern uint sql_slave_skip_counter;
/****************************************************************************
@@ -229,10 +228,12 @@ public:
Needed for problems when slave stops and we want to restart it
skipping one or more events in the master log that have caused
errors, and have been manually applied by DBA already.
+ Must be ulong as it's refered to from set_var.cc
*/
- volatile uint32 slave_skip_counter;
+ volatile ulong slave_skip_counter;
volatile ulong abort_pos_wait; /* Incremented on change master */
volatile ulong slave_run_id; /* Incremented on slave start */
+ ulong max_relay_log_size;
mysql_mutex_t log_space_lock;
mysql_cond_t log_space_cond;
THD * sql_thd;
@@ -286,6 +287,7 @@ public:
slave started.
*/
ulong trans_retries, retried_trans;
+ ulong executed_entries; /* For SLAVE STATUS */
/*
If the end of the hot relay log is made of master's events ignored by the
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 388a6c9f9bb..069fac1c3ec 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -15,11 +15,10 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "rpl_utility.h"
+#include "log_event.h"
-#ifndef MYSQL_CLIENT
-#include "unireg.h" // REQUIRED by later includes
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
#include "rpl_rli.h"
-#include "log_event.h"
#include "sql_select.h"
/**
@@ -954,7 +953,6 @@ TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *
target_table->s->table_name.str);
DBUG_RETURN(conv_table);
}
-
#endif /* MYSQL_CLIENT */
table_def::table_def(unsigned char *types, ulong size,
@@ -1115,7 +1113,6 @@ bool event_checksum_test(uchar *event_buf, ulong event_len, uint8 alg)
return DBUG_EVALUATE_IF("simulate_checksum_test_failure", TRUE, res);
}
-
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
Deferred_log_events::Deferred_log_events(Relay_log_info *rli) : last_added(NULL)
diff --git a/sql/rpl_utility.h b/sql/rpl_utility.h
index 9046891e27f..79f4517c492 100644
--- a/sql/rpl_utility.h
+++ b/sql/rpl_utility.h
@@ -272,7 +272,7 @@ private:
public:
Deferred_log_events(Relay_log_info *rli);
~Deferred_log_events();
- /* queue for exection at Query-log-event time prior the Query */;
+ /* queue for exection at Query-log-event time prior the Query */
int add(Log_event *ev);
bool is_empty();
bool execute(Relay_log_info *rli);
diff --git a/sql/set_var.cc b/sql/set_var.cc
index ceb1adb81de..1276dd28e22 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -259,7 +259,7 @@ uchar *sys_var::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
bool sys_var::set_default(THD *thd, enum_var_type type)
{
LEX_STRING empty={0,0};
- set_var var(type, 0, &empty, 0);
+ set_var var(type, this, &empty, 0);
if (type == OPT_GLOBAL || scope() == GLOBAL)
global_save_default(thd, &var);
diff --git a/sql/set_var.h b/sql/set_var.h
index f0beac0fa7f..dcb60ba0bdf 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -69,13 +69,14 @@ public:
enum binlog_status_enum { VARIABLE_NOT_IN_BINLOG,
SESSION_VARIABLE_IN_BINLOG } binlog_status;
+ my_option option; ///< min, max, default values are stored here
+
protected:
typedef bool (*on_check_function)(sys_var *self, THD *thd, set_var *var);
typedef bool (*on_update_function)(sys_var *self, THD *thd, enum_var_type type);
int flags; ///< or'ed flag_enum values
const SHOW_TYPE show_val_type; ///< what value_ptr() returns for sql_show.cc
- my_option option; ///< min, max, default values are stored here
PolyLock *guard; ///< *second* lock that protects the variable
ptrdiff_t offset; ///< offset to the value from global_system_variables
on_check_function on_check;
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 16a907a6eff..5a298b4d25c 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -4271,18 +4271,18 @@ ER_TRANS_CACHE_FULL
swe "Transaktionen krävde mera än 'max_binlog_cache_size' minne. Öka denna mysqld-variabel och försök på nytt"
ukr "Ð¢Ñ€Ð°Ð½Ð·Ð°ÐºÑ†Ñ–Ñ Ð· багатьма виразами вимагає більше ніж 'max_binlog_cache_size' байтів Ð´Ð»Ñ Ð·Ð±ÐµÑ€Ñ–Ð³Ð°Ð½Ð½Ñ. Збільште цю змінну mysqld та Ñпробуйте знову"
ER_SLAVE_MUST_STOP
- dan "Denne handling kunne ikke udføres med kørende slave, brug først kommandoen STOP SLAVE"
- nla "Deze operatie kan niet worden uitgevoerd met een actieve slave, doe eerst STOP SLAVE"
- eng "This operation cannot be performed with a running slave; run STOP SLAVE first"
- fre "Cette opération ne peut être réalisée avec un esclave actif, faites STOP SLAVE d'abord"
- ger "Diese Operation kann bei einem aktiven Slave nicht durchgeführt werden. Bitte zuerst STOP SLAVE ausführen"
- ita "Questa operazione non puo' essere eseguita con un database 'slave' che gira, lanciare prima STOP SLAVE"
- por "Esta operação não pode ser realizada com um 'slave' em execução. Execute STOP SLAVE primeiro"
- rus "Эту операцию невозможно выполнить при работающем потоке подчиненного Ñервера. Сначала выполните STOP SLAVE"
- serbian "Ova operacija ne može biti izvršena dok je aktivan podređeni server. Zadajte prvo komandu 'STOP SLAVE' da zaustavite podređeni server."
- spa "Esta operación no puede ser hecha con el esclavo funcionando, primero use STOP SLAVE"
- swe "Denna operation kan inte göras under replikering; Gör STOP SLAVE först"
- ukr "ÐžÐ¿ÐµÑ€Ð°Ñ†Ñ–Ñ Ð½Ðµ може бути виконана з запущеним підлеглим, Ñпочатку виконайте STOP SLAVE"
+ dan "Denne handling kunne ikke udføres med kørende slave '%2$*1$s', brug først kommandoen STOP SLAVE '%2$*1$s'"
+ nla "Deze operatie kan niet worden uitgevoerd met een actieve slave '%2$*1$s', doe eerst STOP SLAVE '%2$*1$s'"
+ eng "This operation cannot be performed as you have a running slave '%2$*1$s'; run STOP SLAVE '%2$*1$s' first"
+ fre "Cette opération ne peut être réalisée avec un esclave '%2$*1$s' actif, faites STOP SLAVE '%2$*1$s' d'abord"
+ ger "Diese Operation kann bei einem aktiven Slave '%2$*1$s' nicht durchgeführt werden. Bitte zuerst STOP SLAVE '%2$*1$s' ausführen"
+ ita "Questa operazione non puo' essere eseguita con un database 'slave' '%2$*1$s' che gira, lanciare prima STOP SLAVE '%2$*1$s'"
+ por "Esta operação não pode ser realizada com um 'slave' '%2$*1$s' em execução. Execute STOP SLAVE '%2$*1$s' primeiro"
+ rus "Эту операцию невозможно выполнить при работающем потоке подчиненного Ñервера %2$*1$s. Сначала выполните STOP SLAVE '%2$*1$s'"
+ serbian "Ova operacija ne može biti izvršena dok je aktivan podređeni '%2$*1$s' server. Zadajte prvo komandu 'STOP SLAVE '%2$*1$s'' da zaustavite podređeni server."
+ spa "Esta operación no puede ser hecha con el esclavo '%2$*1$s' funcionando, primero use STOP SLAVE '%2$*1$s'"
+ swe "Denna operation kan inte göras under replikering; Du har en aktiv förbindelse till '%2$*1$s'. Gör STOP SLAVE '%2$*1$s' först"
+ ukr "ÐžÐ¿ÐµÑ€Ð°Ñ†Ñ–Ñ Ð½Ðµ може бути виконана з запущеним підлеглим '%2$*1$s', Ñпочатку виконайте STOP SLAVE '%2$*1$s'"
ER_SLAVE_NOT_RUNNING
dan "Denne handling kræver en kørende slave. Konfigurer en slave og brug kommandoen START SLAVE"
nla "Deze operatie vereist een actieve slave, configureer slave en doe dan START SLAVE"
@@ -4310,11 +4310,11 @@ ER_BAD_SLAVE
swe "Servern är inte konfigurerade som en replikationsslav. Ändra konfigurationsfilen eller gör CHANGE MASTER TO"
ukr "Сервер не зконфігуровано Ñк підлеглий, виправте це у файлі конфігурації або з CHANGE MASTER TO"
ER_MASTER_INFO
- eng "Could not initialize master info structure; more error messages can be found in the MariaDB error log"
- fre "Impossible d'initialiser les structures d'information de maître, vous trouverez des messages d'erreur supplémentaires dans le journal des erreurs de MariaDB"
- ger "Konnte Master-Info-Struktur nicht initialisieren. Weitere Fehlermeldungen können im MariaDB-Error-Log eingesehen werden"
- serbian "Nisam mogao da inicijalizujem informacionu strukturu glavnog servera, proverite da li imam privilegije potrebne za pristup file-u 'master.info'"
- swe "Kunde inte initialisera replikationsstrukturerna. See MariaDB fel fil för mera information"
+ eng "Could not initialize master info structure for '%.*s'; more error messages can be found in the MariaDB error log"
+ fre "Impossible d'initialiser les structures d'information de maître '%.*s', vous trouverez des messages d'erreur supplémentaires dans le journal des erreurs de MariaDB"
+ ger "Konnte Master-Info-Struktur '%.*s' nicht initialisieren. Weitere Fehlermeldungen können im MariaDB-Error-Log eingesehen werden"
+ serbian "Nisam mogao da inicijalizujem informacionu strukturu glavnog servera, proverite da li imam privilegije potrebne za pristup file-u 'master.info' '%.*s'"
+ swe "Kunde inte initialisera replikationsstrukturerna för '%.*s'. See MariaDB fel fil för mera information"
ER_SLAVE_THREAD
dan "Kunne ikke danne en slave-tråd; check systemressourcerne"
nla "Kon slave thread niet aanmaken, controleer systeem resources"
@@ -4345,13 +4345,13 @@ ER_TOO_MANY_USER_CONNECTIONS 42000
ER_SET_CONSTANTS_ONLY
dan "Du må kun bruge konstantudtryk med SET"
nla "U mag alleen constante expressies gebruiken bij SET"
- eng "You may only use constant expressions with SET"
+ eng "You may only use constant expressions in this statement"
est "Ainult konstantsed suurused on lubatud SET klauslis"
fre "Seules les expressions constantes sont autorisées avec SET"
- ger "Bei SET dürfen nur konstante Ausdrücke verwendet werden"
+ ger "Bei diesem Befehl dürfen nur konstante Ausdrücke verwendet werden"
ita "Si possono usare solo espressioni costanti con SET"
por "Você pode usar apenas expressões constantes com SET"
- rus "Ð’Ñ‹ можете иÑпользовать в SET только конÑтантные выражениÑ"
+ rus "С Ñтой командой вы можете иÑпользовать только конÑтантные выражениÑ"
serbian "Možete upotrebiti samo konstantan iskaz sa komandom 'SET'"
spa "Tu solo debes usar expresiones constantes con SET"
swe "Man kan endast använda konstantuttryck med SET"
@@ -6157,8 +6157,8 @@ ER_DELAYED_NOT_SUPPORTED
eng "DELAYED option not supported for table '%-.192s'"
ger "Die DELAYED-Option wird für Tabelle '%-.192s' nicht unterstützt"
WARN_NO_MASTER_INFO
- eng "The master info structure does not exist"
- ger "Die Master-Info-Struktur existiert nicht"
+ eng "There is no master connection '%.*s'"
+ ger "Die Master-Info-Struktur existiert nicht '%.*s'"
WARN_OPTION_IGNORED
eng "<%-.64s> option ignored"
ger "Option <%-.64s> ignoriert"
@@ -6807,3 +6807,18 @@ ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
eng "Cannot modify @@session.skip_replication inside a stored function or trigger"
ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT
eng "Query execution was interrupted. The query examined at least %llu rows, which exceeds LIMIT ROWS EXAMINED (%llu). The query result may be incomplete."
+ER_NO_SUCH_TABLE_IN_ENGINE 42S02
+ eng "Table '%-.192s.%-.192s' doesn't exist in engine"
+ swe "Det finns ingen tabell som heter '%-.192s.%-.192s' i handlern"
+ER_TARGET_NOT_EXPLAINABLE
+ eng "Target is not running an EXPLAINable command"
+ER_CONNECTION_ALREADY_EXISTS
+ eng "Connection '%.*s' conflicts with existing connection '%.*s'"
+ER_MASTER_LOG_PREFIX
+ eng "Master '%.*s': "
+ER_CANT_START_STOP_SLAVE
+ eng "Can't %s SLAVE '%.*s'"
+ER_SLAVE_STARTED
+ eng "SLAVE '%.*s' started"
+ER_SLAVE_STOPPED
+ eng "SLAVE '%.*s' stopped" \ No newline at end of file
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc
index 37f28844a7c..edc33c4d63b 100644
--- a/sql/signal_handler.cc
+++ b/sql/signal_handler.cc
@@ -138,23 +138,6 @@ extern "C" sig_handler handle_fatal_signal(int sig)
my_safe_printf_stderr("%s",
"Hope that's ok; if not, decrease some variables in the equation.\n\n");
-#if defined(HAVE_LINUXTHREADS)
-#define UNSAFE_DEFAULT_LINUX_THREADS 200
- if (sizeof(char*) == 4 && thread_count > UNSAFE_DEFAULT_LINUX_THREADS)
- {
- my_safe_printf_stderr(
- "You seem to be running 32-bit Linux and have "
- "%d concurrent connections.\n"
- "If you have not changed STACK_SIZE in LinuxThreads "
- "and built the binary \n"
- "yourself, LinuxThreads is quite likely to steal "
- "a part of the global heap for\n"
- "the thread stack. Please read "
- "http://dev.mysql.com/doc/mysql/en/linux-installation.html\n\n"
- thread_count);
- }
-#endif /* HAVE_LINUXTHREADS */
-
#ifdef HAVE_STACKTRACE
thd= current_thd;
diff --git a/sql/slave.cc b/sql/slave.cc
index 36a3d51b497..e1bac640e00 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -71,8 +71,10 @@ char slave_skip_error_names[SHOW_VAR_FUNC_BUFF_SIZE];
char* slave_load_tmpdir = 0;
Master_info *active_mi= 0;
+Master_info_index *master_info_index;
my_bool replicate_same_server_id;
ulonglong relay_log_space_limit = 0;
+LEX_STRING default_master_connection_name= { (char*) "", 0 };
/*
When slave thread exits, we need to remember the temporary tables so we
@@ -144,7 +146,8 @@ static int process_io_create_file(Master_info* mi, Create_file_log_event* cev);
static bool wait_for_relay_log_space(Relay_log_info* rli);
static inline bool io_slave_killed(THD* thd,Master_info* mi);
static inline bool sql_slave_killed(THD* thd,Relay_log_info* rli);
-static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type);
+static int init_slave_thread(THD* thd, Master_info *mi,
+ SLAVE_THD_TYPE thd_type);
static void print_slave_skip_errors(void);
static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi);
static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi,
@@ -159,6 +162,8 @@ static int terminate_slave_thread(THD *thd,
volatile uint *slave_running,
bool skip_lock);
static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info);
+static bool send_show_master_info_header(THD *thd, bool full);
+static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full);
/*
Find out which replications threads are running
@@ -263,15 +268,33 @@ int init_slave()
So it's safer to take the lock.
*/
mysql_mutex_lock(&LOCK_active_mi);
- /*
- TODO: re-write this to interate through the list of files
- for multi-master
- */
- active_mi= new Master_info(relay_log_recovery);
if (pthread_key_create(&RPL_MASTER_INFO, NULL))
goto err;
+ master_info_index= new Master_info_index;
+ if (!master_info_index || master_info_index->init_all_master_info())
+ {
+ sql_print_error("Failed to initialize multi master structures");
+ mysql_mutex_unlock(&LOCK_active_mi);
+ DBUG_RETURN(1);
+ }
+ if (!(active_mi= new Master_info(&default_master_connection_name,
+ relay_log_recovery)) ||
+ active_mi->error())
+ {
+ delete active_mi;
+ active_mi= 0;
+ goto err;
+ }
+
+ if (master_info_index->add_master_info(active_mi, FALSE))
+ {
+ delete active_mi;
+ active_mi= 0;
+ goto err;
+ }
+
/*
If --slave-skip-errors=... was not used, the string value for the
system variable has not been set up yet. Do it now.
@@ -286,18 +309,11 @@ int init_slave()
If master_host is specified, create the master_info file if it doesn't
exists.
*/
- if (!active_mi)
- {
- sql_print_error("Failed to allocate memory for the master info structure");
- error= 1;
- goto err;
- }
if (init_master_info(active_mi,master_info_file,relay_log_info_file,
1, (SLAVE_IO | SLAVE_SQL)))
{
sql_print_error("Failed to initialize the master info structure");
- error= 1;
goto err;
}
@@ -313,14 +329,18 @@ int init_slave()
SLAVE_IO | SLAVE_SQL))
{
sql_print_error("Failed to create slave threads");
- error= 1;
goto err;
}
}
-err:
+end:
mysql_mutex_unlock(&LOCK_active_mi);
DBUG_RETURN(error);
+
+err:
+ sql_print_error("Failed to allocate memory for the Master Info structure");
+ error= 1;
+ goto end;
}
/*
@@ -834,42 +854,19 @@ void end_slave()
running presently. If a START SLAVE was in progress, the mutex lock below
will make us wait until slave threads have started, and START SLAVE
returns, then we terminate them here.
+
+ We can also be called by cleanup(), which only happens if some
+ startup parameter to the server was wrong.
*/
mysql_mutex_lock(&LOCK_active_mi);
- if (active_mi)
- {
- /*
- TODO: replace the line below with
- list_walk(&master_list, (list_walk_action)end_slave_on_walk,0);
- once multi-master code is ready.
- */
- terminate_slave_threads(active_mi,SLAVE_FORCE_ALL);
- }
+ /* This will call terminate_slave_threads() on all connections */
+ delete master_info_index;
+ master_info_index= 0;
+ active_mi= 0;
mysql_mutex_unlock(&LOCK_active_mi);
DBUG_VOID_RETURN;
}
-/**
- Free all resources used by slave threads at time of executing shutdown.
- The routine must be called after all possible users of @c active_mi
- have left.
-
- SYNOPSIS
- close_active_mi()
-
-*/
-void close_active_mi()
-{
- mysql_mutex_lock(&LOCK_active_mi);
- if (active_mi)
- {
- end_master_info(active_mi);
- delete active_mi;
- active_mi= 0;
- }
- mysql_mutex_unlock(&LOCK_active_mi);
-}
-
static bool io_slave_killed(THD* thd, Master_info* mi)
{
DBUG_ENTER("io_slave_killed");
@@ -1767,6 +1764,37 @@ past_checksum:
}
}
}
+
+ /* Announce MariaDB slave capabilities. */
+ DBUG_EXECUTE_IF("simulate_slave_capability_none", goto after_set_capability;);
+ {
+ int rc= DBUG_EVALUATE_IF("simulate_slave_capability_old_53",
+ mysql_real_query(mysql, STRING_WITH_LEN("SET @mariadb_slave_capability="
+ STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_ANNOTATE))),
+ mysql_real_query(mysql, STRING_WITH_LEN("SET @mariadb_slave_capability="
+ STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_MINE))));
+ if (rc)
+ {
+ err_code= mysql_errno(mysql);
+ if (is_network_error(err_code))
+ {
+ mi->report(ERROR_LEVEL, err_code,
+ "Setting @mariadb_slave_capability failed with error: %s",
+ mysql_error(mysql));
+ goto network_err;
+ }
+ else
+ {
+ /* Fatal error */
+ errmsg= "The slave I/O thread stops because a fatal error is "
+ "encountered when it tries to set @mariadb_slave_capability.";
+ sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
+ goto err;
+ }
+ }
+ }
+after_set_capability:
+
err:
if (errmsg)
{
@@ -1849,9 +1877,9 @@ static bool wait_for_relay_log_space(Relay_log_info* rli)
#endif
if (rli->sql_force_rotate_relay)
{
- mysql_mutex_lock(&active_mi->data_lock);
+ mysql_mutex_lock(&mi->data_lock);
rotate_relay_log(rli->mi);
- mysql_mutex_unlock(&active_mi->data_lock);
+ mysql_mutex_unlock(&mi->data_lock);
rli->sql_force_rotate_relay= false;
}
@@ -2005,15 +2033,36 @@ int register_slave_on_master(MYSQL* mysql, Master_info *mi,
@retval FALSE success
@retval TRUE failure
*/
-bool show_master_info(THD* thd, Master_info* mi)
+
+bool show_master_info(THD *thd, Master_info *mi, bool full)
+{
+ DBUG_ENTER("show_master_info");
+
+ if (send_show_master_info_header(thd, full))
+ DBUG_RETURN(TRUE);
+ if (send_show_master_info_data(thd, mi, full))
+ DBUG_RETURN(TRUE);
+ my_eof(thd);
+ DBUG_RETURN(FALSE);
+}
+
+static bool send_show_master_info_header(THD *thd, bool full)
{
- // TODO: fix this for multi-master
List<Item> field_list;
Protocol *protocol= thd->protocol;
- DBUG_ENTER("show_master_info");
+ Master_info *mi;
+ DBUG_ENTER("show_master_info_header");
+
+ if (full)
+ {
+ field_list.push_back(new Item_empty_string("Connection_name",
+ MAX_CONNECTION_NAME));
+ field_list.push_back(new Item_empty_string("Slave_SQL_State",
+ 30));
+ }
field_list.push_back(new Item_empty_string("Slave_IO_State",
- 14));
+ 30));
field_list.push_back(new Item_empty_string("Master_Host",
sizeof(mi->host)));
field_list.push_back(new Item_empty_string("Master_User",
@@ -2080,22 +2129,52 @@ bool show_master_info(THD* thd, Master_info* mi)
sizeof(mi->ssl_crl)));
field_list.push_back(new Item_empty_string("Master_SSL_Crlpath",
sizeof(mi->ssl_crlpath)));
+ if (full)
+ {
+ field_list.push_back(new Item_return_int("Retried_transactions",
+ 10, MYSQL_TYPE_LONG));
+ field_list.push_back(new Item_return_int("Max_relay_log_size",
+ 10, MYSQL_TYPE_LONGLONG));
+ field_list.push_back(new Item_return_int("Executed_log_entries",
+ 10, MYSQL_TYPE_LONG));
+ field_list.push_back(new Item_return_int("Slave_received_heartbeats",
+ 10, MYSQL_TYPE_LONG));
+ field_list.push_back(new Item_float("Slave_heartbeat_period",
+ 0.0, 3, 10));
+ }
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
+ DBUG_RETURN(FALSE);
+}
+
+
+static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full)
+{
+ DBUG_ENTER("send_show_master_info_data");
if (mi->host[0])
{
DBUG_PRINT("info",("host is set: '%s'", mi->host));
String *packet= &thd->packet;
+ Protocol *protocol= thd->protocol;
+ char buf[256];
+ String tmp(buf, sizeof(buf), &my_charset_bin);
+
protocol->prepare_for_resend();
/*
slave_running can be accessed without run_lock but not other
non-volotile members like mi->io_thd, which is guarded by the mutex.
*/
+ if (full)
+ protocol->store(mi->connection_name.str, mi->connection_name.length,
+ &my_charset_bin);
mysql_mutex_lock(&mi->run_lock);
+ if (full)
+ protocol->store(mi->rli.sql_thd ? mi->rli.sql_thd->get_proc_info() : "",
+ &my_charset_bin);
protocol->store(mi->io_thd ? mi->io_thd->get_proc_info() : "", &my_charset_bin);
mysql_mutex_unlock(&mi->run_lock);
@@ -2121,8 +2200,6 @@ bool show_master_info(THD* thd, Master_info* mi)
protocol->store(rpl_filter->get_do_db());
protocol->store(rpl_filter->get_ignore_db());
- char buf[256];
- String tmp(buf, sizeof(buf), &my_charset_bin);
rpl_filter->get_do_table(&tmp);
protocol->store(&tmp);
rpl_filter->get_ignore_table(&tmp);
@@ -2232,6 +2309,14 @@ bool show_master_info(THD* thd, Master_info* mi)
protocol->store(mi->ssl_ca, &my_charset_bin);
// Master_Ssl_Crlpath
protocol->store(mi->ssl_capath, &my_charset_bin);
+ if (full)
+ {
+ protocol->store((uint32) mi->rli.retried_trans);
+ protocol->store((ulonglong) mi->rli.max_relay_log_size);
+ protocol->store((uint32) mi->rli.executed_entries);
+ protocol->store((uint32) mi->received_heartbeats);
+ protocol->store((double) mi->heartbeat_period, 3, &tmp);
+ }
mysql_mutex_unlock(&mi->rli.err_lock);
mysql_mutex_unlock(&mi->err_lock);
@@ -2241,6 +2326,69 @@ bool show_master_info(THD* thd, Master_info* mi)
if (my_net_write(&thd->net, (uchar*) thd->packet.ptr(), packet->length()))
DBUG_RETURN(TRUE);
}
+ DBUG_RETURN(FALSE);
+}
+
+
+/* Used to sort connections by name */
+
+static int cmp_mi_by_name(const Master_info **arg1,
+ const Master_info **arg2)
+{
+ return my_strcasecmp(system_charset_info, (*arg1)->connection_name.str,
+ (*arg2)->connection_name.str);
+}
+
+
+/**
+ Execute a SHOW FULL SLAVE STATUS statement.
+
+ @param thd Pointer to THD object for the client thread executing the
+ statement.
+
+ Elements are sorted according to the original connection_name.
+
+ @retval FALSE success
+ @retval TRUE failure
+
+ @note
+ master_info_index is protected by LOCK_active_mi.
+*/
+
+bool show_all_master_info(THD* thd)
+{
+ uint i, elements;
+ Master_info **tmp;
+ DBUG_ENTER("show_master_info");
+ mysql_mutex_assert_owner(&LOCK_active_mi);
+
+ if (send_show_master_info_header(thd, 1))
+ DBUG_RETURN(TRUE);
+
+ if (!(elements= master_info_index->master_info_hash.records))
+ goto end;
+
+ /*
+ Sort lines to get them into a predicted order
+ (needed for test cases and to not confuse users)
+ */
+ if (!(tmp= (Master_info**) thd->alloc(sizeof(Master_info*) * elements)))
+ DBUG_RETURN(TRUE);
+
+ for (i= 0; i < elements; i++)
+ {
+ tmp[i]= (Master_info *) my_hash_element(&master_info_index->
+ master_info_hash, i);
+ }
+ my_qsort(tmp, elements, sizeof(Master_info*), (qsort_cmp) cmp_mi_by_name);
+
+ for (i= 0; i < elements; i++)
+ {
+ if (send_show_master_info_data(thd, tmp[i], 1))
+ DBUG_RETURN(TRUE);
+ }
+
+end:
my_eof(thd);
DBUG_RETURN(FALSE);
}
@@ -2294,7 +2442,8 @@ void set_slave_thread_default_charset(THD* thd, Relay_log_info const *rli)
init_slave_thread()
*/
-static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
+static int init_slave_thread(THD* thd, Master_info *mi,
+ SLAVE_THD_TYPE thd_type)
{
DBUG_ENTER("init_slave_thread");
#if !defined(DBUG_OFF)
@@ -2309,9 +2458,9 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
slave threads, since a replication event can become this much larger
than the corresponding packet (query) sent from client to master.
*/
- thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
- + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
- thd->slave_thread = 1;
+ thd->variables.max_allowed_packet= slave_max_allowed_packet;
+ thd->slave_thread= 1;
+ thd->connection_name= mi->connection_name;
thd->enable_slow_log= opt_log_slow_slave_statements;
thd->variables.log_slow_filter= global_system_variables.log_slow_filter;
set_slave_thread_options(thd);
@@ -2626,7 +2775,10 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli)
int reason= ev->shall_skip(rli);
if (reason == Log_event::EVENT_SKIP_COUNT)
- sql_slave_skip_counter= --rli->slave_skip_counter;
+ {
+ DBUG_ASSERT(rli->slave_skip_counter > 0);
+ rli->slave_skip_counter--;
+ }
mysql_mutex_unlock(&rli->data_lock);
if (reason == Log_event::EVENT_SKIP_NOT)
exec_res= ev->apply_event(rli);
@@ -2875,6 +3027,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
mysql_mutex_lock(&rli->data_lock); // because of SHOW STATUS
rli->trans_retries++;
rli->retried_trans++;
+ statistic_increment(slave_retried_transactions, LOCK_status);
mysql_mutex_unlock(&rli->data_lock);
DBUG_PRINT("info", ("Slave retries transaction "
"rli->trans_retries: %lu", rli->trans_retries));
@@ -3033,6 +3186,8 @@ pthread_handler_t handle_slave_io(void *arg)
mysql= NULL ;
retry_count= 0;
+ thd= new THD; // note that contructor of THD uses DBUG_ !
+
mysql_mutex_lock(&mi->run_lock);
/* Inform waiting threads that slave has started */
mi->slave_run_id++;
@@ -3041,14 +3196,13 @@ pthread_handler_t handle_slave_io(void *arg)
mi->events_till_disconnect = disconnect_slave_event_count;
#endif
- thd= new THD; // note that contructor of THD uses DBUG_ !
THD_CHECK_SENTRY(thd);
mi->io_thd = thd;
pthread_detach_this_thread();
thd->thread_stack= (char*) &thd; // remember where our stack is
mi->clear_error();
- if (init_slave_thread(thd, SLAVE_THD_IO))
+ if (init_slave_thread(thd, mi, SLAVE_THD_IO))
{
mysql_cond_broadcast(&mi->start_cond);
sql_print_error("Failed during slave I/O thread initialization");
@@ -3057,7 +3211,7 @@ pthread_handler_t handle_slave_io(void *arg)
mysql_mutex_lock(&LOCK_thread_count);
threads.append(thd);
mysql_mutex_unlock(&LOCK_thread_count);
- mi->slave_running = 1;
+ mi->slave_running = MYSQL_SLAVE_RUN_NOT_CONNECT;
mi->abort_slave = 0;
mysql_mutex_unlock(&mi->run_lock);
mysql_cond_broadcast(&mi->start_cond);
@@ -3097,6 +3251,7 @@ pthread_handler_t handle_slave_io(void *arg)
thread, since a replication event can become this much larger than
the corresponding packet (query) sent from client to master.
*/
+ thd->net.max_packet_size= slave_max_allowed_packet;
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
}
else
@@ -3229,12 +3384,12 @@ reading event"))
switch (mysql_error_number) {
case CR_NET_PACKET_TOO_LARGE:
sql_print_error("\
-Log entry on master is longer than max_allowed_packet (%ld) on \
+Log entry on master is longer than slave_max_allowed_packet (%lu) on \
slave. If the entry is correct, restart the server with a higher value of \
-max_allowed_packet",
- thd->variables.max_allowed_packet);
+slave_max_allowed_packet",
+ slave_max_allowed_packet);
mi->report(ERROR_LEVEL, ER_NET_PACKET_TOO_LARGE,
- "%s", ER(ER_NET_PACKET_TOO_LARGE));
+ "%s", "Got a packet bigger than 'slave_max_allowed_packet' bytes");
goto err;
case ER_MASTER_FATAL_ERROR_READING_BINLOG:
mi->report(ERROR_LEVEL, ER_MASTER_FATAL_ERROR_READING_BINLOG,
@@ -3368,7 +3523,7 @@ err_during_init:
delete thd;
mysql_mutex_unlock(&LOCK_thread_count);
mi->abort_slave= 0;
- mi->slave_running= 0;
+ mi->slave_running= MYSQL_SLAVE_NOT_RUN;
mi->io_thd= 0;
/*
Note: the order of the two following calls (first broadcast, then unlock)
@@ -3446,7 +3601,8 @@ pthread_handler_t handle_slave_sql(void *arg)
my_off_t UNINIT_VAR(saved_log_pos);
my_off_t UNINIT_VAR(saved_master_log_pos);
my_off_t saved_skip= 0;
- Relay_log_info* rli = &((Master_info*)arg)->rli;
+ Master_info *mi= ((Master_info*)arg);
+ Relay_log_info* rli = &mi->rli;
const char *errmsg;
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
@@ -3460,6 +3616,7 @@ pthread_handler_t handle_slave_sql(void *arg)
thd->thread_stack = (char*)&thd; // remember where our stack is
DBUG_ASSERT(rli->inited);
+ DBUG_ASSERT(rli->mi == mi);
mysql_mutex_lock(&rli->run_lock);
DBUG_ASSERT(!rli->slave_running);
errmsg= 0;
@@ -3471,10 +3628,10 @@ pthread_handler_t handle_slave_sql(void *arg)
/* Inform waiting threads that slave has started */
rli->slave_run_id++;
- rli->slave_running = 1;
+ rli->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT;
pthread_detach_this_thread();
- if (init_slave_thread(thd, SLAVE_THD_SQL))
+ if (init_slave_thread(thd, mi, SLAVE_THD_SQL))
{
/*
TODO: this is currently broken - slave start and change master
@@ -3715,6 +3872,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
}
goto err;
}
+ rli->executed_entries++;
}
/* Thread stopped. Print the current replication position to the log */
@@ -3745,9 +3903,9 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
err_during_init:
/* We need data_lock, at least to wake up any waiting master_pos_wait() */
mysql_mutex_lock(&rli->data_lock);
- DBUG_ASSERT(rli->slave_running == 1); // tracking buffer overrun
+ DBUG_ASSERT(rli->slave_running == MYSQL_SLAVE_RUN_NOT_CONNECT); // tracking buffer overrun
/* When master_pos_wait() wakes up it will check this and terminate */
- rli->slave_running= 0;
+ rli->slave_running= MYSQL_SLAVE_NOT_RUN;
/* Forget the relay log's format */
delete rli->relay_log.description_event_for_exec;
rli->relay_log.description_event_for_exec= 0;
@@ -5266,11 +5424,6 @@ static Log_event* next_event(Relay_log_info* rli)
mysql_mutex_lock(log_lock);
if (rli->relay_log.is_active(rli->linfo.log_file_name))
{
-#ifdef EXTRA_DEBUG
- if (global_system_variables.log_warnings)
- sql_print_information("next log '%s' is currently active",
- rli->linfo.log_file_name);
-#endif
rli->cur_log= cur_log= rli->relay_log.get_log_file();
rli->cur_log_old_open_count= rli->relay_log.get_open_count();
DBUG_ASSERT(rli->cur_log_fd == -1);
@@ -5353,11 +5506,6 @@ static Log_event* next_event(Relay_log_info* rli)
ourselves. We are sure that the log is still not hot now (a log can get
from hot to cold, but not from cold to hot). No need for LOCK_log.
*/
-#ifdef EXTRA_DEBUG
- if (global_system_variables.log_warnings)
- sql_print_information("next log '%s' is not active",
- rli->linfo.log_file_name);
-#endif
// open_binlog() will check the magic header
if ((rli->cur_log_fd=open_binlog(cur_log,rli->linfo.log_file_name,
&errmsg)) <0)
@@ -5537,11 +5685,10 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
*/
bool rpl_master_erroneous_autoinc(THD *thd)
{
- if (active_mi && active_mi->rli.sql_thd == thd)
+ if (thd->rli_slave)
{
- Relay_log_info *rli= &active_mi->rli;
DBUG_EXECUTE_IF("simulate_bug33029", return TRUE;);
- return rpl_master_has_bug(rli, 33029, FALSE, NULL, NULL);
+ return rpl_master_has_bug(thd->rli_slave, 33029, FALSE, NULL, NULL);
}
return FALSE;
}
diff --git a/sql/slave.h b/sql/slave.h
index 6b4bcffe109..565f40b7236 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -45,9 +45,12 @@
#define MAX_SLAVE_ERROR 2000
+#define MAX_REPLICATION_THREAD 64
+
// Forward declarations
class Relay_log_info;
class Master_info;
+class Master_info_index;
int init_intvar_from_file(int* var, IO_CACHE* f, int default_val);
int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
@@ -197,7 +200,8 @@ int mysql_table_dump(THD* thd, const char* db,
int fetch_master_table(THD* thd, const char* db_name, const char* table_name,
Master_info* mi, MYSQL* mysql, bool overwrite);
-bool show_master_info(THD* thd, Master_info* mi);
+bool show_master_info(THD* thd, Master_info* mi, bool full);
+bool show_all_master_info(THD* thd);
bool show_binlog_info(THD* thd);
bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
bool (*pred)(const void *), const void *param);
@@ -231,6 +235,9 @@ bool net_request_file(NET* net, const char* fname);
extern bool volatile abort_loop;
extern Master_info main_mi, *active_mi; /* active_mi for multi-master */
+extern Master_info *default_master_info; /* To replace active_mi */
+extern Master_info_index *master_info_index;
+extern LEX_STRING default_master_connection_name;
extern LIST master_list;
extern my_bool replicate_same_server_id;
diff --git a/sql/sp.cc b/sql/sp.cc
index 1a2e3bd49ab..db180bde4b5 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -984,9 +984,6 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
enum_check_fields saved_count_cuted_fields;
bool store_failed= FALSE;
-
- bool save_binlog_row_based;
-
DBUG_ENTER("sp_create_routine");
DBUG_PRINT("enter", ("type: %d name: %.*s", (int) type,
(int) sp->m_name.length,
@@ -1004,14 +1001,6 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
/* Reset sql_mode during data dictionary operations. */
thd->variables.sql_mode= 0;
- /*
- This statement will be replicated as a statement, even when using
- row-based replication. The flag will be reset at the end of the
- statement.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
saved_count_cuted_fields= thd->count_cuted_fields;
thd->count_cuted_fields= CHECK_FIELD_WARN;
@@ -1217,10 +1206,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
done:
thd->count_cuted_fields= saved_count_cuted_fields;
thd->variables.sql_mode= saved_mode;
- /* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(ret);
}
@@ -1245,7 +1231,6 @@ sp_drop_routine(THD *thd, stored_procedure_type type, sp_name *name)
{
TABLE *table;
int ret;
- bool save_binlog_row_based;
MDL_key::enum_mdl_namespace mdl_type= type == TYPE_ENUM_FUNCTION ?
MDL_key::FUNCTION : MDL_key::PROCEDURE;
DBUG_ENTER("sp_drop_routine");
@@ -1267,9 +1252,6 @@ sp_drop_routine(THD *thd, stored_procedure_type type, sp_name *name)
row-based replication. The flag will be reset at the end of the
statement.
*/
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
if ((ret= db_find_routine_aux(thd, type, name, table)) == SP_OK)
{
if (table->file->ha_delete_row(table->record[0]))
@@ -1296,10 +1278,7 @@ sp_drop_routine(THD *thd, stored_procedure_type type, sp_name *name)
sp_cache_flush_obsolete(spc, &sp);
}
}
- /* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(ret);
}
@@ -1327,7 +1306,6 @@ sp_update_routine(THD *thd, stored_procedure_type type, sp_name *name,
{
TABLE *table;
int ret;
- bool save_binlog_row_based;
MDL_key::enum_mdl_namespace mdl_type= type == TYPE_ENUM_FUNCTION ?
MDL_key::FUNCTION : MDL_key::PROCEDURE;
DBUG_ENTER("sp_update_routine");
@@ -1345,14 +1323,6 @@ sp_update_routine(THD *thd, stored_procedure_type type, sp_name *name,
if (!(table= open_proc_table_for_update(thd)))
DBUG_RETURN(SP_OPEN_TABLE_FAILED);
- /*
- This statement will be replicated as a statement, even when using
- row-based replication. The flag will be reset at the end of the
- statement.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
if ((ret= db_find_routine_aux(thd, type, name, table)) == SP_OK)
{
if (type == TYPE_ENUM_FUNCTION && ! trust_function_creators &&
@@ -1406,10 +1376,7 @@ sp_update_routine(THD *thd, stored_procedure_type type, sp_name *name,
sp_cache_invalidate();
}
err:
- /* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(ret);
}
@@ -1429,6 +1396,7 @@ public:
MYSQL_ERROR ** cond_hdl)
{
if (sql_errno == ER_NO_SUCH_TABLE ||
+ sql_errno == ER_NO_SUCH_TABLE_IN_ENGINE ||
sql_errno == ER_CANNOT_LOAD_FROM_TABLE_V2 ||
sql_errno == ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE ||
sql_errno == ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2)
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 9a356cb3321..bde54ea2443 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -218,6 +218,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_CREATE_TRIGGER:
case SQLCOM_SHOW_DATABASES:
case SQLCOM_SHOW_ERRORS:
+ case SQLCOM_SHOW_EXPLAIN:
case SQLCOM_SHOW_FIELDS:
case SQLCOM_SHOW_FUNC_CODE:
case SQLCOM_SHOW_GRANTS:
@@ -3032,6 +3033,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
if (!res || !thd->is_error() ||
(thd->stmt_da->sql_errno() != ER_CANT_REOPEN_TABLE &&
thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE &&
+ thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE_IN_ENGINE &&
thd->stmt_da->sql_errno() != ER_UPDATE_TABLE_USED))
thd->stmt_arena->state= Query_arena::STMT_EXECUTED;
diff --git a/sql/spatial.h b/sql/spatial.h
index 0d0560656f0..07675d59040 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -554,5 +554,5 @@ public:
struct Geometry_buffer : public
my_aligned_storage<sizeof(Gis_point), MY_ALIGNOF(Gis_point)> {};
-#endif /*HAVE_SPATAIAL*/
+#endif /*HAVE_SPATIAL*/
#endif
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index c2cfb6f5477..d920202a426 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1875,7 +1875,7 @@ bool change_password(THD *thd, const char *host, const char *user,
/* Buffer should be extended when password length is extended. */
char buff[512];
ulong query_length;
- bool save_binlog_row_based;
+ enum_binlog_format save_binlog_format;
uint new_password_len= (uint) strlen(new_password);
bool result= 1;
DBUG_ENTER("change_password");
@@ -1912,9 +1912,10 @@ bool change_password(THD *thd, const char *host, const char *user,
This statement will be replicated as a statement, even when using
row-based replication. The flag will be reset at the end of the
statement.
+ This has to be handled here as it's called by set_var.cc, which is
+ not automaticly handled by sql_parse.cc
*/
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
+ save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
mysql_mutex_lock(&acl_cache->lock);
ACL_USER *acl_user;
@@ -1963,11 +1964,7 @@ bool change_password(THD *thd, const char *host, const char *user,
}
end:
close_mysql_tables(thd);
-
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
+ thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(result);
}
@@ -3538,7 +3535,6 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
TABLE_LIST tables[3];
bool create_new_users=0;
char *db_name, *table_name;
- bool save_binlog_row_based;
DBUG_ENTER("mysql_table_grant");
if (!initialized)
@@ -3628,14 +3624,6 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
if (column_priv || (revoke_grant && ((rights & COL_ACLS) || columns.elements)))
tables[1].next_local= tables[1].next_global= tables+2;
- /*
- This statement will be replicated as a statement, even when using
- row-based replication. The flag will be reset at the end of the
- statement.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
#ifdef HAVE_REPLICATION
/*
GRANT and REVOKE are applied the slave in/exclusion rules as they are
@@ -3649,13 +3637,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
*/
tables[0].updating= tables[1].updating= tables[2].updating= 1;
if (!(thd->spcont || rpl_filter->tables_ok(0, tables)))
- {
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(FALSE);
- }
}
#endif
@@ -3673,11 +3655,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
thd->lex->sql_command= backup.sql_command;
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{ // Should never happen
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
thd->lex->restore_backup_query_tables_list(&backup);
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(TRUE); /* purecov: deadcode */
}
@@ -3805,9 +3783,6 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
/* Tables are automatically closed */
thd->lex->restore_backup_query_tables_list(&backup);
/* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(result);
}
@@ -3836,7 +3811,6 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
TABLE_LIST tables[2];
bool create_new_users=0, result=0;
char *db_name, *table_name;
- bool save_binlog_row_based;
DBUG_ENTER("mysql_routine_grant");
if (!initialized)
@@ -3866,14 +3840,6 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
C_STRING_WITH_LEN("procs_priv"), "procs_priv", TL_WRITE);
tables[0].next_local= tables[0].next_global= tables+1;
- /*
- This statement will be replicated as a statement, even when using
- row-based replication. The flag will be reset at the end of the
- statement.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
#ifdef HAVE_REPLICATION
/*
GRANT and REVOKE are applied the slave in/exclusion rules as they are
@@ -3888,23 +3854,15 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
tables[0].updating= tables[1].updating= 1;
if (!(thd->spcont || rpl_filter->tables_ok(0, tables)))
{
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(FALSE);
}
}
#endif
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
- { // Should never happen
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(TRUE);
- }
+
+ DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (!revoke_grant)
create_new_users= test_if_create_new_users(thd);
@@ -3978,10 +3936,6 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
}
mysql_rwlock_unlock(&LOCK_grant);
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
/* Tables are automatically closed */
DBUG_RETURN(result);
@@ -3996,8 +3950,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
char tmp_db[SAFE_NAME_LEN+1];
bool create_new_users=0;
TABLE_LIST tables[2];
- bool save_binlog_row_based;
DBUG_ENTER("mysql_grant");
+
if (!initialized)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
@@ -4034,14 +3988,6 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
TL_WRITE);
tables[0].next_local= tables[0].next_global= tables+1;
- /*
- This statement will be replicated as a statement, even when using
- row-based replication. The flag will be reset at the end of the
- statement.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
#ifdef HAVE_REPLICATION
/*
GRANT and REVOKE are applied the slave in/exclusion rules as they are
@@ -4055,24 +4001,14 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
*/
tables[0].updating= tables[1].updating= 1;
if (!(thd->spcont || rpl_filter->tables_ok(0, tables)))
- {
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(FALSE);
- }
}
#endif
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
- { // This should never happen
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(TRUE); /* purecov: deadcode */
- }
+
+ DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (!revoke_grant)
create_new_users= test_if_create_new_users(thd);
@@ -4138,10 +4074,6 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
if (!result)
my_ok(thd);
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(result);
}
@@ -6454,26 +6386,11 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
List_iterator <LEX_USER> user_list(list);
TABLE_LIST tables[GRANT_TABLES];
bool some_users_created= FALSE;
- bool save_binlog_row_based;
DBUG_ENTER("mysql_create_user");
- /*
- This statement will be replicated as a statement, even when using
- row-based replication. The flag will be reset at the end of the
- statement.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
/* CREATE USER may be skipped on replication client. */
if ((result= open_grant_tables(thd, tables)))
- {
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(result != 1);
- }
mysql_rwlock_wrlock(&LOCK_grant);
mysql_mutex_lock(&acl_cache->lock);
@@ -6514,10 +6431,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
result |= write_bin_log(thd, FALSE, thd->query(), thd->query_length());
mysql_rwlock_unlock(&LOCK_grant);
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(result);
}
@@ -6544,26 +6457,11 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
TABLE_LIST tables[GRANT_TABLES];
bool some_users_deleted= FALSE;
ulonglong old_sql_mode= thd->variables.sql_mode;
- bool save_binlog_row_based;
DBUG_ENTER("mysql_drop_user");
- /*
- This statement will be replicated as a statement, even when using
- row-based replication. The flag will be reset at the end of the
- statement.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
/* DROP USER may be skipped on replication client. */
if ((result= open_grant_tables(thd, tables)))
- {
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(result != 1);
- }
thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
@@ -6599,10 +6497,6 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
mysql_rwlock_unlock(&LOCK_grant);
thd->variables.sql_mode= old_sql_mode;
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(result);
}
@@ -6629,26 +6523,13 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
List_iterator <LEX_USER> user_list(list);
TABLE_LIST tables[GRANT_TABLES];
bool some_users_renamed= FALSE;
- bool save_binlog_row_based;
DBUG_ENTER("mysql_rename_user");
- /*
- This statement will be replicated as a statement, even when using
- row-based replication. The flag will be reset at the end of the
- statement.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
/* RENAME USER may be skipped on replication client. */
if ((result= open_grant_tables(thd, tables)))
- {
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(result != 1);
- }
+
+ DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
mysql_rwlock_wrlock(&LOCK_grant);
mysql_mutex_lock(&acl_cache->lock);
@@ -6694,10 +6575,6 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
result |= write_bin_log(thd, FALSE, thd->query(), thd->query_length());
mysql_rwlock_unlock(&LOCK_grant);
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(result);
}
@@ -6722,25 +6599,12 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
int result;
ACL_DB *acl_db;
TABLE_LIST tables[GRANT_TABLES];
- bool save_binlog_row_based;
DBUG_ENTER("mysql_revoke_all");
- /*
- This statement will be replicated as a statement, even when using
- row-based replication. The flag will be reset at the end of the
- statement.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
if ((result= open_grant_tables(thd, tables)))
- {
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(result != 1);
- }
+
+ DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
mysql_rwlock_wrlock(&LOCK_grant);
mysql_mutex_lock(&acl_cache->lock);
@@ -6891,10 +6755,6 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
mysql_rwlock_unlock(&LOCK_grant);
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(result);
}
@@ -6986,26 +6846,19 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
TABLE_LIST tables[GRANT_TABLES];
HASH *hash= is_proc ? &proc_priv_hash : &func_priv_hash;
Silence_routine_definer_errors error_handler;
- bool save_binlog_row_based;
DBUG_ENTER("sp_revoke_privileges");
if ((result= open_grant_tables(thd, tables)))
DBUG_RETURN(result != 1);
+ DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
+
/* Be sure to pop this before exiting this scope! */
thd->push_internal_handler(&error_handler);
mysql_rwlock_wrlock(&LOCK_grant);
mysql_mutex_lock(&acl_cache->lock);
- /*
- This statement will be replicated as a statement, even when using
- row-based replication. The flag will be reset at the end of the
- statement.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
/* Remove procedure access */
do
{
@@ -7039,10 +6892,6 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
mysql_rwlock_unlock(&LOCK_grant);
thd->pop_internal_handler();
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(error_handler.has_errors());
}
@@ -8045,6 +7894,7 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
int2store(end+3, mpvio->thd->server_status);
int2store(end+5, thd->client_capabilities >> 16);
end[7]= data_len;
+ DBUG_EXECUTE_IF("poison_srv_handshake_scramble_len", end[7]= -100;);
bzero(end + 8, 10);
end+= 18;
/* write scramble tail */
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 8d0f2e5634f..c65e56edbe0 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -285,6 +285,7 @@ end:
static inline bool table_not_corrupt_error(uint sql_errno)
{
return (sql_errno == ER_NO_SUCH_TABLE ||
+ sql_errno == ER_NO_SUCH_TABLE_IN_ENGINE ||
sql_errno == ER_FILE_NOT_FOUND ||
sql_errno == ER_LOCK_WAIT_TIMEOUT ||
sql_errno == ER_LOCK_DEADLOCK ||
diff --git a/sql/sql_array.h b/sql/sql_array.h
index 67f1f1c2ad7..98a4a4815af 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -19,6 +19,77 @@
#include <my_sys.h>
+/**
+ A wrapper class which provides array bounds checking.
+ We do *not* own the array, we simply have a pointer to the first element,
+ and a length.
+
+ @remark
+ We want the compiler-generated versions of:
+ - the copy CTOR (memberwise initialization)
+ - the assignment operator (memberwise assignment)
+
+ @param Element_type The type of the elements of the container.
+ */
+template <typename Element_type> class Bounds_checked_array
+{
+public:
+ Bounds_checked_array() : m_array(NULL), m_size(0) {}
+
+ Bounds_checked_array(Element_type *el, size_t size)
+ : m_array(el), m_size(size)
+ {}
+
+ void reset() { m_array= NULL; m_size= 0; }
+
+ void reset(Element_type *array, size_t size)
+ {
+ m_array= array;
+ m_size= size;
+ }
+
+ /**
+ Set a new bound on the array. Does not resize the underlying
+ array, so the new size must be smaller than or equal to the
+ current size.
+ */
+ void resize(size_t new_size)
+ {
+ DBUG_ASSERT(new_size <= m_size);
+ m_size= new_size;
+ }
+
+ Element_type &operator[](size_t n)
+ {
+ DBUG_ASSERT(n < m_size);
+ return m_array[n];
+ }
+
+ const Element_type &operator[](size_t n) const
+ {
+ DBUG_ASSERT(n < m_size);
+ return m_array[n];
+ }
+
+ size_t element_size() const { return sizeof(Element_type); }
+ size_t size() const { return m_size; }
+
+ bool is_null() const { return m_array == NULL; }
+
+ void pop_front()
+ {
+ DBUG_ASSERT(m_size > 0);
+ m_array+= 1;
+ m_size-= 1;
+ }
+
+ Element_type *array() const { return m_array; }
+
+private:
+ Element_type *m_array;
+ size_t m_size;
+};
+
/*
A typesafe wrapper around DYNAMIC_ARRAY
*/
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 7ce77bcf9b4..feb4e43eb51 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -70,7 +70,7 @@ No_such_table_error_handler::handle_condition(THD *,
MYSQL_ERROR ** cond_hdl)
{
*cond_hdl= NULL;
- if (sql_errno == ER_NO_SUCH_TABLE)
+ if (sql_errno == ER_NO_SUCH_TABLE || sql_errno == ER_NO_SUCH_TABLE_IN_ENGINE)
{
m_handled_errors++;
return TRUE;
@@ -144,7 +144,9 @@ Repair_mrg_table_error_handler::handle_condition(THD *,
MYSQL_ERROR ** cond_hdl)
{
*cond_hdl= NULL;
- if (sql_errno == ER_NO_SUCH_TABLE || sql_errno == ER_WRONG_MRG_TABLE)
+ if (sql_errno == ER_NO_SUCH_TABLE ||
+ sql_errno == ER_NO_SUCH_TABLE_IN_ENGINE ||
+ sql_errno == ER_WRONG_MRG_TABLE)
{
m_handled_errors= true;
return TRUE;
@@ -394,6 +396,7 @@ bool table_def_init(void)
void table_def_start_shutdown(void)
{
+ DBUG_ENTER("table_def_start_shutdown");
if (table_def_inited)
{
mysql_mutex_lock(&LOCK_open);
@@ -408,6 +411,7 @@ void table_def_start_shutdown(void)
/* Free all cached but unused TABLEs and TABLE_SHAREs. */
close_cached_tables(NULL, NULL, FALSE, LONG_TIMEOUT);
}
+ DBUG_VOID_RETURN;
}
@@ -725,7 +729,9 @@ get_table_share_with_discover(THD *thd, TABLE_LIST *table_list,
@todo Rework alternative ways to deal with ER_NO_SUCH TABLE.
*/
- if (share || (thd->is_error() && thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE))
+ if (share ||
+ (thd->is_error() && thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE &&
+ thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE_IN_ENGINE))
DBUG_RETURN(share);
*error= 0;
@@ -1090,6 +1096,9 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
mysql_mutex_unlock(&LOCK_open);
+ DBUG_PRINT("info", ("open table definitions: %d",
+ (int) table_def_cache.records));
+
if (!wait_for_refresh)
DBUG_RETURN(result);
@@ -3928,36 +3937,24 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry)
entry->file->implicit_emptied= 0;
if (mysql_bin_log.is_open())
{
- char *query, *end;
- uint query_buf_size= 20 + share->db.length + share->table_name.length +1;
- if ((query= (char*) my_malloc(query_buf_size,MYF(MY_WME))))
- {
- /* this DELETE FROM is needed even with row-based binlogging */
- end = strxmov(strmov(query, "DELETE FROM `"),
- share->db.str,"`.`",share->table_name.str,"`", NullS);
- int errcode= query_error_code(thd, TRUE);
- if (thd->binlog_query(THD::STMT_QUERY_TYPE,
- query, (ulong)(end-query),
- FALSE, FALSE, FALSE, errcode))
- {
- my_free(query);
- return TRUE;
- }
- my_free(query);
- }
- else
- {
- /*
- As replication is maybe going to be corrupted, we need to warn the
- DBA on top of warning the client (which will automatically be done
- because of MYF(MY_WME) in my_malloc() above).
- */
- sql_print_error("When opening HEAP table, could not allocate memory "
- "to write 'DELETE FROM `%s`.`%s`' to the binary log",
- share->db.str, share->table_name.str);
- delete entry->triggers;
+ char query_buf[2*FN_REFLEN + 21];
+ String query(query_buf, sizeof(query_buf), system_charset_info);
+
+ query.length(0);
+ query.append("DELETE FROM ");
+ append_identifier(thd, &query, share->db.str, share->db.length);
+ query.append(".");
+ append_identifier(thd, &query, share->table_name.str,
+ share->table_name.length);
+
+ /*
+ we bypass thd->binlog_query() here,
+ as it does a lot of extra work, that is simply wrong in this case
+ */
+ Query_log_event qinfo(thd, query.ptr(), query.length(),
+ FALSE, TRUE, TRUE, 0);
+ if (mysql_bin_log.write(&qinfo))
return TRUE;
- }
}
}
return FALSE;
@@ -9490,6 +9487,7 @@ open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
if (mysql_make_view(thd, parser, table_desc,
(prgflag & OPEN_VIEW_NO_PARSE)))
goto err;
+ status_var_increment(thd->status_var.opened_views);
}
else
{
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 354898a7cf2..256a51b9575 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1539,7 +1539,7 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
unlock();
goto end;
}
- if (!register_all_tables(query_block, tables_used, local_tables))
+ if (!register_all_tables(thd, query_block, tables_used, local_tables))
{
refused++;
DBUG_PRINT("warning", ("tables list including failed"));
@@ -1819,7 +1819,10 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
goto err;
if (query_cache_size == 0)
+ {
+ thd->query_cache_is_applicable= 0; // Query can't be cached
goto err_unlock;
+ }
Query_cache_block *query_block;
if (thd->variables.query_cache_strip_comments)
@@ -3212,6 +3215,7 @@ Query_cache::invalidate_query_block_list(THD *thd,
SYNOPSIS
Query_cache::register_tables_from_list
+ thd thread handle
tables_used given table list
counter number current position in table of tables of block
block_table pointer to current position in tables table of block
@@ -3222,24 +3226,24 @@ Query_cache::invalidate_query_block_list(THD *thd,
*/
TABLE_COUNTER_TYPE
-Query_cache::register_tables_from_list(TABLE_LIST *tables_used,
+Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
TABLE_COUNTER_TYPE counter,
- Query_cache_block_table *block_table)
+ Query_cache_block_table **block_table)
{
TABLE_COUNTER_TYPE n;
DBUG_ENTER("Query_cache::register_tables_from_list");
for (n= counter;
tables_used;
- tables_used= tables_used->next_global, n++, block_table++)
+ tables_used= tables_used->next_global, n++, (*block_table)++)
{
if (tables_used->is_anonymous_derived_table())
{
DBUG_PRINT("qcache", ("derived table skipped"));
n--;
- block_table--;
+ (*block_table)--;
continue;
}
- block_table->n= n;
+ (*block_table)->n= n;
if (tables_used->view)
{
char key[MAX_DBKEY_LENGTH];
@@ -3252,9 +3256,9 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used,
/*
There are not callback function for for VIEWs
*/
- if (!insert_table(key_length, key, block_table,
+ if (!insert_table(key_length, key, (*block_table),
tables_used->view_db.length + 1,
- HA_CACHE_TBL_NONTRANSACT, 0, 0))
+ HA_CACHE_TBL_NONTRANSACT, 0, 0, TRUE))
DBUG_RETURN(0);
/*
We do not need to register view tables here because they are already
@@ -3273,42 +3277,17 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used,
if (!insert_table(tables_used->table->s->table_cache_key.length,
tables_used->table->s->table_cache_key.str,
- block_table,
+ (*block_table),
tables_used->db_length,
tables_used->table->file->table_cache_type(),
tables_used->callback_func,
- tables_used->engine_data))
+ tables_used->engine_data,
+ TRUE))
DBUG_RETURN(0);
-#ifdef WITH_MYISAMMRG_STORAGE_ENGINE
- /*
- XXX FIXME: Some generic mechanism is required here instead of this
- MYISAMMRG-specific implementation.
- */
- if (tables_used->table->s->db_type()->db_type == DB_TYPE_MRG_MYISAM)
- {
- ha_myisammrg *handler = (ha_myisammrg *) tables_used->table->file;
- MYRG_INFO *file = handler->myrg_info();
- for (MYRG_TABLE *table = file->open_tables;
- table != file->end_table ;
- table++)
- {
- char key[MAX_DBKEY_LENGTH];
- uint32 db_length;
- uint key_length= filename_2_table_key(key, table->table->filename,
- &db_length);
- (++block_table)->n= ++n;
- /*
- There are not callback function for for MyISAM, and engine data
- */
- if (!insert_table(key_length, key, block_table,
- db_length,
- tables_used->table->file->table_cache_type(),
- 0, 0))
- DBUG_RETURN(0);
- }
- }
-#endif
+ if (tables_used->table->file->
+ register_query_cache_dependant_tables(thd, this, block_table, &n))
+ DBUG_RETURN(0);
}
}
DBUG_RETURN(n - counter);
@@ -3319,12 +3298,14 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used,
SYNOPSIS
register_all_tables()
+ thd Thread handle
block Store tables in this block
tables_used List if used tables
tables_arg Not used ?
*/
-my_bool Query_cache::register_all_tables(Query_cache_block *block,
+my_bool Query_cache::register_all_tables(THD *thd,
+ Query_cache_block *block,
TABLE_LIST *tables_used,
TABLE_COUNTER_TYPE tables_arg)
{
@@ -3335,7 +3316,7 @@ my_bool Query_cache::register_all_tables(Query_cache_block *block,
Query_cache_block_table *block_table = block->table(0);
- n= register_tables_from_list(tables_used, 0, block_table);
+ n= register_tables_from_list(thd, tables_used, 0, &block_table);
if (n==0)
{
@@ -3344,6 +3325,8 @@ my_bool Query_cache::register_all_tables(Query_cache_block *block,
tmp != block_table;
tmp++)
unlink_table(tmp);
+ if (block_table->parent)
+ unlink_table(block_table);
}
return test(n);
}
@@ -3362,7 +3345,8 @@ Query_cache::insert_table(uint key_len, char *key,
Query_cache_block_table *node,
uint32 db_length, uint8 cache_type,
qc_engine_callback callback,
- ulonglong engine_data)
+ ulonglong engine_data,
+ my_bool hash)
{
DBUG_ENTER("Query_cache::insert_table");
DBUG_PRINT("qcache", ("insert table node 0x%lx, len %d",
@@ -3370,8 +3354,10 @@ Query_cache::insert_table(uint key_len, char *key,
THD *thd= current_thd;
- Query_cache_block *table_block=
- (Query_cache_block *) my_hash_search(&tables, (uchar*) key, key_len);
+ Query_cache_block *table_block=
+ (hash ?
+ (Query_cache_block *) my_hash_search(&tables, (uchar*) key, key_len) :
+ NULL);
if (table_block &&
table_block->table()->engine_data() != engine_data)
@@ -3421,7 +3407,8 @@ Query_cache::insert_table(uint key_len, char *key,
*/
list_root->next= list_root->prev= list_root;
- if (my_hash_insert(&tables, (const uchar *) table_block))
+ if (hash &&
+ my_hash_insert(&tables, (const uchar *) table_block))
{
DBUG_PRINT("qcache", ("Can't insert table to hash"));
// write_block_data return locked block
@@ -3434,6 +3421,7 @@ Query_cache::insert_table(uint key_len, char *key,
header->type(cache_type);
header->callback(callback);
header->engine_data(engine_data);
+ header->set_hashed(hash);
/*
We insert this table without the assumption that it isn't refrenenced by
@@ -3487,7 +3475,9 @@ void Query_cache::unlink_table(Query_cache_block_table *node)
Query_cache_block *table_block= neighbour->block();
double_linked_list_exclude(table_block,
&tables_blocks);
- my_hash_delete(&tables,(uchar *) table_block);
+ Query_cache_table *header= table_block->table();
+ if (header->is_hashed())
+ my_hash_delete(&tables,(uchar *) table_block);
free_memory_block(table_block);
}
DBUG_VOID_RETURN;
@@ -3960,6 +3950,9 @@ Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used,
table_alias_charset used here because it depends of
lower_case_table_names variable
*/
+ table_count+= tables_used->table->file->
+ count_query_cache_dependant_tables(tables_type);
+
if (tables_used->table->s->tmp_table != NO_TMP_TABLE ||
(*tables_type & HA_CACHE_TBL_NOCACHE) ||
(tables_used->db_length == 5 &&
@@ -3972,18 +3965,6 @@ Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used,
"other non-cacheable table(s)"));
DBUG_RETURN(0);
}
-#ifdef WITH_MYISAMMRG_STORAGE_ENGINE
- /*
- XXX FIXME: Some generic mechanism is required here instead of this
- MYISAMMRG-specific implementation.
- */
- if (tables_used->table->s->db_type()->db_type == DB_TYPE_MRG_MYISAM)
- {
- ha_myisammrg *handler = (ha_myisammrg *)tables_used->table->file;
- MYRG_INFO *file = handler->myrg_info();
- table_count+= (file->end_table - file->open_tables);
- }
-#endif
}
}
DBUG_RETURN(table_count);
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 87291e80a85..7444d444cf9 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -200,6 +200,10 @@ struct Query_cache_table
The number of queries depending of this table.
*/
int32 m_cached_query_count;
+ /**
+ If table included in the table hash to be found by other queries
+ */
+ my_bool hashed;
inline char *db() { return (char *) data(); }
inline char *table() { return tbl; }
@@ -212,6 +216,8 @@ struct Query_cache_table
inline void callback(qc_engine_callback fn){ callback_func= fn; }
inline ulonglong engine_data() { return engine_data_buff; }
inline void engine_data(ulonglong data_arg){ engine_data_buff= data_arg; }
+ inline my_bool is_hashed() { return hashed; }
+ inline void set_hashed(my_bool hash) { hashed= hash; }
inline uchar* data()
{
return (uchar*)(((uchar*)this)+
@@ -343,10 +349,6 @@ protected:
static void double_linked_list_join(Query_cache_block *head_tail,
Query_cache_block *tail_head);
- /* Table key generation */
- static uint filename_2_table_key (char *key, const char *filename,
- uint32 *db_langth);
-
/* The following functions require that structure_guard_mutex is locked */
void flush_cache();
my_bool free_old_query();
@@ -363,17 +365,12 @@ protected:
Query_cache_block_table *list_root);
TABLE_COUNTER_TYPE
- register_tables_from_list(TABLE_LIST *tables_used,
+ register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
TABLE_COUNTER_TYPE counter,
- Query_cache_block_table *block_table);
- my_bool register_all_tables(Query_cache_block *block,
+ Query_cache_block_table **block_table);
+ my_bool register_all_tables(THD *thd, Query_cache_block *block,
TABLE_LIST *tables_used,
TABLE_COUNTER_TYPE tables);
- my_bool insert_table(uint key_len, char *key,
- Query_cache_block_table *node,
- uint32 db_length, uint8 cache_type,
- qc_engine_callback callback,
- ulonglong engine_data);
void unlink_table(Query_cache_block_table *node);
Query_cache_block *get_free_block (ulong len, my_bool not_less,
ulong min);
@@ -491,6 +488,12 @@ protected:
const char *packet,
ulong length,
unsigned pkt_nr);
+ my_bool insert_table(uint key_len, char *key,
+ Query_cache_block_table *node,
+ uint32 db_length, uint8 cache_type,
+ qc_engine_callback callback,
+ ulonglong engine_data,
+ my_bool hash);
void end_of_result(THD *thd);
void abort(Query_cache_tls *query_cache_tls);
@@ -513,6 +516,10 @@ protected:
const char *name);
my_bool in_blocks(Query_cache_block * point);
+ /* Table key generation */
+ static uint filename_2_table_key (char *key, const char *filename,
+ uint32 *db_langth);
+
enum Cache_try_lock_mode {WAIT, TIMEOUT, TRY};
bool try_lock(THD *thd, Cache_try_lock_mode mode= WAIT);
void lock(THD *thd);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index a96fe63e3c9..ba1d46ec3cc 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -857,6 +857,9 @@ THD::THD()
progress.max_counter= 0;
current_linfo = 0;
slave_thread = 0;
+ connection_name.str= 0;
+ connection_name.length= 0;
+
bzero(&variables, sizeof(variables));
thread_id= 0;
one_shot_set= 0;
@@ -1224,7 +1227,14 @@ void THD::init(void)
avoid temporary tables replication failure.
*/
variables.pseudo_thread_id= thread_id;
+
+ variables.default_master_connection.str= default_master_connection_buff;
+ ::strmake(variables.default_master_connection.str,
+ global_system_variables.default_master_connection.str,
+ variables.default_master_connection.length);
+
mysql_mutex_unlock(&LOCK_global_system_variables);
+
server_status= SERVER_STATUS_AUTOCOMMIT;
if (variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES)
server_status|= SERVER_STATUS_NO_BACKSLASH_ESCAPES;
@@ -1255,6 +1265,7 @@ void THD::init(void)
/* Initialize the Debug Sync Facility. See debug_sync.cc. */
debug_sync_init_thread(this);
#endif /* defined(ENABLED_DEBUG_SYNC) */
+ apc_target.init(&LOCK_thd_data);
}
@@ -1420,6 +1431,7 @@ void THD::cleanup(void)
ull= NULL;
}
+ apc_target.destroy();
cleanup_done=1;
DBUG_VOID_RETURN;
}
@@ -2072,6 +2084,20 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
int THD::send_explain_fields(select_result *result)
{
List<Item> field_list;
+ make_explain_field_list(field_list);
+ return (result->send_result_set_metadata(field_list,
+ Protocol::SEND_NUM_ROWS |
+ Protocol::SEND_EOF));
+}
+
+
+/*
+ Populate the provided field_list with EXPLAIN output columns.
+ this->lex->describe has the EXPLAIN flags
+*/
+
+void THD::make_explain_field_list(List<Item> &field_list)
+{
Item *item;
CHARSET_INFO *cs= system_charset_info;
field_list.push_back(item= new Item_return_int("id",3, MYSQL_TYPE_LONGLONG));
@@ -2110,10 +2136,9 @@ int THD::send_explain_fields(select_result *result)
}
item->maybe_null= 1;
field_list.push_back(new Item_empty_string("Extra", 255, cs));
- return (result->send_result_set_metadata(field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF));
}
+
#ifdef SIGNAL_WITH_VIO_CLOSE
void THD::close_active_vio()
{
@@ -2345,6 +2370,7 @@ int select_send::send_data(List<Item> &items)
DBUG_RETURN(0);
}
+
bool select_send::send_eof()
{
/*
@@ -3238,6 +3264,10 @@ void THD::end_statement()
}
+/*
+ Start using arena specified by @set. Current arena data will be saved to
+ *backup.
+*/
void THD::set_n_backup_active_arena(Query_arena *set, Query_arena *backup)
{
DBUG_ENTER("THD::set_n_backup_active_arena");
@@ -3252,6 +3282,12 @@ void THD::set_n_backup_active_arena(Query_arena *set, Query_arena *backup)
}
+/*
+ Stop using the temporary arena, and start again using the arena that is
+ specified in *backup.
+ The temporary arena is returned back into *set.
+*/
+
void THD::restore_active_arena(Query_arena *set, Query_arena *backup)
{
DBUG_ENTER("THD::restore_active_arena");
@@ -3826,12 +3862,21 @@ void THD::restore_backup_open_tables_state(Open_tables_backup *backup)
@retval 1 the user thread has been killed
This is used to signal a storage engine if it should be killed.
+ See also THD::check_killed().
*/
extern "C" int thd_killed(const MYSQL_THD thd)
{
+ THD* current= current_thd;
if (!thd)
- thd= current_thd;
+ thd= current;
+
+ if (thd == current)
+ {
+ Apc_target *apc_target= (Apc_target*)&thd->apc_target;
+ if (apc_target->have_apc_requests())
+ apc_target->process_apc_requests();
+ }
if (!(thd->killed & KILL_HARD_BIT))
return 0;
@@ -5384,6 +5429,134 @@ show_query_type(THD::enum_binlog_query_type qtype)
}
#endif
+/*
+ Constants required for the limit unsafe warnings suppression
+*/
+//seconds after which the limit unsafe warnings suppression will be activated
+#define LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT 50
+//number of limit unsafe warnings after which the suppression will be activated
+#define LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT 50
+
+static ulonglong limit_unsafe_suppression_start_time= 0;
+static bool unsafe_warning_suppression_is_activated= false;
+static int limit_unsafe_warning_count= 0;
+
+/**
+ Auxiliary function to reset the limit unsafety warning suppression.
+*/
+static void reset_binlog_unsafe_suppression()
+{
+ DBUG_ENTER("reset_binlog_unsafe_suppression");
+ unsafe_warning_suppression_is_activated= false;
+ limit_unsafe_warning_count= 0;
+ limit_unsafe_suppression_start_time= my_interval_timer()/10000000;
+ DBUG_VOID_RETURN;
+}
+
+/**
+ Auxiliary function to print warning in the error log.
+*/
+static void print_unsafe_warning_to_log(int unsafe_type, char* buf,
+ char* query)
+{
+ DBUG_ENTER("print_unsafe_warning_in_log");
+ sprintf(buf, ER(ER_BINLOG_UNSAFE_STATEMENT),
+ ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
+ sql_print_warning(ER(ER_MESSAGE_AND_STATEMENT), buf, query);
+ DBUG_VOID_RETURN;
+}
+
+/**
+ Auxiliary function to check if the warning for limit unsafety should be
+ thrown or suppressed. Details of the implementation can be found in the
+ comments inline.
+ SYNOPSIS:
+ @params
+ buf - buffer to hold the warning message text
+ unsafe_type - The type of unsafety.
+ query - The actual query statement.
+
+ TODO: Remove this function and implement a general service for all warnings
+ that would prevent flooding the error log.
+*/
+static void do_unsafe_limit_checkout(char* buf, int unsafe_type, char* query)
+{
+ ulonglong now= 0;
+ DBUG_ENTER("do_unsafe_limit_checkout");
+ DBUG_ASSERT(unsafe_type == LEX::BINLOG_STMT_UNSAFE_LIMIT);
+ limit_unsafe_warning_count++;
+ /*
+ INITIALIZING:
+ If this is the first time this function is called with log warning
+ enabled, the monitoring the unsafe warnings should start.
+ */
+ if (limit_unsafe_suppression_start_time == 0)
+ {
+ limit_unsafe_suppression_start_time= my_interval_timer()/10000000;
+ print_unsafe_warning_to_log(unsafe_type, buf, query);
+ }
+ else
+ {
+ if (!unsafe_warning_suppression_is_activated)
+ print_unsafe_warning_to_log(unsafe_type, buf, query);
+
+ if (limit_unsafe_warning_count >=
+ LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT)
+ {
+ now= my_interval_timer()/10000000;
+ if (!unsafe_warning_suppression_is_activated)
+ {
+ /*
+ ACTIVATION:
+ We got LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT warnings in
+ less than LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT we activate the
+ suppression.
+ */
+ if ((now-limit_unsafe_suppression_start_time) <=
+ LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT)
+ {
+ unsafe_warning_suppression_is_activated= true;
+ DBUG_PRINT("info",("A warning flood has been detected and the limit \
+unsafety warning suppression has been activated."));
+ }
+ else
+ {
+ /*
+ there is no flooding till now, therefore we restart the monitoring
+ */
+ limit_unsafe_suppression_start_time= my_interval_timer()/10000000;
+ limit_unsafe_warning_count= 0;
+ }
+ }
+ else
+ {
+ /*
+ Print the suppression note and the unsafe warning.
+ */
+ sql_print_information("The following warning was suppressed %d times \
+during the last %d seconds in the error log",
+ limit_unsafe_warning_count,
+ (int)
+ (now-limit_unsafe_suppression_start_time));
+ print_unsafe_warning_to_log(unsafe_type, buf, query);
+ /*
+ DEACTIVATION: We got LIMIT_UNSAFE_WARNING_ACTIVATION_THRESHOLD_COUNT
+ warnings in more than LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT, the
+ suppression should be deactivated.
+ */
+ if ((now - limit_unsafe_suppression_start_time) >
+ LIMIT_UNSAFE_WARNING_ACTIVATION_TIMEOUT)
+ {
+ reset_binlog_unsafe_suppression();
+ DBUG_PRINT("info",("The limit unsafety warning supression has been \
+deactivated"));
+ }
+ }
+ limit_unsafe_warning_count= 0;
+ }
+ }
+ DBUG_VOID_RETURN;
+}
/**
Auxiliary method used by @c binlog_query() to raise warnings.
@@ -5393,6 +5566,7 @@ show_query_type(THD::enum_binlog_query_type qtype)
*/
void THD::issue_unsafe_warnings()
{
+ char buf[MYSQL_ERRMSG_SIZE * 2];
DBUG_ENTER("issue_unsafe_warnings");
/*
Ensure that binlog_unsafe_warning_flags is big enough to hold all
@@ -5418,17 +5592,16 @@ void THD::issue_unsafe_warnings()
ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
if (global_system_variables.log_warnings)
{
- char buf[MYSQL_ERRMSG_SIZE * 2];
- sprintf(buf, ER(ER_BINLOG_UNSAFE_STATEMENT),
- ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
- sql_print_warning(ER(ER_MESSAGE_AND_STATEMENT), buf, query());
+ if (unsafe_type == LEX::BINLOG_STMT_UNSAFE_LIMIT)
+ do_unsafe_limit_checkout( buf, unsafe_type, query());
+ else //cases other than LIMIT unsafety
+ print_unsafe_warning_to_log(unsafe_type, buf, query());
}
}
}
DBUG_VOID_RETURN;
}
-
/**
Log the current query.
@@ -5604,3 +5777,4 @@ bool Discrete_intervals_list::append(Discrete_interval *new_interval)
}
#endif /* !defined(MYSQL_CLIENT) */
+
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 6c218a58109..c061e6c2bb2 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -55,6 +55,8 @@ void set_thd_stage_info(void *thd,
#define THD_STAGE_INFO(thd, stage) \
(thd)->enter_stage(& stage, NULL, __func__, __FILE__, __LINE__)
+#include "my_apc.h"
+
class Reprepare_observer;
class Relay_log_info;
@@ -159,9 +161,6 @@ public:
};
-#define TC_LOG_PAGE_SIZE 8192
-#define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE)
-
#define TC_HEURISTIC_RECOVER_COMMIT 1
#define TC_HEURISTIC_RECOVER_ROLLBACK 2
extern ulong tc_heuristic_recover;
@@ -546,6 +545,12 @@ typedef struct system_variables
thread the query is being run to replicate temp tables properly
*/
my_thread_id pseudo_thread_id;
+ /**
+ Place holders to store Multi-source variables in sys_var.cc during
+ update and show of variables.
+ */
+ ulong slave_skip_counter;
+ ulong max_relay_log_size;
/**
Default transaction access mode. READ ONLY (true) or READ WRITE (false).
@@ -574,6 +579,9 @@ typedef struct system_variables
CHARSET_INFO *collation_database;
CHARSET_INFO *collation_connection;
+ /* Names. These will be allocated in buffers in thd */
+ LEX_STRING default_master_connection;
+
/* Error messages */
MY_LOCALE *lc_messages;
/* Locale Support */
@@ -635,25 +643,17 @@ typedef struct system_status_var
ulong ha_savepoint_rollback_count;
ulong ha_external_lock_count;
-#if 0
- /* KEY_CACHE parts. These are copies of the original */
- ulong key_blocks_changed;
- ulong key_blocks_used;
- ulong key_cache_r_requests;
- ulong key_cache_read;
- ulong key_cache_w_requests;
- ulong key_cache_write;
- /* END OF KEY_CACHE parts */
-#endif
-
ulong net_big_packet_count;
ulong opened_tables;
ulong opened_shares;
+ ulong opened_views; /* +1 opening a view */
+
ulong select_full_join_count_;
ulong select_full_range_join_count_;
ulong select_range_count_;
ulong select_range_check_count_;
ulong select_scan_count_;
+ ulong executed_triggers;
ulong long_query_count;
ulong filesort_merge_passes_;
ulong filesort_range_count_;
@@ -668,6 +668,16 @@ typedef struct system_status_var
ulong com_stmt_reset;
ulong com_stmt_close;
+ /* Features used */
+ ulong feature_dynamic_columns; /* +1 when creating a dynamic column */
+ ulong feature_fulltext; /* +1 when MATCH is used */
+ ulong feature_gis; /* +1 opening a table with GIS features */
+ ulong feature_locale; /* +1 when LOCALE is set */
+ ulong feature_subquery; /* +1 when subqueries are used */
+ ulong feature_timezone; /* +1 when XPATH is used */
+ ulong feature_trigger; /* +1 opening a table with triggers */
+ ulong feature_xml; /* +1 when XPATH is used */
+
ulong empty_queries;
ulong access_denied_errors;
ulong lost_connections;
@@ -1536,6 +1546,11 @@ private:
extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
+class THD;
+#ifndef DBUG_OFF
+void dbug_serve_apcs(THD *thd, int n_calls);
+#endif
+
/**
@class THD
For each client connection we create a separate thread with THD serving as
@@ -1716,7 +1731,7 @@ public:
my_hrtime_t user_time;
// track down slow pthread_create
ulonglong prior_thr_create_utime, thr_create_utime;
- ulonglong start_utime, utime_after_lock;
+ ulonglong start_utime, utime_after_lock, utime_after_query;
// Process indicator
struct {
@@ -1877,6 +1892,7 @@ public:
MEM_ROOT mem_root; // Transaction-life memory allocation pool
void cleanup()
{
+ DBUG_ENTER("thd::cleanup");
changed_tables= 0;
savepoints= 0;
/*
@@ -1888,6 +1904,7 @@ public:
if (!xid_state.rm_error)
xid_state.xid.null();
free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
+ DBUG_VOID_RETURN;
}
my_bool is_active()
{
@@ -2272,9 +2289,25 @@ public:
*/
killed_state volatile killed;
+ /* See also thd_killed() */
+ inline bool check_killed()
+ {
+ if (killed)
+ return TRUE;
+ if (apc_target.have_apc_requests())
+ apc_target.process_apc_requests();
+ return FALSE;
+ }
+
/* scramble - random string sent to client on handshake */
char scramble[SCRAMBLE_LENGTH+1];
+ /*
+ If this is a slave, the name of the connection stored here.
+ This is used for taging error messages in the log files.
+ */
+ LEX_STRING connection_name;
+ char default_master_connection_buff[MAX_CONNECTION_NAME+1];
bool slave_thread, one_shot_set;
bool extra_port; /* If extra connection */
@@ -2470,10 +2503,21 @@ public:
void close_active_vio();
#endif
void awake(killed_state state_to_set);
-
+
/** Disconnect the associated communication endpoint. */
void disconnect();
+
+ /*
+ Allows this thread to serve as a target for others to schedule Async
+ Procedure Calls on.
+
+ It's possible to schedule any code to be executed this way, by
+ inheriting from the Apc_call object. Currently, only
+ Show_explain_request uses this.
+ */
+ Apc_target apc_target;
+
#ifndef MYSQL_CLIENT
enum enum_binlog_query_type {
/* The query can be logged in row format or in statement format. */
@@ -2577,8 +2621,8 @@ public:
*/
void update_server_status()
{
- ulonglong end_utime_of_query= current_utime();
- if (end_utime_of_query > utime_after_lock + variables.long_query_time)
+ utime_after_query= current_utime();
+ if (utime_after_query > utime_after_lock + variables.long_query_time)
server_status|= SERVER_QUERY_WAS_SLOW;
}
inline ulonglong found_rows(void)
@@ -2676,7 +2720,7 @@ public:
void add_changed_table(const char *key, long key_length);
CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
int send_explain_fields(select_result *result);
-
+ void make_explain_field_list(List<Item> &field_list);
/**
Clear the current error, if any.
We do not clear is_fatal_error or is_fatal_sub_stmt_error since we
@@ -2818,6 +2862,27 @@ public:
void set_n_backup_active_arena(Query_arena *set, Query_arena *backup);
void restore_active_arena(Query_arena *set, Query_arena *backup);
+ inline void get_binlog_format(enum_binlog_format *format,
+ enum_binlog_format *current_format)
+ {
+ *format= (enum_binlog_format) variables.binlog_format;
+ *current_format= current_stmt_binlog_format;
+ }
+ inline void set_binlog_format(enum_binlog_format format,
+ enum_binlog_format current_format)
+ {
+ DBUG_ENTER("set_binlog_format");
+ variables.binlog_format= format;
+ current_stmt_binlog_format= current_format;
+ DBUG_VOID_RETURN;
+ }
+ inline void set_binlog_format_stmt()
+ {
+ DBUG_ENTER("set_binlog_format_stmt");
+ variables.binlog_format= BINLOG_FORMAT_STMT;
+ current_stmt_binlog_format= BINLOG_FORMAT_STMT;
+ DBUG_VOID_RETURN;
+ }
/*
@todo Make these methods private or remove them completely. Only
decide_logging_format should call them. /Sven
@@ -2848,16 +2913,26 @@ public:
DBUG_VOID_RETURN;
}
+
inline void set_current_stmt_binlog_format_row()
{
DBUG_ENTER("set_current_stmt_binlog_format_row");
current_stmt_binlog_format= BINLOG_FORMAT_ROW;
DBUG_VOID_RETURN;
}
- inline void clear_current_stmt_binlog_format_row()
+ /* Set binlog format temporarily to statement. Returns old format */
+ inline enum_binlog_format set_current_stmt_binlog_format_stmt()
{
- DBUG_ENTER("clear_current_stmt_binlog_format_row");
+ enum_binlog_format orig_format= current_stmt_binlog_format;
+ DBUG_ENTER("set_current_stmt_binlog_format_stmt");
current_stmt_binlog_format= BINLOG_FORMAT_STMT;
+ DBUG_RETURN(orig_format);
+ }
+ inline void restore_stmt_binlog_format(enum_binlog_format format)
+ {
+ DBUG_ENTER("restore_stmt_binlog_format");
+ DBUG_ASSERT(!is_current_stmt_binlog_format_row());
+ current_stmt_binlog_format= format;
DBUG_VOID_RETURN;
}
inline void reset_current_stmt_binlog_format_row()
@@ -2887,7 +2962,7 @@ public:
if (variables.binlog_format == BINLOG_FORMAT_ROW)
set_current_stmt_binlog_format_row();
else if (temporary_tables == NULL)
- clear_current_stmt_binlog_format_row();
+ set_current_stmt_binlog_format_stmt();
}
DBUG_VOID_RETURN;
}
@@ -3138,7 +3213,7 @@ public:
if (global_system_variables.log_warnings > threshold)
{
Security_context *sctx= &main_security_ctx;
- sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),
+ sql_print_warning(ER_THD(this, ER_NEW_ABORTING_CONNECTION),
thread_id, (db ? db : "unconnected"),
sctx->user ? sctx->user : "unauthenticated",
sctx->host_or_ip, reason);
@@ -3303,10 +3378,42 @@ public:
class JOIN;
-class select_result :public Sql_alloc {
+/* Pure interface for sending tabular data */
+class select_result_sink: public Sql_alloc
+{
+public:
+ /*
+ send_data returns 0 on ok, 1 on error and -1 if data was ignored, for
+ example for a duplicate row entry written to a temp table.
+ */
+ virtual int send_data(List<Item> &items)=0;
+ virtual ~select_result_sink() {};
+};
+
+
+/*
+ Interface for sending tabular data, together with some other stuff:
+
+ - Primary purpose seems to be seding typed tabular data:
+ = the DDL is sent with send_fields()
+ = the rows are sent with send_data()
+ Besides that,
+ - there seems to be an assumption that the sent data is a result of
+ SELECT_LEX_UNIT *unit,
+ - nest_level is used by SQL parser
+*/
+
+class select_result :public select_result_sink
+{
protected:
THD *thd;
+ /*
+ All descendant classes have their send_data() skip the first
+ unit->offset_limit_cnt rows sent. Select_materialize
+ also uses unit->get_unit_column_types().
+ */
SELECT_LEX_UNIT *unit;
+ /* Something used only by the parser: */
public:
select_result();
virtual ~select_result() {};
@@ -3324,11 +3431,6 @@ public:
virtual uint field_count(List<Item> &fields) const
{ return fields.elements; }
virtual bool send_result_set_metadata(List<Item> &list, uint flags)=0;
- /*
- send_data returns 0 on ok, 1 on error and -1 if data was ignored, for
- example for a duplicate row entry written to a temp table.
- */
- virtual int send_data(List<Item> &items)=0;
virtual bool initialize_tables (JOIN *join=0) { return 0; }
virtual void send_error(uint errcode,const char *err);
virtual bool send_eof()=0;
@@ -3356,6 +3458,32 @@ public:
/*
+ This is a select_result_sink which simply writes all data into a (temporary)
+ table. Creation/deletion of the table is outside of the scope of the class
+
+ It is aimed at capturing SHOW EXPLAIN output, so:
+ - Unlike select_result class, we don't assume that the sent data is an
+ output of a SELECT_LEX_UNIT (and so we dont apply "LIMIT x,y" from the
+ unit)
+ - We don't try to convert the target table to MyISAM
+*/
+
+class select_result_explain_buffer : public select_result_sink
+{
+public:
+ select_result_explain_buffer(THD *thd_arg, TABLE *table_arg) :
+ thd(thd_arg), dst_table(table_arg) {};
+
+ THD *thd;
+ TABLE *dst_table; /* table to write into */
+
+ /* The following is called in the child thread: */
+ int send_data(List<Item> &items);
+};
+
+
+
+/*
Base class for select_result descendands which intercept and
transform result set rows. As the rows are not sent to the client,
sending of result set metadata should be suppressed as well.
@@ -3932,6 +4060,8 @@ class user_var_entry
DTCollation collation;
};
+user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
+ bool create_if_not_exists);
/*
Unique -- class for unique (removing of duplicates).
@@ -4225,6 +4355,11 @@ public:
*/
#define CF_DISALLOW_IN_RO_TRANS (1U << 15)
+/**
+ Statement that need the binlog format to be unchanged.
+*/
+#define CF_FORCE_ORIGINAL_BINLOG_FORMAT (1U << 16)
+
/* Bits in server_command_flags */
/**
diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h
index 29b478bfb52..5cf88d2566c 100644
--- a/sql/sql_cmd.h
+++ b/sql/sql_cmd.h
@@ -90,6 +90,8 @@ enum enum_sql_command {
SQLCOM_SHOW_RELAYLOG_EVENTS,
SQLCOM_SHOW_USER_STATS, SQLCOM_SHOW_TABLE_STATS, SQLCOM_SHOW_INDEX_STATS,
SQLCOM_SHOW_CLIENT_STATS,
+ SQLCOM_SLAVE_ALL_START, SQLCOM_SLAVE_ALL_STOP,
+ SQLCOM_SHOW_EXPLAIN,
/*
When a command is added here, be sure it's also added in mysqld.cc
diff --git a/sql/sql_const.h b/sql/sql_const.h
index cfbf077bd91..255a0162e93 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -38,6 +38,7 @@
#define MAX_REFLENGTH 4 /* Max length for record ref */
#endif
#define MAX_HOSTNAME 61 /* len+1 in mysql.user */
+#define MAX_CONNECTION_NAME NAME_LEN
#define MAX_MBWIDTH 3 /* Max multibyte sequence */
#define MAX_FIELD_CHARLENGTH 255
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index fd348e0b75f..6a664e4d20b 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -118,6 +118,8 @@ int mysql_open_cursor(THD *thd, select_result *result,
2);
parent_locker= thd->m_statement_psi;
thd->m_statement_psi= NULL;
+ /* Mark that we can't use query cache with cursors */
+ thd->query_cache_is_applicable= 0;
rc= mysql_execute_command(thd);
thd->m_statement_psi= parent_locker;
MYSQL_QUERY_EXEC_DONE(rc);
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 052616f6965..5704b6d51b6 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -544,7 +544,6 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
bool silent)
{
char path[FN_REFLEN+16];
- char tmp_query[FN_REFLEN+16];
long result= 1;
int error= 0;
MY_STAT stat_info;
@@ -622,17 +621,9 @@ not_silent:
char *query;
uint query_length;
- if (!thd->query()) // Only in replication
- {
- query= tmp_query;
- query_length= (uint) (strxmov(tmp_query,"create database `",
- db, "`", NullS) - tmp_query);
- }
- else
- {
- query= thd->query();
- query_length= thd->query_length();
- }
+ query= thd->query();
+ query_length= thd->query_length();
+ DBUG_ASSERT(query);
ha_binlog_log_query(thd, 0, LOGCOM_CREATE_DB,
query, query_length,
@@ -885,18 +876,11 @@ update_binlog:
{
const char *query;
ulong query_length;
- if (!thd->query())
- {
- /* The client used the old obsolete mysql_drop_db() call */
- query= path;
- query_length= (uint) (strxmov(path, "drop database `", db, "`",
- NullS) - path);
- }
- else
- {
- query= thd->query();
- query_length= thd->query_length();
- }
+
+ query= thd->query();
+ query_length= thd->query_length();
+ DBUG_ASSERT(query);
+
if (mysql_bin_log.is_open())
{
int errcode= query_error_code(thd, TRUE);
@@ -940,6 +924,7 @@ update_binlog:
{
uint tbl_name_len;
bool exists;
+ char quoted_name[FN_REFLEN+3];
// Only write drop table to the binlog for tables that no longer exist.
if (check_if_table_exists(thd, tbl, &exists))
@@ -950,8 +935,8 @@ update_binlog:
if (exists)
continue;
- /* 3 for the quotes and the comma*/
- tbl_name_len= strlen(tbl->table_name) + 3;
+ my_snprintf(quoted_name, sizeof(quoted_name), "%`s", tbl->table_name);
+ tbl_name_len= strlen(quoted_name) + 1; /* +1 for the comma */
if (query_pos + tbl_name_len + 1 >= query_end)
{
/*
@@ -966,9 +951,7 @@ update_binlog:
query_pos= query_data_start;
}
- *query_pos++ = '`';
- query_pos= strmov(query_pos,tbl->table_name);
- *query_pos++ = '`';
+ query_pos= strmov(query_pos, quoted_name);
*query_pos++ = ',';
}
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index c87c9382630..0f07f01c6fd 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -244,6 +244,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
uint length= 0;
SORT_FIELD *sortorder;
ha_rows examined_rows;
+ ha_rows found_rows;
table->update_const_key_parts(conds);
order= simple_remove_const(order, conds);
@@ -264,9 +265,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
MYF(MY_FAE | MY_ZEROFILL));
if (!(sortorder= make_unireg_sortorder(order, &length, NULL)) ||
- (table->sort.found_records = filesort(thd, table, sortorder, length,
- select, HA_POS_ERROR, 1,
- &examined_rows))
+ (table->sort.found_records= filesort(thd, table, sortorder, length,
+ select, HA_POS_ERROR,
+ true,
+ &examined_rows, &found_rows))
== HA_POS_ERROR)
{
delete select;
@@ -368,8 +370,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
}
}
}
- else
+ /*
+ Don't try unlocking the row if skip_record reported an error since in
+ this case the transaction might have been rolled back already.
+ */
+ else if (!thd->is_error())
table->file->unlock_row(); // Row failed selection, release lock on it
+ else
+ break;
}
killed_status= thd->killed;
if (killed_status != NOT_KILLED || thd->is_error())
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 023792dddd0..599a892da9f 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -329,7 +329,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
/*
- Check update fields for the timestamp field.
+ Check update fields for the timestamp and auto_increment fields.
SYNOPSIS
check_update_fields()
@@ -342,6 +342,9 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
If the update fields include the timestamp field,
remove TIMESTAMP_AUTO_SET_ON_UPDATE from table->timestamp_field_type.
+ If the update fields include an autoinc field, set the
+ table->next_number_field_updated flag.
+
RETURN
0 OK
-1 Error
@@ -353,7 +356,9 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list,
{
TABLE *table= insert_table_list->table;
my_bool timestamp_mark;
+ my_bool autoinc_mark;
LINT_INIT(timestamp_mark);
+ LINT_INIT(autoinc_mark);
if (table->timestamp_field)
{
@@ -365,6 +370,19 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list,
table->timestamp_field->field_index);
}
+ table->next_number_field_updated= FALSE;
+
+ if (table->found_next_number_field)
+ {
+ /*
+ Unmark the auto_increment field so that we can check if this is modified
+ by update_fields
+ */
+ autoinc_mark= bitmap_test_and_clear(table->write_set,
+ table->found_next_number_field->
+ field_index);
+ }
+
/* Check the fields we are going to modify */
if (setup_fields(thd, 0, update_fields, MARK_COLUMNS_WRITE, 0, 0))
return -1;
@@ -386,6 +404,18 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list,
bitmap_set_bit(table->write_set,
table->timestamp_field->field_index);
}
+
+ if (table->found_next_number_field)
+ {
+ if (bitmap_is_set(table->write_set,
+ table->found_next_number_field->field_index))
+ table->next_number_field_updated= TRUE;
+
+ if (autoinc_mark)
+ bitmap_set_bit(table->write_set,
+ table->found_next_number_field->field_index);
+ }
+
return 0;
}
@@ -827,10 +857,10 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
table->next_number_field=table->found_next_number_field;
#ifdef HAVE_REPLICATION
- if (thd->slave_thread &&
+ if (thd->rli_slave &&
(info.handle_duplicates == DUP_UPDATE) &&
(table->next_number_field != NULL) &&
- rpl_master_has_bug(&active_mi->rli, 24432, TRUE, NULL, NULL))
+ rpl_master_has_bug(thd->rli_slave, 24432, TRUE, NULL, NULL))
goto abort;
#endif
@@ -1570,6 +1600,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
MY_BITMAP *save_read_set, *save_write_set;
ulonglong prev_insert_id= table->file->next_insert_id;
ulonglong insert_id_for_cur_row= 0;
+ ulonglong prev_insert_id_for_cur_row= 0;
DBUG_ENTER("write_record");
info->records++;
@@ -1605,7 +1636,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
report error as usual. We will not do any duplicate key processing.
*/
if (info->ignore)
+ {
+ table->file->print_error(error, MYF(ME_JUST_WARNING));
goto ok_or_after_trg_err; /* Ignoring a not fatal error, return 0 */
+ }
goto err;
}
if ((int) (key_nr = table->file->get_dup_key(error)) < 0)
@@ -1695,6 +1729,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
if (info->ignore &&
!table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
{
+ table->file->print_error(error, MYF(ME_JUST_WARNING));
goto ok_or_after_trg_err;
}
goto err;
@@ -1712,6 +1747,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
INSERT query, which is handled separately by
THD::arg_of_last_insert_id_function.
*/
+ prev_insert_id_for_cur_row= table->file->insert_id_for_cur_row;
insert_id_for_cur_row= table->file->insert_id_for_cur_row= 0;
trg_error= (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
@@ -1719,9 +1755,22 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
info->copied++;
}
- if (table->next_number_field)
- table->file->adjust_next_insert_id_after_explicit_value(
- table->next_number_field->val_int());
+ /*
+ Only update next_insert_id if the AUTO_INCREMENT value was explicitly
+ updated, so we don't update next_insert_id with the value from the
+ row being updated. Otherwise reset next_insert_id to what it was
+ before the duplicate key error, since that value is unused.
+ */
+ if (table->next_number_field_updated)
+ {
+ DBUG_ASSERT(table->next_number_field != NULL);
+
+ table->file->adjust_next_insert_id_after_explicit_value(table->next_number_field->val_int());
+ }
+ else
+ {
+ table->file->restore_auto_increment(prev_insert_id_for_cur_row);
+ }
goto ok_or_after_trg_err;
}
else /* DUP_REPLACE */
@@ -1810,6 +1859,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
if (!info->ignore ||
table->file->is_fatal_error(error, HA_CHECK_DUP))
goto err;
+ table->file->print_error(error, MYF(ME_JUST_WARNING));
table->file->restore_auto_increment(prev_insert_id);
goto ok_or_after_trg_err;
}
@@ -2788,9 +2838,6 @@ pthread_handler_t handle_delayed_insert(void *arg)
{
int error;
mysql_audit_release(thd);
-#if defined(HAVE_BROKEN_COND_TIMEDWAIT)
- error= mysql_cond_wait(&di->cond, &di->mutex);
-#else
error= mysql_cond_timedwait(&di->cond, &di->mutex, &abstime);
#ifdef EXTRA_DEBUG
if (error && error != EINTR && error != ETIMEDOUT)
@@ -2800,7 +2847,6 @@ pthread_handler_t handle_delayed_insert(void *arg)
error));
}
#endif
-#endif
if (error == ETIMEDOUT || error == ETIME)
thd->killed= KILL_CONNECTION;
}
@@ -3395,10 +3441,10 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
table->next_number_field=table->found_next_number_field;
#ifdef HAVE_REPLICATION
- if (thd->slave_thread &&
+ if (thd->rli_slave &&
(info.handle_duplicates == DUP_UPDATE) &&
(table->next_number_field != NULL) &&
- rpl_master_has_bug(&active_mi->rli, 24432, TRUE, NULL, NULL))
+ rpl_master_has_bug(thd->rli_slave, 24432, TRUE, NULL, NULL))
DBUG_RETURN(1);
#endif
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index f953cf4df57..4148842a826 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -2236,7 +2236,7 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
while (!(error= join_tab_scan->next()))
{
- if (join->thd->killed)
+ if (join->thd->check_killed())
{
/* The user has aborted the execution of the query */
join->thd->send_kill_message();
@@ -2506,7 +2506,7 @@ enum_nested_loop_state JOIN_CACHE::join_null_complements(bool skip_last)
for ( ; cnt; cnt--)
{
- if (join->thd->killed)
+ if (join->thd->check_killed())
{
/* The user has aborted the execution of the query */
join->thd->send_kill_message();
@@ -3356,7 +3356,7 @@ int JOIN_TAB_SCAN::next()
update_virtual_fields(thd, table);
while (!err && select && (skip_rc= select->skip_record(thd)) <= 0)
{
- if (thd->killed || skip_rc < 0)
+ if (thd->check_killed() || skip_rc < 0)
return 1;
/*
Move to the next record if the last retrieved record does not
@@ -3876,8 +3876,9 @@ int JOIN_TAB_SCAN_MRR::next()
If a record in in an incremental cache contains no fields then the
association for the last record in cache will be equal to cache->end_pos
*/
- DBUG_ASSERT(cache->buff <= (uchar *) (*ptr) &&
- (uchar *) (*ptr) <= cache->end_pos);
+ DBUG_ASSERT((!(mrr_mode & HA_MRR_NO_ASSOCIATION))?
+ (cache->buff <= (uchar *) (*ptr) &&
+ (uchar *) (*ptr) <= cache->end_pos): TRUE);
if (join_tab->table->vfield)
update_virtual_fields(join->thd, join_tab->table);
}
@@ -4543,7 +4544,7 @@ bool JOIN_CACHE_BKAH::prepare_look_for_matches(bool skip_last)
{
last_matching_rec_ref_ptr= next_matching_rec_ref_ptr= 0;
if (no_association &&
- (curr_matching_chain= get_matching_chain_by_join_key()))
+ !(curr_matching_chain= get_matching_chain_by_join_key()))
return 1;
last_matching_rec_ref_ptr= get_next_rec_ref(curr_matching_chain);
return 0;
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 5f18d9861a9..3c183d95b42 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -503,6 +503,7 @@ void lex_start(THD *thd)
lex->expr_allows_subselect= TRUE;
lex->use_only_table_context= FALSE;
lex->parse_vcol_expr= FALSE;
+ lex->verbose= 0;
lex->name.str= 0;
lex->name.length= 0;
@@ -1889,6 +1890,7 @@ void st_select_lex::init_query()
nest_level= 0;
link_next= 0;
is_prep_leaf_list_saved= FALSE;
+ have_merged_subqueries= FALSE;
bzero((char*) expr_cache_may_be_used, sizeof(expr_cache_may_be_used));
m_non_agg_field_used= false;
m_agg_func_used= false;
@@ -3480,7 +3482,7 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
if (options & SELECT_DESCRIBE)
{
/* Optimize the subquery in the context of EXPLAIN. */
- sl->set_explain_type();
+ sl->set_explain_type(FALSE);
sl->options|= SELECT_DESCRIBE;
inner_join->select_options|= SELECT_DESCRIBE;
}
@@ -3930,9 +3932,12 @@ void st_select_lex::update_correlated_cache()
/**
Set the EXPLAIN type for this subquery.
+
+ @param on_the_fly TRUE<=> We're running a SHOW EXPLAIN command, so we must
+ not change any variables
*/
-void st_select_lex::set_explain_type()
+void st_select_lex::set_explain_type(bool on_the_fly)
{
bool is_primary= FALSE;
if (next_select())
@@ -3954,6 +3959,9 @@ void st_select_lex::set_explain_type()
}
}
+ if (on_the_fly && !is_primary && have_merged_subqueries)
+ is_primary= TRUE;
+
SELECT_LEX *first= master_unit()->first_select();
/* drop UNCACHEABLE_EXPLAIN, because it is for internal usage only */
uint8 is_uncacheable= (uncacheable & ~UNCACHEABLE_EXPLAIN);
@@ -4006,10 +4014,15 @@ void st_select_lex::set_explain_type()
else
{
type= is_uncacheable ? "UNCACHEABLE UNION": "UNION";
+ if (this == master_unit()->fake_select_lex)
+ type= "UNION RESULT";
+
}
}
}
- options|= SELECT_DESCRIBE;
+
+ if (!on_the_fly)
+ options|= SELECT_DESCRIBE;
}
@@ -4156,6 +4169,116 @@ bool st_select_lex::is_merged_child_of(st_select_lex *ancestor)
}
+int print_explain_message_line(select_result_sink *result,
+ SELECT_LEX *select_lex,
+ bool on_the_fly,
+ uint8 options,
+ const char *message);
+
+
+int st_select_lex::print_explain(select_result_sink *output,
+ uint8 explain_flags,
+ bool *printed_anything)
+{
+ int res;
+ if (join && join->have_query_plan == JOIN::QEP_AVAILABLE)
+ {
+ /*
+ There is a number of reasons join can be marked as degenerate, so all
+ three conditions below can happen simultaneously, or individually:
+ */
+ *printed_anything= TRUE;
+ if (!join->table_count || !join->tables_list || join->zero_result_cause)
+ {
+ /* It's a degenerate join */
+ const char *cause= join->zero_result_cause ? join-> zero_result_cause :
+ "No tables used";
+ res= join->print_explain(output, explain_flags, TRUE, FALSE, FALSE,
+ FALSE, cause);
+ }
+ else
+ {
+ res= join->print_explain(output, explain_flags, TRUE,
+ join->need_tmp, // need_tmp_table
+ !join->skip_sort_order && !join->no_order &&
+ (join->order || join->group_list), // bool need_order
+ join->select_distinct, // bool distinct
+ NULL); //const char *message
+ }
+ if (res)
+ goto err;
+
+ for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit();
+ unit;
+ unit= unit->next_unit())
+ {
+ /*
+ Display subqueries only if they are not parts of eliminated WHERE/ON
+ clauses.
+ */
+ if (!(unit->item && unit->item->eliminated))
+ {
+ if ((res= unit->print_explain(output, explain_flags, printed_anything)))
+ goto err;
+ }
+ }
+ }
+ else
+ {
+ const char *msg;
+ if (!join)
+ DBUG_ASSERT(0); /* Seems not to be possible */
+
+ /* Not printing anything useful, don't touch *printed_anything here */
+ if (join->have_query_plan == JOIN::QEP_NOT_PRESENT_YET)
+ msg= "Not yet optimized";
+ else
+ {
+ DBUG_ASSERT(join->have_query_plan == JOIN::QEP_DELETED);
+ msg= "Query plan already deleted";
+ }
+ res= print_explain_message_line(output, this, TRUE /* on_the_fly */,
+ 0, msg);
+ }
+err:
+ return res;
+}
+
+
+int st_select_lex_unit::print_explain(select_result_sink *output,
+ uint8 explain_flags, bool *printed_anything)
+{
+ int res= 0;
+ SELECT_LEX *first= first_select();
+
+ if (first && !first->next_select() && !first->join)
+ {
+ /*
+ If there is only one child, 'first', and it has join==NULL, emit "not in
+ EXPLAIN state" error.
+ */
+ const char *msg="Query plan already deleted";
+ res= print_explain_message_line(output, first, TRUE /* on_the_fly */,
+ 0, msg);
+ return 0;
+ }
+
+ for (SELECT_LEX *sl= first; sl; sl= sl->next_select())
+ {
+ if ((res= sl->print_explain(output, explain_flags, printed_anything)))
+ break;
+ }
+
+ /* Note: fake_select_lex->join may be NULL or non-NULL at this point */
+ if (fake_select_lex)
+ {
+ res= print_fake_select_lex_join(output, TRUE /* on the fly */,
+ fake_select_lex, explain_flags);
+ }
+ return res;
+}
+
+
/**
A routine used by the parser to decide whether we are specifying a full
partitioning or if only partitions to add or to split.
@@ -4174,7 +4297,6 @@ bool LEX::is_partition_management() const
alter_info.flags == ALTER_REORGANIZE_PARTITION));
}
-
#ifdef MYSQL_SERVER
uint binlog_unsafe_map[256];
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 3dd978e93b3..fd789143c94 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -209,6 +209,7 @@ struct LEX_MASTER_INFO
char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher;
char *ssl_crl, *ssl_crlpath;
char *relay_log_name;
+ LEX_STRING connection_name;
ulonglong pos;
ulong relay_log_pos;
ulong server_id;
@@ -278,6 +279,8 @@ typedef uchar index_clause_map;
#define INDEX_HINT_MASK_ALL (INDEX_HINT_MASK_JOIN | INDEX_HINT_MASK_GROUP | \
INDEX_HINT_MASK_ORDER)
+class select_result_sink;
+
/* Single element of an USE/FORCE/IGNORE INDEX list specified as a SQL hint */
class Index_hint : public Sql_alloc
{
@@ -638,6 +641,8 @@ public:
friend int subselect_union_engine::exec();
List<Item> *get_unit_column_types();
+ int print_explain(select_result_sink *output, uint8 explain_flags,
+ bool *printed_anything);
};
typedef class st_select_lex_unit SELECT_LEX_UNIT;
@@ -698,6 +703,12 @@ public:
those converted to jtbm nests. The list is emptied when conversion is done.
*/
List<Item_in_subselect> sj_subselects;
+
+ /*
+ Needed to correctly generate 'PRIMARY' or 'SIMPLE' for select_type column
+ of EXPLAIN
+ */
+ bool have_merged_subqueries;
List<TABLE_LIST> leaf_tables;
List<TABLE_LIST> leaf_tables_exec;
@@ -922,7 +933,7 @@ public:
bool is_part_of_union() { return master_unit()->is_union(); }
bool optimize_unflattened_subqueries(bool const_only);
/* Set the EXPLAIN type for this subquery. */
- void set_explain_type();
+ void set_explain_type(bool on_the_fly);
bool handle_derived(LEX *lex, uint phases);
void append_table_to_list(TABLE_LIST *TABLE_LIST::*link, TABLE_LIST *table);
bool get_free_table_map(table_map *map, uint *tablenr);
@@ -946,8 +957,10 @@ public:
bool save_leaf_tables(THD *thd);
bool save_prep_leaf_tables(THD *thd);
- bool is_merged_child_of(st_select_lex *ancestor);
+ bool is_merged_child_of(st_select_lex *ancestor);
+ int print_explain(select_result_sink *output, uint8 explain_flags,
+ bool *printed_anything);
/*
For MODE_ONLY_FULL_GROUP_BY we need to maintain two flags:
- Non-aggregated fields are used in this select.
@@ -2274,7 +2287,7 @@ struct LEX: public Query_tables_list
char *backup_dir; /* For RESTORE/BACKUP */
char* to_log; /* For PURGE MASTER LOGS TO */
char* x509_subject,*x509_issuer,*ssl_cipher;
- String *wild;
+ String *wild; /* Wildcard in SHOW {something} LIKE 'wild'*/
sql_exchange *exchange;
select_result *result;
Item *default_value, *on_update_value;
@@ -2344,6 +2357,7 @@ struct LEX: public Query_tables_list
KEY_CREATE_INFO key_create_info;
LEX_MASTER_INFO mi; // used by CHANGE MASTER
LEX_SERVER_OPTIONS server_options;
+ LEX_STRING relay_log_connection_name;
USER_RESOURCES mqh;
LEX_RESET_SLAVE reset_slave_info;
ulong type;
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 33d1741b5ec..e2c744401b9 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -39,6 +39,7 @@
#include "sp_head.h"
#include "sql_trigger.h"
#include "sql_derived.h"
+#include "sql_show.h"
class XML_TAG {
public:
@@ -374,11 +375,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
MY_RETURN_REAL_PATH);
}
- if (thd->slave_thread)
+ if (thd->rli_slave)
{
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
- if (strncmp(active_mi->rli.slave_patternload_file, name,
- active_mi->rli.slave_patternload_file_size))
+ if (strncmp(thd->rli_slave->slave_patternload_file, name,
+ thd->rli_slave->slave_patternload_file_size))
{
/*
LOAD DATA INFILE in the slave SQL Thread can only read from
@@ -675,24 +676,28 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
bool transactional_table,
int errcode)
{
- char *load_data_query,
- *end,
- *fname_start,
- *fname_end,
- *p= NULL;
- size_t pl= 0;
+ char *load_data_query;
+ my_off_t fname_start,
+ fname_end;
List<Item> fv;
Item *item, *val;
int n;
- const char *tbl= table_name_arg;
const char *tdb= (thd->db != NULL ? thd->db : db_arg);
- char name_buffer[SAFE_NAME_LEN*2];
+ const char *qualify_db= NULL;
char command_buffer[1024];
- String string_buf(name_buffer, sizeof(name_buffer),
- system_charset_info);
- String pfields(command_buffer, sizeof(command_buffer),
+ String query_str(command_buffer, sizeof(command_buffer),
system_charset_info);
+ Load_log_event lle(thd, ex, tdb, table_name_arg, fv, is_concurrent,
+ duplicates, ignore, transactional_table);
+
+ /*
+ force in a LOCAL if there was one in the original.
+ */
+ if (thd->lex->local_file)
+ lle.set_fname_outside_temp_buf(ex->file_name, strlen(ex->file_name));
+
+ query_str.length(0);
if (!thd->db || strcmp(db_arg, thd->db))
{
/*
@@ -700,49 +705,35 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
prefix table name with database name so that it
becomes a FQ name.
*/
- string_buf.length(0);
- string_buf.append(db_arg);
- string_buf.append("`");
- string_buf.append(".");
- string_buf.append("`");
- string_buf.append(table_name_arg);
- tbl= string_buf.c_ptr_safe();
+ qualify_db= db_arg;
}
-
- Load_log_event lle(thd, ex, tdb, tbl, fv, is_concurrent,
- duplicates, ignore, transactional_table);
-
- /*
- force in a LOCAL if there was one in the original.
- */
- if (thd->lex->local_file)
- lle.set_fname_outside_temp_buf(ex->file_name, strlen(ex->file_name));
+ lle.print_query(thd, FALSE, (const char *) ex->cs?ex->cs->csname:NULL,
+ &query_str, &fname_start, &fname_end, qualify_db);
/*
prepare fields-list and SET if needed; print_query won't do that for us.
*/
- pfields.length(0);
if (!thd->lex->field_list.is_empty())
{
List_iterator<Item> li(thd->lex->field_list);
- pfields.append(" (");
+ query_str.append(" (");
n= 0;
while ((item= li++))
{
if (n++)
- pfields.append(", ");
+ query_str.append(", ");
if (item->type() == Item::FIELD_ITEM)
+ append_identifier(thd, &query_str, item->name, strlen(item->name));
+ else
{
- pfields.append("`");
- pfields.append(item->name);
- pfields.append("`");
+ /* Actually Item_user_var_as_out_param despite claiming STRING_ITEM. */
+ DBUG_ASSERT(item->type() == Item::STRING_ITEM);
+ ((Item_user_var_as_out_param *)item)->print_for_load(thd, &query_str);
}
- else
- item->print(&pfields, QT_ORDINARY);
}
- pfields.append(")");
+ query_str.append(")");
}
if (!thd->lex->update_list.is_empty())
@@ -750,38 +741,25 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
List_iterator<Item> lu(thd->lex->update_list);
List_iterator<Item> lv(thd->lex->value_list);
- pfields.append(" SET ");
+ query_str.append(" SET ");
n= 0;
while ((item= lu++))
{
val= lv++;
if (n++)
- pfields.append(", ");
- pfields.append("`");
- pfields.append(item->name);
- pfields.append("`");
- pfields.append(val->name);
+ query_str.append(", ");
+ append_identifier(thd, &query_str, item->name, strlen(item->name));
+ query_str.append(val->name);
}
}
- p= pfields.c_ptr_safe();
- pl= pfields.length();
-
- if (!(load_data_query= (char *)thd->alloc(lle.get_query_buffer_length() + 1 + pl)))
+ if (!(load_data_query= (char *)thd->strmake(query_str.ptr(), query_str.length())))
return TRUE;
- lle.print_query(FALSE, (const char *) ex->cs?ex->cs->csname:NULL,
- load_data_query, &end,
- (char **)&fname_start, (char **)&fname_end);
-
- strcpy(end, p);
- end += pl;
-
Execute_load_query_log_event
- e(thd, load_data_query, end-load_data_query,
- (uint) ((char*) fname_start - load_data_query - 1),
- (uint) ((char*) fname_end - load_data_query),
+ e(thd, load_data_query, query_str.length(),
+ (uint) (fname_start - 1), (uint) fname_end,
(duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
(ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),
transactional_table, FALSE, FALSE, errcode);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 551e1ee1924..1a499081fcb 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -82,6 +82,7 @@
#include <myisam.h>
#include <my_dir.h>
#include "rpl_handler.h"
+#include "rpl_mi.h"
#include "sp_head.h"
#include "sp.h"
@@ -364,6 +365,7 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_SHOW_ENGINE_STATUS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_ENGINE_MUTEX]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_ENGINE_LOGS]= CF_STATUS_COMMAND;
+ sql_command_flags[SQLCOM_SHOW_EXPLAIN]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_PROCESSLIST]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_GRANTS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CREATE_DB]= CF_STATUS_COMMAND;
@@ -379,12 +381,7 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_SHOW_CREATE_EVENT]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_PROFILES]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_PROFILE]= CF_STATUS_COMMAND;
- /*
- @todo SQLCOM_BINLOG_BASE64_EVENT should have
- CF_CAN_GENERATE_ROW_EVENTS set, because this surely generates row
- events. /Sven
- */
- sql_command_flags[SQLCOM_BINLOG_BASE64_EVENT]= CF_STATUS_COMMAND;
+ sql_command_flags[SQLCOM_BINLOG_BASE64_EVENT]= CF_STATUS_COMMAND | CF_CAN_GENERATE_ROW_EVENTS;
sql_command_flags[SQLCOM_SHOW_CLIENT_STATS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_USER_STATS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_TABLE_STATS]= CF_STATUS_COMMAND;
@@ -431,6 +428,19 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_EXECUTE]= CF_CAN_GENERATE_ROW_EVENTS;
/*
+ We don't want to change to statement based replication for these commands
+ */
+ sql_command_flags[SQLCOM_ROLLBACK]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
+ /* We don't want to replicate ALTER TABLE for temp tables in row format */
+ sql_command_flags[SQLCOM_ALTER_TABLE]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
+ /* We don't want to replicate TRUNCATE for temp tables in row format */
+ sql_command_flags[SQLCOM_TRUNCATE]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
+ /* We don't want to replicate DROP for temp tables in row format */
+ sql_command_flags[SQLCOM_DROP_TABLE]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
+ /* One can change replication mode with SET */
+ sql_command_flags[SQLCOM_SET_OPTION]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
+
+ /*
The following admin table operations are allowed
on log tables.
*/
@@ -1449,8 +1459,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
else
#endif
- if (reload_acl_and_cache(thd, options, (TABLE_LIST*) 0, &not_used))
- break;
+ {
+ thd->lex->relay_log_connection_name.str= (char*) "";
+ thd->lex->relay_log_connection_name.length= 0;
+ if (reload_acl_and_cache(thd, options, (TABLE_LIST*) 0, &not_used))
+ break;
+ }
if (trans_commit_implicit(thd))
break;
close_thread_tables(thd);
@@ -1491,7 +1505,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
STATUS_VAR *current_global_status_var; // Big; Don't allocate on stack
ulong uptime;
- uint __attribute__((unused)) length;
+ uint length __attribute__((unused));
ulonglong queries_per_second1000;
char buff[250];
uint buff_len= sizeof(buff);
@@ -1591,6 +1605,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
(thd->open_tables == NULL ||
(thd->locked_tables_mode == LTM_LOCK_TABLES)));
+ thd_proc_info(thd, "updating status");
/* Finalize server status flags after executing a command. */
thd->update_server_status();
thd->protocol->end_statement();
@@ -1652,37 +1667,29 @@ void log_slow_statement(THD *thd)
DBUG_VOID_RETURN; // Don't set time for sub stmt
/* Follow the slow log filter configuration. */
- if (!(thd->variables.log_slow_filter & thd->query_plan_flags))
+ if (!thd->enable_slow_log ||
+ !(thd->variables.log_slow_filter & thd->query_plan_flags))
DBUG_VOID_RETURN;
- /*
- If rate limiting of slow log writes is enabled, decide whether to log
- this query to the log or not.
- */
- if (thd->variables.log_slow_rate_limit > 1 &&
- (global_query_id % thd->variables.log_slow_rate_limit) != 0)
- DBUG_VOID_RETURN;
-
- /*
- Do not log administrative statements unless the appropriate option is
- set.
- */
- if (thd->enable_slow_log)
- {
- ulonglong end_utime_of_query= thd->current_utime();
+ if (((thd->server_status & SERVER_QUERY_WAS_SLOW) ||
+ ((thd->server_status &
+ (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
+ opt_log_queries_not_using_indexes &&
+ !(sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND))) &&
+ thd->get_examined_row_count() >= thd->variables.min_examined_row_limit)
+ {
+ thd->status_var.long_query_count++;
+ /*
+ If rate limiting of slow log writes is enabled, decide whether to log
+ this query to the log or not.
+ */
+ if (thd->variables.log_slow_rate_limit > 1 &&
+ (global_query_id % thd->variables.log_slow_rate_limit) != 0)
+ DBUG_VOID_RETURN;
- if (((thd->server_status & SERVER_QUERY_WAS_SLOW) ||
- ((thd->server_status &
- (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
- opt_log_queries_not_using_indexes &&
- !(sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND))) &&
- thd->get_examined_row_count() >= thd->variables.min_examined_row_limit)
- {
- THD_STAGE_INFO(thd, stage_logging_slow_query);
- thd->status_var.long_query_count++;
- slow_log_print(thd, thd->query(), thd->query_length(),
- end_utime_of_query);
- }
+ THD_STAGE_INFO(thd, stage_logging_slow_query);
+ slow_log_print(thd, thd->query(), thd->query_length(),
+ thd->utime_after_query);
}
DBUG_VOID_RETURN;
}
@@ -2271,6 +2278,22 @@ mysql_execute_command(THD *thd)
DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == FALSE);
+ /* store old value of binlog format */
+ enum_binlog_format orig_binlog_format,orig_current_stmt_binlog_format;
+
+ thd->get_binlog_format(&orig_binlog_format,
+ &orig_current_stmt_binlog_format);
+
+ /*
+ Force statement logging for DDL commands to allow us to update
+ privilege, system or statistic tables directly without the updates
+ getting logged.
+ */
+ if (!(sql_command_flags[lex->sql_command] &
+ (CF_CAN_GENERATE_ROW_EVENTS | CF_FORCE_ORIGINAL_BINLOG_FORMAT |
+ CF_STATUS_COMMAND)))
+ thd->set_binlog_format_stmt();
+
/*
End a active transaction so that this command will have it's
own transaction and will also sync the binary log. If a DDL is
@@ -2330,6 +2353,33 @@ mysql_execute_command(THD *thd)
execute_show_status(thd, all_tables);
break;
}
+ case SQLCOM_SHOW_EXPLAIN:
+ {
+ if (!thd->security_ctx->priv_user[0] &&
+ check_global_access(thd,PROCESS_ACL))
+ break;
+
+ /*
+ The select should use only one table, it's the SHOW EXPLAIN pseudo-table
+ */
+ if (lex->sroutines.records || lex->query_tables->next_global)
+ {
+ my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY),
+ MYF(0));
+ goto error;
+ }
+
+ Item **it= lex->value_list.head_ref();
+ if (!(*it)->basic_const_item() ||
+ (!(*it)->fixed && (*it)->fix_fields(lex->thd, it)) ||
+ (*it)->check_cols(1))
+ {
+ my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY),
+ MYF(0));
+ goto error;
+ }
+ /* no break; fall through */
+ }
case SQLCOM_SHOW_DATABASES:
case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_TRIGGERS:
@@ -2503,10 +2553,42 @@ case SQLCOM_PREPARE:
#ifdef HAVE_REPLICATION
case SQLCOM_CHANGE_MASTER:
{
+ LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
+ Master_info *mi;
+ bool new_master= 0;
+
if (check_global_access(thd, SUPER_ACL))
goto error;
mysql_mutex_lock(&LOCK_active_mi);
- res = change_master(thd,active_mi);
+
+ mi= master_info_index->get_master_info(&lex_mi->connection_name,
+ MYSQL_ERROR::WARN_LEVEL_NOTE);
+
+ if (mi == NULL)
+ {
+ /* New replication created */
+ mi= new Master_info(&lex_mi->connection_name, relay_log_recovery);
+ if (!mi || mi->error())
+ {
+ delete mi;
+ res= 1;
+ mysql_mutex_unlock(&LOCK_active_mi);
+ break;
+ }
+ new_master= 1;
+ }
+
+ res= change_master(thd, mi);
+ if (res && new_master)
+ {
+ /*
+ The new master was added by change_master(). Remove it as it didn't
+ work.
+ */
+ master_info_index->remove_master_info(&lex_mi->connection_name);
+ delete mi;
+ }
+
mysql_mutex_unlock(&LOCK_active_mi);
break;
}
@@ -2516,15 +2598,19 @@ case SQLCOM_PREPARE:
if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
goto error;
mysql_mutex_lock(&LOCK_active_mi);
- if (active_mi != NULL)
- {
- res = show_master_info(thd, active_mi);
- }
+
+ if (lex->verbose)
+ res= show_all_master_info(thd);
else
{
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- WARN_NO_MASTER_INFO, ER(WARN_NO_MASTER_INFO));
- my_ok(thd);
+ LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
+ Master_info *mi;
+ mi= master_info_index->get_master_info(&lex_mi->connection_name,
+ MYSQL_ERROR::WARN_LEVEL_ERROR);
+ if (mi != NULL)
+ {
+ res= show_master_info(thd, mi, 0);
+ }
}
mysql_mutex_unlock(&LOCK_active_mi);
break;
@@ -2824,40 +2910,79 @@ end_with_restore_list:
#ifdef HAVE_REPLICATION
case SQLCOM_SLAVE_START:
{
+ LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
+ Master_info *mi;
mysql_mutex_lock(&LOCK_active_mi);
- start_slave(thd,active_mi,1 /* net report*/);
+
+ if ((mi= (master_info_index->
+ get_master_info(&lex_mi->connection_name,
+ MYSQL_ERROR::WARN_LEVEL_ERROR))))
+ if (!start_slave(thd, mi, 1 /* net report*/))
+ my_ok(thd);
mysql_mutex_unlock(&LOCK_active_mi);
break;
}
case SQLCOM_SLAVE_STOP:
- /*
- If the client thread has locked tables, a deadlock is possible.
- Assume that
- - the client thread does LOCK TABLE t READ.
- - then the master updates t.
- - then the SQL slave thread wants to update t,
- so it waits for the client thread because t is locked by it.
+ {
+ LEX_MASTER_INFO *lex_mi;
+ Master_info *mi;
+ /*
+ If the client thread has locked tables, a deadlock is possible.
+ Assume that
+ - the client thread does LOCK TABLE t READ.
+ - then the master updates t.
+ - then the SQL slave thread wants to update t,
+ so it waits for the client thread because t is locked by it.
- then the client thread does SLAVE STOP.
SLAVE STOP waits for the SQL slave thread to terminate its
update t, which waits for the client thread because t is locked by it.
- To prevent that, refuse SLAVE STOP if the
- client thread has locked tables
- */
- if (thd->locked_tables_mode ||
- thd->in_active_multi_stmt_transaction() || thd->global_read_lock.is_acquired())
+ To prevent that, refuse SLAVE STOP if the
+ client thread has locked tables
+ */
+ if (thd->locked_tables_mode ||
+ thd->in_active_multi_stmt_transaction() ||
+ thd->global_read_lock.is_acquired())
+ {
+ my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
+ ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
+ goto error;
+ }
+
+ lex_mi= &thd->lex->mi;
+ mysql_mutex_lock(&LOCK_active_mi);
+ if ((mi= (master_info_index->
+ get_master_info(&lex_mi->connection_name,
+ MYSQL_ERROR::WARN_LEVEL_ERROR))))
+ if (!stop_slave(thd, mi, 1/* net report*/))
+ my_ok(thd);
+ mysql_mutex_unlock(&LOCK_active_mi);
+ break;
+ }
+ case SQLCOM_SLAVE_ALL_START:
{
- my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
- goto error;
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (!master_info_index->start_all_slaves(thd))
+ my_ok(thd);
+ mysql_mutex_unlock(&LOCK_active_mi);
+ break;
}
+ case SQLCOM_SLAVE_ALL_STOP:
{
+ if (thd->locked_tables_mode ||
+ thd->in_active_multi_stmt_transaction() ||
+ thd->global_read_lock.is_acquired())
+ {
+ my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
+ ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
+ goto error;
+ }
mysql_mutex_lock(&LOCK_active_mi);
- stop_slave(thd,active_mi,1/* net report*/);
+ if (!master_info_index->stop_all_slaves(thd))
+ my_ok(thd);
mysql_mutex_unlock(&LOCK_active_mi);
break;
}
#endif /* HAVE_REPLICATION */
-
case SQLCOM_RENAME_TABLE:
{
if (execute_rename_table(thd, first_table, all_tables))
@@ -3127,6 +3252,7 @@ end_with_restore_list:
DBUG_ASSERT(!debug_sync_set_action(thd,
STRING_WITH_LEN(act2)));
};);
+ DEBUG_SYNC(thd, "after_mysql_insert");
break;
}
case SQLCOM_REPLACE_SELECT:
@@ -4714,6 +4840,11 @@ finish:
if (lex->sql_command != SQLCOM_SET_OPTION && ! thd->in_sub_stmt)
DEBUG_SYNC(thd, "execute_command_after_close_tables");
#endif
+ if (!(sql_command_flags[lex->sql_command] &
+ (CF_CAN_GENERATE_ROW_EVENTS | CF_FORCE_ORIGINAL_BINLOG_FORMAT |
+ CF_STATUS_COMMAND)))
+ thd->set_binlog_format(orig_binlog_format,
+ orig_current_stmt_binlog_format);
if (stmt_causes_implicit_commit(thd, CF_IMPLICIT_COMMIT_END))
{
@@ -6755,23 +6886,17 @@ void add_join_natural(TABLE_LIST *a, TABLE_LIST *b, List<String> *using_fields,
/**
- kill on thread.
+ Find a thread by id and return it, locking it LOCK_thd_data
- @param thd Thread class
- @param id Thread id
- @param only_kill_query Should it kill the query or the connection
+ @param id Identifier of the thread we're looking for
- @note
- This is written such that we have a short lock on LOCK_thread_count
+ @return NULL - not found
+ pointer - thread found, and its LOCK_thd_data is locked.
*/
-uint kill_one_thread(THD *thd, ulong id, killed_state kill_signal)
+THD *find_thread_by_id(ulong id)
{
THD *tmp;
- uint error=ER_NO_SUCH_THREAD;
- DBUG_ENTER("kill_one_thread");
- DBUG_PRINT("enter", ("id: %lu signal: %u", id, (uint) kill_signal));
-
mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
I_List_iterator<THD> it(threads);
while ((tmp=it++))
@@ -6785,7 +6910,29 @@ uint kill_one_thread(THD *thd, ulong id, killed_state kill_signal)
}
}
mysql_mutex_unlock(&LOCK_thread_count);
- if (tmp)
+ return tmp;
+}
+
+
+/**
+ kill on thread.
+
+ @param thd Thread class
+ @param id Thread id
+ @param only_kill_query Should it kill the query or the connection
+
+ @note
+ This is written such that we have a short lock on LOCK_thread_count
+*/
+
+uint kill_one_thread(THD *thd, ulong id, killed_state kill_signal)
+{
+ THD *tmp;
+ uint error=ER_NO_SUCH_THREAD;
+ DBUG_ENTER("kill_one_thread");
+ DBUG_PRINT("enter", ("id: %lu signal: %u", id, (uint) kill_signal));
+
+ if ((tmp= find_thread_by_id(id)))
{
/*
If we're SUPER, we can KILL anything, including system-threads.
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index a9c79589faa..2bec12e4f66 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -5500,10 +5500,12 @@ static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
build_table_filename(path, sizeof(path) - 1, lpt->db, lpt->table_name, "", 0);
- if(mysql_trans_prepare_alter_copy_data(thd))
+ /* First lock the original tables */
+ if (file->ha_external_lock(thd, F_WRLCK))
DBUG_RETURN(TRUE);
- if (file->ha_external_lock(thd, F_WRLCK))
+ /* Disable transactions for all new tables */
+ if (mysql_trans_prepare_alter_copy_data(thd))
DBUG_RETURN(TRUE);
/* TODO: test if bulk_insert would increase the performance */
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 1059103086a..f19b8ca26ef 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -907,7 +907,7 @@ bool plugin_is_ready(const LEX_STRING *name, int type)
}
-SHOW_COMP_OPTION plugin_status(const char *name, int len, size_t type)
+SHOW_COMP_OPTION plugin_status(const char *name, size_t len, int type)
{
LEX_STRING plugin_name= { (char *) name, len };
return plugin_status(&plugin_name, type);
diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h
index eaa368f3515..be1cfcdcc4f 100644
--- a/sql/sql_plugin.h
+++ b/sql/sql_plugin.h
@@ -1,5 +1,5 @@
-/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates.
+/* Copyright (c) 2005, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -165,7 +165,7 @@ extern bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
extern bool plugin_register_builtin(struct st_mysql_plugin *plugin);
extern void plugin_thdvar_init(THD *thd);
extern void plugin_thdvar_cleanup(THD *thd);
-extern SHOW_COMP_OPTION plugin_status(const char *name, int len, size_t type);
+extern SHOW_COMP_OPTION plugin_status(const char *name, size_t len, int type);
extern bool check_valid_path(const char *path, size_t length);
typedef my_bool (plugin_foreach_func)(THD *thd,
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 778d8ba6708..75611a054f0 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2134,6 +2134,7 @@ static bool check_prepared_statement(Prepared_statement *stmt)
Note that we don't need to have cases in this list if they are
marked with CF_STATUS_COMMAND in sql_command_flags
*/
+ case SQLCOM_SHOW_EXPLAIN:
case SQLCOM_DROP_TABLE:
case SQLCOM_RENAME_TABLE:
case SQLCOM_ALTER_TABLE:
@@ -2151,6 +2152,8 @@ static bool check_prepared_statement(Prepared_statement *stmt)
case SQLCOM_FLUSH:
case SQLCOM_SLAVE_START:
case SQLCOM_SLAVE_STOP:
+ case SQLCOM_SLAVE_ALL_START:
+ case SQLCOM_SLAVE_ALL_STOP:
case SQLCOM_INSTALL_PLUGIN:
case SQLCOM_UNINSTALL_PLUGIN:
case SQLCOM_CREATE_DB:
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index 749e65e0902..a1c0b2d8729 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -331,6 +331,7 @@ enum enum_yes_no_unknown
External variables
*/
+
/* sql_yacc.cc */
#ifndef DBUG_OFF
extern void turn_parser_debug_on();
diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc
index b3348698a35..2d00a19870b 100644
--- a/sql/sql_profile.cc
+++ b/sql/sql_profile.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2007, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008, 2011, Monty Program Ab
+/* Copyright (c) 2007, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -88,8 +88,8 @@ ST_FIELD_INFO query_profile_statistics_info[]=
int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
{
- int profile_options = thd->lex->profile_options;
- int fields_include_condition_truth_values[]= {
+ uint profile_options = thd->lex->profile_options;
+ uint fields_include_condition_truth_values[]= {
FALSE, /* Query_id */
FALSE, /* Seq */
TRUE, /* Status */
diff --git a/sql/sql_profile.h b/sql/sql_profile.h
index 2e93912fb25..7705f6ca476 100644
--- a/sql/sql_profile.h
+++ b/sql/sql_profile.h
@@ -287,5 +287,5 @@ public:
int fill_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond);
};
-# endif /* HAVE_PROFILING */
+# endif /* ENABLED_PROFILING */
#endif /* _SQL_PROFILE_H */
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 914b9026014..99fe9267589 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -26,6 +26,7 @@
#include "sql_repl.h" // reset_master, reset_slave
#include "rpl_mi.h" // Master_info::data_lock
#include "debug_sync.h"
+#include "rpl_mi.h"
static void disable_checkpoints(THD *thd);
@@ -157,10 +158,36 @@ bool reload_acl_and_cache(THD *thd, unsigned long options,
if (options & REFRESH_RELAY_LOG)
{
#ifdef HAVE_REPLICATION
- mysql_mutex_lock(&active_mi->data_lock);
- if (rotate_relay_log(active_mi))
- *write_to_binlog= -1;
- mysql_mutex_unlock(&active_mi->data_lock);
+ LEX_STRING connection_name;
+ Master_info *mi;
+ if (thd)
+ connection_name= thd->lex->relay_log_connection_name;
+ else
+ {
+ connection_name.str= (char*) "";
+ connection_name.length= 0;
+ }
+
+ /*
+ Writing this command to the binlog may cause problems as the
+ slave is not likely to have the same connection names.
+ */
+ tmp_write_to_binlog= 0;
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (!(mi= (master_info_index->
+ get_master_info(&connection_name,
+ MYSQL_ERROR::WARN_LEVEL_ERROR))))
+ {
+ result= 1;
+ }
+ else
+ {
+ mysql_mutex_lock(&mi->data_lock);
+ if (rotate_relay_log(mi))
+ *write_to_binlog= -1;
+ mysql_mutex_unlock(&mi->data_lock);
+ }
+ mysql_mutex_unlock(&LOCK_active_mi);
#endif
}
#ifdef HAVE_QUERY_CACHE
@@ -314,13 +341,27 @@ bool reload_acl_and_cache(THD *thd, unsigned long options,
#ifdef HAVE_REPLICATION
if (options & REFRESH_SLAVE)
{
+ LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
+ Master_info *mi;
tmp_write_to_binlog= 0;
mysql_mutex_lock(&LOCK_active_mi);
- if (reset_slave(thd, active_mi))
+
+ if (!(mi= (master_info_index->
+ get_master_info(&lex_mi->connection_name,
+ MYSQL_ERROR::WARN_LEVEL_ERROR))))
+ {
+ result= 1;
+ }
+ else if (reset_slave(thd, mi))
{
/* NOTE: my_error() has been already called by reset_slave(). */
result= 1;
}
+ else if (mi->connection_name.length && thd->lex->reset_slave_info.all)
+ {
+ /* If not default connection and 'all' is used */
+ master_info_index->remove_master_info(&mi->connection_name);
+ }
mysql_mutex_unlock(&LOCK_active_mi);
}
#endif
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 039dd046086..db8dc694502 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2011, Monty Program Ab
+ Copyright (c) 2008, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,14 +34,6 @@ my_bool opt_sporadic_binlog_dump_fail = 0;
static int binlog_dump_count = 0;
#endif
-/**
- a copy of active_mi->rli->slave_skip_counter, for showing in SHOW VARIABLES,
- INFORMATION_SCHEMA.GLOBAL_VARIABLES and @@sql_slave_skip_counter without
- taking all the mutexes needed to access active_mi->rli->slave_skip_counter
- properly.
-*/
-uint sql_slave_skip_counter;
-
extern TYPELIB binlog_checksum_typelib;
/*
@@ -492,6 +484,27 @@ static ulonglong get_heartbeat_period(THD * thd)
}
/*
+ Lookup the capabilities of the slave, which it announces by setting a value
+ MARIA_SLAVE_CAPABILITY_XXX in @mariadb_slave_capability.
+
+ Older MariaDB slaves, and other MySQL slaves, do not set
+ @mariadb_slave_capability, corresponding to a capability of
+ MARIA_SLAVE_CAPABILITY_UNKNOWN (0).
+*/
+static int
+get_mariadb_slave_capability(THD *thd)
+{
+ bool null_value;
+ const LEX_STRING name= { C_STRING_WITH_LEN("mariadb_slave_capability") };
+ const user_var_entry *entry=
+ (user_var_entry*) my_hash_search(&thd->user_vars, (uchar*) name.str,
+ name.length);
+ return entry ?
+ (int)(entry->val_int(&null_value)) : MARIA_SLAVE_CAPABILITY_UNKNOWN;
+}
+
+
+/*
Function prepares and sends repliation heartbeat event.
@param net net object of THD
@@ -563,14 +576,68 @@ static int send_heartbeat_event(NET* net, String* packet,
static const char *
send_event_to_slave(THD *thd, NET *net, String* const packet, ushort flags,
Log_event_type event_type, char *log_file_name,
- IO_CACHE *log)
+ IO_CACHE *log, int mariadb_slave_capability,
+ ulong ev_offset, uint8 current_checksum_alg)
{
my_off_t pos;
/* Do not send annotate_rows events unless slave requested it. */
- if (event_type == ANNOTATE_ROWS_EVENT &&
- !(flags & BINLOG_SEND_ANNOTATE_ROWS_EVENT))
- return NULL;
+ if (event_type == ANNOTATE_ROWS_EVENT && !(flags & BINLOG_SEND_ANNOTATE_ROWS_EVENT))
+ {
+ if (mariadb_slave_capability >= MARIA_SLAVE_CAPABILITY_TOLERATE_HOLES)
+ {
+ /* This slave can tolerate events omitted from the binlog stream. */
+ return NULL;
+ }
+ else if (mariadb_slave_capability >= MARIA_SLAVE_CAPABILITY_ANNOTATE)
+ {
+ /*
+ The slave did not request ANNOTATE_ROWS_EVENT (it does not need them as
+ it will not log them in its own binary log). However, it understands the
+ event and will just ignore it, and it would break if we omitted it,
+ leaving a hole in the binlog stream. So just send the event as-is.
+ */
+ }
+ else
+ {
+ /*
+ The slave does not understand ANNOTATE_ROWS_EVENT.
+
+ Older MariaDB slaves (and MySQL slaves) will break replication if there
+ are holes in the binlog stream (they will miscompute the binlog offset
+ and request the wrong position when reconnecting).
+
+ So replace the event with a dummy event of the same size that will be
+ a no-operation on the slave.
+ */
+ if (Query_log_event::dummy_event(packet, ev_offset, current_checksum_alg))
+ return "Failed to replace row annotate event with dummy: too small event.";
+ }
+ }
+
+ /*
+ Do not send binlog checkpoint events to a slave that does not understand it.
+ */
+ if (unlikely(event_type == BINLOG_CHECKPOINT_EVENT) &&
+ mariadb_slave_capability < MARIA_SLAVE_CAPABILITY_BINLOG_CHECKPOINT)
+ {
+ if (mariadb_slave_capability >= MARIA_SLAVE_CAPABILITY_TOLERATE_HOLES)
+ {
+ /* This slave can tolerate events omitted from the binlog stream. */
+ return NULL;
+ }
+ else
+ {
+ /*
+ The slave does not understand BINLOG_CHECKPOINT_EVENT. Send a dummy
+ event instead, with same length so slave does not get confused about
+ binlog positions.
+ */
+ if (Query_log_event::dummy_event(packet, ev_offset, current_checksum_alg))
+ return "Failed to replace binlog checkpoint event with dummy: "
+ "too small event.";
+ }
+ }
/*
Skip events with the @@skip_replication flag set, if slave requested
@@ -628,6 +695,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
NET* net = &thd->net;
mysql_mutex_t *log_lock;
mysql_cond_t *log_cond;
+ int mariadb_slave_capability;
uint8 current_checksum_alg= BINLOG_CHECKSUM_ALG_UNDEF;
int old_max_allowed_packet= thd->variables.max_allowed_packet;
@@ -653,7 +721,9 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
heartbeat_ts= &heartbeat_buf;
set_timespec_nsec(*heartbeat_ts, 0);
}
- sql_print_information("Start binlog_dump to slave_server(%d), pos(%s, %lu)",
+ mariadb_slave_capability= get_mariadb_slave_capability(thd);
+ if (global_system_variables.log_warnings > 1)
+ sql_print_information("Start binlog_dump to slave_server(%d), pos(%s, %lu)",
thd->server_id, log_ident, (ulong)pos);
if (RUN_HOOK(binlog_transmit, transmit_start, (thd, flags, log_ident, pos)))
{
@@ -765,7 +835,7 @@ impossible position";
this larger than the corresponding packet (query) sent
from client to master.
*/
- thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ thd->variables.max_allowed_packet= MAX_MAX_ALLOWED_PACKET;
/*
We can set log_lock now, it does not move (it's a member of
@@ -938,7 +1008,9 @@ impossible position";
}
if ((tmp_msg= send_event_to_slave(thd, net, packet, flags, event_type,
- log_file_name, &log)))
+ log_file_name, &log,
+ mariadb_slave_capability, ev_offset,
+ current_checksum_alg)))
{
errmsg= tmp_msg;
my_errno= ER_UNKNOWN_ERROR;
@@ -1096,7 +1168,9 @@ impossible position";
if (read_packet &&
(tmp_msg= send_event_to_slave(thd, net, packet, flags, event_type,
- log_file_name, &log)))
+ log_file_name, &log,
+ mariadb_slave_capability, ev_offset,
+ current_checksum_alg)))
{
errmsg= tmp_msg;
my_errno= ER_UNKNOWN_ERROR;
@@ -1223,15 +1297,28 @@ err:
@retval 0 success
@retval 1 error
+ @retval -1 fatal error
*/
+
int start_slave(THD* thd , Master_info* mi, bool net_report)
{
int slave_errno= 0;
int thread_mask;
+ char master_info_file_tmp[FN_REFLEN];
+ char relay_log_info_file_tmp[FN_REFLEN];
DBUG_ENTER("start_slave");
if (check_access(thd, SUPER_ACL, any_db, NULL, NULL, 0, 0))
- DBUG_RETURN(1);
+ DBUG_RETURN(-1);
+
+ create_logfile_name_with_suffix(master_info_file_tmp,
+ sizeof(master_info_file_tmp),
+ master_info_file, 0, &mi->connection_name);
+ create_logfile_name_with_suffix(relay_log_info_file_tmp,
+ sizeof(relay_log_info_file_tmp),
+ relay_log_info_file, 0,
+ &mi->connection_name);
+
lock_slave_threads(mi); // this allows us to cleanly read slave_running
// Get a mask of _stopped_ threads
init_thread_mask(&thread_mask,mi,1 /* inverse */);
@@ -1245,7 +1332,7 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
thread_mask&= thd->lex->slave_thd_opt;
if (thread_mask) //some threads are stopped, start them
{
- if (init_master_info(mi,master_info_file,relay_log_info_file, 0,
+ if (init_master_info(mi,master_info_file_tmp,relay_log_info_file_tmp, 0,
thread_mask))
slave_errno=ER_MASTER_INFO;
else if (server_id_supplied && *mi->host)
@@ -1319,10 +1406,11 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
if (!slave_errno)
slave_errno = start_slave_threads(0 /*no mutex */,
- 1 /* wait for start */,
- mi,
- master_info_file,relay_log_info_file,
- thread_mask);
+ 1 /* wait for start */,
+ mi,
+ master_info_file_tmp,
+ relay_log_info_file_tmp,
+ thread_mask);
}
else
slave_errno = ER_BAD_SLAVE;
@@ -1339,11 +1427,11 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
if (slave_errno)
{
if (net_report)
- my_message(slave_errno, ER(slave_errno), MYF(0));
- DBUG_RETURN(1);
+ my_error(slave_errno, MYF(0),
+ (int) mi->connection_name.length,
+ mi->connection_name.str);
+ DBUG_RETURN(slave_errno == ER_BAD_SLAVE ? -1 : 1);
}
- else if (net_report)
- my_ok(thd);
DBUG_RETURN(0);
}
@@ -1361,17 +1449,17 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
@retval 0 success
@retval 1 error
+ @retval -1 error
*/
+
int stop_slave(THD* thd, Master_info* mi, bool net_report )
{
- DBUG_ENTER("stop_slave");
-
int slave_errno;
- if (!thd)
- thd = current_thd;
+ DBUG_ENTER("stop_slave");
+ DBUG_PRINT("enter",("Connection: %s", mi->connection_name.str));
if (check_access(thd, SUPER_ACL, any_db, NULL, NULL, 0, 0))
- DBUG_RETURN(1);
+ DBUG_RETURN(-1);
THD_STAGE_INFO(thd, stage_killing_slave);
int thread_mask;
lock_slave_threads(mi);
@@ -1406,8 +1494,6 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report )
my_message(slave_errno, ER(slave_errno), MYF(0));
DBUG_RETURN(1);
}
- else if (net_report)
- my_ok(thd);
DBUG_RETURN(0);
}
@@ -1431,15 +1517,18 @@ int reset_slave(THD *thd, Master_info* mi)
int thread_mask= 0, error= 0;
uint sql_errno=ER_UNKNOWN_ERROR;
const char* errmsg= "Unknown error occured while reseting slave";
+ char master_info_file_tmp[FN_REFLEN];
+ char relay_log_info_file_tmp[FN_REFLEN];
DBUG_ENTER("reset_slave");
lock_slave_threads(mi);
init_thread_mask(&thread_mask,mi,0 /* not inverse */);
if (thread_mask) // We refuse if any slave thread is running
{
- sql_errno= ER_SLAVE_MUST_STOP;
- error=1;
- goto err;
+ unlock_slave_threads(mi);
+ my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length,
+ mi->connection_name.str);
+ DBUG_RETURN(ER_SLAVE_MUST_STOP);
}
ha_reset_slave(thd);
@@ -1466,22 +1555,35 @@ int reset_slave(THD *thd, Master_info* mi)
// close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0
end_master_info(mi);
+
// and delete these two files
- fn_format(fname, master_info_file, mysql_data_home, "", 4+32);
+ create_logfile_name_with_suffix(master_info_file_tmp,
+ sizeof(master_info_file_tmp),
+ master_info_file, 0, &mi->connection_name);
+ create_logfile_name_with_suffix(relay_log_info_file_tmp,
+ sizeof(relay_log_info_file_tmp),
+ relay_log_info_file, 0, &mi->connection_name);
+
+ fn_format(fname, master_info_file_tmp, mysql_data_home, "", 4+32);
if (mysql_file_stat(key_file_master_info, fname, &stat_area, MYF(0)) &&
mysql_file_delete(key_file_master_info, fname, MYF(MY_WME)))
{
error=1;
goto err;
}
+ else if (global_system_variables.log_warnings > 1)
+ sql_print_information("Deleted Master_info file '%s'.", fname);
+
// delete relay_log_info_file
- fn_format(fname, relay_log_info_file, mysql_data_home, "", 4+32);
+ fn_format(fname, relay_log_info_file_tmp, mysql_data_home, "", 4+32);
if (mysql_file_stat(key_file_relay_log_info, fname, &stat_area, MYF(0)) &&
mysql_file_delete(key_file_relay_log_info, fname, MYF(MY_WME)))
{
error=1;
goto err;
}
+ else if (global_system_variables.log_warnings > 1)
+ sql_print_information("Deleted Master_info file '%s'.", fname);
RUN_HOOK(binlog_relay_io, after_reset_slave, (thd, mi));
err:
@@ -1561,20 +1663,12 @@ bool change_master(THD* thd, Master_info* mi)
char saved_host[HOSTNAME_LENGTH + 1];
uint saved_port;
char saved_log_name[FN_REFLEN];
+ char master_info_file_tmp[FN_REFLEN];
+ char relay_log_info_file_tmp[FN_REFLEN];
my_off_t saved_log_pos;
- DBUG_ENTER("change_master");
-
- lock_slave_threads(mi);
- init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
- if (thread_mask) // We refuse if any slave thread is running
- {
- my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
- ret= TRUE;
- goto err;
- }
+ DBUG_ENTER("change_master");
- THD_STAGE_INFO(thd, stage_changing_master);
/*
We need to check if there is an empty master_host. Otherwise
change master succeeds, a master.info file is created containing
@@ -1582,17 +1676,61 @@ bool change_master(THD* thd, Master_info* mi)
is thrown stating that the server is not configured as slave.
(See BUG#28796).
*/
- if(lex_mi->host && !*lex_mi->host)
+ if (lex_mi->host && !*lex_mi->host)
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "MASTER_HOST");
- unlock_slave_threads(mi);
DBUG_RETURN(TRUE);
}
- // TODO: see if needs re-write
- if (init_master_info(mi, master_info_file, relay_log_info_file, 0,
+ if (master_info_index->check_duplicate_master_info(&lex_mi->connection_name,
+ lex_mi->host,
+ lex_mi->port))
+ DBUG_RETURN(TRUE);
+
+ lock_slave_threads(mi);
+ init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
+ if (thread_mask) // We refuse if any slave thread is running
+ {
+ my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length,
+ mi->connection_name.str);
+ ret= TRUE;
+ goto err;
+ }
+
+ THD_STAGE_INFO(thd, stage_changing_master);
+
+ create_logfile_name_with_suffix(master_info_file_tmp,
+ sizeof(master_info_file_tmp),
+ master_info_file, 0, &mi->connection_name);
+ create_logfile_name_with_suffix(relay_log_info_file_tmp,
+ sizeof(relay_log_info_file_tmp),
+ relay_log_info_file, 0, &mi->connection_name);
+
+ /* if new Master_info doesn't exists, add it */
+ if (!master_info_index->get_master_info(&mi->connection_name,
+ MYSQL_ERROR::WARN_LEVEL_NOTE))
+ {
+ if (master_info_index->add_master_info(mi, TRUE))
+ {
+ my_error(ER_MASTER_INFO, MYF(0),
+ (int) lex_mi->connection_name.length,
+ lex_mi->connection_name.str);
+ ret= TRUE;
+ goto err;
+ }
+ }
+ if (global_system_variables.log_warnings > 1)
+ sql_print_information("Master: '%.*s' Master_info_file: '%s' "
+ "Relay_info_file: '%s'",
+ (int) mi->connection_name.length,
+ mi->connection_name.str,
+ master_info_file_tmp, relay_log_info_file_tmp);
+
+ if (init_master_info(mi, master_info_file_tmp, relay_log_info_file_tmp, 0,
thread_mask))
{
- my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0));
+ my_error(ER_MASTER_INFO, MYF(0),
+ (int) lex_mi->connection_name.length,
+ lex_mi->connection_name.str);
ret= TRUE;
goto err;
}
@@ -1860,7 +1998,7 @@ int reset_master(THD* thd)
return 1;
}
- if (mysql_bin_log.reset_logs(thd))
+ if (mysql_bin_log.reset_logs(thd, 1))
return 1;
RUN_HOOK(binlog_transmit, after_reset_master, (thd, 0 /* flags */));
return 0;
@@ -1886,6 +2024,7 @@ bool mysql_show_binlog_events(THD* thd)
File file = -1;
MYSQL_BIN_LOG *binary_log= NULL;
int old_max_allowed_packet= thd->variables.max_allowed_packet;
+ Master_info *mi= 0;
LOG_INFO linfo;
DBUG_ENTER("mysql_show_binlog_events");
@@ -1915,10 +2054,15 @@ bool mysql_show_binlog_events(THD* thd)
}
else /* showing relay log contents */
{
- if (!active_mi)
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (!(mi= master_info_index->
+ get_master_info(&thd->variables.default_master_connection,
+ MYSQL_ERROR::WARN_LEVEL_ERROR)))
+ {
+ mysql_mutex_unlock(&LOCK_active_mi);
DBUG_RETURN(TRUE);
-
- binary_log= &(active_mi->rli.relay_log);
+ }
+ binary_log= &(mi->rli.relay_log);
}
if (binary_log->is_open())
@@ -1932,6 +2076,13 @@ bool mysql_show_binlog_events(THD* thd)
mysql_mutex_t *log_lock = binary_log->get_log_lock();
Log_event* ev;
+ if (mi)
+ {
+ /* We can unlock the mutex as we have a lock on the file */
+ mysql_mutex_unlock(&LOCK_active_mi);
+ mi= 0;
+ }
+
unit->set_limit(thd->lex->current_select);
limit_start= unit->offset_limit_cnt;
limit_end= unit->select_limit_cnt;
@@ -2002,7 +2153,7 @@ bool mysql_show_binlog_events(THD* thd)
description_event->checksum_alg= ev->checksum_alg;
if (event_count >= limit_start &&
- ev->net_send(protocol, linfo.log_file_name, pos))
+ ev->net_send(thd, protocol, linfo.log_file_name, pos))
{
errmsg = "Net error";
delete ev;
@@ -2026,6 +2177,9 @@ bool mysql_show_binlog_events(THD* thd)
mysql_mutex_unlock(log_lock);
}
+ else if (mi)
+ mysql_mutex_unlock(&LOCK_active_mi);
+
// Check that linfo is still on the function scope.
DEBUG_SYNC(thd, "after_show_binlog_events");
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 7f32ca0337e..ba44aba33b9 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -266,8 +266,62 @@ Item_equal *find_item_equal(COND_EQUAL *cond_equal, Field *field,
bool *inherited_fl);
JOIN_TAB *first_depth_first_tab(JOIN* join);
JOIN_TAB *next_depth_first_tab(JOIN* join, JOIN_TAB* tab);
-JOIN_TAB *first_breadth_first_tab(JOIN *join);
-JOIN_TAB *next_breadth_first_tab(JOIN *join, JOIN_TAB *tab);
+
+enum enum_exec_or_opt {WALK_OPTIMIZATION_TABS , WALK_EXECUTION_TABS};
+JOIN_TAB *first_breadth_first_tab(JOIN *join, enum enum_exec_or_opt tabs_kind);
+JOIN_TAB *next_breadth_first_tab(JOIN *join, enum enum_exec_or_opt tabs_kind,
+ JOIN_TAB *tab);
+
+#ifndef DBUG_OFF
+
+/*
+ SHOW EXPLAIN testing: wait for, and serve n_calls APC requests.
+*/
+void dbug_serve_apcs(THD *thd, int n_calls)
+{
+ const char *save_proc_info= thd->proc_info;
+ /* This is so that mysqltest knows we're ready to serve requests: */
+ thd_proc_info(thd, "show_explain_trap");
+
+ /* Busy-wait for n_calls APC requests to arrive and be processed */
+ int n_apcs= thd->apc_target.n_calls_processed + n_calls;
+ while (thd->apc_target.n_calls_processed < n_apcs)
+ {
+ my_sleep(300);
+ if (thd->check_killed())
+ break;
+ }
+ thd_proc_info(thd, save_proc_info);
+}
+
+
+/*
+ Debugging: check if @name=value, comparing as integer
+
+ Intended usage:
+
+ DBUG_EXECUTE_IF("show_explain_probe_2",
+ if (dbug_user_var_equals_int(thd, "select_id", select_id))
+ dbug_serve_apcs(thd, 1);
+ );
+
+*/
+
+bool dbug_user_var_equals_int(THD *thd, const char *name, int value)
+{
+ user_var_entry *var;
+ LEX_STRING varname= {(char*)name, strlen(name)};
+ if ((var= get_variable(&thd->user_vars, varname, FALSE)))
+ {
+ bool null_value;
+ longlong var_value= var->val_int(&null_value);
+ if (!null_value && var_value == value)
+ return TRUE;
+ }
+ return FALSE;
+}
+#endif
+
/**
This handles SELECT with and without UNION.
@@ -710,6 +764,8 @@ JOIN::prepare(Item ***rref_pointer_array,
if (having)
{
+ Query_arena backup, *arena;
+ arena= thd->activate_stmt_arena_if_needed(&backup);
nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
thd->where="having clause";
thd->lex->allow_sum_func|= 1 << select_lex_arg->nest_level;
@@ -725,6 +781,10 @@ JOIN::prepare(Item ***rref_pointer_array,
(having->fix_fields(thd, &having) ||
having->check_cols(1)));
select_lex->having_fix_field= 0;
+ select_lex->having= having;
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
+
if (having_fix_rc || thd->is_error())
DBUG_RETURN(-1); /* purecov: inspected */
thd->lex->allow_sum_func= save_allow_sum_func;
@@ -925,6 +985,19 @@ err:
}
+int JOIN::optimize()
+{
+ int res= optimize_inner();
+ /*
+ If we're inside a non-correlated subquery, this function may be
+ called for the second time after the subquery has been executed
+ and deleted. The second call will not produce a valid query plan, it will
+ short-circuit because optimized==TRUE.
+ */
+ if (!res && have_query_plan != QEP_DELETED)
+ have_query_plan= QEP_AVAILABLE;
+ return res;
+}
/**
global select optimisation.
@@ -938,7 +1011,7 @@ err:
*/
int
-JOIN::optimize()
+JOIN::optimize_inner()
{
ulonglong select_opts_for_readinfo;
uint no_jbuf_after;
@@ -1430,9 +1503,10 @@ JOIN::optimize()
We have found that grouping can be removed since groups correspond to
only one row anyway, but we still have to guarantee correct result
order. The line below effectively rewrites the query from GROUP BY
- <fields> to ORDER BY <fields>. There are two exceptions:
+ <fields> to ORDER BY <fields>. There are three exceptions:
- if skip_sort_order is set (see above), then we can simply skip
GROUP BY;
+ - if we are in a subquery, we don't have to maintain order
- we can only rewrite ORDER BY if the ORDER BY fields are 'compatible'
with the GROUP BY ones, i.e. either one is a prefix of another.
We only check if the ORDER BY is a prefix of GROUP BY. In this case
@@ -1442,7 +1516,13 @@ JOIN::optimize()
'order' as is.
*/
if (!order || test_if_subpart(group_list, order))
- order= skip_sort_order ? 0 : group_list;
+ {
+ if (skip_sort_order ||
+ select_lex->master_unit()->item) // This is a subquery
+ order= NULL;
+ else
+ order= group_list;
+ }
/*
If we have an IGNORE INDEX FOR GROUP BY(fields) clause, this must be
rewritten to IGNORE INDEX FOR ORDER BY(fields).
@@ -1848,6 +1928,7 @@ int JOIN::init_execution()
if (!group_list && ! exec_tmp_table1->distinct && order && simple_order)
{
+ DBUG_PRINT("info",("Sorting for order"));
THD_STAGE_INFO(thd, stage_sorting_for_order);
if (create_sort_index(thd, this, order,
HA_POS_ERROR, HA_POS_ERROR, TRUE))
@@ -2154,6 +2235,32 @@ JOIN::save_join_tab()
}
+void JOIN::exec()
+{
+ /*
+ Enable SHOW EXPLAIN only if we're in the top-level query.
+ */
+ thd->apc_target.enable();
+ DBUG_EXECUTE_IF("show_explain_probe_join_exec_start",
+ if (dbug_user_var_equals_int(thd,
+ "show_explain_probe_select_id",
+ select_lex->select_number))
+ dbug_serve_apcs(thd, 1);
+ );
+
+ exec_inner();
+
+ DBUG_EXECUTE_IF("show_explain_probe_join_exec_end",
+ if (dbug_user_var_equals_int(thd,
+ "show_explain_probe_select_id",
+ select_lex->select_number))
+ dbug_serve_apcs(thd, 1);
+ );
+
+ thd->apc_target.disable();
+}
+
+
/**
Exec select.
@@ -2165,13 +2272,15 @@ JOIN::save_join_tab()
@todo
When can we have here thd->net.report_error not zero?
*/
-void
-JOIN::exec()
+
+void JOIN::exec_inner()
{
List<Item> *columns_list= &fields_list;
int tmp_error;
DBUG_ENTER("JOIN::exec");
+ const bool has_group_by= this->group;
+
THD_STAGE_INFO(thd, stage_executing);
error= 0;
if (procedure)
@@ -2471,6 +2580,10 @@ JOIN::exec()
DBUG_PRINT("info",("Creating group table"));
/* Free first data from old join */
+
+ /*
+ psergey-todo: this is the place of pre-mature JOIN::free call.
+ */
curr_join->join_free();
if (curr_join->make_simple_join(this, curr_tmp_table))
DBUG_VOID_RETURN;
@@ -2511,11 +2624,12 @@ JOIN::exec()
}
if (curr_join->group_list)
{
- THD_STAGE_INFO(thd, stage_creating_sort_index);
if (curr_join->join_tab == join_tab && save_join_tab())
{
DBUG_VOID_RETURN;
}
+ DBUG_PRINT("info",("Sorting for index"));
+ THD_STAGE_INFO(thd, stage_creating_sort_index);
if (create_sort_index(thd, curr_join, curr_join->group_list,
HA_POS_ERROR, HA_POS_ERROR, FALSE) ||
make_group_fields(this, curr_join))
@@ -2781,13 +2895,39 @@ JOIN::exec()
the query. XXX: it's never shown in EXPLAIN!
OPTION_FOUND_ROWS supersedes LIMIT and is taken into account.
*/
- if (create_sort_index(thd, curr_join,
- curr_join->group_list ?
- curr_join->group_list : curr_join->order,
- curr_join->select_limit,
- (select_options & OPTION_FOUND_ROWS ?
- HA_POS_ERROR : unit->select_limit_cnt),
- curr_join->group_list ? TRUE : FALSE))
+ DBUG_PRINT("info",("Sorting for order by/group by"));
+ ORDER *order_arg=
+ curr_join->group_list ? curr_join->group_list : curr_join->order;
+ /*
+ filesort_limit: Return only this many rows from filesort().
+ We can use select_limit_cnt only if we have no group_by and 1 table.
+ This allows us to use Bounded_queue for queries like:
+ "select SQL_CALC_FOUND_ROWS * from t1 order by b desc limit 1;"
+ select_limit == HA_POS_ERROR (we need a full table scan)
+ unit->select_limit_cnt == 1 (we only need one row in the result set)
+ */
+ const ha_rows filesort_limit_arg=
+ (has_group_by || curr_join->table_count > 1)
+ ? curr_join->select_limit : unit->select_limit_cnt;
+ const ha_rows select_limit_arg=
+ select_options & OPTION_FOUND_ROWS
+ ? HA_POS_ERROR : unit->select_limit_cnt;
+
+ DBUG_PRINT("info", ("has_group_by %d "
+ "curr_join->table_count %d "
+ "curr_join->m_select_limit %d "
+ "unit->select_limit_cnt %d",
+ has_group_by,
+ curr_join->table_count,
+ (int) curr_join->select_limit,
+ (int) unit->select_limit_cnt));
+
+ if (create_sort_index(thd,
+ curr_join,
+ order_arg,
+ filesort_limit_arg,
+ select_limit_arg,
+ curr_join->group_list ? FALSE : TRUE))
DBUG_VOID_RETURN;
sortorder= curr_join->sortorder;
if (curr_join->const_tables != curr_join->table_count &&
@@ -2819,6 +2959,14 @@ JOIN::exec()
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
error= do_select(curr_join, curr_fields_list, NULL, procedure);
thd->limit_found_rows= curr_join->send_records;
+ if (curr_join->order &&
+ curr_join->sortorder)
+ {
+ /* Use info provided by filesort. */
+ DBUG_ASSERT(curr_join->table_count > curr_join->const_tables);
+ JOIN_TAB *tab= curr_join->join_tab + curr_join->const_tables;
+ thd->limit_found_rows= tab->records;
+ }
/* Accumulate the counts from all join iterations of all join parts. */
thd->inc_examined_row_count(curr_join->examined_rows);
@@ -3708,7 +3856,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
goto error;
/* Generate an execution plan from the found optimal join order. */
- DBUG_RETURN(join->thd->killed || get_best_combination(join));
+ DBUG_RETURN(join->thd->check_killed() || get_best_combination(join));
error:
/*
@@ -6399,8 +6547,7 @@ greedy_search(JOIN *join,
POSITION best_pos;
JOIN_TAB *best_table; // the next plan node to be added to the curr QEP
// ==join->tables or # tables in the sj-mat nest we're optimizing
- uint __attribute__((unused)) n_tables;
-
+ uint n_tables __attribute__((unused));
DBUG_ENTER("greedy_search");
/* number of tables that remain to be optimized */
@@ -6639,12 +6786,12 @@ double JOIN::get_examined_rows()
{
ha_rows examined_rows;
double prev_fanout= 1;
- JOIN_TAB *tab= first_breadth_first_tab(this);
+ JOIN_TAB *tab= first_breadth_first_tab(this, WALK_OPTIMIZATION_TABS);
JOIN_TAB *prev_tab= tab;
examined_rows= tab->get_examined_rows();
- while ((tab= next_breadth_first_tab(this, tab)))
+ while ((tab= next_breadth_first_tab(this, WALK_OPTIMIZATION_TABS, tab)))
{
prev_fanout *= prev_tab->records_read;
examined_rows+= (ha_rows) (tab->get_examined_rows() * prev_fanout);
@@ -6783,7 +6930,7 @@ best_extension_by_limited_search(JOIN *join,
DBUG_ENTER("best_extension_by_limited_search");
THD *thd= join->thd;
- if (thd->killed) // Abort
+ if (thd->check_killed()) // Abort
DBUG_RETURN(TRUE);
DBUG_EXECUTE("opt", print_plan(join, idx, read_time, record_count, idx,
@@ -6940,7 +7087,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
{
DBUG_ENTER("find_best");
THD *thd= join->thd;
- if (thd->killed)
+ if (thd->check_killed())
DBUG_RETURN(TRUE);
if (!rest_tables)
{
@@ -7259,23 +7406,30 @@ prev_record_reads(POSITION *positions, uint idx, table_map found_ref)
Enumerate join tabs in breadth-first fashion, including const tables.
*/
-JOIN_TAB *first_breadth_first_tab(JOIN *join)
+JOIN_TAB *first_breadth_first_tab(JOIN *join, enum enum_exec_or_opt tabs_kind)
{
- return join->join_tab; /* There's always one (i.e. first) table */
+ /* There's always one (i.e. first) table */
+ return (tabs_kind == WALK_EXECUTION_TABS)? join->join_tab:
+ join->table_access_tabs;
}
-JOIN_TAB *next_breadth_first_tab(JOIN *join, JOIN_TAB *tab)
+JOIN_TAB *next_breadth_first_tab(JOIN *join, enum enum_exec_or_opt tabs_kind,
+ JOIN_TAB *tab)
{
+ JOIN_TAB* const first_top_tab= first_breadth_first_tab(join, tabs_kind);
+ const uint n_top_tabs_count= (tabs_kind == WALK_EXECUTION_TABS)?
+ join->top_join_tab_count:
+ join->top_table_access_tabs_count;
if (!tab->bush_root_tab)
{
/* We're at top level. Get the next top-level tab */
tab++;
- if (tab < join->join_tab + join->top_join_tab_count)
+ if (tab < first_top_tab + n_top_tabs_count)
return tab;
/* No more top-level tabs. Switch to enumerating SJM nest children */
- tab= join->join_tab;
+ tab= first_top_tab;
}
else
{
@@ -7299,7 +7453,7 @@ JOIN_TAB *next_breadth_first_tab(JOIN *join, JOIN_TAB *tab)
Ok, "tab" points to a top-level table, and we need to find the next SJM
nest and enter it.
*/
- for (; tab < join->join_tab + join->top_join_tab_count; tab++)
+ for (; tab < first_top_tab + n_top_tabs_count; tab++)
{
if (tab->bush_children)
return tab->bush_children->start;
@@ -7323,7 +7477,7 @@ JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables with_const
JOIN_TAB *next_top_level_tab(JOIN *join, JOIN_TAB *tab)
{
- tab= next_breadth_first_tab(join, tab);
+ tab= next_breadth_first_tab(join, WALK_EXECUTION_TABS, tab);
if (tab && tab->bush_root_tab)
tab= NULL;
return tab;
@@ -7623,6 +7777,13 @@ get_best_combination(JOIN *join)
join->top_join_tab_count= join->join_tab_ranges.head()->end -
join->join_tab_ranges.head()->start;
+ /*
+ Save pointers to select join tabs for SHOW EXPLAIN
+ */
+ join->table_access_tabs= join->join_tab;
+ join->top_table_access_tabs_count= join->top_join_tab_count;
+
+
update_depend_map(join);
DBUG_RETURN(0);
}
@@ -7866,6 +8027,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
j->ref.null_rejecting= 0;
j->ref.disable_cache= FALSE;
j->ref.null_ref_part= NO_REF_PART;
+ j->ref.const_ref_part_map= 0;
keyuse=org_keyuse;
store_key **ref_key= j->ref.key_copy;
@@ -7901,6 +8063,13 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
if (keyuse->null_rejecting)
j->ref.null_rejecting |= 1 << i;
keyuse_uses_no_tables= keyuse_uses_no_tables && !keyuse->used_tables;
+ /*
+ Todo: we should remove this check for thd->lex->describe on the next
+ line. With SHOW EXPLAIN code, EXPLAIN printout code no longer depends
+ on it. However, removing the check caused change in lots of query
+ plans! Does the optimizer depend on the contents of
+ table_ref->key_copy ? If yes, do we produce incorrect EXPLAINs?
+ */
if (!keyuse->val->used_tables() && !thd->lex->describe)
{ // Compare against constant
store_key_item tmp(thd,
@@ -7913,6 +8082,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
if (thd->is_fatal_error)
DBUG_RETURN(TRUE);
tmp.copy();
+ j->ref.const_ref_part_map |= key_part_map(1) << i ;
}
else
*ref_key++= get_store_key(thd,
@@ -8002,37 +8172,6 @@ get_store_key(THD *thd, KEYUSE *keyuse, table_map used_tables,
}
/**
- This function is only called for const items on fields which are keys.
-
- @return
- returns 1 if there was some conversion made when the field was stored.
-*/
-
-bool
-store_val_in_field(Field *field, Item *item, enum_check_fields check_flag)
-{
- bool error;
- TABLE *table= field->table;
- THD *thd= table->in_use;
- ha_rows cuted_fields=thd->cuted_fields;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
- table->write_set);
-
- /*
- we should restore old value of count_cuted_fields because
- store_val_in_field can be called from mysql_insert
- with select_insert, which make count_cuted_fields= 1
- */
- enum_check_fields old_count_cuted_fields= thd->count_cuted_fields;
- thd->count_cuted_fields= check_flag;
- error= item->save_in_field(field, 1);
- thd->count_cuted_fields= old_count_cuted_fields;
- dbug_tmp_restore_column_map(table->write_set, old_map);
- return error || cuted_fields != thd->cuted_fields;
-}
-
-
-/**
@details Initialize a JOIN as a query execution plan
that accesses a single table via a table scan.
@@ -8055,6 +8194,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *temp_table)
!(parent->join_tab_reexec= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB))))
DBUG_RETURN(TRUE); /* purecov: inspected */
+ // psergey-todo: here, save the pointer for original join_tabs.
join_tab= parent->join_tab_reexec;
table= &parent->table_reexec[0]; parent->table_reexec[0]= temp_table;
table_count= top_join_tab_count= 1;
@@ -10316,7 +10456,7 @@ ha_rows JOIN_TAB::get_examined_rows()
{
ha_rows examined_rows;
- if (select && select->quick)
+ if (select && select->quick && use_quick != 2)
examined_rows= select->quick->records;
else if (type == JT_NEXT || type == JT_ALL ||
type == JT_HASH || type ==JT_HASH_NEXT)
@@ -10370,9 +10510,18 @@ bool JOIN_TAB::preread_init()
mysql_handle_single_derived(join->thd->lex,
derived, DT_CREATE | DT_FILL))
return TRUE;
+
preread_init_done= TRUE;
if (select && select->quick)
select->quick->replace_handler(table->file);
+
+ DBUG_EXECUTE_IF("show_explain_probe_join_tab_preread",
+ if (dbug_user_var_equals_int(join->thd,
+ "show_explain_probe_select_id",
+ join->select_lex->select_number))
+ dbug_serve_apcs(join->thd, 1);
+ );
+
return FALSE;
}
@@ -10515,7 +10664,7 @@ void JOIN::join_free()
Optimization: if not EXPLAIN and we are done with the JOIN,
free all tables.
*/
- bool full= !(select_lex->uncacheable);
+ bool full= !(select_lex->uncacheable) && !(thd->lex->describe);
bool can_unlock= full;
DBUG_ENTER("JOIN::join_free");
@@ -10580,6 +10729,8 @@ void JOIN::cleanup(bool full)
{
DBUG_ENTER("JOIN::cleanup");
DBUG_PRINT("enter", ("full %u", (uint) full));
+
+ have_query_plan= QEP_DELETED;
if (table)
{
@@ -10600,9 +10751,22 @@ void JOIN::cleanup(bool full)
if (full)
{
+ JOIN_TAB *sort_tab= first_linear_tab(this, WITHOUT_CONST_TABLES);
+ if (pre_sort_join_tab)
+ {
+ if (sort_tab && sort_tab->select == pre_sort_join_tab->select)
+ {
+ pre_sort_join_tab->select= NULL;
+ }
+ else
+ clean_pre_sort_join_tab();
+ }
+
for (tab= first_linear_tab(this, WITH_CONST_TABLES); tab;
tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS))
+ {
tab->cleanup();
+ }
}
else
{
@@ -11877,9 +12041,9 @@ static int compare_fields_by_table_order(Item *field1,
bool outer_ref= 0;
Item_field *f1= (Item_field *) (field1->real_item());
Item_field *f2= (Item_field *) (field2->real_item());
- if (f1->const_item())
+ if (field1->const_item() || f1->const_item())
return 1;
- if (f2->const_item())
+ if (field2->const_item() || f2->const_item())
return -1;
if (f2->used_tables() & OUTER_REF_TABLE_BIT)
{
@@ -15465,7 +15629,7 @@ create_internal_tmp_table_from_heap(THD *thd, TABLE *table,
DBUG_EXECUTE_IF("raise_error", write_err= HA_ERR_FOUND_DUPP_KEY ;);
if (write_err)
goto err;
- if (thd->killed)
+ if (thd->check_killed())
{
thd->send_kill_message();
goto err_killed;
@@ -15724,6 +15888,14 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
else
{
DBUG_ASSERT(join->table_count);
+
+ DBUG_EXECUTE_IF("show_explain_probe_do_select",
+ if (dbug_user_var_equals_int(join->thd,
+ "show_explain_probe_select_id",
+ join->select_lex->select_number))
+ dbug_serve_apcs(join->thd, 1);
+ );
+
if (join->outer_ref_cond && !join->outer_ref_cond->val_int())
error= NESTED_LOOP_NO_MORE_ROWS;
else
@@ -15854,7 +16026,7 @@ sub_select_cache(JOIN *join, JOIN_TAB *join_tab, bool end_of_records)
rc= sub_select(join, join_tab, end_of_records);
DBUG_RETURN(rc);
}
- if (join->thd->killed)
+ if (join->thd->check_killed())
{
/* The user has aborted the execution of the query */
join->thd->send_kill_message();
@@ -16141,7 +16313,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
DBUG_RETURN(NESTED_LOOP_ERROR);
if (error < 0)
DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
- if (join->thd->killed) // Aborted by user
+ if (join->thd->check_killed()) // Aborted by user
{
join->thd->send_kill_message();
DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */
@@ -16416,10 +16588,11 @@ int report_error(TABLE *table, int error)
Locking reads can legally return also these errors, do not
print them to the .err log
*/
- if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT
+ && !table->in_use->killed)
{
push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN, error,
- "Got error %d when reading table `%s`.`%s`",
+ "Got error %d when reading table %`s.%`s",
error, table->s->db.str, table->s->table_name.str);
sql_print_error("Got error %d when reading table '%s'",
error, table->s->path.str);
@@ -16885,6 +17058,14 @@ int read_first_record_seq(JOIN_TAB *tab)
static int
test_if_quick_select(JOIN_TAB *tab)
{
+ DBUG_EXECUTE_IF("show_explain_probe_test_if_quick_select",
+ if (dbug_user_var_equals_int(tab->join->thd,
+ "show_explain_probe_select_id",
+ tab->join->select_lex->select_number))
+ dbug_serve_apcs(tab->join->thd, 1);
+ );
+
+
delete tab->select->quick;
tab->select->quick=0;
return tab->select->test_quick_select(tab->join->thd, tab->keys,
@@ -17124,7 +17305,25 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if ((error= join->result->send_data(*join->fields)))
DBUG_RETURN(error < 0 ? NESTED_LOOP_OK : NESTED_LOOP_ERROR);
}
- if (++join->send_records >= join->unit->select_limit_cnt &&
+
+ ++join->send_records;
+ if (join->send_records >= join->unit->select_limit_cnt &&
+ !join->do_send_rows)
+ {
+ /*
+ If filesort is used for sorting, stop after select_limit_cnt+1
+ records are read. Because of optimization in some cases it can
+ provide only select_limit_cnt+1 records.
+ */
+ if (join->order &&
+ join->sortorder &&
+ join->select_options & OPTION_FOUND_ROWS)
+ {
+ DBUG_PRINT("info", ("filesort NESTED_LOOP_QUERY_LIMIT"));
+ DBUG_RETURN(NESTED_LOOP_QUERY_LIMIT);
+ }
+ }
+ if (join->send_records >= join->unit->select_limit_cnt &&
join->do_send_rows)
{
if (join->select_options & OPTION_FOUND_ROWS)
@@ -17345,7 +17544,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
}
}
end:
- if (join->thd->killed)
+ if (join->thd->check_killed())
{
join->thd->send_kill_message();
DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */
@@ -17428,7 +17627,7 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
}
join->send_records++;
end:
- if (join->thd->killed)
+ if (join->thd->check_killed())
{
join->thd->send_kill_message();
DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */
@@ -17478,7 +17677,7 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
}
}
- if (join->thd->killed)
+ if (join->thd->check_killed())
{
join->thd->send_kill_message();
DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */
@@ -17556,7 +17755,7 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (join->procedure)
join->procedure->add();
end:
- if (join->thd->killed)
+ if (join->thd->check_killed())
{
join->thd->send_kill_message();
DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */
@@ -17636,7 +17835,7 @@ bool test_if_ref(Item *root_cond, Item_field *left_item,Item *right_item)
field->real_type() != MYSQL_TYPE_VARCHAR &&
(field->type() != MYSQL_TYPE_FLOAT || field->decimals() == 0))
{
- return !store_val_in_field(field, right_item, CHECK_FIELD_WARN);
+ return !right_item->save_in_field_no_warnings(field, 1);
}
}
}
@@ -18809,9 +19008,13 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
{
uint length= 0;
ha_rows examined_rows;
+ ha_rows found_rows;
+ ha_rows filesort_retval= HA_POS_ERROR;
TABLE *table;
SQL_SELECT *select;
JOIN_TAB *tab;
+ int err= 0;
+ bool quick_created= FALSE;
DBUG_ENTER("create_sort_index");
if (join->table_count == join->const_tables)
@@ -18819,6 +19022,43 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
tab= join->join_tab + join->const_tables;
table= tab->table;
select= tab->select;
+
+ JOIN_TAB *save_pre_sort_join_tab= NULL;
+ if (join->pre_sort_join_tab)
+ {
+ /*
+ we've already been in this function, and stashed away the original access
+ method in join->pre_sort_join_tab, restore it now.
+ */
+
+ /* First, restore state of the handler */
+ if (join->pre_sort_index != MAX_KEY)
+ {
+ if (table->file->ha_index_or_rnd_end())
+ goto err;
+ if (join->pre_sort_idx_pushed_cond)
+ {
+ table->file->idx_cond_push(join->pre_sort_index,
+ join->pre_sort_idx_pushed_cond);
+ }
+ }
+ else
+ {
+ if (table->file->ha_index_or_rnd_end() ||
+ table->file->ha_rnd_init(TRUE))
+ goto err;
+ }
+
+ /* Second, restore access method parameters */
+ tab->records= join->pre_sort_join_tab->records;
+ tab->select= join->pre_sort_join_tab->select;
+ tab->select_cond= join->pre_sort_join_tab->select_cond;
+ tab->type= join->pre_sort_join_tab->type;
+ tab->read_first_record= join->pre_sort_join_tab->read_first_record;
+
+ save_pre_sort_join_tab= join->pre_sort_join_tab;
+ join->pre_sort_join_tab= NULL;
+ }
/* Currently ORDER BY ... LIMIT is not supported in subqueries. */
DBUG_ASSERT(join->group_list || !join->is_in_subquery());
@@ -18874,6 +19114,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
get_quick_select_for_ref(thd, table, &tab->ref,
tab->found_records))))
goto err;
+ quick_created= TRUE;
}
}
@@ -18886,10 +19127,42 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
goto err;
if (table->s->tmp_table)
table->file->info(HA_STATUS_VARIABLE); // Get record count
- table->sort.found_records=filesort(thd, table,join->sortorder, length,
- select, filesort_limit, 0,
- &examined_rows);
- tab->records= table->sort.found_records; // For SQL_CALC_ROWS
+ filesort_retval= filesort(thd, table, join->sortorder, length,
+ select, filesort_limit, 0,
+ &examined_rows, &found_rows);
+ table->sort.found_records= filesort_retval;
+ tab->records= found_rows; // For SQL_CALC_ROWS
+
+ if (quick_created)
+ {
+ /* This will delete the quick select. */
+ select->cleanup();
+ }
+
+ if (!join->pre_sort_join_tab)
+ {
+ if (save_pre_sort_join_tab)
+ join->pre_sort_join_tab= save_pre_sort_join_tab;
+ else if (!(join->pre_sort_join_tab= (JOIN_TAB*)thd->alloc(sizeof(JOIN_TAB))))
+ goto err;
+ }
+
+ *(join->pre_sort_join_tab)= *tab;
+
+ if (table->file->inited == handler::INDEX)
+ {
+ // Save index #, save index condition
+ join->pre_sort_index= table->file->active_index;
+ join->pre_sort_idx_pushed_cond= table->file->pushed_idx_cond;
+ // no need to save key_read?
+ err= table->file->ha_index_end();
+ }
+ else
+ join->pre_sort_index= MAX_KEY;
+
+ /*TODO: here, close the index scan, cancel index-only read. */
+#if 0
+ /* MariaDB doesn't need the following: */
if (select)
{
/*
@@ -18906,23 +19179,83 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
tablesort_result_cache= table->sort.io_cache;
table->sort.io_cache= NULL;
- select->cleanup(); // filesort did select
- table->quick_keys.clear_all(); // as far as we cleanup select->quick
- table->intersect_keys.clear_all();
+ // select->cleanup(); // filesort did select
+ /*
+ If a quick object was created outside of create_sort_index()
+ that might be reused, then do not call select->cleanup() since
+ it will delete the quick object.
+ */
+ if (!keep_quick)
+ {
+ select->cleanup();
+ /*
+ The select object should now be ready for the next use. If it
+ is re-used then there exists a backup copy of this join tab
+ which has the pointer to it. The join tab will be restored in
+ JOIN::reset(). So here we just delete the pointer to it.
+ */
+ tab->select= NULL;
+ // If we deleted the quick select object we need to clear quick_keys
+ table->quick_keys.clear_all();
+ table->intersect_keys.clear_all();
+ }
+ // Restore the output resultset
table->sort.io_cache= tablesort_result_cache;
}
+#endif
+ tab->select=NULL;
tab->set_select_cond(NULL, __LINE__);
- tab->last_inner= 0;
- tab->first_unmatched= 0;
+// tab->last_inner= 0;
+// tab->first_unmatched= 0;
tab->type=JT_ALL; // Read with normal read_record
tab->read_first_record= join_init_read_record;
+ tab->table->file->ha_index_or_rnd_end();
+
+ if (err)
+ goto err;
+
tab->join->examined_rows+=examined_rows;
- table->disable_keyread(); // Restore if we used indexes
- DBUG_RETURN(table->sort.found_records == HA_POS_ERROR);
+ DBUG_RETURN(filesort_retval == HA_POS_ERROR);
err:
DBUG_RETURN(-1);
}
+void JOIN::clean_pre_sort_join_tab()
+{
+ //TABLE *table= pre_sort_join_tab->table;
+ /*
+ Note: we can come here for fake_select_lex object. That object will have
+ the table already deleted by st_select_lex_unit::cleanup().
+ We rely on that fake_select_lex didn't have quick select.
+ */
+#if 0
+ if (pre_sort_join_tab->select && pre_sort_join_tab->select->quick)
+ {
+ /*
+ We need to preserve tablesort's output resultset here, because
+ QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT (called by
+ SQL_SELECT::cleanup()) may free it assuming it's the result of the quick
+ select operation that we no longer need. Note that all the other parts of
+ this data structure are cleaned up when
+ QUICK_INDEX_MERGE_SELECT::get_next encounters end of data, so the next
+ SQL_SELECT::cleanup() call changes sort.io_cache alone.
+ */
+ IO_CACHE *tablesort_result_cache;
+
+ tablesort_result_cache= table->sort.io_cache;
+ table->sort.io_cache= NULL;
+ pre_sort_join_tab->select->cleanup();
+ table->quick_keys.clear_all(); // as far as we cleanup select->quick
+ table->intersect_keys.clear_all();
+ table->sort.io_cache= tablesort_result_cache;
+ }
+#endif
+ //table->disable_keyread(); // Restore if we used indexes
+ if (pre_sort_join_tab->select && pre_sort_join_tab->select->quick)
+ {
+ pre_sort_join_tab->select->cleanup();
+ }
+}
/*****************************************************************************
Remove duplicates from tmp table
This should be recoded to add a unique index to the table and remove
@@ -19041,7 +19374,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
error= file->ha_rnd_next(record);
for (;;)
{
- if (thd->killed)
+ if (thd->check_killed())
{
thd->send_kill_message();
error=0;
@@ -19173,7 +19506,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
for (;;)
{
uchar *org_key_pos;
- if (thd->killed)
+ if (thd->check_killed())
{
thd->send_kill_message();
error=0;
@@ -19249,7 +19582,7 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length,
pos= sort= sortorder;
if (!pos)
- return 0;
+ DBUG_RETURN(0);
for (;order;order=order->next,pos++)
{
@@ -19266,6 +19599,7 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length,
else
pos->item= *order->item;
pos->reverse=! order->asc;
+ DBUG_ASSERT(pos->field != NULL || pos->item != NULL);
}
*length=count;
DBUG_RETURN(sort);
@@ -21194,29 +21528,155 @@ void JOIN::clear()
}
}
+
+/*
+ Print an EXPLAIN line with all NULLs and given message in the 'Extra' column
+*/
+int print_explain_message_line(select_result_sink *result,
+ SELECT_LEX *select_lex,
+ bool on_the_fly,
+ uint8 options,
+ const char *message)
+{
+ const CHARSET_INFO *cs= system_charset_info;
+ Item *item_null= new Item_null();
+ List<Item> item_list;
+
+ if (on_the_fly)
+ select_lex->set_explain_type(on_the_fly);
+
+ item_list.push_back(new Item_int((int32)
+ select_lex->select_number));
+ item_list.push_back(new Item_string(select_lex->type,
+ strlen(select_lex->type), cs));
+ for (uint i=0 ; i < 7; i++)
+ item_list.push_back(item_null);
+ if (options & DESCRIBE_PARTITIONS)
+ item_list.push_back(item_null);
+ if (options & DESCRIBE_EXTENDED)
+ item_list.push_back(item_null);
+
+ item_list.push_back(new Item_string(message,strlen(message),cs));
+
+ if (result->send_data(item_list))
+ return 1;
+ return 0;
+}
+
+
+int print_fake_select_lex_join(select_result_sink *result, bool on_the_fly,
+ SELECT_LEX *select_lex, uint8 explain_flags)
+{
+ const CHARSET_INFO *cs= system_charset_info;
+ Item *item_null= new Item_null();
+ List<Item> item_list;
+ if (on_the_fly)
+ select_lex->set_explain_type(on_the_fly);
+ /*
+ here we assume that the query will return at least two rows, so we
+ show "filesort" in EXPLAIN. Of course, sometimes we'll be wrong
+ and no filesort will be actually done, but executing all selects in
+ the UNION to provide precise EXPLAIN information will hardly be
+ appreciated :)
+ */
+ char table_name_buffer[SAFE_NAME_LEN];
+ item_list.empty();
+ /* id */
+ item_list.push_back(new Item_null);
+ /* select_type */
+ item_list.push_back(new Item_string(select_lex->type,
+ strlen(select_lex->type),
+ cs));
+ /* table */
+ {
+ SELECT_LEX *sl= select_lex->master_unit()->first_select();
+ uint len= 6, lastop= 0;
+ memcpy(table_name_buffer, STRING_WITH_LEN("<union"));
+ for (; sl && len + lastop + 5 < NAME_LEN; sl= sl->next_select())
+ {
+ len+= lastop;
+ lastop= my_snprintf(table_name_buffer + len, NAME_LEN - len,
+ "%u,", sl->select_number);
+ }
+ if (sl || len + lastop >= NAME_LEN)
+ {
+ memcpy(table_name_buffer + len, STRING_WITH_LEN("...>") + 1);
+ len+= 4;
+ }
+ else
+ {
+ len+= lastop;
+ table_name_buffer[len - 1]= '>'; // change ',' to '>'
+ }
+ item_list.push_back(new Item_string(table_name_buffer, len, cs));
+ }
+ /* partitions */
+ if (explain_flags & DESCRIBE_PARTITIONS)
+ item_list.push_back(item_null);
+ /* type */
+ item_list.push_back(new Item_string(join_type_str[JT_ALL],
+ strlen(join_type_str[JT_ALL]),
+ cs));
+ /* possible_keys */
+ item_list.push_back(item_null);
+ /* key*/
+ item_list.push_back(item_null);
+ /* key_len */
+ item_list.push_back(item_null);
+ /* ref */
+ item_list.push_back(item_null);
+ /* in_rows */
+ if (explain_flags & DESCRIBE_EXTENDED)
+ item_list.push_back(item_null);
+ /* rows */
+ item_list.push_back(item_null);
+ /* extra */
+ if (select_lex->master_unit()->global_parameters->order_list.first)
+ item_list.push_back(new Item_string("Using filesort",
+ 14, cs));
+ else
+ item_list.push_back(new Item_string("", 0, cs));
+
+ if (result->send_data(item_list))
+ return 1;
+ return 0;
+}
+
+
/**
EXPLAIN handling.
- Send a description about what how the select will be done to stdout.
+ Produce lines explaining execution of *this* select (not including children
+ selects)
+ @param on_the_fly TRUE <=> we're being executed on-the-fly, so don't make
+ modifications to any select's data structures
*/
-static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
- bool distinct,const char *message)
+int JOIN::print_explain(select_result_sink *result, uint8 explain_flags,
+ bool on_the_fly,
+ bool need_tmp_table, bool need_order,
+ bool distinct, const char *message)
{
List<Item> field_list;
List<Item> item_list;
+ JOIN *join= this; /* Legacy: this code used to be a non-member function */
THD *thd=join->thd;
- select_result *result=join->result;
Item *item_null= new Item_null();
CHARSET_INFO *cs= system_charset_info;
int quick_type;
- DBUG_ENTER("select_describe");
+ int error= 0;
+ DBUG_ENTER("JOIN::print_explain");
DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s",
(ulong)join->select_lex, join->select_lex->type,
message ? message : "NULL"));
+ DBUG_ASSERT(on_the_fly? have_query_plan == QEP_AVAILABLE: TRUE);
/* Don't log this into the slow query log */
- thd->server_status&= ~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED);
- join->unit->offset_limit_cnt= 0;
+
+ if (!on_the_fly)
+ {
+ thd->server_status&= ~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED);
+ join->unit->offset_limit_cnt= 0;
+ }
/*
NOTE: the number/types of items pushed into item_list must be in sync with
@@ -21224,101 +21684,32 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
*/
if (message)
{
- item_list.push_back(new Item_int((int32)
- join->select_lex->select_number));
- item_list.push_back(new Item_string(join->select_lex->type,
- strlen(join->select_lex->type), cs));
- for (uint i=0 ; i < 7; i++)
- item_list.push_back(item_null);
- if (join->thd->lex->describe & DESCRIBE_PARTITIONS)
- item_list.push_back(item_null);
- if (join->thd->lex->describe & DESCRIBE_EXTENDED)
- item_list.push_back(item_null);
-
- item_list.push_back(new Item_string(message,strlen(message),cs));
- if (result->send_data(item_list))
- join->error= 1;
+ if (print_explain_message_line(result, join->select_lex, on_the_fly,
+ explain_flags, message))
+ error= 1;
+
}
else if (join->select_lex == join->unit->fake_select_lex)
{
- /*
- here we assume that the query will return at least two rows, so we
- show "filesort" in EXPLAIN. Of course, sometimes we'll be wrong
- and no filesort will be actually done, but executing all selects in
- the UNION to provide precise EXPLAIN information will hardly be
- appreciated :)
- */
- char table_name_buffer[SAFE_NAME_LEN];
- item_list.empty();
- /* id */
- item_list.push_back(new Item_null);
- /* select_type */
- item_list.push_back(new Item_string(join->select_lex->type,
- strlen(join->select_lex->type),
- cs));
- /* table */
- {
- SELECT_LEX *sl= join->unit->first_select();
- uint len= 6, lastop= 0;
- memcpy(table_name_buffer, STRING_WITH_LEN("<union"));
- for (; sl && len + lastop + 5 < NAME_LEN; sl= sl->next_select())
- {
- len+= lastop;
- lastop= my_snprintf(table_name_buffer + len, NAME_LEN - len,
- "%u,", sl->select_number);
- }
- if (sl || len + lastop >= NAME_LEN)
- {
- memcpy(table_name_buffer + len, STRING_WITH_LEN("...>") + 1);
- len+= 4;
- }
- else
- {
- len+= lastop;
- table_name_buffer[len - 1]= '>'; // change ',' to '>'
- }
- item_list.push_back(new Item_string(table_name_buffer, len, cs));
- }
- /* partitions */
- if (join->thd->lex->describe & DESCRIBE_PARTITIONS)
- item_list.push_back(item_null);
- /* type */
- item_list.push_back(new Item_string(join_type_str[JT_ALL],
- strlen(join_type_str[JT_ALL]),
- cs));
- /* possible_keys */
- item_list.push_back(item_null);
- /* key*/
- item_list.push_back(item_null);
- /* key_len */
- item_list.push_back(item_null);
- /* ref */
- item_list.push_back(item_null);
- /* in_rows */
- if (join->thd->lex->describe & DESCRIBE_EXTENDED)
- item_list.push_back(item_null);
- /* rows */
- item_list.push_back(item_null);
- /* extra */
- if (join->unit->global_parameters->order_list.first)
- item_list.push_back(new Item_string("Using filesort",
- 14, cs));
- else
- item_list.push_back(new Item_string("", 0, cs));
-
- if (result->send_data(item_list))
- join->error= 1;
+ if (print_fake_select_lex_join(result, on_the_fly,
+ join->select_lex,
+ explain_flags))
+ error= 1;
}
else if (!join->select_lex->master_unit()->derived ||
join->select_lex->master_unit()->derived->is_materialized_derived())
{
table_map used_tables=0;
+ //if (!join->select_lex->type)
+ if (on_the_fly)
+ join->select_lex->set_explain_type(on_the_fly);
bool printing_materialize_nest= FALSE;
uint select_id= join->select_lex->select_number;
+ JOIN_TAB* const first_top_tab= first_breadth_first_tab(join, WALK_OPTIMIZATION_TABS);
- for (JOIN_TAB *tab= first_breadth_first_tab(join); tab;
- tab= next_breadth_first_tab(join, tab))
+ for (JOIN_TAB *tab= first_breadth_first_tab(join, WALK_OPTIMIZATION_TABS); tab;
+ tab= next_breadth_first_tab(join, WALK_OPTIMIZATION_TABS, tab))
{
if (tab->bush_root_tab)
{
@@ -21350,6 +21741,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
tmp3.length(0);
tmp4.length(0);
quick_type= -1;
+ QUICK_SELECT_I *quick= NULL;
+ JOIN_TAB *saved_join_tab= NULL;
/* Don't show eliminated tables */
if (table->map & join->eliminated_tables)
@@ -21358,6 +21751,13 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
continue;
}
+ if (join->table_access_tabs == join->join_tab &&
+ tab == (first_top_tab + join->const_tables) && pre_sort_join_tab)
+ {
+ saved_join_tab= tab;
+ tab= pre_sort_join_tab;
+ }
+
item_list.empty();
/* id */
item_list.push_back(new Item_uint((uint32)select_id));
@@ -21366,17 +21766,19 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
join->select_lex->type;
item_list.push_back(new Item_string(stype, strlen(stype), cs));
+ enum join_type tab_type= tab->type;
if ((tab->type == JT_ALL || tab->type == JT_HASH) &&
- tab->select && tab->select->quick)
+ tab->select && tab->select->quick && tab->use_quick != 2)
{
+ quick= tab->select->quick;
quick_type= tab->select->quick->get_type();
if ((quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE) ||
(quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_INTERSECT) ||
(quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT) ||
(quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION))
- tab->type= tab->type == JT_ALL ? JT_INDEX_MERGE : JT_HASH_INDEX_MERGE;
+ tab_type= tab->type == JT_ALL ? JT_INDEX_MERGE : JT_HASH_INDEX_MERGE;
else
- tab->type= tab->type == JT_ALL ? JT_RANGE : JT_HASH_RANGE;
+ tab_type= tab->type == JT_ALL ? JT_RANGE : JT_HASH_RANGE;
}
/* table */
@@ -21401,19 +21803,11 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
else
{
TABLE_LIST *real_table= table->pos_in_table_list;
- /*
- Internal temporary tables have no corresponding table reference
- object. Such a table may appear in EXPLAIN when a subquery that needs
- a temporary table has been executed, and JOIN::exec replaced the
- original JOIN with a plan to access the data in the temp table
- (made by JOIN::make_simple_join).
- */
- const char *tab_name= real_table ? real_table->alias :
- "internal_tmp_table";
- item_list.push_back(new Item_string(tab_name, strlen(tab_name), cs));
+ item_list.push_back(new Item_string(real_table->alias,
+ strlen(real_table->alias), cs));
}
/* "partitions" column */
- if (join->thd->lex->describe & DESCRIBE_PARTITIONS)
+ if (explain_flags & DESCRIBE_PARTITIONS)
{
#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *part_info;
@@ -21432,8 +21826,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
#endif
}
/* "type" column */
- item_list.push_back(new Item_string(join_type_str[tab->type],
- strlen(join_type_str[tab->type]),
+ item_list.push_back(new Item_string(join_type_str[tab_type],
+ strlen(join_type_str[tab_type]),
cs));
/* Build "possible_keys" value and add it to item_list */
if (!tab->keys.is_clear_all())
@@ -21457,7 +21851,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
item_list.push_back(item_null);
/* Build "key", "key_len", and "ref" values and add them to item_list */
- if (tab->type == JT_NEXT)
+ if (tab_type == JT_NEXT)
{
key_info= table->key_info+tab->index;
key_len= key_info->key_length;
@@ -21476,22 +21870,30 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
length= (longlong10_to_str(key_len, keylen_str_buf, 10) -
keylen_str_buf);
tmp3.append(keylen_str_buf, length, cs);
- if (tab->ref.key_parts)
+ if (tab->ref.key_parts && tab_type != JT_FT)
{
- for (store_key **ref=tab->ref.key_copy ; *ref ; ref++)
+ store_key **ref=tab->ref.key_copy;
+ for (uint kp= 0; kp < tab->ref.key_parts; kp++)
{
if (tmp4.length())
tmp4.append(',');
- tmp4.append((*ref)->name(), strlen((*ref)->name()), cs);
+
+ if ((key_part_map(1) << kp) & tab->ref.const_ref_part_map)
+ tmp4.append("const");
+ else
+ {
+ tmp4.append((*ref)->name(), strlen((*ref)->name()), cs);
+ ref++;
+ }
}
}
}
- if (is_hj && tab->type != JT_HASH)
+ if (is_hj && tab_type != JT_HASH)
{
tmp2.append(':');
tmp3.append(':');
}
- if (tab->type == JT_HASH_NEXT)
+ if (tab_type == JT_HASH_NEXT)
{
register uint length;
key_info= table->key_info+tab->index;
@@ -21500,15 +21902,10 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
length= (longlong10_to_str(key_len, keylen_str_buf, 10) -
keylen_str_buf);
tmp3.append(keylen_str_buf, length, cs);
-/*<<<<<<< TREE
- }
- if ((is_hj || tab->type==JT_RANGE || tab->type == JT_INDEX_MERGE) &&
- tab->select && tab->select->quick)
-=======*/
}
- if (tab->type != JT_CONST && tab->select && tab->select->quick)
+ if (tab->type != JT_CONST && tab->select && quick)
tab->select->quick->add_keys_and_lengths(&tmp2, &tmp3);
- if (key_info || (tab->select && tab->select->quick))
+ if (key_info || (tab->select && quick))
{
if (tmp2.length())
item_list.push_back(new Item_string(tmp2.ptr(),tmp2.length(),cs));
@@ -21518,7 +21915,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
item_list.push_back(new Item_string(tmp3.ptr(),tmp3.length(),cs));
else
item_list.push_back(item_null);
- if (key_info && tab->type != JT_NEXT)
+ if (key_info && tab_type != JT_NEXT)
item_list.push_back(new Item_string(tmp4.ptr(),tmp4.length(),cs));
else
item_list.push_back(item_null);
@@ -21561,7 +21958,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
table_list->schema_table)
{
/* in_rows */
- if (join->thd->lex->describe & DESCRIBE_EXTENDED)
+ if (explain_flags & DESCRIBE_EXTENDED)
item_list.push_back(item_null);
/* rows */
item_list.push_back(item_null);
@@ -21574,7 +21971,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
MY_INT64_NUM_DECIMAL_DIGITS));
/* Add "filtered" field to item_list. */
- if (join->thd->lex->describe & DESCRIBE_EXTENDED)
+ if (explain_flags & DESCRIBE_EXTENDED)
{
float f= 0.0;
if (examined_rows)
@@ -21586,11 +21983,11 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
/* Build "Extra" field and add it to item_list. */
key_read=table->key_read;
- if ((tab->type == JT_NEXT || tab->type == JT_CONST) &&
+ if ((tab_type == JT_NEXT || tab_type == JT_CONST) &&
table->covering_keys.is_set(tab->index))
key_read=1;
if (quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT &&
- !((QUICK_ROR_INTERSECT_SELECT*)tab->select->quick)->need_to_fetch_row)
+ !((QUICK_ROR_INTERSECT_SELECT*)quick)->need_to_fetch_row)
key_read=1;
if (tab->info)
@@ -21618,8 +22015,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
uint keyno= MAX_KEY;
if (tab->ref.key_parts)
keyno= tab->ref.key;
- else if (tab->select && tab->select->quick)
- keyno = tab->select->quick->index;
+ else if (tab->select && quick)
+ keyno = quick->index;
if (keyno != MAX_KEY && keyno == table->file->pushed_idx_cond_keyno &&
table->file->pushed_idx_cond)
@@ -21658,7 +22055,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{
extra.append(STRING_WITH_LEN("; Using where with pushed "
"condition"));
- if (thd->lex->describe & DESCRIBE_EXTENDED)
+ if (explain_flags & DESCRIBE_EXTENDED)
{
extra.append(STRING_WITH_LEN(": "));
((COND *)pushed_cond)->print(&extra, QT_ORDINARY);
@@ -21751,7 +22148,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
extra.append(STRING_WITH_LEN("; End temporary"));
else if (tab->do_firstmatch)
{
- if (tab->do_firstmatch == join->join_tab - 1)
+ if (tab->do_firstmatch == /*join->join_tab*/ first_top_tab - 1)
extra.append(STRING_WITH_LEN("; FirstMatch"));
else
{
@@ -21798,12 +22195,34 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
item_list.push_back(new Item_string(str, len, cs));
}
+ if (saved_join_tab)
+ tab= saved_join_tab;
+
// For next iteration
used_tables|=table->map;
if (result->send_data(item_list))
- join->error= 1;
+ error= 1;
}
}
+ DBUG_RETURN(error);
+}
+
+
+/*
+ See st_select_lex::print_explain() for the SHOW EXPLAIN counterpart
+*/
+
+static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
+ bool distinct,const char *message)
+{
+ THD *thd=join->thd;
+ select_result *result=join->result;
+ DBUG_ENTER("select_describe");
+ join->error= join->print_explain(result, thd->lex->describe,
+ FALSE, /* Not on-the-fly */
+ need_tmp_table, need_order, distinct,
+ message);
+
for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit();
unit;
unit= unit->next_unit())
@@ -21846,7 +22265,7 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
for (SELECT_LEX *sl= first; sl; sl= sl->next_select())
{
- sl->set_explain_type();
+ sl->set_explain_type(FALSE);
sl->options|= SELECT_DESCRIBE;
}
diff --git a/sql/sql_select.h b/sql/sql_select.h
index fa990d8a709..586019cae23 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -92,6 +92,13 @@ typedef struct st_table_ref
uchar *key_buff; ///< value to look for with key
uchar *key_buff2; ///< key_buff+key_length
store_key **key_copy; //
+
+ /*
+ Bitmap of key parts which refer to constants. key_copy only has copiers for
+ non-const key parts.
+ */
+ key_part_map const_ref_part_map;
+
Item **items; ///< val()'s for each keypart
/*
Array of pointers to trigger variables. Some/all of the pointers may be
@@ -888,6 +895,27 @@ protected:
public:
JOIN_TAB *join_tab, **best_ref;
+ /*
+ For "Using temporary+Using filesort" queries, JOIN::join_tab can point to
+ either:
+ 1. array of join tabs describing how to run the select, or
+ 2. array of single join tab describing read from the temporary table.
+
+ SHOW EXPLAIN code needs to read/show #1. This is why two next members are
+ there for saving it.
+ */
+ JOIN_TAB *table_access_tabs;
+ uint top_table_access_tabs_count;
+
+ /*
+ Saved join_tab for pre_sorting. create_sort_index() will save here..
+ */
+ JOIN_TAB *pre_sort_join_tab;
+ uint pre_sort_index;
+ Item *pre_sort_idx_pushed_cond;
+ void clean_pre_sort_join_tab();
+
+
JOIN_TAB **map2table; ///< mapping between table indexes and JOIN_TABs
JOIN_TAB *join_tab_save; ///< saved join_tab for subquery reexecution
@@ -1153,8 +1181,14 @@ public:
const char *zero_result_cause; ///< not 0 if exec must return zero result
bool union_part; ///< this subselect is part of union
+
+ enum join_optimization_state { NOT_OPTIMIZED=0,
+ OPTIMIZATION_IN_PROGRESS=1,
+ OPTIMIZATION_DONE=2};
bool optimized; ///< flag to avoid double optimization in EXPLAIN
bool initialized; ///< flag to avoid double init_execution calls
+
+ enum { QEP_NOT_PRESENT_YET, QEP_AVAILABLE, QEP_DELETED} have_query_plan;
/*
Additional WHERE and HAVING predicates to be considered for IN=>EXISTS
@@ -1237,6 +1271,7 @@ public:
ref_pointer_array_size= 0;
zero_result_cause= 0;
optimized= 0;
+ have_query_plan= QEP_NOT_PRESENT_YET;
initialized= 0;
cond_equal= 0;
having_equal= 0;
@@ -1257,6 +1292,8 @@ public:
outer_ref_cond= pseudo_bits_cond= NULL;
in_to_exists_where= NULL;
in_to_exists_having= NULL;
+
+ pre_sort_join_tab= NULL;
}
int prepare(Item ***rref_pointer_array, TABLE_LIST *tables, uint wind_num,
@@ -1265,9 +1302,11 @@ public:
SELECT_LEX_UNIT *unit);
bool prepare_stage2();
int optimize();
+ int optimize_inner();
int reinit();
int init_execution();
void exec();
+ void exec_inner();
int destroy();
void restore_tmp();
bool alloc_func_list();
@@ -1381,6 +1420,11 @@ public:
{
return (unit->item && unit->item->is_in_predicate());
}
+
+ int print_explain(select_result_sink *result, uint8 explain_flags,
+ bool on_the_fly,
+ bool need_tmp_table, bool need_order,
+ bool distinct,const char *message);
private:
/**
TRUE if the query contains an aggregate function but has no GROUP
@@ -1408,7 +1452,6 @@ typedef struct st_select_check {
extern const char *join_type_str[];
/* Extern functions in sql_select.cc */
-bool store_val_in_field(Field *field, Item *val, enum_check_fields check_flag);
void count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param,
List<Item> &fields, bool reset_with_sum_func);
bool setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
@@ -1482,6 +1525,7 @@ public:
enum_check_fields saved_count_cuted_fields= thd->count_cuted_fields;
ulonglong sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
+ thd->variables.sql_mode|= MODE_INVALID_DATES;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
@@ -1732,6 +1776,9 @@ inline bool optimizer_flag(THD *thd, uint flag)
return (thd->variables.optimizer_switch & flag);
}
+int print_fake_select_lex_join(select_result_sink *result, bool on_the_fly,
+ SELECT_LEX *select_lex, uint8 select_options);
+
uint get_index_for_order(ORDER *order, TABLE *table, SQL_SELECT *select,
ha_rows limit, bool *need_sort, bool *reverse);
ORDER *simple_remove_const(ORDER *order, COND *where);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 903dc0d9cf2..2a82ae115a0 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -660,6 +660,7 @@ public:
break;
case ER_NO_SUCH_TABLE:
+ case ER_NO_SUCH_TABLE_IN_ENGINE:
/* Established behavior: warn if underlying tables are missing. */
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_VIEW_INVALID,
@@ -992,9 +993,13 @@ static const char *require_quotes(const char *name, uint name_length)
packet target string
name the identifier to be appended
name_length length of the appending identifier
+
+ RETURN VALUES
+ true Error
+ false Ok
*/
-void
+bool
append_identifier(THD *thd, String *packet, const char *name, uint length)
{
const char *name_end;
@@ -1002,10 +1007,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
int q= get_quote_char_for_identifier(thd, name, length);
if (q == EOF)
- {
- packet->append(name, length, packet->charset());
- return;
- }
+ return packet->append(name, length, packet->charset());
/*
The identifier must be quoted as it includes a quote character or
@@ -1014,7 +1016,8 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
(void) packet->reserve(length*2 + 2);
quote_char= (char) q;
- packet->append(&quote_char, 1, system_charset_info);
+ if (packet->append(&quote_char, 1, system_charset_info))
+ return true;
for (name_end= name+length ; name < name_end ; name+= length)
{
@@ -1029,11 +1032,13 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
*/
if (!length)
length= 1;
- if (length == 1 && chr == (uchar) quote_char)
- packet->append(&quote_char, 1, system_charset_info);
- packet->append(name, length, system_charset_info);
+ if (length == 1 && chr == (uchar) quote_char &&
+ packet->append(&quote_char, 1, system_charset_info))
+ return true;
+ if (packet->append(name, length, system_charset_info))
+ return true;
}
- packet->append(&quote_char, 1, system_charset_info);
+ return packet->append(&quote_char, 1, system_charset_info);
}
@@ -1998,6 +2003,166 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
DBUG_VOID_RETURN;
}
+
+/*
+ Produce EXPLAIN data.
+
+ This function is APC-scheduled to be run in the context of the thread that
+ we're producing EXPLAIN for.
+*/
+
+void Show_explain_request::call_in_target_thread()
+{
+ Query_arena backup_arena;
+ bool printed_anything= FALSE;
+
+ /*
+ Change the arena because JOIN::print_explain and co. are going to allocate
+ items. Let them allocate them on our arena.
+ */
+ target_thd->set_n_backup_active_arena((Query_arena*)request_thd,
+ &backup_arena);
+
+ query_str.copy(target_thd->query(),
+ target_thd->query_length(),
+ target_thd->query_charset());
+
+ if (target_thd->lex->unit.print_explain(explain_buf, 0 /* explain flags*/,
+ &printed_anything))
+ {
+ failed_to_produce= TRUE;
+ }
+
+ if (!printed_anything)
+ failed_to_produce= TRUE;
+
+ target_thd->restore_active_arena((Query_arena*)request_thd, &backup_arena);
+}
+
+
+int select_result_explain_buffer::send_data(List<Item> &items)
+{
+ fill_record(thd, dst_table->field, items, TRUE, FALSE);
+ if ((dst_table->file->ha_write_tmp_row(dst_table->record[0])))
+ return 1;
+ return 0;
+}
+
+
+/*
+ Store the SHOW EXPLAIN output in the temporary table.
+*/
+
+int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond)
+{
+ const char *calling_user;
+ THD *tmp;
+ my_thread_id thread_id;
+ DBUG_ENTER("fill_show_explain");
+
+ DBUG_ASSERT(cond==NULL);
+ thread_id= thd->lex->value_list.head()->val_int();
+ calling_user= (thd->security_ctx->master_access & PROCESS_ACL) ? NullS :
+ thd->security_ctx->priv_user;
+
+ if ((tmp= find_thread_by_id(thread_id)))
+ {
+ Security_context *tmp_sctx= tmp->security_ctx;
+ /*
+ If calling_user==NULL, calling thread has SUPER or PROCESS
+ privilege, and so can do SHOW EXPLAIN on any user.
+
+ if calling_user!=NULL, he's only allowed to view SHOW EXPLAIN on
+ his own threads.
+ */
+ if (calling_user && (!tmp_sctx->user || strcmp(calling_user,
+ tmp_sctx->user)))
+ {
+ my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "PROCESS");
+ mysql_mutex_unlock(&tmp->LOCK_thd_data);
+ DBUG_RETURN(1);
+ }
+
+ if (tmp == thd)
+ {
+ mysql_mutex_unlock(&tmp->LOCK_thd_data);
+ my_error(ER_TARGET_NOT_EXPLAINABLE, MYF(0));
+ DBUG_RETURN(1);
+ }
+
+ bool bres;
+ /*
+ Ok we've found the thread of interest and it won't go away because
+ we're holding its LOCK_thd data. Post it a SHOW EXPLAIN request.
+ */
+ bool timed_out;
+ int timeout_sec= 30;
+ Show_explain_request explain_req;
+ select_result_explain_buffer *explain_buf;
+
+ explain_buf= new select_result_explain_buffer(thd, table->table);
+
+ explain_req.explain_buf= explain_buf;
+ explain_req.target_thd= tmp;
+ explain_req.request_thd= thd;
+ explain_req.failed_to_produce= FALSE;
+
+ /* Ok, we have a lock on target->LOCK_thd_data, can call: */
+ bres= tmp->apc_target.make_apc_call(thd, &explain_req, timeout_sec, &timed_out);
+
+ if (bres || explain_req.failed_to_produce)
+ {
+ if (thd->killed)
+ thd->send_kill_message();
+ else if (timed_out)
+ my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
+ else
+ my_error(ER_TARGET_NOT_EXPLAINABLE, MYF(0));
+
+ bres= TRUE;
+ }
+ else
+ {
+ /*
+ Push the query string as a warning. The query may be in a different
+ charset than the charset that's used for error messages, so, convert it
+ if needed.
+ */
+ CHARSET_INFO *fromcs= explain_req.query_str.charset();
+ CHARSET_INFO *tocs= error_message_charset_info;
+ char *warning_text;
+ if (!my_charset_same(fromcs, tocs))
+ {
+ uint conv_length= 1 + tocs->mbmaxlen * explain_req.query_str.length() /
+ fromcs->mbminlen;
+ uint dummy_errors;
+ char *to, *p;
+ if (!(to= (char*)thd->alloc(conv_length + 1)))
+ DBUG_RETURN(1);
+ p= to;
+ p+= copy_and_convert(to, conv_length, tocs,
+ explain_req.query_str.c_ptr(),
+ explain_req.query_str.length(), fromcs,
+ &dummy_errors);
+ *p= 0;
+ warning_text= to;
+ }
+ else
+ warning_text= explain_req.query_str.c_ptr_safe();
+
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_YES, warning_text);
+ }
+ DBUG_RETURN(bres);
+ }
+ else
+ {
+ my_error(ER_NO_SUCH_THREAD, MYF(0), thread_id);
+ DBUG_RETURN(1);
+ }
+}
+
+
int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
{
TABLE *table= tables->table;
@@ -2330,6 +2495,7 @@ static bool show_status_array(THD *thd, const char *wild,
for (; variables->name; variables++)
{
+ bool wild_checked;
strnmov(prefix_end, variables->name, len);
name_buffer[sizeof(name_buffer)-1]=0; /* Safety */
if (ucase_names)
@@ -2338,11 +2504,25 @@ static bool show_status_array(THD *thd, const char *wild,
restore_record(table, s->default_values);
table->field[0]->store(name_buffer, strlen(name_buffer),
system_charset_info);
+
/*
- if var->type is SHOW_FUNC, call the function.
- Repeat as necessary, if new var is again SHOW_FUNC
+ Compare name for types that can't return arrays. We do this to not
+ calculate the value for function variables that we will not access
*/
- for (var=variables; var->type == SHOW_FUNC; var= &tmp)
+ if ((variables->type != SHOW_FUNC && variables->type != SHOW_ARRAY))
+ {
+ if (wild && wild[0] && wild_case_compare(system_charset_info,
+ name_buffer, wild))
+ continue;
+ wild_checked= 1; // Avoid checking it again
+ }
+
+ /*
+ if var->type is SHOW_FUNC or SHOW_SIMPLE_FUNC, call the function.
+ Repeat as necessary, if new var is again one of the above
+ */
+ for (var=variables; var->type == SHOW_FUNC ||
+ var->type == SHOW_SIMPLE_FUNC; var= &tmp)
((mysql_show_var_func)(var->value))(thd, &tmp, buff);
SHOW_TYPE show_type=var->type;
@@ -2353,8 +2533,9 @@ static bool show_status_array(THD *thd, const char *wild,
}
else
{
- if (!(wild && wild[0] && wild_case_compare(system_charset_info,
- name_buffer, wild)) &&
+ if ((wild_checked ||
+ (wild && wild[0] && wild_case_compare(system_charset_info,
+ name_buffer, wild))) &&
(!partial_cond || partial_cond->val_int()))
{
char *value=var->value;
@@ -3225,9 +3406,12 @@ int make_db_list(THD *thd, List<LEX_STRING> *files,
/*
If we have db lookup vaule we just add it to list and
- exit from the function
+ exit from the function.
+ We don't do this for database names longer than the maximum
+ path length.
*/
- if (lookup_field_vals->db_value.str)
+ if (lookup_field_vals->db_value.str &&
+ lookup_field_vals->db_value.length < FN_REFLEN)
{
if (is_infoschema_db(lookup_field_vals->db_value.str,
lookup_field_vals->db_value.length))
@@ -8309,6 +8493,32 @@ ST_FIELD_INFO keycache_fields_info[]=
};
+ST_FIELD_INFO show_explain_fields_info[]=
+{
+ /* field_name, length, type, value, field_flags, old_name*/
+ {"id", 3, MYSQL_TYPE_LONGLONG, 0 /*value*/, MY_I_S_MAYBE_NULL, "id",
+ SKIP_OPEN_TABLE},
+ {"select_type", 19, MYSQL_TYPE_STRING, 0 /*value*/, 0, "select_type",
+ SKIP_OPEN_TABLE},
+ {"table", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0 /*value*/, MY_I_S_MAYBE_NULL,
+ "table", SKIP_OPEN_TABLE},
+ {"type", 15, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, "type", SKIP_OPEN_TABLE},
+ {"possible_keys", NAME_CHAR_LEN*MAX_KEY, MYSQL_TYPE_STRING, 0/*value*/,
+ MY_I_S_MAYBE_NULL, "possible_keys", SKIP_OPEN_TABLE},
+ {"key", NAME_CHAR_LEN*MAX_KEY, MYSQL_TYPE_STRING, 0/*value*/,
+ MY_I_S_MAYBE_NULL, "key", SKIP_OPEN_TABLE},
+ {"key_len", NAME_CHAR_LEN*MAX_KEY, MYSQL_TYPE_STRING, 0/*value*/,
+ MY_I_S_MAYBE_NULL, "key_len", SKIP_OPEN_TABLE},
+ {"ref", NAME_CHAR_LEN*MAX_REF_PARTS, MYSQL_TYPE_STRING, 0/*value*/,
+ MY_I_S_MAYBE_NULL, "ref", SKIP_OPEN_TABLE},
+ {"rows", 10, MYSQL_TYPE_LONGLONG, 0/*value*/, MY_I_S_MAYBE_NULL, "rows",
+ SKIP_OPEN_TABLE},
+ {"Extra", 255, MYSQL_TYPE_STRING, 0/*value*/, 0 /*flags*/, "Extra",
+ SKIP_OPEN_TABLE},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+};
+
+
/*
Description of ST_FIELD_INFO in table.h
@@ -8340,6 +8550,8 @@ ST_SCHEMA_TABLE schema_tables[]=
{"EVENTS", events_fields_info, create_schema_table,
0, make_old_format, 0, -1, -1, 0, 0},
#endif
+ {"EXPLAIN", show_explain_fields_info, create_schema_table, fill_show_explain,
+ make_old_format, 0, -1, -1, TRUE /*hidden*/ , 0},
{"FILES", files_fields_info, create_schema_table,
hton_fill_schema_table, 0, 0, -1, -1, 0, 0},
{"GLOBAL_STATUS", variables_fields_info, create_schema_table,
diff --git a/sql/sql_show.h b/sql/sql_show.h
index 8ad9327c08c..7541ed58e48 100644
--- a/sql/sql_show.h
+++ b/sql/sql_show.h
@@ -19,6 +19,7 @@
#include "sql_list.h" /* List */
#include "handler.h" /* enum_schema_tables */
#include "table.h" /* enum_schema_table_state */
+#include "my_apc.h"
/* Forward declarations */
class JOIN;
@@ -90,7 +91,7 @@ int view_store_create_info(THD *thd, TABLE_LIST *table, String *buff);
int copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table);
-void append_identifier(THD *thd, String *packet, const char *name,
+bool append_identifier(THD *thd, String *packet, const char *name,
uint length);
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);
@@ -131,5 +132,30 @@ enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
/* These functions were under INNODB_COMPATIBILITY_HOOKS */
int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
+THD *find_thread_by_id(ulong id);
+
+class select_result_explain_buffer;
+/*
+ SHOW EXPLAIN request object.
+*/
+
+class Show_explain_request : public Apc_target::Apc_call
+{
+public:
+ THD *target_thd; /* thd that we're running SHOW EXPLAIN for */
+ THD *request_thd; /* thd that run SHOW EXPLAIN command */
+
+ /* If true, there was some error when producing EXPLAIN output. */
+ bool failed_to_produce;
+
+ /* SHOW EXPLAIN will be stored here */
+ select_result_explain_buffer *explain_buf;
+
+ /* Query that we've got SHOW EXPLAIN for */
+ String query_str;
+
+ /* Overloaded virtual function */
+ void call_in_target_thread();
+};
#endif /* SQL_SHOW_H */
diff --git a/sql/sql_sort.h b/sql/sql_sort.h
index f1a3a2f9d8b..d30ddfb6eec 100644
--- a/sql/sql_sort.h
+++ b/sql/sql_sort.h
@@ -16,6 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include "m_string.h" /* memset */
#include "my_global.h" /* uchar */
#include "my_base.h" /* ha_rows */
#include "my_sys.h" /* qsort2_cmp */
@@ -27,7 +28,6 @@ typedef struct st_sort_field SORT_FIELD;
class Field;
struct TABLE;
-
/* Defines used by filesort and uniques */
#define MERGEBUFF 7
@@ -65,41 +65,51 @@ struct BUFFPEK_COMPARE_CONTEXT
void *key_compare_arg;
};
-typedef struct st_sort_param {
- uint rec_length; /* Length of sorted records */
- uint sort_length; /* Length of sorted columns */
- uint ref_length; /* Length of record ref. */
- uint addon_length; /* Length of added packed fields */
- uint res_length; /* Length of records in final sorted file/buffer */
- uint keys; /* Max keys / buffer */
+
+class Sort_param {
+public:
+ uint rec_length; // Length of sorted records.
+ uint sort_length; // Length of sorted columns.
+ uint ref_length; // Length of record ref.
+ uint addon_length; // Length of added packed fields.
+ uint res_length; // Length of records in final sorted file/buffer.
+ uint max_keys_per_buffer; // Max keys / buffer.
uint min_dupl_count;
- ha_rows max_rows,examined_rows;
- TABLE *sort_form; /* For quicker make_sortkey */
+ ha_rows max_rows; // Select limit, or HA_POS_ERROR if unlimited.
+ ha_rows examined_rows; // Number of examined rows.
+ TABLE *sort_form; // For quicker make_sortkey.
SORT_FIELD *local_sortorder;
SORT_FIELD *end;
- SORT_ADDON_FIELD *addon_field; /* Descriptors for companion fields */
+ SORT_ADDON_FIELD *addon_field; // Descriptors for companion fields.
uchar *unique_buff;
bool not_killable;
char* tmp_buffer;
- /* The fields below are used only by Unique class */
+ // The fields below are used only by Unique class.
qsort2_cmp compare;
BUFFPEK_COMPARE_CONTEXT cmp_context;
-} SORTPARAM;
+ Sort_param()
+ {
+ memset(this, 0, sizeof(*this));
+ }
+ void init_for_filesort(uint sortlen, TABLE *table,
+ ulong max_length_for_sort_data,
+ ha_rows maxrows, bool sort_positions);
+};
-int merge_many_buff(SORTPARAM *param, uchar *sort_buffer,
+
+int merge_many_buff(Sort_param *param, uchar *sort_buffer,
BUFFPEK *buffpek,
uint *maxbuffer, IO_CACHE *t_file);
uint read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
uint sort_length);
-int merge_buffers(SORTPARAM *param,IO_CACHE *from_file,
- IO_CACHE *to_file, uchar *sort_buffer,
- BUFFPEK *lastbuff,BUFFPEK *Fb,
- BUFFPEK *Tb,int flag);
-int merge_index(SORTPARAM *param, uchar *sort_buffer,
+int merge_buffers(Sort_param *param,IO_CACHE *from_file,
+ IO_CACHE *to_file, uchar *sort_buffer,
+ BUFFPEK *lastbuff,BUFFPEK *Fb,
+ BUFFPEK *Tb,int flag);
+int merge_index(Sort_param *param, uchar *sort_buffer,
BUFFPEK *buffpek, uint maxbuffer,
IO_CACHE *tempfile, IO_CACHE *outfile);
-
void reuse_freed_buff(QUEUE *queue, BUFFPEK *reuse, uint key_length);
#endif /* SQL_SORT_INCLUDED */
diff --git a/sql/sql_state.c b/sql/sql_state.c
index 511dc65917b..5acf97f16cc 100644
--- a/sql/sql_state.c
+++ b/sql/sql_state.c
@@ -17,6 +17,7 @@
#include <my_global.h>
#include <mysqld_error.h>
+#include <my_base.h>
struct st_map_errno_to_sqlstate
{
@@ -27,6 +28,7 @@ struct st_map_errno_to_sqlstate
struct st_map_errno_to_sqlstate sqlstate_map[]=
{
+#include <handler_state.h>
#include <sql_state.h>
};
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index c4f5f315b08..75029a03790 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -1121,39 +1121,47 @@ outp:
-
-void String::print(String *str)
+/*
+ Append characters to a single-quoted string '...', escaping special
+ characters as necessary.
+ Does not add the enclosing quotes, this is left up to caller.
+*/
+void String::append_for_single_quote(const char *st, uint len)
{
- char *st= (char*)Ptr, *end= st+str_length;
+ const char *end= st+len;
for (; st < end; st++)
{
uchar c= *st;
switch (c)
{
case '\\':
- str->append(STRING_WITH_LEN("\\\\"));
+ append(STRING_WITH_LEN("\\\\"));
break;
case '\0':
- str->append(STRING_WITH_LEN("\\0"));
+ append(STRING_WITH_LEN("\\0"));
break;
case '\'':
- str->append(STRING_WITH_LEN("\\'"));
+ append(STRING_WITH_LEN("\\'"));
break;
case '\n':
- str->append(STRING_WITH_LEN("\\n"));
+ append(STRING_WITH_LEN("\\n"));
break;
case '\r':
- str->append(STRING_WITH_LEN("\\r"));
+ append(STRING_WITH_LEN("\\r"));
break;
case '\032': // Ctrl-Z
- str->append(STRING_WITH_LEN("\\Z"));
+ append(STRING_WITH_LEN("\\Z"));
break;
default:
- str->append(c);
+ append(c);
}
}
}
+void String::print(String *str)
+{
+ str->append_for_single_quote(Ptr, str_length);
+}
/*
Exchange state of this object and argument.
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 86af507918c..2f0cd9103dc 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -459,6 +459,7 @@ public:
return FALSE;
}
void print(String *print);
+ void append_for_single_quote(const char *st, uint len);
/* Swap two string objects. Efficient way to exchange data without memcpy. */
void swap(String &s);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 8d73ce1388c..f74d5427266 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -163,6 +163,13 @@ static char* add_identifier(THD* thd, char *to_p, const char * end_p,
diagnostic, error etc. when it would be useful to know what a particular
file [and directory] means. Such as SHOW ENGINE STATUS, error messages etc.
+ Examples:
+
+ t1#P#p1 table t1 partition p1
+ t1#P#p1#SP#sp1 table t1 partition p1 subpartition sp1
+ t1#P#p1#SP#sp1#TMP# table t1 partition p1 subpartition sp1 temporary
+ t1#P#p1#SP#sp1#REN# table t1 partition p1 subpartition sp1 renamed
+
@param thd Thread handle
@param from Path name in my_charset_filename
Null terminated in my_charset_filename, normalized
@@ -201,7 +208,7 @@ uint explain_filename(THD* thd,
int part_name_len= 0;
const char *subpart_name= NULL;
int subpart_name_len= 0;
- enum enum_file_name_type {NORMAL, TEMP, RENAMED} name_type= NORMAL;
+ uint name_variant= NORMAL_PART_NAME;
const char *tmp_p;
DBUG_ENTER("explain_filename");
DBUG_PRINT("enter", ("from '%s'", from));
@@ -244,7 +251,6 @@ uint explain_filename(THD* thd,
(tmp_p[2] == 'L' || tmp_p[2] == 'l') &&
tmp_p[3] == '-')
{
- name_type= TEMP;
tmp_p+= 4; /* sql- prefix found */
}
else
@@ -255,7 +261,7 @@ uint explain_filename(THD* thd,
if ((tmp_p[1] == 'M' || tmp_p[1] == 'm') &&
(tmp_p[2] == 'P' || tmp_p[2] == 'p') &&
tmp_p[3] == '#' && !tmp_p[4])
- name_type= TEMP;
+ name_variant= TEMP_PART_NAME;
else
res= 3;
tmp_p+= 4;
@@ -265,7 +271,7 @@ uint explain_filename(THD* thd,
if ((tmp_p[1] == 'E' || tmp_p[1] == 'e') &&
(tmp_p[2] == 'N' || tmp_p[2] == 'n') &&
tmp_p[3] == '#' && !tmp_p[4])
- name_type= RENAMED;
+ name_variant= RENAMED_PART_NAME;
else
res= 4;
tmp_p+= 4;
@@ -290,7 +296,7 @@ uint explain_filename(THD* thd,
subpart_name_len= strlen(subpart_name);
else
part_name_len= strlen(part_name);
- if (name_type != NORMAL)
+ if (name_variant != NORMAL_PART_NAME)
{
if (subpart_name)
subpart_name_len-= 5;
@@ -332,9 +338,9 @@ uint explain_filename(THD* thd,
to_p= strnmov(to_p, " ", end_p - to_p);
else
to_p= strnmov(to_p, ", ", end_p - to_p);
- if (name_type != NORMAL)
+ if (name_variant != NORMAL_PART_NAME)
{
- if (name_type == TEMP)
+ if (name_variant == TEMP_PART_NAME)
to_p= strnmov(to_p, ER_THD_OR_DEFAULT(thd, ER_TEMPORARY_NAME),
end_p - to_p);
else
@@ -1826,6 +1832,7 @@ int write_bin_log(THD *thd, bool clear_error,
if (mysql_bin_log.is_open())
{
int errcode= 0;
+ thd_proc_info(thd, "Writing to binlog");
if (clear_error)
thd->clear_error();
else
@@ -1833,6 +1840,7 @@ int write_bin_log(THD *thd, bool clear_error,
error= thd->binlog_query(THD::STMT_QUERY_TYPE,
query, query_length, is_trans, FALSE, FALSE,
errcode);
+ thd_proc_info(thd, 0);
}
return error;
}
@@ -1948,6 +1956,50 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
/**
+ Find the comment in the query.
+ That's auxiliary function to be used handling DROP TABLE [comment].
+
+ @param thd Thread handler
+ @param comment_pos How many characters to skip before the comment.
+ Can be either 9 for DROP TABLE or
+ 17 for DROP TABLE IF EXISTS
+ @param comment_start returns the beginning of the comment if found.
+
+ @retval 0 no comment found
+ @retval >0 the lenght of the comment found
+
+*/
+static uint32 comment_length(THD *thd, uint32 comment_pos,
+ const char **comment_start)
+{
+ /* We use uchar * here to make array indexing portable */
+ const uchar *query= (uchar*) thd->query();
+ const uchar *query_end= (uchar*) query + thd->query_length();
+ const uchar *const state_map= thd->charset()->state_map;
+
+ for (; query < query_end; query++)
+ {
+ if (state_map[static_cast<uchar>(*query)] == MY_LEX_SKIP)
+ continue;
+ if (comment_pos-- == 0)
+ break;
+ }
+ if (query > query_end - 3 /* comment can't be shorter than 4 */ ||
+ state_map[static_cast<uchar>(*query)] != MY_LEX_LONG_COMMENT || query[1] != '*')
+ return 0;
+
+ *comment_start= (char*) query;
+
+ for (query+= 3; query < query_end; query++)
+ {
+ if (query[-1] == '*' && query[0] == '/')
+ return (char*) query - *comment_start + 1;
+ }
+ return 0;
+}
+
+
+/**
Execute the drop of a normal or temporary table.
@param thd Thread handler
@@ -2022,11 +2074,20 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
{
if (!drop_temporary)
{
+ const char *comment_start;
+ uint32 comment_len;
+
built_query.set_charset(system_charset_info);
if (if_exists)
built_query.append("DROP TABLE IF EXISTS ");
else
built_query.append("DROP TABLE ");
+
+ if ((comment_len= comment_length(thd, if_exists ? 17:9, &comment_start)))
+ {
+ built_query.append(comment_start, comment_len);
+ built_query.append(" ");
+ }
}
if (thd->is_current_stmt_binlog_format_row() || if_exists)
@@ -2049,6 +2110,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
{
bool is_trans;
char *db=table->db;
+ size_t db_length= table->db_length;
handlerton *table_type;
enum legacy_db_type frm_db_type= DB_TYPE_UNKNOWN;
@@ -2110,14 +2172,14 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
Don't write the database name if it is the current one (or if
thd->db is NULL).
*/
- built_ptr_query->append("`");
if (thd->db == NULL || strcmp(db,thd->db) != 0)
{
- built_ptr_query->append(db);
- built_ptr_query->append("`.`");
+ append_identifier(thd, built_ptr_query, db, db_length);
+ built_ptr_query->append(".");
}
- built_ptr_query->append(table->table_name);
- built_ptr_query->append("`,");
+ append_identifier(thd, built_ptr_query, table->table_name,
+ table->table_name_length);
+ built_ptr_query->append(",");
}
/*
This means that a temporary table was droped and as such there
@@ -2132,7 +2194,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
if (thd->locked_tables_mode)
{
- if (wait_while_table_is_used(thd, table->table, HA_EXTRA_FORCE_REOPEN))
+ if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED))
{
error= -1;
goto err;
@@ -2173,15 +2235,15 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
Don't write the database name if it is the current one (or if
thd->db is NULL).
*/
- built_query.append("`");
if (thd->db == NULL || strcmp(db,thd->db) != 0)
{
- built_query.append(db);
- built_query.append("`.`");
+ append_identifier(thd, &built_query, db, db_length);
+ built_query.append(".");
}
- built_query.append(table->table_name);
- built_query.append("`,");
+ append_identifier(thd, &built_query, table->table_name,
+ table->table_name_length);
+ built_query.append(",");
}
}
DEBUG_SYNC(thd, "rm_table_no_locks_before_delete_table");
@@ -6062,8 +6124,26 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
else
{
+ MDL_request_list mdl_requests;
+ MDL_request target_db_mdl_request;
+
target_mdl_request.init(MDL_key::TABLE, new_db, new_name,
MDL_EXCLUSIVE, MDL_TRANSACTION);
+ mdl_requests.push_front(&target_mdl_request);
+
+ /*
+ If we are moving the table to a different database, we also
+ need IX lock on the database name so that the target database
+ is protected by MDL while the table is moved.
+ */
+ if (new_db != db)
+ {
+ target_db_mdl_request.init(MDL_key::SCHEMA, new_db, "",
+ MDL_INTENTION_EXCLUSIVE,
+ MDL_TRANSACTION);
+ mdl_requests.push_front(&target_db_mdl_request);
+ }
+
/*
Global intention exclusive lock must have been already acquired when
table to be altered was open, so there is no need to do it here.
@@ -6072,14 +6152,10 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
"", "",
MDL_INTENTION_EXCLUSIVE));
- if (thd->mdl_context.try_acquire_lock(&target_mdl_request))
+ if (thd->mdl_context.acquire_locks(&mdl_requests,
+ thd->variables.lock_wait_timeout))
DBUG_RETURN(TRUE);
- if (target_mdl_request.ticket == NULL)
- {
- /* Table exists and is locked by some thread. */
- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
- DBUG_RETURN(TRUE);
- }
+
DEBUG_SYNC(thd, "locked_table_name");
/*
Table maybe does not exist, but we got an exclusive lock
@@ -6505,11 +6581,23 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
the primary key is not added and dropped in the same statement.
Otherwise we have to recreate the table.
need_copy_table is no-zero at this place.
+
+ Also, in-place is not possible if we add a primary key
+ and drop another key in the same statement. If the drop fails,
+ we will not be able to revert adding of primary key.
*/
if ( pk_changed < 2 )
{
- if ((alter_flags & needed_inplace_with_read_flags) ==
- needed_inplace_with_read_flags)
+ if ((needed_inplace_with_read_flags & HA_INPLACE_ADD_PK_INDEX_NO_WRITE) &&
+ index_drop_count > 0)
+ {
+ /*
+ Do copy, not in-place ALTER.
+ Avoid setting ALTER_TABLE_METADATA_ONLY.
+ */
+ }
+ else if ((alter_flags & needed_inplace_with_read_flags) ==
+ needed_inplace_with_read_flags)
{
/* All required in-place flags to allow concurrent reads are present. */
need_copy_table= ALTER_TABLE_METADATA_ONLY;
@@ -6787,17 +6875,38 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
Tell the handler to prepare for drop indexes.
This re-numbers the indexes to get rid of gaps.
*/
- if ((error= table->file->prepare_drop_index(table, key_numbers,
- index_drop_count)))
+ error= table->file->prepare_drop_index(table, key_numbers,
+ index_drop_count);
+ if (!error)
{
- table->file->print_error(error, MYF(0));
- goto err_new_table_cleanup;
+ /* Tell the handler to finally drop the indexes. */
+ error= table->file->final_drop_index(table);
}
- /* Tell the handler to finally drop the indexes. */
- if ((error= table->file->final_drop_index(table)))
+ if (error)
{
table->file->print_error(error, MYF(0));
+ if (index_add_count) // Drop any new indexes added.
+ {
+ /*
+ Temporarily set table-key_info to include information about the
+ indexes added above that we now need to drop.
+ */
+ KEY *save_key_info= table->key_info;
+ table->key_info= key_info_buffer;
+ if ((error= table->file->prepare_drop_index(table, index_add_buffer,
+ index_add_count)))
+ table->file->print_error(error, MYF(0));
+ else if ((error= table->file->final_drop_index(table)))
+ table->file->print_error(error, MYF(0));
+ table->key_info= save_key_info;
+ }
+
+ /*
+ Mark this TABLE instance as stale to avoid
+ out-of-sync index information.
+ */
+ table->m_needs_reopen= true;
goto err_new_table_cleanup;
}
}
@@ -7159,7 +7268,7 @@ err_with_mdl:
bool mysql_trans_prepare_alter_copy_data(THD *thd)
{
- DBUG_ENTER("mysql_prepare_alter_copy_data");
+ DBUG_ENTER("mysql_trans_prepare_alter_copy_data");
/*
Turn off recovery logging since rollback of an alter table is to
delete the new table so there is no need to log the changes to it.
@@ -7179,7 +7288,7 @@ bool mysql_trans_prepare_alter_copy_data(THD *thd)
bool mysql_trans_commit_alter_copy_data(THD *thd)
{
bool error= FALSE;
- DBUG_ENTER("mysql_commit_alter_copy_data");
+ DBUG_ENTER("mysql_trans_commit_alter_copy_data");
if (ha_enable_transaction(thd, TRUE))
DBUG_RETURN(TRUE);
@@ -7219,6 +7328,7 @@ copy_data_between_tables(THD *thd, TABLE *from,TABLE *to,
List<Item> fields;
List<Item> all_fields;
ha_rows examined_rows;
+ ha_rows found_rows;
bool auto_increment_field_copied= 0;
ulonglong save_sql_mode= thd->variables.sql_mode;
ulonglong prev_insert_id, time_to_report_progress;
@@ -7302,8 +7412,9 @@ copy_data_between_tables(THD *thd, TABLE *from,TABLE *to,
&tables, fields, all_fields, order) ||
!(sortorder= make_unireg_sortorder(order, &length, NULL)) ||
(from->sort.found_records= filesort(thd, from, sortorder, length,
- (SQL_SELECT *) 0, HA_POS_ERROR,
- 1, &examined_rows)) ==
+ NULL, HA_POS_ERROR,
+ true,
+ &examined_rows, &found_rows)) ==
HA_POS_ERROR)
goto err;
}
@@ -7385,7 +7496,7 @@ copy_data_between_tables(THD *thd, TABLE *from,TABLE *to,
(to->key_info[0].key_part[0].field->flags &
AUTO_INCREMENT_FLAG))
err_msg= ER(ER_DUP_ENTRY_AUTOINCREMENT_CASE);
- to->file->print_keydup_error(key_nr, err_msg);
+ to->file->print_keydup_error(key_nr, err_msg, MYF(0));
break;
}
}
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 5972c8918ba..5c0471fdfaa 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -25,9 +25,9 @@
#include <m_ctype.h>
- /* Some functions to calculate dates */
+#define MAX_DAY_NUMBER 3652424L
-#ifndef TESTTIME
+ /* Some functions to calculate dates */
/*
Name description of interval names used in statements.
@@ -147,46 +147,42 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year)
/* Change a daynr to year, month and day */
/* Daynr 0 is returned as date 00.00.00 */
-void get_date_from_daynr(long daynr,uint *ret_year,uint *ret_month,
+bool get_date_from_daynr(long daynr,uint *ret_year,uint *ret_month,
uint *ret_day)
{
uint year,temp,leap_day,day_of_year,days_in_year;
uchar *month_pos;
DBUG_ENTER("get_date_from_daynr");
- if (daynr <= 365L || daynr >= 3652500)
- { /* Fix if wrong daynr */
- *ret_year= *ret_month = *ret_day =0;
+ if (daynr < 365 || daynr > MAX_DAY_NUMBER)
+ DBUG_RETURN(1);
+
+ year= (uint) (daynr*100 / 36525L);
+ temp=(((year-1)/100+1)*3)/4;
+ day_of_year=(uint) (daynr - (long) year * 365L) - (year-1)/4 +temp;
+ while (day_of_year > (days_in_year= calc_days_in_year(year)))
+ {
+ day_of_year-=days_in_year;
+ (year)++;
}
- else
+ leap_day=0;
+ if (days_in_year == 366)
{
- year= (uint) (daynr*100 / 36525L);
- temp=(((year-1)/100+1)*3)/4;
- day_of_year=(uint) (daynr - (long) year * 365L) - (year-1)/4 +temp;
- while (day_of_year > (days_in_year= calc_days_in_year(year)))
+ if (day_of_year > 31+28)
{
- day_of_year-=days_in_year;
- (year)++;
+ day_of_year--;
+ if (day_of_year == 31+28)
+ leap_day=1; /* Handle leapyears leapday */
}
- leap_day=0;
- if (days_in_year == 366)
- {
- if (day_of_year > 31+28)
- {
- day_of_year--;
- if (day_of_year == 31+28)
- leap_day=1; /* Handle leapyears leapday */
- }
- }
- *ret_month=1;
- for (month_pos= days_in_month ;
- day_of_year > (uint) *month_pos ;
- day_of_year-= *(month_pos++), (*ret_month)++)
- ;
- *ret_year=year;
- *ret_day=day_of_year+leap_day;
}
- DBUG_VOID_RETURN;
+ *ret_month=1;
+ for (month_pos= days_in_month ;
+ day_of_year > (uint) *month_pos ;
+ day_of_year-= *(month_pos++), (*ret_month)++)
+ ;
+ *ret_year=year;
+ *ret_day=day_of_year+leap_day;
+ DBUG_RETURN(0);
}
/* Functions to handle periods */
@@ -842,7 +838,6 @@ void make_truncated_value_warning(THD *thd,
/* Daynumber from year 0 to 9999-12-31 */
-#define MAX_DAY_NUMBER 3652424L
#define COMBINE(X) \
(((((X)->day * 24LL + (X)->hour) * 60LL + \
(X)->minute) * 60LL + (X)->second)*1000000LL + \
@@ -909,19 +904,18 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
daynr= usec;
/* Day number from year 0 to 9999-12-31 */
- if ((ulonglong) daynr > MAX_DAY_NUMBER)
+ if (get_date_from_daynr((long) daynr, &ltime->year, &ltime->month,
+ &ltime->day))
goto invalid_date;
- get_date_from_daynr((long) daynr, &ltime->year, &ltime->month,
- &ltime->day);
break;
}
case INTERVAL_WEEK:
period= (calc_daynr(ltime->year,ltime->month,ltime->day) +
sign * (long) interval.day);
/* Daynumber from year 0 to 9999-12-31 */
- if ((ulong) period > MAX_DAY_NUMBER)
+ if (get_date_from_daynr((long) period,&ltime->year,&ltime->month,
+ &ltime->day))
goto invalid_date;
- get_date_from_daynr((long) period,&ltime->year,&ltime->month,&ltime->day);
break;
case INTERVAL_YEAR:
ltime->year+= sign * (long) interval.year;
@@ -1071,4 +1065,3 @@ int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b)
return 0;
}
-#endif
diff --git a/sql/sql_time.h b/sql/sql_time.h
index 026a15cb796..c1a75bb2ad3 100644
--- a/sql/sql_time.h
+++ b/sql/sql_time.h
@@ -33,7 +33,7 @@ typedef struct st_known_date_time_format KNOWN_DATE_TIME_FORMAT;
ulong convert_period_to_month(ulong period);
ulong convert_month_to_period(ulong month);
-void get_date_from_daynr(long daynr,uint *year, uint *month, uint *day);
+bool get_date_from_daynr(long daynr,uint *year, uint *month, uint *day);
my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, uint *error_code);
bool str_to_time_with_warn(CHARSET_INFO *cs, const char *str, uint length,
MYSQL_TIME *l_time, ulonglong fuzzydate);
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 1b942ecc93b..aff00f9fcf4 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -1334,6 +1334,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
triggers->definitions_list.elements);
table->triggers= triggers;
+ status_var_increment(thd->status_var.feature_trigger);
/*
TODO: This could be avoided if there is no triggers
@@ -2116,6 +2117,8 @@ bool Table_triggers_list::process_triggers(THD *thd,
if (sp_trigger == NULL)
return FALSE;
+ status_var_increment(thd->status_var.executed_triggers);
+
if (old_row_is_record1)
{
old_field= record1_field;
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index 3c1b231d3f2..9d4ca5e1373 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -24,6 +24,7 @@
#include "sql_acl.h" // DROP_ACL
#include "sql_parse.h" // check_one_table_access()
#include "sql_truncate.h"
+#include "sql_show.h"
/**
@@ -35,7 +36,8 @@
@return TRUE on failure, FALSE otherwise.
*/
-static bool fk_info_append_fields(String *str, List<LEX_STRING> *fields)
+static bool fk_info_append_fields(THD *thd, String *str,
+ List<LEX_STRING> *fields)
{
bool res= FALSE;
LEX_STRING *field;
@@ -43,9 +45,8 @@ static bool fk_info_append_fields(String *str, List<LEX_STRING> *fields)
while ((field= it++))
{
- res|= str->append("`");
- res|= str->append(field);
- res|= str->append("`, ");
+ res|= append_identifier(thd, str, field->str, field->length);
+ res|= str->append(", ");
}
str->chop();
@@ -76,20 +77,24 @@ static const char *fk_info_str(THD *thd, FOREIGN_KEY_INFO *fk_info)
`db`.`tbl`, CONSTRAINT `id` FOREIGN KEY (`fk`) REFERENCES `db`.`tbl` (`fk`)
*/
- res|= str.append('`');
- res|= str.append(fk_info->foreign_db);
- res|= str.append("`.`");
- res|= str.append(fk_info->foreign_table);
- res|= str.append("`, CONSTRAINT `");
- res|= str.append(fk_info->foreign_id);
- res|= str.append("` FOREIGN KEY (");
- res|= fk_info_append_fields(&str, &fk_info->foreign_fields);
- res|= str.append(") REFERENCES `");
- res|= str.append(fk_info->referenced_db);
- res|= str.append("`.`");
- res|= str.append(fk_info->referenced_table);
- res|= str.append("` (");
- res|= fk_info_append_fields(&str, &fk_info->referenced_fields);
+ res|= append_identifier(thd, &str, fk_info->foreign_db->str,
+ fk_info->foreign_db->length);
+ res|= str.append(".");
+ res|= append_identifier(thd, &str, fk_info->foreign_table->str,
+ fk_info->foreign_table->length);
+ res|= str.append(", CONSTRAINT ");
+ res|= append_identifier(thd, &str, fk_info->foreign_id->str,
+ fk_info->foreign_id->length);
+ res|= str.append(" FOREIGN KEY (");
+ res|= fk_info_append_fields(thd, &str, &fk_info->foreign_fields);
+ res|= str.append(") REFERENCES ");
+ res|= append_identifier(thd, &str, fk_info->referenced_db->str,
+ fk_info->referenced_db->length);
+ res|= str.append(".");
+ res|= append_identifier(thd, &str, fk_info->referenced_table->str,
+ fk_info->referenced_table->length);
+ res|= str.append(" (");
+ res|= fk_info_append_fields(thd, &str, &fk_info->referenced_fields);
res|= str.append(')');
return res ? NULL : thd->strmake(str.ptr(), str.length());
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 169e0d9e418..9069d876609 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -428,7 +428,6 @@ int mysql_create_function(THD *thd,udf_func *udf)
TABLE *table;
TABLE_LIST tables;
udf_func *u_d;
- bool save_binlog_row_based;
DBUG_ENTER("mysql_create_function");
if (!initialized)
@@ -459,13 +458,6 @@ int mysql_create_function(THD *thd,udf_func *udf)
DBUG_RETURN(1);
}
- /*
- Turn off row binlogging of this statement and use statement-based
- so that all supporting tables are updated for CREATE FUNCTION command.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
mysql_rwlock_wrlock(&THR_LOCK_udf);
if ((my_hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length)))
{
@@ -533,27 +525,14 @@ int mysql_create_function(THD *thd,udf_func *udf)
/* Binlog the create function. */
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
- {
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1);
- }
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
+
DBUG_RETURN(0);
err:
if (new_dl)
dlclose(dl);
mysql_rwlock_unlock(&THR_LOCK_udf);
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1);
}
@@ -565,7 +544,6 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
udf_func *udf;
char *exact_name_str;
uint exact_name_len;
- bool save_binlog_row_based;
DBUG_ENTER("mysql_drop_function");
if (!initialized)
@@ -577,13 +555,6 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
DBUG_RETURN(1);
}
- /*
- Turn off row binlogging of this statement and use statement-based
- so that all supporting tables are updated for DROP FUNCTION command.
- */
- if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
- thd->clear_current_stmt_binlog_format_row();
-
mysql_rwlock_wrlock(&THR_LOCK_udf);
if (!(udf=(udf_func*) my_hash_search(&udf_hash,(uchar*) udf_name->str,
(uint) udf_name->length)))
@@ -623,24 +594,12 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
while binlogging, to avoid binlog inconsistency.
*/
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
- {
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1);
- }
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
+
DBUG_RETURN(0);
+
err:
mysql_rwlock_unlock(&THR_LOCK_udf);
- /* Restore the state of binlog format */
- DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1);
}
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index df5f0c9d287..7fab29a7d64 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -621,6 +621,8 @@ bool st_select_lex_unit::exec()
if (executed && !uncacheable && !describe)
DBUG_RETURN(FALSE);
executed= 1;
+ if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item)
+ item->make_const();
saved_error= optimize();
@@ -720,6 +722,8 @@ bool st_select_lex_unit::exec()
}
}
+ DBUG_EXECUTE_IF("show_explain_probe_union_read",
+ dbug_serve_apcs(thd, 1););
/* Send result to 'result' */
saved_error= TRUE;
{
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 4b536c71fd6..549e59329aa 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -406,7 +406,7 @@ int mysql_update(THD *thd,
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
select= make_select(table, 0, 0, conds, 0, &error);
- if (error || !limit ||
+ if (error || !limit || thd->is_error() ||
(select && select->check_quick(thd, safe_update, limit)))
{
delete select;
@@ -498,13 +498,15 @@ int mysql_update(THD *thd,
uint length= 0;
SORT_FIELD *sortorder;
ha_rows examined_rows;
+ ha_rows found_rows;
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));
if (!(sortorder=make_unireg_sortorder(order, &length, NULL)) ||
(table->sort.found_records= filesort(thd, table, sortorder, length,
- select, limit, 1,
- &examined_rows))
+ select, limit,
+ true,
+ &examined_rows, &found_rows))
== HA_POS_ERROR)
{
goto err;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index bb74640d9da..b14757f7581 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -65,6 +65,7 @@
#include <myisammrg.h>
#include "keycaches.h"
#include "set_var.h"
+#include "rpl_mi.h"
/* this is to get the bison compilation windows warnings out */
#ifdef _MSC_VER
@@ -1174,6 +1175,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token KILL_SYM
%token LANGUAGE_SYM /* SQL-2003-R */
%token LAST_SYM /* SQL-2003-N */
+%token LAST_VALUE
%token LE /* OPERATOR */
%token LEADING /* SQL-2003-R */
%token LEAVES
@@ -1402,6 +1404,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token SIGNED_SYM
%token SIMPLE_SYM /* SQL-2003-N */
%token SLAVE
+%token SLAVES
%token SLOW
%token SMALLINT /* SQL-2003-R */
%token SNAPSHOT_SYM
@@ -2022,7 +2025,7 @@ help:
/* change master */
change:
- CHANGE MASTER_SYM TO_SYM
+ CHANGE MASTER_SYM optional_connection_name TO_SYM
{
Lex->sql_command = SQLCOM_CHANGE_MASTER;
}
@@ -2179,6 +2182,29 @@ master_file_def:
}
;
+optional_connection_name:
+ /* empty */
+ {
+ THD *thd= YYTHD;
+ LEX *lex= thd->lex;
+ lex->mi.connection_name= thd->variables.default_master_connection;
+ }
+ | connection_name;
+ ;
+
+connection_name:
+ TEXT_STRING_sys
+ {
+ Lex->mi.connection_name= $1;
+#ifdef HAVE_REPLICATION
+ if (check_master_connection_name(&$1))
+ {
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "MASTER_CONNECTION_NAME");
+ MYSQL_YYABORT;
+ }
+#endif
+ }
+
/* create a table */
create:
@@ -5771,7 +5797,23 @@ type:
$$= MYSQL_TYPE_VARCHAR;
}
| YEAR_SYM opt_field_length field_options
- { $$=MYSQL_TYPE_YEAR; }
+ {
+ if (Lex->length)
+ {
+ errno= 0;
+ ulong length= strtoul(Lex->length, NULL, 10);
+ if (errno == 0 && length <= MAX_FIELD_BLOBLENGTH && length != 4)
+ {
+ char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
+ my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
+ push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_WARN_DEPRECATED_SYNTAX,
+ ER(ER_WARN_DEPRECATED_SYNTAX),
+ buff, "YEAR(4)");
+ }
+ }
+ $$=MYSQL_TYPE_YEAR;
+ }
| DATE_SYM
{ $$=MYSQL_TYPE_DATE; }
| TIME_SYM opt_field_length
@@ -5983,9 +6025,9 @@ attribute:
NULL_SYM { Lex->type&= ~ NOT_NULL_FLAG; }
| not NULL_SYM { Lex->type|= NOT_NULL_FLAG; }
| DEFAULT now_or_signed_literal { Lex->default_value=$2; }
- | ON UPDATE_SYM NOW_SYM opt_time_precision
+ | ON UPDATE_SYM NOW_SYM optional_braces
{
- Item *item= new (YYTHD->mem_root) Item_func_now_local($4);
+ Item *item= new (YYTHD->mem_root) Item_func_now_local(6);
if (item == NULL)
MYSQL_YYABORT;
Lex->on_update_value= item;
@@ -6077,9 +6119,9 @@ type_with_opt_collate:
now_or_signed_literal:
- NOW_SYM opt_time_precision
+ NOW_SYM optional_braces
{
- $$= new (YYTHD->mem_root) Item_func_now_local($2);
+ $$= new (YYTHD->mem_root) Item_func_now_local(6);
if ($$ == NULL)
MYSQL_YYABORT;
}
@@ -7184,7 +7226,7 @@ opt_to:
*/
slave:
- START_SYM SLAVE slave_thread_opts
+ START_SYM SLAVE optional_connection_name slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_START;
@@ -7193,14 +7235,28 @@ slave:
}
slave_until
{}
- | STOP_SYM SLAVE slave_thread_opts
+ | START_SYM ALL SLAVES slave_thread_opts
+ {
+ LEX *lex=Lex;
+ lex->sql_command = SQLCOM_SLAVE_ALL_START;
+ lex->type = 0;
+ }
+ {}
+ | STOP_SYM SLAVE optional_connection_name slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_STOP;
lex->type = 0;
/* If you change this code don't forget to update SLAVE STOP too */
}
- | SLAVE START_SYM slave_thread_opts
+ | STOP_SYM ALL SLAVES slave_thread_opts
+ {
+ LEX *lex=Lex;
+ lex->sql_command = SQLCOM_SLAVE_ALL_STOP;
+ lex->type = 0;
+ /* If you change this code don't forget to update SLAVE STOP too */
+ }
+ | SLAVE optional_connection_name START_SYM slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_START;
@@ -7208,7 +7264,7 @@ slave:
}
slave_until
{}
- | SLAVE STOP_SYM slave_thread_opts
+ | SLAVE optional_connection_name STOP_SYM slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_STOP;
@@ -9037,6 +9093,12 @@ function_call_conflict:
if ($$ == NULL)
MYSQL_YYABORT;
}
+ | LAST_VALUE '(' expr_list ')'
+ {
+ $$= new (YYTHD->mem_root) Item_func_last_value(* $3);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
| MICROSECOND_SYM '(' expr ')'
{
$$= new (YYTHD->mem_root) Item_func_microsecond($3);
@@ -11569,7 +11631,7 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_BINLOG_EVENTS;
} opt_limit_clause_init
- | RELAYLOG_SYM EVENTS_SYM binlog_in binlog_from
+ | RELAYLOG_SYM optional_connection_name EVENTS_SYM binlog_in binlog_from
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_RELAYLOG_EVENTS;
@@ -11698,9 +11760,23 @@ show_param:
{
Lex->sql_command = SQLCOM_SHOW_MASTER_STAT;
}
+ | ALL SLAVES STATUS_SYM
+ {
+ Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
+ Lex->verbose= 1;
+ }
| SLAVE STATUS_SYM
{
+ THD *thd= YYTHD;
+ LEX *lex= thd->lex;
+ lex->mi.connection_name= thd->variables.default_master_connection;
+ lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
+ lex->verbose= 0;
+ }
+ | SLAVE connection_name STATUS_SYM
+ {
Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
+ Lex->verbose= 0;
}
| CLIENT_STATS_SYM
{
@@ -11779,6 +11855,14 @@ show_param:
Lex->spname= $3;
Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT;
}
+ | describe_command FOR_SYM expr
+ {
+ THD *thd= YYTHD;
+ Lex->sql_command= SQLCOM_SHOW_EXPLAIN;
+ if (prepare_schema_table(thd, Lex, 0, SCH_EXPLAIN))
+ MYSQL_YYABORT;
+ add_value_to_list(thd, $3);
+ }
;
show_engine_param:
@@ -11952,8 +12036,17 @@ flush_option:
{ Lex->type|= REFRESH_SLOW_LOG; }
| BINARY LOGS_SYM
{ Lex->type|= REFRESH_BINARY_LOG; }
- | RELAY LOGS_SYM
- { Lex->type|= REFRESH_RELAY_LOG; }
+ | RELAY LOGS_SYM optional_connection_name
+ {
+ LEX *lex= Lex;
+ if (lex->type & REFRESH_RELAY_LOG)
+ {
+ my_error(ER_WRONG_USAGE, MYF(0), "FLUSH", "RELAY LOGS");
+ MYSQL_YYABORT;
+ }
+ lex->type|= REFRESH_RELAY_LOG;
+ lex->relay_log_connection_name= lex->mi.connection_name;
+ }
| QUERY_SYM CACHE_SYM
{ Lex->type|= REFRESH_QUERY_CACHE_FREE; }
| HOSTS_SYM
@@ -11961,13 +12054,23 @@ flush_option:
| PRIVILEGES
{ Lex->type|= REFRESH_GRANT; }
| LOGS_SYM
- { Lex->type|= REFRESH_LOG; }
+ {
+ Lex->type|= REFRESH_LOG;
+ Lex->relay_log_connection_name.str= (char*) "";
+ Lex->relay_log_connection_name.length= 0;
+ }
| STATUS_SYM
{ Lex->type|= REFRESH_STATUS; }
- | SLAVE
+ | SLAVE optional_connection_name
{
- Lex->type|= REFRESH_SLAVE;
- Lex->reset_slave_info.all= false;
+ LEX *lex= Lex;
+ if (lex->type & REFRESH_SLAVE)
+ {
+ my_error(ER_WRONG_USAGE, MYF(0), "FLUSH","SLAVE");
+ MYSQL_YYABORT;
+ }
+ lex->type|= REFRESH_SLAVE;
+ lex->reset_slave_info.all= false;
}
| CLIENT_STATS_SYM
{ Lex->type|= REFRESH_CLIENT_STATS; }
@@ -12011,6 +12114,7 @@ reset_options:
reset_option:
SLAVE { Lex->type|= REFRESH_SLAVE; }
+ optional_connection_name
slave_reset_options { }
| MASTER_SYM { Lex->type|= REFRESH_MASTER; }
| QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;}
@@ -12291,7 +12395,7 @@ load_data_set_elem:
if (lex->update_list.push_back($1) ||
lex->value_list.push_back($4))
MYSQL_YYABORT;
- $4->set_name($3, (uint) ($5 - $3), YYTHD->charset());
+ $4->set_name_no_truncate($3, (uint) ($5 - $3), YYTHD->charset());
}
;
@@ -13109,6 +13213,7 @@ keyword:
| SIGNED_SYM {}
| SOCKET_SYM {}
| SLAVE {}
+ | SLAVES {}
| SONAME_SYM {}
| START_SYM {}
| STOP_SYM {}
@@ -13235,6 +13340,7 @@ keyword_sp:
| ISSUER_SYM {}
| INSERT_METHOD {}
| KEY_BLOCK_SIZE {}
+ | LAST_VALUE {}
| LAST_SYM {}
| LEAVES {}
| LESS_SYM {}
diff --git a/sql/strfunc.cc b/sql/strfunc.cc
index 0c0742b3805..9603ca30cfa 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -15,6 +15,7 @@
/* Some useful string utility functions used by the MySQL server */
+#include <my_global.h>
#include "sql_priv.h"
#include "unireg.h"
#include "strfunc.h"
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index ac84d820ca6..02f7fc0601c 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -50,7 +50,9 @@
#include "sql_base.h" // close_cached_tables
#include <myisam.h>
#include "log_slow.h"
+#include "debug_sync.h" // DEBUG_SYNC
+#include "log_event.h"
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#include "../storage/perfschema/pfs_server.h"
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
@@ -997,6 +999,30 @@ static Sys_var_lexstring Sys_init_connect(
DEFAULT(""), &PLock_sys_init_connect, NOT_IN_BINLOG,
ON_CHECK(check_init_string));
+#ifdef HAVE_REPLICATION
+static bool check_master_connection(sys_var *self, THD *thd, set_var *var)
+{
+ LEX_STRING tmp;
+ tmp.str= var->save_result.string_value.str;
+ tmp.length= var->save_result.string_value.length;
+ if (!tmp.str || check_master_connection_name(&tmp))
+ {
+ my_error(ER_WRONG_ARGUMENTS, MYF(ME_JUST_WARNING),
+ var->var->name.str);
+ return true;
+ }
+ return false;
+}
+
+static Sys_var_session_lexstring Sys_default_master_connection(
+ "default_master_connection",
+ "Master connection to use for all slave variables and slave commands",
+ SESSION_ONLY(default_master_connection),
+ NO_CMD_LINE, IN_SYSTEM_CHARSET,
+ DEFAULT(""), MAX_CONNECTION_NAME, ON_CHECK(check_master_connection),
+ ON_UPDATE(0));
+#endif
+
static Sys_var_charptr Sys_init_file(
"init_file", "Read SQL commands from this file at startup",
READ_ONLY GLOBAL_VAR(opt_init_file),
@@ -1255,6 +1281,14 @@ static Sys_var_ulong Sys_max_allowed_packet(
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_max_allowed_packet));
+static Sys_var_ulong Sys_slave_max_allowed_packet(
+ "slave_max_allowed_packet",
+ "The maximum packet length to sent successfully from the master to slave.",
+ GLOBAL_VAR(slave_max_allowed_packet), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(1024, MAX_MAX_ALLOWED_PACKET),
+ DEFAULT(MAX_MAX_ALLOWED_PACKET),
+ BLOCK_SIZE(1024));
+
static Sys_var_ulonglong Sys_max_binlog_cache_size(
"max_binlog_cache_size",
"Sets the total size of the transactional cache",
@@ -1274,16 +1308,12 @@ static Sys_var_ulonglong Sys_max_binlog_stmt_cache_size(
static bool fix_max_binlog_size(sys_var *self, THD *thd, enum_var_type type)
{
mysql_bin_log.set_max_size(max_binlog_size);
-#ifdef HAVE_REPLICATION
- if (!max_relay_log_size)
- active_mi->rli.relay_log.set_max_size(max_binlog_size);
-#endif
return false;
}
static Sys_var_ulong Sys_max_binlog_size(
"max_binlog_size",
"Binary log will be rotated automatically when the size exceeds this "
- "value. Will also apply to relay logs if max_relay_log_size is 0",
+ "value.",
GLOBAL_VAR(max_binlog_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, 1024*1024L*1024L), DEFAULT(1024*1024L*1024L),
BLOCK_SIZE(IO_SIZE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
@@ -1428,24 +1458,6 @@ static Sys_var_ulong Sys_max_prepared_stmt_count(
VALID_RANGE(0, 1024*1024), DEFAULT(16382), BLOCK_SIZE(1),
&PLock_prepared_stmt_count);
-static bool fix_max_relay_log_size(sys_var *self, THD *thd, enum_var_type type)
-{
-#ifdef HAVE_REPLICATION
- active_mi->rli.relay_log.set_max_size(max_relay_log_size ?
- max_relay_log_size: max_binlog_size);
-#endif
- return false;
-}
-static Sys_var_ulong Sys_max_relay_log_size(
- "max_relay_log_size",
- "If non-zero: relay log will be rotated automatically when the "
- "size exceeds this value; if zero: when the size "
- "exceeds max_binlog_size",
- GLOBAL_VAR(max_relay_log_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0), BLOCK_SIZE(IO_SIZE),
- NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
- ON_UPDATE(fix_max_relay_log_size));
-
static Sys_var_ulong Sys_max_sort_length(
"max_sort_length",
"The number of bytes to use when sorting BLOB or TEXT values (only "
@@ -2216,50 +2228,22 @@ static Sys_var_mybool Sys_master_verify_checksum(
static const char *replicate_events_marked_for_skip_names[]= {
"replicate", "filter_on_slave", "filter_on_master", 0
};
-static bool
-replicate_events_marked_for_skip_check(sys_var *self, THD *thd,
- set_var *var)
-{
- int thread_mask;
- DBUG_ENTER("sys_var_replicate_events_marked_for_skip_check");
- /* Slave threads must be stopped to change the variable. */
- mysql_mutex_lock(&LOCK_active_mi);
- lock_slave_threads(active_mi);
- init_thread_mask(&thread_mask, active_mi, 0 /*not inverse*/);
- unlock_slave_threads(active_mi);
- mysql_mutex_unlock(&LOCK_active_mi);
-
- if (thread_mask) // We refuse if any slave thread is running
- {
- my_error(ER_SLAVE_MUST_STOP, MYF(0));
- DBUG_RETURN(true);
- }
- DBUG_RETURN(false);
-}
bool
Sys_var_replicate_events_marked_for_skip::global_update(THD *thd, set_var *var)
{
- bool result;
- int thread_mask;
+ bool result= true; // Assume error
DBUG_ENTER("Sys_var_replicate_events_marked_for_skip::global_update");
- /* Slave threads must be stopped to change the variable. */
+ mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
- lock_slave_threads(active_mi);
- init_thread_mask(&thread_mask, active_mi, 0 /*not inverse*/);
- if (thread_mask) // We refuse if any slave thread is running
- {
- my_error(ER_SLAVE_MUST_STOP, MYF(0));
- result= true;
- }
- else
+ if (!master_info_index->give_error_if_slave_running())
result= Sys_var_enum::global_update(thd, var);
-
- unlock_slave_threads(active_mi);
mysql_mutex_unlock(&LOCK_active_mi);
+ mysql_mutex_lock(&LOCK_global_system_variables);
DBUG_RETURN(result);
}
+
static Sys_var_replicate_events_marked_for_skip Replicate_events_marked_for_skip
("replicate_events_marked_for_skip",
"Whether the slave should replicate events that were created with "
@@ -2270,8 +2254,7 @@ static Sys_var_replicate_events_marked_for_skip Replicate_events_marked_for_skip
"the slave).",
GLOBAL_VAR(opt_replicate_events_marked_for_skip), CMD_LINE(REQUIRED_ARG),
replicate_events_marked_for_skip_names, DEFAULT(RPL_SKIP_REPLICATE),
- NO_MUTEX_GUARD, NOT_IN_BINLOG,
- ON_CHECK(replicate_events_marked_for_skip_check));
+ NO_MUTEX_GUARD, NOT_IN_BINLOG);
#endif
@@ -3495,43 +3478,18 @@ static Sys_var_mybool Sys_relay_log_recovery(
"processed",
GLOBAL_VAR(relay_log_recovery), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
-bool Sys_var_rpl_filter::do_check(THD *thd, set_var *var)
-{
- bool status;
-
- mysql_mutex_lock(&LOCK_active_mi);
- mysql_mutex_lock(&active_mi->rli.run_lock);
-
- status= active_mi->rli.slave_running;
-
- mysql_mutex_unlock(&active_mi->rli.run_lock);
- mysql_mutex_unlock(&LOCK_active_mi);
-
- if (status)
- my_error(ER_SLAVE_MUST_STOP, MYF(0));
- else
- status= Sys_var_charptr::do_string_check(thd, var, charset(thd));
-
- return status;
-}
bool Sys_var_rpl_filter::global_update(THD *thd, set_var *var)
{
- bool slave_running, status= false;
+ bool result= true; // Assume error
+ mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
- mysql_mutex_lock(&active_mi->rli.run_lock);
-
- if (! (slave_running= active_mi->rli.slave_running))
- status= set_filter_value(var->save_result.string_value.str);
-
- mysql_mutex_unlock(&active_mi->rli.run_lock);
+ if (!master_info_index->give_error_if_slave_running())
+ result= set_filter_value(var->save_result.string_value.str);
mysql_mutex_unlock(&LOCK_active_mi);
-
- if (slave_running)
- my_error(ER_SLAVE_MUST_STOP, MYF(0));
-
- return slave_running || status;
+ mysql_mutex_lock(&LOCK_global_system_variables);
+ return result;
}
bool Sys_var_rpl_filter::set_filter_value(const char *value)
@@ -3569,9 +3527,6 @@ uchar *Sys_var_rpl_filter::global_value_ptr(THD *thd, LEX_STRING *base)
tmp.length(0);
- mysql_mutex_lock(&LOCK_active_mi);
- mysql_mutex_lock(&active_mi->rli.run_lock);
-
switch (opt_id) {
case OPT_REPLICATE_DO_DB:
rpl_filter->get_do_db(&tmp);
@@ -3593,9 +3548,6 @@ uchar *Sys_var_rpl_filter::global_value_ptr(THD *thd, LEX_STRING *base)
break;
}
- mysql_mutex_unlock(&active_mi->rli.run_lock);
- mysql_mutex_unlock(&LOCK_active_mi);
-
return (uchar *) thd->strmake(tmp.ptr(), tmp.length());
}
@@ -3645,66 +3597,105 @@ static Sys_var_charptr Sys_slave_load_tmpdir(
READ_ONLY GLOBAL_VAR(slave_load_tmpdir), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(0));
-static bool fix_slave_net_timeout(sys_var *self, THD *thd, enum_var_type type)
-{
- mysql_mutex_lock(&LOCK_active_mi);
- DBUG_PRINT("info", ("slave_net_timeout=%u mi->heartbeat_period=%.3f",
- slave_net_timeout,
- (active_mi? active_mi->heartbeat_period : 0.0)));
- if (active_mi && slave_net_timeout < active_mi->heartbeat_period)
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX,
- ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX));
- mysql_mutex_unlock(&LOCK_active_mi);
- return false;
-}
static Sys_var_uint Sys_slave_net_timeout(
"slave_net_timeout", "Number of seconds to wait for more data "
- "from a master/slave connection before aborting the read",
+ "from any master/slave connection before aborting the read",
GLOBAL_VAR(slave_net_timeout), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(SLAVE_NET_TIMEOUT), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
- ON_UPDATE(fix_slave_net_timeout));
+ ON_UPDATE(0));
+
+
+/*
+ Access a multi_source variable
+ Return 0 + warning if it doesn't exist
+*/
-static bool check_slave_skip_counter(sys_var *self, THD *thd, set_var *var)
+uint Sys_var_multi_source_ulong::
+get_master_info_uint_value(THD *thd, ptrdiff_t offset)
{
- bool result= false;
+ Master_info *mi;
+ uint res= 0; // Default value
mysql_mutex_lock(&LOCK_active_mi);
- mysql_mutex_lock(&active_mi->rli.run_lock);
- if (active_mi->rli.slave_running)
+ mi= master_info_index->
+ get_master_info(&thd->variables.default_master_connection,
+ MYSQL_ERROR::WARN_LEVEL_WARN);
+ if (mi)
{
- my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
- result= true;
+ mysql_mutex_lock(&mi->rli.data_lock);
+ res= *((uint*) (((uchar*) mi) + master_info_offset));
+ mysql_mutex_unlock(&mi->rli.data_lock);
}
- mysql_mutex_unlock(&active_mi->rli.run_lock);
- mysql_mutex_unlock(&LOCK_active_mi);
- return result;
+ mysql_mutex_unlock(&LOCK_active_mi);
+ return res;
}
-static bool fix_slave_skip_counter(sys_var *self, THD *thd, enum_var_type type)
+
+
+bool update_multi_source_variable(sys_var *self_var, THD *thd,
+ enum_var_type type)
{
+ Sys_var_multi_source_ulong *self= (Sys_var_multi_source_ulong*) self_var;
+ bool result= true;
+ Master_info *mi;
+
mysql_mutex_lock(&LOCK_active_mi);
- mysql_mutex_lock(&active_mi->rli.run_lock);
- /*
- The following test should normally never be true as we test this
- in the check function; To be safe against multiple
- SQL_SLAVE_SKIP_COUNTER request, we do the check anyway
- */
- if (!active_mi->rli.slave_running)
+ mi= master_info_index->
+ get_master_info(&thd->variables.default_master_connection,
+ MYSQL_ERROR::WARN_LEVEL_ERROR);
+ if (mi)
{
- mysql_mutex_lock(&active_mi->rli.data_lock);
- active_mi->rli.slave_skip_counter= sql_slave_skip_counter;
- mysql_mutex_unlock(&active_mi->rli.data_lock);
+ mysql_mutex_lock(&mi->rli.run_lock);
+ mysql_mutex_lock(&mi->rli.data_lock);
+ result= self->update_variable(thd, mi);
+ mysql_mutex_unlock(&mi->rli.data_lock);
+ mysql_mutex_unlock(&mi->rli.run_lock);
}
- mysql_mutex_unlock(&active_mi->rli.run_lock);
mysql_mutex_unlock(&LOCK_active_mi);
- return 0;
+ return result;
+}
+
+static bool update_slave_skip_counter(sys_var *self, THD *thd, Master_info *mi)
+{
+ if (mi->rli.slave_running)
+ {
+ my_error(ER_SLAVE_MUST_STOP, MYF(0), mi->connection_name.length,
+ mi->connection_name.str);
+ return true;
+ }
+ /* The value was stored temporarly in thd */
+ mi->rli.slave_skip_counter= thd->variables.slave_skip_counter;
+ return false;
+}
+
+
+static Sys_var_multi_source_ulong
+Sys_slave_skip_counter("sql_slave_skip_counter",
+ "Skip the next N events from the master log",
+ SESSION_VAR(slave_skip_counter),
+ NO_CMD_LINE,
+ offsetof(Master_info, rli.slave_skip_counter),
+ VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1),
+ ON_UPDATE(update_slave_skip_counter));
+
+
+static bool update_max_relay_log_size(sys_var *self, THD *thd, Master_info *mi)
+{
+ mi->rli.max_relay_log_size= thd->variables.max_relay_log_size;
+ mi->rli.relay_log.set_max_size(mi->rli.max_relay_log_size);
+ return false;
}
-static Sys_var_uint Sys_slave_skip_counter(
- "sql_slave_skip_counter", "sql_slave_skip_counter",
- GLOBAL_VAR(sql_slave_skip_counter), NO_CMD_LINE,
- VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1),
- NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_slave_skip_counter),
- ON_UPDATE(fix_slave_skip_counter));
+
+static Sys_var_multi_source_ulong
+Sys_max_relay_log_size( "max_relay_log_size",
+ "relay log will be rotated automatically when the "
+ "size exceeds this value. If 0 are startup, it's "
+ "set to max_binlog_size",
+ SESSION_VAR(max_relay_log_size),
+ CMD_LINE(REQUIRED_ARG),
+ offsetof(Master_info, rli.max_relay_log_size),
+ VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0),
+ BLOCK_SIZE(IO_SIZE),
+ ON_UPDATE(update_max_relay_log_size));
static Sys_var_charptr Sys_slave_skip_errors(
"slave_skip_errors", "Tells the slave thread to continue "
@@ -3788,22 +3779,25 @@ static bool check_locale(sys_var *self, THD *thd, set_var *var)
if (!locale->errmsgs->errmsgs)
{
+ bool res;
mysql_mutex_lock(&LOCK_error_messages);
- if (!locale->errmsgs->errmsgs &&
- read_texts(ERRMSG_FILE, locale->errmsgs->language,
- &locale->errmsgs->errmsgs,
- ER_ERROR_LAST - ER_ERROR_FIRST + 1))
+ res= (!locale->errmsgs->errmsgs &&
+ read_texts(ERRMSG_FILE, locale->errmsgs->language,
+ &locale->errmsgs->errmsgs,
+ ER_ERROR_LAST - ER_ERROR_FIRST + 1));
+ mysql_mutex_unlock(&LOCK_error_messages);
+ if (res)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Can't process error message file for locale '%s'",
locale->name);
- mysql_mutex_unlock(&LOCK_error_messages);
return true;
}
- mysql_mutex_unlock(&LOCK_error_messages);
}
+ status_var_increment(thd->status_var.feature_locale);
return false;
}
+
static Sys_var_struct Sys_lc_messages(
"lc_messages", "Set the language used for the error messages",
SESSION_VAR(lc_messages), NO_CMD_LINE,
diff --git a/sql/sys_vars.h b/sql/sys_vars.h
index ff7ac46d96f..54ae4025a65 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.h
@@ -568,11 +568,13 @@ public:
option.var_type= GET_STR;
}
+ bool do_check(THD *thd, set_var *var)
+ {
+ return Sys_var_charptr::do_string_check(thd, var, charset(thd));
+ }
bool check_update_type(Item_result type)
{ return type != STRING_RESULT; }
- bool do_check(THD *thd, set_var *var);
-
void session_save_default(THD *thd, set_var *var)
{ DBUG_ASSERT(FALSE); }
@@ -633,6 +635,93 @@ public:
}
};
+
+/*
+ A LEX_STRING stored only in thd->variables
+ Only to be used for small buffers
+*/
+
+class Sys_var_session_lexstring: public sys_var
+{
+ size_t max_length;
+public:
+ Sys_var_session_lexstring(const char *name_arg,
+ const char *comment, int flag_args,
+ ptrdiff_t off, size_t size, CMD_LINE getopt,
+ enum charset_enum is_os_charset_arg,
+ const char *def_val, size_t max_length_arg,
+ on_check_function on_check_func=0,
+ on_update_function on_update_func=0)
+ : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
+ getopt.arg_type, SHOW_CHAR, (intptr)def_val,
+ 0, VARIABLE_NOT_IN_BINLOG, on_check_func, on_update_func,
+ 0, 0),max_length(max_length_arg)
+ {
+ option.var_type= GET_NO_ARG;
+ SYSVAR_ASSERT(scope() == ONLY_SESSION)
+ *const_cast<SHOW_TYPE*>(&show_val_type)= SHOW_LEX_STRING;
+ }
+ bool do_check(THD *thd, set_var *var)
+ {
+ char buff[STRING_BUFFER_USUAL_SIZE];
+ String str(buff, sizeof(buff), system_charset_info), *res;
+
+ if (!(res=var->value->val_str(&str)))
+ {
+ var->save_result.string_value.str= 0; /* NULL */
+ var->save_result.string_value.length= 0;
+ }
+ else
+ {
+ if (res->length() > max_length)
+ {
+ my_error(ER_WRONG_STRING_LENGTH, MYF(0),
+ res->ptr(), name.str, (int) max_length);
+ return true;
+ }
+ var->save_result.string_value.str= thd->strmake(res->ptr(),
+ res->length());
+ var->save_result.string_value.length= res->length();
+ }
+ return false;
+ }
+ bool session_update(THD *thd, set_var *var)
+ {
+ LEX_STRING *tmp= &session_var(thd, LEX_STRING);
+ tmp->length= var->save_result.string_value.length;
+ /* Store as \0 terminated string (just to be safe) */
+ strmake(tmp->str, var->save_result.string_value.str, tmp->length);
+ return false;
+ }
+ bool global_update(THD *thd, set_var *var)
+ {
+ DBUG_ASSERT(FALSE);
+ return false;
+ }
+ void session_save_default(THD *thd, set_var *var)
+ {
+ char *ptr= (char*)(intptr)option.def_value;
+ var->save_result.string_value.str= ptr;
+ var->save_result.string_value.length= strlen(ptr);
+ }
+ void global_save_default(THD *thd, set_var *var)
+ {
+ DBUG_ASSERT(FALSE);
+ }
+ uchar *session_value_ptr(THD *thd, LEX_STRING *base)
+ {
+ return (uchar*) &session_var(thd, LEX_STRING);
+ }
+ uchar *global_value_ptr(THD *thd, LEX_STRING *base)
+ {
+ DBUG_ASSERT(FALSE);
+ return NULL;
+ }
+ bool check_update_type(Item_result type)
+ { return type != STRING_RESULT; }
+};
+
+
#ifndef DBUG_OFF
/**
@@session.dbug and @@global.dbug variables.
@@ -959,7 +1048,7 @@ public:
Sys_var_max_user_conn(const char *name_arg,
const char *comment, int flag_args, ptrdiff_t off, size_t size,
CMD_LINE getopt,
- int min_val, int max_val, uint def_val,
+ int min_val, int max_val, int def_val,
uint block_size, PolyLock *lock=0,
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
@@ -1389,6 +1478,7 @@ public:
};
#endif /* defined(ENABLED_DEBUG_SYNC) */
+
/**
The class for bit variables - a variant of boolean that stores the value
in a bit.
@@ -1878,14 +1968,86 @@ public:
const char *comment, int flag_args, ptrdiff_t off, size_t size,
CMD_LINE getopt,
const char *values[], uint def_val, PolyLock *lock,
- enum binlog_status_enum binlog_status_arg,
- on_check_function on_check_func)
+ enum binlog_status_enum binlog_status_arg)
:Sys_var_enum(name_arg, comment, flag_args, off, size, getopt,
- values, def_val, lock, binlog_status_arg, on_check_func)
+ values, def_val, lock, binlog_status_arg)
{}
bool global_update(THD *thd, set_var *var);
};
+/*
+ Class for handing multi-source replication variables
+ Variable values are store in Master_info, but to make it possible to
+ access variable without locks we also store it thd->variables.
+ These can be used as GLOBAL or SESSION, but both points to the same
+ variable. This is to make things compatible with MySQL 5.5 where variables
+ like sql_slave_skip_counter are GLOBAL.
+*/
+
+class Sys_var_multi_source_ulong;
+class Master_info;
+
+typedef bool (*on_multi_source_update_function)(sys_var *self, THD *thd,
+ Master_info *mi);
+bool update_multi_source_variable(sys_var *self,
+ THD *thd, enum_var_type type);
+
+
+class Sys_var_multi_source_ulong :public Sys_var_ulong
+{
+ ptrdiff_t master_info_offset;
+ on_multi_source_update_function update_multi_source_variable_func;
+public:
+ Sys_var_multi_source_ulong(const char *name_arg,
+ const char *comment, int flag_args,
+ ptrdiff_t off, size_t size,
+ CMD_LINE getopt,
+ ptrdiff_t master_info_offset_arg,
+ uint min_val, uint max_val, uint def_val,
+ uint block_size,
+ on_multi_source_update_function on_update_func)
+ :Sys_var_ulong(name_arg, comment, flag_args, off, size,
+ getopt, min_val, max_val, def_val, block_size,
+ 0, VARIABLE_NOT_IN_BINLOG, 0, update_multi_source_variable),
+ master_info_offset(master_info_offset_arg),
+ update_multi_source_variable_func(on_update_func)
+ {
+ }
+ bool session_update(THD *thd, set_var *var)
+ {
+ session_var(thd, uint)= (uint) (var->save_result.ulonglong_value);
+ /* Value should be moved to multi_master in on_update_func */
+ return false;
+ }
+ bool global_update(THD *thd, set_var *var)
+ {
+ return session_update(thd, var);
+ }
+ void session_save_default(THD *thd, set_var *var)
+ {
+ /* Use value given in variable declaration */
+ global_save_default(thd, var);
+ }
+ uchar *session_value_ptr(THD *thd,LEX_STRING *base)
+ {
+ uint *tmp, res;
+ tmp= (uint*) (((uchar*)&(thd->variables)) + offset);
+ res= get_master_info_uint_value(thd, master_info_offset);
+ *tmp= res;
+ return (uchar*) tmp;
+ }
+ uchar *global_value_ptr(THD *thd, LEX_STRING *base)
+ {
+ return session_value_ptr(thd, base);
+ }
+ uint get_master_info_uint_value(THD *thd, ptrdiff_t offset);
+ bool update_variable(THD *thd, Master_info *mi)
+ {
+ return update_multi_source_variable_func(this, thd, mi);
+ }
+};
+
+
/****************************************************************************
Used templates
****************************************************************************/
diff --git a/sql/table.cc b/sql/table.cc
index 4a66ab6f118..f033c08553a 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -4394,7 +4394,7 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type)
There are currently two mechanisms at work that handle errors for views,
this one and a more general mechanism based on an Internal_error_handler,
see Show_create_error_handler. The latter handles errors encountered during
- execution of SHOW CREATE VIEW, while the machanism using this method is
+ execution of SHOW CREATE VIEW, while the mechanism using this method is
handles SELECT from views. The two methods should not clash.
@param[in,out] thd thread handler
@@ -4545,7 +4545,14 @@ bool TABLE_LIST::check_single_table(TABLE_LIST **table_arg,
tbl;
tbl= tbl->next_local)
{
- if (tbl->table)
+ /*
+ Merged view has also temporary table attached (in 5.2 if it has table
+ then it was real table), so we have filter such temporary tables out
+ by checking that it is not merged view
+ */
+ if (tbl->table &&
+ !(tbl->is_view() &&
+ tbl->is_merged_derived()))
{
if (tbl->table->map & map)
{
@@ -4943,6 +4950,28 @@ void TABLE_LIST::set_check_materialized()
}
}
+TABLE *TABLE_LIST::get_real_join_table()
+{
+ TABLE_LIST *tbl= this;
+ while (tbl->table == NULL || tbl->table->reginfo.join_tab == NULL)
+ {
+ if (tbl->view == NULL && tbl->derived == NULL)
+ break;
+ /* we do not support merging of union yet */
+ DBUG_ASSERT(tbl->view == NULL ||
+ tbl->view->select_lex.next_select() == NULL);
+ DBUG_ASSERT(tbl->derived == NULL ||
+ tbl->derived->first_select()->next_select() == NULL);
+
+ if (tbl->table)
+ table= tbl->table;
+ tbl= (tbl->view != NULL ?
+ tbl->view->select_lex.get_table_list() :
+ tbl->derived->first_select()->get_table_list());
+ }
+ return tbl->table;
+}
+
Natural_join_column::Natural_join_column(Field_translator *field_param,
TABLE_LIST *tab)
diff --git a/sql/table.h b/sql/table.h
index 87affe984fc..458d661ceb5 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -29,6 +29,7 @@
#include "handler.h" /* row_type, ha_choice, handler */
#include "mysql_com.h" /* enum_field_types */
#include "thr_lock.h" /* thr_lock_type */
+#include "filesort_utils.h"
/* Structs that defines the TABLE */
@@ -299,11 +300,14 @@ enum tmp_table_type
};
enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP };
-typedef struct st_filesort_info
+
+class Filesort_info
{
+ /// Buffer for sorting keys.
+ Filesort_buffer filesort_buffer;
+
+public:
IO_CACHE *io_cache; /* If sorted through filesort */
- uchar **sort_keys; /* Buffer for sorting keys */
- uint keys; /* Number of key pointers in buffer */
uchar *buffpek; /* Buffer for buffpek structures */
uint buffpek_len; /* Max number of buffpeks in the buffer */
uchar *addon_buf; /* Pointer to a buffer if sorted with fields */
@@ -312,7 +316,38 @@ typedef struct st_filesort_info
void (*unpack)(struct st_sort_addon_field *, uchar *, uchar *); /* To unpack back */
uchar *record_pointers; /* If sorted in memory */
ha_rows found_records; /* How many records in sort */
-} FILESORT_INFO;
+
+ /** Sort filesort_buffer */
+ void sort_buffer(Sort_param *param, uint count)
+ { filesort_buffer.sort_buffer(param, count); }
+
+ /**
+ Accessors for Filesort_buffer (which @c).
+ */
+ uchar *get_record_buffer(uint idx)
+ { return filesort_buffer.get_record_buffer(idx); }
+
+ uchar **get_sort_keys()
+ { return filesort_buffer.get_sort_keys(); }
+
+ uchar **alloc_sort_buffer(uint num_records, uint record_length)
+ { return filesort_buffer.alloc_sort_buffer(num_records, record_length); }
+
+ bool check_sort_buffer_properties(uint num_records, uint record_length)
+ {
+ return filesort_buffer.check_sort_buffer_properties(num_records,
+ record_length);
+ }
+
+ void free_sort_buffer()
+ { filesort_buffer.free_sort_buffer(); }
+
+ void init_record_pointers()
+ { filesort_buffer.init_record_pointers(); }
+
+ size_t sort_buffer_size() const
+ { return filesort_buffer.sort_buffer_size(); }
+};
/*
@@ -1053,15 +1088,20 @@ public:
uint db_stat; /* mode of file as in handler.h */
/* number of select if it is derived table */
uint derived_select_number;
- int current_lock; /* Type of lock on table */
- bool copy_blobs; /* copy_blobs when storing */
-
/*
0 or JOIN_TYPE_{LEFT|RIGHT}. Currently this is only compared to 0.
If maybe_null !=0, this table is inner w.r.t. some outer join operation,
and null_row may be true.
*/
uint maybe_null;
+ int current_lock; /* Type of lock on table */
+ bool copy_blobs; /* copy_blobs when storing */
+ /*
+ Set if next_number_field is in the UPDATE fields of INSERT ... ON DUPLICATE
+ KEY UPDATE.
+ */
+ bool next_number_field_updated;
+
/*
If true, the current table row is considered to have all columns set to
NULL, including columns declared as "not null" (see maybe_null).
@@ -1106,7 +1146,12 @@ public:
See TABLE_LIST::process_index_hints().
*/
bool force_index_group;
- bool distinct,const_table,no_rows, used_for_duplicate_elimination;
+ /*
+ TRUE<=> this table was created with create_tmp_table(... distinct=TRUE..)
+ call
+ */
+ bool distinct;
+ bool const_table,no_rows, used_for_duplicate_elimination;
/**
If set, the optimizer has found that row retrieval should access index
@@ -1136,7 +1181,7 @@ public:
REGINFO reginfo; /* field connections */
MEM_ROOT mem_root;
GRANT_INFO grant;
- FILESORT_INFO sort;
+ Filesort_info sort;
/*
The arena which the items for expressions from the table definition
are associated with.
@@ -1929,6 +1974,7 @@ struct TABLE_LIST
TABLE_LIST *find_underlying_table(TABLE *table);
TABLE_LIST *first_leaf_for_name_resolution();
TABLE_LIST *last_leaf_for_name_resolution();
+ TABLE *get_real_join_table();
bool is_leaf_for_name_resolution();
inline TABLE_LIST *top_table()
{ return belong_to_view ? belong_to_view : this; }
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 9fae9f3fedd..ba24cab9ca7 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2329,7 +2329,6 @@ my_tz_find(THD *thd, const String *name)
if (!str_to_offset(name->ptr(), name->length(), &offset))
{
-
if (!(result_tz= (Time_zone_offset *)my_hash_search(&offset_tzs,
(const uchar *)&offset,
sizeof(long))))
@@ -2371,6 +2370,9 @@ my_tz_find(THD *thd, const String *name)
mysql_mutex_unlock(&tz_LOCK);
+ if (result_tz && result_tz != my_tz_SYSTEM && result_tz != my_tz_UTC)
+ status_var_increment(thd->status_var.feature_timezone);
+
DBUG_RETURN(result_tz);
}
diff --git a/sql/uniques.cc b/sql/uniques.cc
index ae50a1d3970..c246cd637bd 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -620,7 +620,6 @@ bool Unique::walk(tree_walk_action action, void *walk_action_arg)
bool Unique::get(TABLE *table)
{
- SORTPARAM sort_param;
table->sort.found_records=elements+tree.elements_in_tree;
if (my_b_tell(&file) == 0)
{
@@ -660,6 +659,7 @@ bool Unique::get(TABLE *table)
return 1;
reinit_io_cache(outfile,WRITE_CACHE,0L,0,0);
+ Sort_param sort_param;
bzero((char*) &sort_param,sizeof(sort_param));
sort_param.max_rows= elements;
sort_param.sort_form=table;
@@ -667,14 +667,15 @@ bool Unique::get(TABLE *table)
full_size;
sort_param.min_dupl_count= min_dupl_count;
sort_param.res_length= 0;
- sort_param.keys= (uint) (max_in_memory_size / sort_param.sort_length);
+ sort_param.max_keys_per_buffer=
+ (uint) (max_in_memory_size / sort_param.sort_length);
sort_param.not_killable=1;
- if (!(sort_buffer=(uchar*) my_malloc((sort_param.keys+1) *
+ if (!(sort_buffer=(uchar*) my_malloc((sort_param.max_keys_per_buffer+1) *
sort_param.sort_length,
MYF(0))))
return 1;
- sort_param.unique_buff= sort_buffer+(sort_param.keys*
+ sort_param.unique_buff= sort_buffer+(sort_param.max_keys_per_buffer *
sort_param.sort_length);
sort_param.compare= (qsort2_cmp) buffpek_compare;
diff --git a/storage/archive/azio.c b/storage/archive/azio.c
index 8fc85965cf0..92d7ad70344 100644
--- a/storage/archive/azio.c
+++ b/storage/archive/azio.c
@@ -39,6 +39,10 @@ void putLong(File file, uLong x);
uLong getLong(azio_stream *s);
void read_header(azio_stream *s, unsigned char *buffer);
+#ifdef HAVE_PSI_INTERFACE
+extern PSI_file_key arch_key_file_data;
+#endif
+
/* ===========================================================================
Opens a gzip (.gz) file for reading or writing. The mode parameter
is as in fopen ("rb" or "wb"). The file is given either by file descriptor
@@ -115,7 +119,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
s->stream.avail_out = AZ_BUFSIZE_WRITE;
errno = 0;
- s->file = fd < 0 ? my_open(path, Flags, MYF(0)) : fd;
+ s->file = fd < 0 ? mysql_file_open(arch_key_file_data, path, Flags, MYF(0)) : fd;
DBUG_EXECUTE_IF("simulate_archive_open_failure",
{
if (s->file >= 0)
@@ -248,8 +252,8 @@ int get_byte(s)
if (s->stream.avail_in == 0)
{
errno = 0;
- s->stream.avail_in= (uInt) my_read(s->file, (uchar *)s->inbuf,
- AZ_BUFSIZE_READ, MYF(0));
+ s->stream.avail_in= (uInt) mysql_file_read(s->file, (uchar *)s->inbuf,
+ AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
@@ -290,7 +294,8 @@ void check_header(azio_stream *s)
if (len < 2) {
if (len) s->inbuf[0] = s->stream.next_in[0];
errno = 0;
- len = (uInt)my_read(s->file, (uchar *)s->inbuf + len, AZ_BUFSIZE_READ >> len, MYF(0));
+ len = (uInt)mysql_file_read(s->file, (uchar *)s->inbuf + len,
+ AZ_BUFSIZE_READ >> len, MYF(0));
if (len == (uInt)-1) s->z_err = Z_ERRNO;
s->stream.avail_in += len;
s->stream.next_in = s->inbuf;
@@ -481,7 +486,8 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error)
if (s->stream.avail_out > 0)
{
s->stream.avail_out -=
- (uInt)my_read(s->file, (uchar *)next_out, s->stream.avail_out, MYF(0));
+ (uInt)mysql_file_read(s->file, (uchar *)next_out,
+ s->stream.avail_out, MYF(0));
}
len -= s->stream.avail_out;
s->in += len;
@@ -494,7 +500,8 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error)
if (s->stream.avail_in == 0 && !s->z_eof) {
errno = 0;
- s->stream.avail_in = (uInt)my_read(s->file, (uchar *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
+ s->stream.avail_in = (uInt)mysql_file_read(s->file, (uchar *)s->inbuf,
+ AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
@@ -561,8 +568,8 @@ unsigned int azwrite (azio_stream *s, const voidp buf, unsigned int len)
{
s->stream.next_out = s->outbuf;
- if (my_write(s->file, (uchar *)s->outbuf, AZ_BUFSIZE_WRITE,
- MYF(0)) != AZ_BUFSIZE_WRITE)
+ if (mysql_file_write(s->file, (uchar *)s->outbuf, AZ_BUFSIZE_WRITE,
+ MYF(0)) != AZ_BUFSIZE_WRITE)
{
s->z_err = Z_ERRNO;
break;
@@ -609,7 +616,7 @@ int do_flush (azio_stream *s, int flush)
if (len != 0)
{
s->check_point= my_tell(s->file, MYF(0));
- if ((uInt)my_write(s->file, (uchar *)s->outbuf, len, MYF(0)) != len)
+ if ((uInt)mysql_file_write(s->file, (uchar *)s->outbuf, len, MYF(0)) != len)
{
s->z_err = Z_ERRNO;
return Z_ERRNO;
@@ -796,7 +803,7 @@ void putLong (File file, uLong x)
for (n = 0; n < 4; n++)
{
buffer[0]= (int)(x & 0xff);
- my_write(file, buffer, 1, MYF(0));
+ mysql_file_write(file, buffer, 1, MYF(0));
x >>= 8;
}
}
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 430f0373919..8376ebc9826 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -112,6 +112,10 @@ static HASH archive_open_tables;
#define DATA_BUFFER_SIZE 2 // Size of the data used in the data file
#define ARCHIVE_CHECK_HEADER 254 // The number we use to determine corruption
+#ifdef HAVE_PSI_INTERFACE
+extern "C" PSI_file_key arch_key_file_data;
+#endif
+
/* Static declarations for handerton */
static handler *archive_create_handler(handlerton *hton,
TABLE_SHARE *table,
@@ -157,6 +161,14 @@ static PSI_mutex_info all_archive_mutexes[]=
{ &az_key_mutex_ARCHIVE_SHARE_mutex, "ARCHIVE_SHARE::mutex", 0}
};
+PSI_file_key arch_key_file_metadata, arch_key_file_data, arch_key_file_frm;
+static PSI_file_info all_archive_files[]=
+{
+ { &arch_key_file_metadata, "metadata", 0},
+ { &arch_key_file_data, "data", 0},
+ { &arch_key_file_frm, "FRM", 0}
+};
+
static void init_archive_psi_keys(void)
{
const char* category= "archive";
@@ -167,6 +179,9 @@ static void init_archive_psi_keys(void)
count= array_elements(all_archive_mutexes);
PSI_server->register_mutex(category, all_archive_mutexes, count);
+
+ count= array_elements(all_archive_files);
+ PSI_server->register_file(category, all_archive_files, count);
}
#endif /* HAVE_PSI_INTERFACE */
@@ -260,7 +275,7 @@ int archive_discover(handlerton *hton, THD* thd, const char *db,
build_table_filename(az_file, sizeof(az_file) - 1, db, name, ARZ, 0);
- if (!(my_stat(az_file, &file_stat, MYF(0))))
+ if (!(mysql_file_stat(arch_key_file_data, az_file, &file_stat, MYF(0))))
goto err;
if (!(azopen(&frm_stream, az_file, O_RDONLY|O_BINARY)))
@@ -723,7 +738,7 @@ int ha_archive::create(const char *name, TABLE *table_arg,
There is a chance that the file was "discovered". In this case
just use whatever file is there.
*/
- if (!(my_stat(name_buff, &file_stat, MYF(0))))
+ if (!(mysql_file_stat(arch_key_file_data, name_buff, &file_stat, MYF(0))))
{
my_errno= 0;
if (!(azopen(&create_stream, name_buff, O_CREAT|O_RDWR|O_BINARY)))
@@ -740,19 +755,19 @@ int ha_archive::create(const char *name, TABLE *table_arg,
/*
Here is where we open up the frm and pass it to archive to store
*/
- if ((frm_file= my_open(name_buff, O_RDONLY, MYF(0))) > 0)
+ if ((frm_file= mysql_file_open(arch_key_file_frm, name_buff, O_RDONLY, MYF(0))) >= 0)
{
if (!mysql_file_fstat(frm_file, &file_stat, MYF(MY_WME)))
{
frm_ptr= (uchar *)my_malloc(sizeof(uchar) * (size_t)file_stat.st_size, MYF(0));
if (frm_ptr)
{
- my_read(frm_file, frm_ptr, (size_t)file_stat.st_size, MYF(0));
+ mysql_file_read(frm_file, frm_ptr, (size_t)file_stat.st_size, MYF(0));
azwrite_frm(&create_stream, (char *)frm_ptr, (size_t)file_stat.st_size);
my_free(frm_ptr);
}
}
- my_close(frm_file, MYF(0));
+ mysql_file_close(frm_file, MYF(0));
}
if (create_info->comment.str)
@@ -1610,7 +1625,7 @@ int ha_archive::info(uint flag)
{
MY_STAT file_stat; // Stat information for the data file
- (void) my_stat(share->data_file_name, &file_stat, MYF(MY_WME));
+ (void) mysql_file_stat(arch_key_file_data, share->data_file_name, &file_stat, MYF(MY_WME));
if (flag & HA_STATUS_TIME)
stats.update_time= (ulong) file_stat.st_mtime;
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 91ead36fcea..98968d0b5b5 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -1095,7 +1095,8 @@ static struct st_mysql_sys_var* example_system_variables[]= {
NULL
};
-// this is an example of SHOW_FUNC and of my_snprintf() service
+// this is an example of SHOW_SIMPLE_FUNC and of my_snprintf() service
+// If this function would return an array, one should use SHOW_FUNC
static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var,
char *buf)
{
@@ -1109,7 +1110,7 @@ static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var,
static struct st_mysql_show_var func_status[]=
{
- {"example_func_example", (char *)show_func_example, SHOW_FUNC},
+ {"example_func_example", (char *)show_func_example, SHOW_SIMPLE_FUNC},
{0,0,SHOW_UNDEF}
};
diff --git a/storage/example/mysql-test/mtr/suite.pm b/storage/example/mysql-test/mtr/suite.pm
new file mode 100644
index 00000000000..f7ff42241fe
--- /dev/null
+++ b/storage/example/mysql-test/mtr/suite.pm
@@ -0,0 +1,8 @@
+package My::Suite::MTR::Example;
+
+@ISA = qw(My::Suite);
+
+sub skip_combinations {(
+ 't/combs.combinations' => [ 'c1' ],
+)}
+bless { };
diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c
index 90efeeb7924..01978e2b4e8 100644
--- a/storage/heap/hp_block.c
+++ b/storage/heap/hp_block.c
@@ -64,18 +64,19 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length)
break;
/*
- Allocate space for leaf block plus space for upper level blocks up to
- first level that has a free slot to put the pointer.
- In some cases we actually allocate more then we need:
- Consider e.g. a situation where we have one level 1 block and one level 0
- block, the level 0 block is full and this function is called. We only
- need a leaf block in this case. Nevertheless, we will get here with i=1
- and will also allocate sizeof(HP_PTRS) for non-leaf block and will never
- use this space.
- This doesn't add much overhead - with current values of sizeof(HP_PTRS)
- and my_default_record_cache_size we get about 1/128 unused memory.
+ Allocate space for leaf block (data) plus space for upper level blocks
+ up to first level that has a free slot to put the pointer.
+ If this is a new level, we have to allocate pointers to all future
+ lower levels.
+
+ For example, for level 0, we allocate data for X rows.
+ When level 0 is full, we allocate data for HPTRS_IN_NODE + X rows.
+ Next time we allocate data for X rows.
+ When level 1 is full, we allocate data for HPTRS_IN_NODE at level 2 and 1
+ + X rows at level 0.
*/
- *alloc_length=sizeof(HP_PTRS)*i+block->records_in_block* block->recbuffer;
+ *alloc_length= (sizeof(HP_PTRS)* ((i == block->levels) ? i : i - 1) +
+ block->records_in_block* block->recbuffer);
if (!(root=(HP_PTRS*) my_malloc(*alloc_length,MYF(MY_WME))))
return 1;
diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c
index 22ab9b54a85..d170d1abc65 100644
--- a/storage/heap/hp_create.c
+++ b/storage/heap/hp_create.c
@@ -245,21 +245,32 @@ static void init_block(HP_BLOCK *block, uint reclength, ulong min_records,
{
uint i,recbuffer,records_in_block;
- max_records= max(min_records,max_records);
+ /*
+ If not min_records and max_records are given, optimize for 1000 rows
+ */
+ if (!min_records)
+ min_records= min(1000, max_records);
if (!max_records)
- max_records= 1000; /* As good as quess as anything */
- recbuffer= (uint) (reclength + sizeof(uchar**) - 1) & ~(sizeof(uchar**) - 1);
- records_in_block= max_records / 10;
+ max_records= max(min_records, 1000);
/*
We don't want too few records_in_block as otherwise the overhead of
of the HP_PTRS block will be too notable
*/
- records_in_block= min(1000, max_records);
+ records_in_block= max(1000, min_records);
+ records_in_block= min(records_in_block, max_records);
+ /* If big max_records is given, allocate bigger blocks */
+ records_in_block= max(records_in_block, max_records / 10);
+ /* We don't want too few blocks per row either */
if (records_in_block < 10)
records_in_block= 10;
- /* The + 1 is there to ensure that we get at least 1 row per level */
+ recbuffer= (uint) (reclength + sizeof(uchar**) - 1) & ~(sizeof(uchar**) - 1);
+ /*
+ Don't allocate more than my_default_record_cache_size per level.
+ The + 1 is there to ensure that we get at least 1 row per level (for
+ the exceptional case of very long rows)
+ */
if (records_in_block*recbuffer >
(my_default_record_cache_size-sizeof(HP_PTRS)*HP_MAX_LEVELS))
records_in_block= (my_default_record_cache_size - sizeof(HP_PTRS) *
diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c
index d44726ba762..2abed55459c 100644
--- a/storage/heap/hp_hash.c
+++ b/storage/heap/hp_hash.c
@@ -348,6 +348,8 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
seg->length/cs->mbmaxlen);
set_if_smaller(length, char_length);
}
+ else
+ set_if_smaller(length, seg->length);
cs->coll->hash_sort(cs, pos+pack_length, length, &nr, &nr2);
}
else
@@ -593,6 +595,11 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2,
char_length2= my_charpos(cs, pos2, pos2 + char_length2, char_length);
set_if_smaller(char_length2, safe_length2);
}
+ else
+ {
+ set_if_smaller(char_length1, seg->length);
+ set_if_smaller(char_length2, seg->length);
+ }
if (cs->coll->strnncollsp(seg->charset,
pos1, char_length1,
@@ -689,6 +696,8 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
char_length2= my_charpos(cs, pos, pos + char_length_rec, char_length2);
set_if_smaller(char_length_rec, char_length2);
}
+ else
+ set_if_smaller(char_length_rec, seg->length);
if (cs->coll->strnncollsp(seg->charset,
(uchar*) pos, char_length_rec,
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 60babcb3b74..760bed8de8c 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -43,6 +43,7 @@ Created 6/2/1994 Heikki Tuuri
#include "trx0trx.h"
#include "srv0mon.h"
+#endif /* UNIV_HOTBACKUP */
/**************************************************************//**
Report that an index page is corrupted. */
UNIV_INTERN
@@ -65,6 +66,7 @@ btr_corruption_report(
buf_page_print(buf_block_get_frame(block), 0, 0);
}
+#ifndef UNIV_HOTBACKUP
#ifdef UNIV_BLOB_DEBUG
# include "srv0srv.h"
# include "ut0rbt.h"
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 2ae668ace50..2b543d8d1cf 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -3866,9 +3866,10 @@ buf_mark_space_corrupt(
/********************************************************************//**
Completes an asynchronous read or write request of a file page to or from
-the buffer pool. */
+the buffer pool.
+@return TRUE if successful */
UNIV_INTERN
-void
+ibool
buf_page_io_complete(
/*=================*/
buf_page_t* bpage) /*!< in: pointer to the block in question */
@@ -3995,7 +3996,7 @@ corrupt:
table as corrupted instead of crashing server */
if (bpage->space > TRX_SYS_SPACE
&& buf_mark_space_corrupt(bpage)) {
- return;
+ return(FALSE);
} else {
fputs("InnoDB: Ending processing"
" because of"
@@ -4087,6 +4088,8 @@ corrupt:
mutex_exit(buf_page_get_mutex(bpage));
buf_pool_mutex_exit(buf_pool);
+
+ return(TRUE);
}
/*********************************************************************//**
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index 92883269d42..1e2c15f969f 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -1993,9 +1993,23 @@ buf_LRU_free_one_page(
be in a state where it can be freed; there
may or may not be a hash index to the page */
{
+#ifdef UNIV_DEBUG
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+#endif
+ mutex_t* block_mutex = buf_page_get_mutex(bpage);
+
+ ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(block_mutex));
+
if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
!= BUF_BLOCK_ZIP_FREE) {
buf_LRU_block_free_hashed_page((buf_block_t*) bpage);
+ } else {
+ /* The block_mutex should have been released by
+ buf_LRU_block_remove_hashed_page() when it returns
+ BUF_BLOCK_ZIP_FREE. */
+ ut_ad(block_mutex == &buf_pool->zip_mutex);
+ mutex_enter(block_mutex);
}
}
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 1b3e5deed05..227cb083725 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -52,6 +52,44 @@ i/o-fixed buffer blocks */
#define BUF_READ_AHEAD_PEND_LIMIT 2
/********************************************************************//**
+Unfixes the pages, unlatches the page,
+removes it from page_hash and removes it from LRU. */
+static
+void
+buf_read_page_handle_error(
+/*=======================*/
+ buf_page_t* bpage) /*!< in: pointer to the block */
+{
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ const ibool uncompressed = (buf_page_get_state(bpage)
+ == BUF_BLOCK_FILE_PAGE);
+
+ /* First unfix and release lock on the bpage */
+ buf_pool_mutex_enter(buf_pool);
+ mutex_enter(buf_page_get_mutex(bpage));
+ ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ);
+ ut_ad(bpage->buf_fix_count == 0);
+
+ /* Set BUF_IO_NONE before we remove the block from LRU list */
+ buf_page_set_io_fix(bpage, BUF_IO_NONE);
+
+ if (uncompressed) {
+ rw_lock_x_unlock_gen(
+ &((buf_block_t*) bpage)->lock,
+ BUF_IO_READ);
+ }
+
+ /* remove the block from LRU list */
+ buf_LRU_free_one_page(bpage);
+
+ ut_ad(buf_pool->n_pend_reads > 0);
+ buf_pool->n_pend_reads--;
+
+ mutex_exit(buf_page_get_mutex(bpage));
+ buf_pool_mutex_exit(buf_pool);
+}
+
+/********************************************************************//**
Low-level function which reads a page asynchronously from a file to the
buffer buf_pool if it is not already there, in which case does nothing.
Sets the io_fix flag and sets an exclusive lock on the buffer frame. The
@@ -154,6 +192,11 @@ buf_read_page_low(
}
thd_wait_end(NULL);
+ if (*err == DB_TABLESPACE_DELETED) {
+ buf_read_page_handle_error(bpage);
+ return(0);
+ }
+
if (*err != DB_SUCCESS) {
if (ignore_nonexistent_pages) {
return(0);
@@ -165,7 +208,9 @@ buf_read_page_low(
if (sync) {
/* The i/o is already completed when we arrive from
fil_read */
- buf_page_io_complete(bpage);
+ if (!buf_page_io_complete(bpage)) {
+ return(0);
+ }
}
return(1);
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index c97207c92be..5871281e1b9 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -185,6 +185,7 @@ void
dict_field_print_low(
/*=================*/
const dict_field_t* field); /*!< in: field */
+#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
Frees a foreign key struct. */
static
@@ -242,7 +243,7 @@ and unique key errors */
UNIV_INTERN FILE* dict_foreign_err_file = NULL;
/* mutex protecting the foreign and unique error buffers */
UNIV_INTERN mutex_t dict_foreign_err_mutex;
-
+#endif /* !UNIV_HOTBACKUP */
/******************************************************************//**
Makes all characters in a NUL-terminated UTF-8 string lower case. */
UNIV_INTERN
@@ -2808,6 +2809,8 @@ dict_index_build_internal_fts(
return(new_index);
}
+
+#ifndef UNIV_HOTBACKUP
/*====================== FOREIGN KEY PROCESSING ========================*/
/*********************************************************************//**
@@ -3071,6 +3074,7 @@ dict_foreign_find_equiv_index(
FALSE/* allow columns to be NULL */));
}
+#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
Returns an index object by matching on the name and column names and
if more than one index matches return the index with the max id
@@ -3130,6 +3134,7 @@ dict_table_get_index_by_max_id(
return(found);
}
+#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Report an error in a foreign key definition. */
static
@@ -3308,6 +3313,7 @@ dict_foreign_add_to_cache(
return(DB_SUCCESS);
}
+#endif /* !UNIV_HOTBACKUP */
/*********************************************************************//**
Scans from pointer onwards. Stops if is at the start of a copy of
'string' where characters are compared without case sensitivity, and
@@ -3792,6 +3798,7 @@ end_of_string:
}
}
+#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
Finds the highest [number] for foreign key constraints of the table. Looks
only at the >= 4.0.18-format id's, which are of the form
@@ -4649,7 +4656,7 @@ syntax_error:
}
/*==================== END OF FOREIGN KEY PROCESSING ====================*/
-
+#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
Returns an index object if it is found in the dictionary cache.
Assumes that dict_sys->mutex is already being held.
@@ -4889,6 +4896,7 @@ dict_index_calc_min_rec_len(
return(sum);
}
+#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Prints info of a foreign key constraint. */
static
@@ -4919,6 +4927,7 @@ dict_foreign_print_low(
fputs(" )\n", stderr);
}
+#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
Prints a table data. */
UNIV_INTERN
@@ -5100,6 +5109,7 @@ dict_field_print_low(
}
}
+#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Outputs info on a foreign key of a table in a format suitable for
CREATE TABLE. */
@@ -5288,6 +5298,7 @@ dict_print_info_on_foreign_keys(
mutex_exit(&(dict_sys->mutex));
}
+#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
Displays the names of the index and the table. */
UNIV_INTERN
@@ -5608,6 +5619,28 @@ dict_table_replace_index_in_foreign_list(
foreign->foreign_index = new_index;
}
}
+
+
+ for (foreign = UT_LIST_GET_FIRST(table->referenced_list);
+ foreign;
+ foreign = UT_LIST_GET_NEXT(referenced_list, foreign)) {
+
+ dict_index_t* new_index;
+
+ if (foreign->referenced_index == index) {
+ ut_ad(foreign->referenced_table == index->table);
+
+ new_index = dict_foreign_find_index(
+ foreign->referenced_table,
+ foreign->referenced_col_names,
+ foreign->n_fields, index,
+ /*check_charsets=*/TRUE, /*check_null=*/FALSE);
+ ut_ad(new_index || !trx->check_foreigns);
+ ut_ad(!new_index || new_index->table == index->table);
+
+ foreign->referenced_index = new_index;
+ }
+ }
}
/**********************************************************************//**
diff --git a/storage/innobase/ha/ha0ha.cc b/storage/innobase/ha/ha0ha.cc
index dd99e3afae5..b58dc486cfa 100644
--- a/storage/innobase/ha/ha0ha.cc
+++ b/storage/innobase/ha/ha0ha.cc
@@ -28,6 +28,7 @@ Created 8/22/1994 Heikki Tuuri
#include "ha0ha.ic"
#endif
+#ifndef UNIV_HOTBACKUP
#ifdef UNIV_DEBUG
# include "buf0buf.h"
#endif /* UNIV_DEBUG */
@@ -59,9 +60,7 @@ ha_create_func(
MEM_HEAP_FOR_PAGE_HASH */
{
hash_table_t* table;
-#ifndef UNIV_HOTBACKUP
ulint i;
-#endif /* !UNIV_HOTBACKUP */
ut_a(type == MEM_HEAP_FOR_BTR_SEARCH
|| type == MEM_HEAP_FOR_PAGE_HASH);
@@ -205,7 +204,6 @@ ha_insert_for_fold_func(
while (prev_node != NULL) {
if (prev_node->fold == fold) {
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-# ifndef UNIV_HOTBACKUP
if (table->adaptive) {
buf_block_t* prev_block = prev_node->block;
ut_a(prev_block->frame
@@ -214,7 +212,6 @@ ha_insert_for_fold_func(
prev_block->n_pointers--;
block->n_pointers++;
}
-# endif /* !UNIV_HOTBACKUP */
prev_node->block = block;
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -243,11 +240,9 @@ ha_insert_for_fold_func(
ha_node_set_data(node, block, (rec_t*) data);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-# ifndef UNIV_HOTBACKUP
if (table->adaptive) {
block->n_pointers++;
}
-# endif /* !UNIV_HOTBACKUP */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
node->fold = fold;
@@ -289,13 +284,11 @@ ha_delete_hash_node(
#endif /* UNIV_SYNC_DEBUG */
ut_ad(btr_search_enabled);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-# ifndef UNIV_HOTBACKUP
if (table->adaptive) {
ut_a(del_node->block->frame = page_align(del_node->data));
ut_a(del_node->block->n_pointers > 0);
del_node->block->n_pointers--;
}
-# endif /* !UNIV_HOTBACKUP */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
HASH_DELETE_AND_COMPACT(ha_node_t, next, table, del_node);
@@ -337,13 +330,11 @@ ha_search_and_update_if_found_func(
if (node) {
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-# ifndef UNIV_HOTBACKUP
if (table->adaptive) {
ut_a(node->block->n_pointers > 0);
node->block->n_pointers--;
new_block->n_pointers++;
}
-# endif /* !UNIV_HOTBACKUP */
node->block = new_block;
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -355,7 +346,6 @@ ha_search_and_update_if_found_func(
return(FALSE);
}
-#ifndef UNIV_HOTBACKUP
/*****************************************************************//**
Removes from the chain determined by fold all nodes whose data pointer
points to the page given. */
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 9d8658e861c..5b3aa15a9a2 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -678,6 +678,15 @@ innobase_release_savepoint(
savepoint should be released */
void* savepoint); /*!< in: savepoint data */
+/*****************************************************************//**
+Handle a commit checkpoint request from server layer.
+We simply flush the redo log immediately and do the notify call.*/
+static
+void
+innobase_checkpoint_request(
+ handlerton *hton,
+ void *cookie);
+
/************************************************************************//**
Function for constructing an InnoDB table handler instance. */
static
@@ -1829,28 +1838,85 @@ ulonglong
innobase_next_autoinc(
/*==================*/
ulonglong current, /*!< in: Current value */
- ulonglong increment, /*!< in: increment current by */
+ ulonglong need, /*!< in: count of values needed */
+ ulonglong step, /*!< in: AUTOINC increment step */
ulonglong offset, /*!< in: AUTOINC offset */
- ulonglong max_value, /*!< in: max value for type */
- ulonglong reserve) /*!< in: how many values to reserve */
+ ulonglong max_value) /*!< in: max value for type */
{
ulonglong next_value;
+ ulonglong block = need * step;
/* Should never be 0. */
- ut_a(increment > 0);
+ ut_a(need > 0);
+ ut_a(block > 0);
+ ut_a(max_value > 0);
+
+ /*
+ Allow auto_increment to go over max_value up to max ulonglong.
+ This allows us to detect that all values are exhausted.
+ If we don't do this, we will return max_value several times
+ and get duplicate key errors instead of auto increment value
+ out of range.
+ */
+ max_value= (~(ulonglong) 0);
/* According to MySQL documentation, if the offset is greater than
- the increment then the offset is ignored. */
- if (offset >= increment)
+ the step then the offset is ignored. */
+ if (offset > block) {
offset = 0;
+ }
+
+ /* Check for overflow. */
+ if (block >= max_value
+ || offset > max_value
+ || current >= max_value
+ || max_value - offset <= offset) {
+
+ next_value = max_value;
+ } else {
+ ut_a(max_value > current);
+
+ ulonglong free = max_value - current;
+
+ if (free < offset || free - offset <= block) {
+ next_value = max_value;
+ } else {
+ next_value = 0;
+ }
+ }
+
+ if (next_value == 0) {
+ ulonglong next;
+
+ if (current > offset) {
+ next = (current - offset) / step;
+ } else {
+ next = (offset - current) / step;
+ }
+
+ ut_a(max_value > next);
+ next_value = next * step;
+ /* Check for multiplication overflow. */
+ ut_a(next_value >= next);
+ ut_a(max_value > next_value);
+
+ /* Check for overflow */
+ if (max_value - next_value >= block) {
- if (max_value <= current)
- return max_value;
- next_value = (current / increment) + reserve;
- next_value = next_value * increment + offset;
- /* Check for overflow. */
- if (next_value < current || next_value > max_value)
- next_value = max_value;
+ next_value += block;
+
+ if (max_value - next_value >= offset) {
+ next_value += offset;
+ } else {
+ next_value = max_value;
+ }
+ } else {
+ next_value = max_value;
+ }
+ }
+
+ ut_a(next_value != 0);
+ ut_a(next_value <= max_value);
return(next_value);
}
@@ -2585,6 +2651,7 @@ innobase_init(
innobase_hton->recover = innobase_xa_recover;
innobase_hton->commit_by_xid = innobase_commit_by_xid;
innobase_hton->rollback_by_xid = innobase_rollback_by_xid;
+ innobase_hton->commit_checkpoint_request=innobase_checkpoint_request;
innobase_hton->create_cursor_read_view = innobase_create_cursor_view;
innobase_hton->set_cursor_read_view = innobase_set_cursor_view;
innobase_hton->close_cursor_read_view = innobase_close_cursor_view;
@@ -3447,6 +3514,19 @@ innobase_rollback_trx(
}
/*****************************************************************//**
+Handle a commit checkpoint request from server layer.
+We simply flush the redo log immediately and do the notify call.*/
+static
+void
+innobase_checkpoint_request(
+ handlerton *hton,
+ void *cookie)
+{
+ log_buffer_flush_to_disk();
+ commit_checkpoint_notify_ha(hton, cookie);
+}
+
+/*****************************************************************//**
Rolls back a transaction to a savepoint.
@return 0 if success, HA_ERR_NO_SAVEPOINT if no savepoint with the
given name */
@@ -4290,7 +4370,7 @@ ha_innobase::innobase_initialize_autoinc()
nor the offset, so use a default increment of 1. */
auto_inc = innobase_next_autoinc(
- read_auto_inc, 1, 1, col_max_value, 1);
+ read_auto_inc, 1, 1, 0, col_max_value);
break;
}
case DB_RECORD_NOT_FOUND:
@@ -6201,7 +6281,10 @@ no_commit:
goto report_error;
}
- /* MySQL errors are passed straight back. */
+ /* MySQL errors are passed straight back. except for
+ HA_ERR_AUTO_INC_READ_FAILED. This can only happen
+ for values out of range.
+ */
error_result = (int) error;
goto func_exit;
}
@@ -6284,15 +6367,16 @@ set_max_autoinc:
if (auto_inc <= col_max_value) {
ut_a(prebuilt->autoinc_increment > 0);
- ulonglong need;
ulonglong offset;
+ ulonglong increment;
offset = prebuilt->autoinc_offset;
- need = prebuilt->autoinc_increment;
+ increment = prebuilt->autoinc_increment;
auto_inc = innobase_next_autoinc(
auto_inc,
- need, offset, col_max_value, 1);
+ 1, increment, offset,
+ col_max_value);
err = innobase_set_max_autoinc(
auto_inc);
@@ -6697,14 +6781,14 @@ ha_innobase::update_row(
if (auto_inc <= col_max_value && auto_inc != 0) {
- ulonglong need;
ulonglong offset;
+ ulonglong increment;
offset = prebuilt->autoinc_offset;
- need = prebuilt->autoinc_increment;
+ increment = prebuilt->autoinc_increment;
auto_inc = innobase_next_autoinc(
- auto_inc, need, offset, col_max_value, 1);
+ auto_inc, 1, increment, offset, col_max_value);
error = innobase_set_max_autoinc(auto_inc);
}
@@ -7014,6 +7098,7 @@ ha_innobase::index_read(
ulint ret;
DBUG_ENTER("index_read");
+ DEBUG_SYNC_C("ha_innobase_index_read_begin");
ut_a(prebuilt->trx == thd_to_trx(user_thd));
@@ -9814,10 +9899,15 @@ innobase_get_mysql_key_number_for_index(
}
}
- /* Print an error message if we cannot find the index
- ** in the "index translation table". */
- sql_print_error("Cannot find index %s in InnoDB index "
- "translation table.", index->name);
+ /* If index_count in translation table is set to 0, it
+ is possible we are in the process of rebuilding table,
+ do not spit error in this case */
+ if (share->idx_trans_tbl.index_count) {
+ /* Print an error message if we cannot find the index
+ ** in the "index translation table". */
+ sql_print_error("Cannot find index %s in InnoDB index "
+ "translation table.", index->name);
+ }
}
/* If we do not have an "index translation table", or not able
@@ -10220,9 +10310,10 @@ ha_innobase::info_low(
}
else if (rec_per_key > 1) {
rec_per_key =
- k_rec_per_key *
- (double)rec_per_key /
- n_rows;
+ (ha_rows)
+ (k_rec_per_key *
+ (double)rec_per_key /
+ n_rows);
}
key_info->rec_per_key[k++]=
@@ -11454,6 +11545,7 @@ innodb_show_status(
const long MAX_STATUS_SIZE = 1048576;
ulint trx_list_start = ULINT_UNDEFINED;
ulint trx_list_end = ULINT_UNDEFINED;
+ bool res;
DBUG_ENTER("innodb_show_status");
DBUG_ASSERT(hton == innodb_hton_ptr);
@@ -11523,12 +11615,13 @@ innodb_show_status(
mutex_exit(&srv_monitor_file_mutex);
- stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name),
- STRING_WITH_LEN(""), str, flen);
+ res= stat_print(thd, innobase_hton_name,
+ (uint) strlen(innobase_hton_name),
+ STRING_WITH_LEN(""), str, flen);
my_free(str);
- DBUG_RETURN(0);
+ DBUG_RETURN(res);
}
/************************************************************************//**
@@ -12188,13 +12281,17 @@ ha_innobase::get_auto_increment(
/* Not in the middle of a mult-row INSERT. */
} else if (prebuilt->autoinc_last_value == 0) {
set_if_bigger(*first_value, autoinc);
- /* Check for -ve values. */
- } else if (*first_value > col_max_value && trx->n_autoinc_rows > 0) {
- /* Set to next logical value. */
- ut_a(autoinc > trx->n_autoinc_rows);
- *first_value = (autoinc - trx->n_autoinc_rows) - 1;
}
+ if (*first_value > col_max_value)
+ {
+ /* Out of range number. Let handler::update_auto_increment()
+ take care of this */
+ prebuilt->autoinc_last_value = 0;
+ dict_table_autoinc_unlock(prebuilt->table);
+ *nb_reserved_values= 0;
+ return;
+ }
*nb_reserved_values = trx->n_autoinc_rows;
/* With old style AUTOINC locking we only update the table's
@@ -12203,11 +12300,12 @@ ha_innobase::get_auto_increment(
ulonglong current;
ulonglong next_value;
- current = *first_value > col_max_value ? autoinc : *first_value;
-
+ current = *first_value;
+
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
- current, increment, offset, col_max_value, *nb_reserved_values);
+ current, *nb_reserved_values, increment, offset,
+ col_max_value);
prebuilt->autoinc_last_value = next_value;
@@ -14422,10 +14520,17 @@ static MYSQL_SYSVAR_STR(ft_server_stopword_table, innobase_server_stopword_table
static MYSQL_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
PLUGIN_VAR_OPCMDARG,
- "Set to 0 (write and flush once per second),"
- " 1 (write and flush at each commit)"
- " or 2 (write at commit, flush once per second).",
- NULL, NULL, 1, 0, 2, 0);
+ "Controls the durability/speed trade-off for commits."
+ " Set to 0 (write and flush redo log to disk only once per second),"
+ " 1 (flush to disk at each commit),"
+ " 2 (write to log at commit but flush to disk only once per second)"
+ " or 3 (flush to disk at prepare and at commit, slower and usually redundant)."
+ " 1 and 3 guarantees that after a crash, committed transactions will"
+ " not be lost and will be consistent with the binlog and other transactional"
+ " engines. 2 can get inconsistent and lose transactions if there is a"
+ " power failure or kernel crash but not if mysqld crashes. 0 has no"
+ " guarantees in case of crash. 0 and 2 can be faster than 1 or 3.",
+ NULL, NULL, 1, 0, 3, 0);
static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 32501299630..9de45527ec7 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1061,6 +1061,10 @@ ha_innobase::add_index(
ut_a(indexed_table == prebuilt->table);
+ if (indexed_table->tablespace_discarded) {
+ DBUG_RETURN(-1);
+ }
+
/* Check that index keys are sensible */
error = innobase_check_index_keys(key_info, num_of_keys, prebuilt->table);
@@ -1162,7 +1166,7 @@ ha_innobase::add_index(
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
/* If a new primary key is defined for the table we need
to drop the original table and rebuild all indexes. */
@@ -1199,7 +1203,7 @@ ha_innobase::add_index(
}
ut_d(dict_table_check_for_dup_indexes(prebuilt->table,
- FALSE));
+ TRUE));
row_mysql_unlock_data_dictionary(trx);
mem_heap_free(heap);
@@ -1553,7 +1557,7 @@ ha_innobase::final_add_index(
trx_commit_for_mysql(prebuilt->trx);
}
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
ut_a(fts_check_cached_index(prebuilt->table));
@@ -1598,7 +1602,7 @@ ha_innobase::prepare_drop_index(
/* Test and mark all the indexes to be dropped */
row_mysql_lock_data_dictionary(trx);
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
/* Check that none of the indexes have previously been flagged
for deletion. */
@@ -1769,7 +1773,7 @@ func_exit:
} while (index);
}
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
row_mysql_unlock_data_dictionary(trx);
DBUG_RETURN(err);
@@ -1847,7 +1851,7 @@ ha_innobase::final_drop_index(
}
row_mysql_lock_data_dictionary(trx);
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
if (UNIV_UNLIKELY(err)) {
@@ -1890,7 +1894,7 @@ ha_innobase::final_drop_index(
share->idx_trans_tbl.index_count = 0;
func_exit:
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
ut_a(fts_check_cached_index(prebuilt->table));
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index f531b785786..5592995d4b2 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -92,6 +92,8 @@ insert/delete buffer when the record is not in the buffer pool. */
buffer when the record is not in the buffer pool. */
#define BTR_DELETE 8192
+#endif /* UNIV_HOTBACKUP */
+
/**************************************************************//**
Report that an index page is corrupted. */
UNIV_INTERN
@@ -112,6 +114,7 @@ btr_corruption_report(
ut_error; \
}
+#ifndef UNIV_HOTBACKUP
#ifdef UNIV_BLOB_DEBUG
# include "ut0rbt.h"
/** An index->blobs entry for keeping track of off-page column references */
diff --git a/storage/innobase/include/btr0types.h b/storage/innobase/include/btr0types.h
index 62b7868b419..09f97b3cabd 100644
--- a/storage/innobase/include/btr0types.h
+++ b/storage/innobase/include/btr0types.h
@@ -39,6 +39,8 @@ typedef struct btr_cur_struct btr_cur_t;
/** B-tree search information for the adaptive hash index */
typedef struct btr_search_struct btr_search_t;
+#ifndef UNIV_HOTBACKUP
+
/** @brief The latch protecting the adaptive search system
This latch protects the
@@ -54,6 +56,8 @@ Bear in mind (3) and (4) when using the hash index.
*/
extern rw_lock_t* btr_search_latch_temp;
+#endif /* UNIV_HOTBACKUP */
+
/** The latch protecting the adaptive search system */
#define btr_search_latch (*btr_search_latch_temp)
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 08e61c08004..2284f21e3ab 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -594,34 +594,34 @@ ib_uint64_t
buf_block_get_modify_clock(
/*=======================*/
buf_block_t* block); /*!< in: block */
-#else /* !UNIV_HOTBACKUP */
-# define buf_block_modify_clock_inc(block) ((void) 0)
-#endif /* !UNIV_HOTBACKUP */
/*******************************************************************//**
Increments the bufferfix count. */
UNIV_INLINE
void
buf_block_buf_fix_inc_func(
/*=======================*/
-#ifdef UNIV_SYNC_DEBUG
+# ifdef UNIV_SYNC_DEBUG
const char* file, /*!< in: file name */
ulint line, /*!< in: line */
-#endif /* UNIV_SYNC_DEBUG */
+# endif /* UNIV_SYNC_DEBUG */
buf_block_t* block) /*!< in/out: block to bufferfix */
__attribute__((nonnull));
-#ifdef UNIV_SYNC_DEBUG
+# ifdef UNIV_SYNC_DEBUG
/** Increments the bufferfix count.
@param b in/out: block to bufferfix
@param f in: file name where requested
@param l in: line number where requested */
# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(f,l,b)
-#else /* UNIV_SYNC_DEBUG */
+# else /* UNIV_SYNC_DEBUG */
/** Increments the bufferfix count.
@param b in/out: block to bufferfix
@param f in: file name where requested
@param l in: line number where requested */
# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(b)
-#endif /* UNIV_SYNC_DEBUG */
+# endif /* UNIV_SYNC_DEBUG */
+#else /* !UNIV_HOTBACKUP */
+# define buf_block_modify_clock_inc(block) ((void) 0)
+#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
Checks if a page is corrupt.
@return TRUE if corrupted */
@@ -1163,9 +1163,10 @@ buf_page_init_for_read(
ulint offset);/*!< in: page number */
/********************************************************************//**
Completes an asynchronous read or write request of a file page to or from
-the buffer pool. */
+the buffer pool.
+@return TRUE if successful */
UNIV_INTERN
-void
+ibool
buf_page_io_complete(
/*=================*/
buf_page_t* bpage); /*!< in: pointer to the block in question */
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 073b68c26ad..68008f95c2f 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -797,6 +797,7 @@ void
dict_table_x_unlock_indexes(
/*========================*/
dict_table_t* table); /*!< in: table */
+#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
Checks if a column is in the ordering columns of the clustered index of a
table. Column prefixes are treated like whole columns.
@@ -908,7 +909,7 @@ dict_index_remove_from_cache(
/*=========================*/
dict_table_t* table, /*!< in/out: table */
dict_index_t* index); /*!< in, own: index */
-#endif /* !UNIV_HOTBACKUP */
+
/********************************************************************//**
Gets the number of fields in the internal representation of an index,
including fields added by the dictionary system.
@@ -1427,7 +1428,7 @@ UNIV_INTERN
void
dict_close(void);
/*============*/
-
+#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Check whether the table is corrupted.
@return nonzero for corrupted table, zero for valid tables */
@@ -1448,6 +1449,7 @@ dict_index_is_corrupted(
const dict_index_t* index) /*!< in: index */
__attribute__((nonnull, pure, warn_unused_result));
+#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
Flags an index and table corrupted both in the data dictionary cache
and in the system table SYS_INDEXES. */
diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
index a454c682f89..b1aa3d2224c 100644
--- a/storage/innobase/include/trx0sys.h
+++ b/storage/innobase/include/trx0sys.h
@@ -183,7 +183,6 @@ UNIV_INLINE
trx_id_t
trx_sys_get_max_trx_id(void);
/*========================*/
-#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_DEBUG
/* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */
@@ -200,7 +199,6 @@ trx_write_trx_id(
/*=============*/
byte* ptr, /*!< in: pointer to memory where written */
trx_id_t id); /*!< in: id */
-#ifndef UNIV_HOTBACKUP
/*****************************************************************//**
Reads a trx id from an index page. In case that the id size changes in
some future version, this function should be used instead of
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 9919ec2a80a..a360d05f056 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2896,7 +2896,7 @@ recv_recovery_from_checkpoint_start_func(
lsn_t checkpoint_lsn;
ib_uint64_t checkpoint_no;
lsn_t old_scanned_lsn;
- lsn_t group_scanned_lsn;
+ lsn_t group_scanned_lsn = 0;
lsn_t contiguous_lsn;
#ifdef UNIV_LOG_ARCHIVE
lsn_t archived_lsn;
diff --git a/storage/innobase/mysql-test/storage_engine/alter_tablespace.opt b/storage/innobase/mysql-test/storage_engine/alter_tablespace.opt
new file mode 100644
index 00000000000..cf4b117e1b1
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/alter_tablespace.opt
@@ -0,0 +1,2 @@
+--innodb-file-per-table=1
+
diff --git a/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff b/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff
new file mode 100644
index 00000000000..c24594c5024
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff
@@ -0,0 +1,30 @@
+--- suite/storage_engine/autoinc_secondary.result 2012-07-12 04:34:18.153885986 +0400
++++ suite/storage_engine/autoinc_secondary.reject 2012-07-15 17:47:03.937703666 +0400
+@@ -13,18 +13,15 @@
+ 5 a
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <CHAR_COLUMN>, b <INT_COLUMN> AUTO_INCREMENT, PRIMARY KEY (a,b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
+-SELECT LAST_INSERT_ID();
+-LAST_INSERT_ID()
+-1
+-SELECT * FROM t1;
+-a b
+-a 1
+-a 2
+-b 1
+-b 2
+-c 1
+-DROP TABLE t1;
++ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
++# ERROR: Statement ended with errno 1075, errname ER_WRONG_AUTO_KEY (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_WRONG_AUTO_KEY.
++# Multi-part keys or PK or AUTO_INCREMENT (on a secondary column) or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ CREATE TABLE t1 (a <CHAR_COLUMN>, b <INT_COLUMN> AUTO_INCREMENT, PRIMARY KEY (a,b), <CUSTOM_INDEX>(b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
+ SELECT LAST_INSERT_ID();
diff --git a/storage/innobase/mysql-test/storage_engine/cache_index.rdiff b/storage/innobase/mysql-test/storage_engine/cache_index.rdiff
new file mode 100644
index 00000000000..e04df87aa34
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/cache_index.rdiff
@@ -0,0 +1,71 @@
+--- suite/storage_engine/cache_index.result 2012-07-15 00:22:19.822493731 +0400
++++ suite/storage_engine/cache_index.reject 2012-07-15 17:47:18.321522834 +0400
+@@ -12,31 +12,31 @@
+ SET GLOBAL <CACHE_NAME>.key_buffer_size=128*1024;
+ CACHE INDEX t1 INDEX (a), t2 IN <CACHE_NAME>;
+ Table Op Msg_type Msg_text
+-test.t1 assign_to_keycache status OK
+-test.t2 assign_to_keycache status OK
++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
++test.t2 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+ LOAD INDEX INTO CACHE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
+-test.t2 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
++test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
+ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+ SET GLOBAL <CACHE_NAME>.key_buffer_size=8*1024;
+ LOAD INDEX INTO CACHE t1, t2 IGNORE LEAVES;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
+-test.t2 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
++test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
+ SET GLOBAL <CACHE_NAME>.key_cache_age_threshold = 100, <CACHE_NAME>.key_cache_block_size = 512, <CACHE_NAME>.key_cache_division_limit = 1, <CACHE_NAME>.key_cache_segments=2;
+ INSERT INTO t1 (a,b) VALUES (5,'e'),(6,'f');
+ LOAD INDEX INTO CACHE t1;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+ SET GLOBAL new_<CACHE_NAME>.key_buffer_size=128*1024;
+ CACHE INDEX t1 IN new_<CACHE_NAME>;
+ Table Op Msg_type Msg_text
+-test.t1 assign_to_keycache status OK
++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ LOAD INDEX INTO CACHE t1 IGNORE LEAVES;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+ INSERT INTO t1 (a,b) VALUES (9,'i');
+ DROP TABLE t2;
+ DROP TABLE t1;
+@@ -47,11 +47,11 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ CACHE INDEX t1 IN <CACHE_NAME>;
+ Table Op Msg_type Msg_text
+-test.t1 assign_to_keycache status OK
++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ LOAD INDEX INTO CACHE t1;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -59,11 +59,11 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ CACHE INDEX t1 IN <CACHE_NAME>;
+ Table Op Msg_type Msg_text
+-test.t1 assign_to_keycache status OK
++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ LOAD INDEX INTO CACHE t1;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+ DROP TABLE t1;
+ SET GLOBAL <CACHE_NAME>.key_buffer_size=0;
+ SET GLOBAL new_<CACHE_NAME>.key_buffer_size=0;
diff --git a/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff b/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff
new file mode 100644
index 00000000000..71c782848a6
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff
@@ -0,0 +1,13 @@
+--- suite/storage_engine/checksum_table_live.result 2012-07-12 21:05:44.497062968 +0400
++++ suite/storage_engine/checksum_table_live.reject 2012-07-15 17:47:28.105399836 +0400
+@@ -11,8 +11,8 @@
+ test.t1 4272806499
+ CHECKSUM TABLE t1, t2 QUICK;
+ Table Checksum
+-test.t1 4272806499
+-test.t2 0
++test.t1 NULL
++test.t2 NULL
+ CHECKSUM TABLE t1, t2 EXTENDED;
+ Table Checksum
+ test.t1 4272806499
diff --git a/storage/innobase/mysql-test/storage_engine/define_engine.inc b/storage/innobase/mysql-test/storage_engine/define_engine.inc
new file mode 100644
index 00000000000..7d7b0c7407a
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/define_engine.inc
@@ -0,0 +1,45 @@
+###########################################
+#
+# This is a template of the include file define_engine.inc which
+# should be placed in storage/<engine>/mysql-test/storage_engine folder.
+#
+################################
+#
+# The name of the engine under test must be defined in $ENGINE variable.
+# You can set it either here (uncomment and edit) or in your environment.
+#
+let $ENGINE = InnoDB;
+#
+################################
+#
+# The following three variables define specific options for columns and tables.
+# Normally there should be none needed, but for some engines it can be different.
+# If the engine requires specific column option for all or indexed columns,
+# set them inside the comment, e.g. /*!NOT NULL*/.
+# Do the same for table options if needed, e.g. /*!INSERT_METHOD=LAST*/
+
+let $default_col_opts = /*!*/;
+let $default_col_indexed_opts = /*!*/;
+let $default_tbl_opts = /*!*/;
+
+# INDEX, UNIQUE INDEX, PRIMARY KEY, special index type - choose the fist that the engine allows,
+# or set it to /*!*/ if none is supported
+
+let $default_index = /*!INDEX*/;
+
+# If the engine does not support the following types, replace them with the closest possible
+
+let $default_int_type = INT(11);
+let $default_char_type = CHAR(8);
+
+################################
+
+--disable_query_log
+--disable_result_log
+
+# Here you can place your custom MTR code which needs to be executed before each test,
+# e.g. creation of an additional schema or table, etc.
+# The cleanup part should be defined in cleanup_engine.inc
+
+--enable_query_log
+--enable_result_log
diff --git a/storage/innobase/mysql-test/storage_engine/disabled.def b/storage/innobase/mysql-test/storage_engine/disabled.def
new file mode 100644
index 00000000000..3849170a7b8
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/disabled.def
@@ -0,0 +1,9 @@
+alter_table_online : MDEV-397 (Changing a column name via ALTER ONLINE does not work for InnoDB)
+autoinc_vars : MySQL:65225 (InnoDB miscalculates auto-increment)
+tbl_opt_ai : MySQL:65901 (AUTO_INCREMENT option on InnoDB table is ignored if added before autoinc column)
+delete_low_prio : InnoDB does not use table-level locking
+insert_high_prio : InnoDB does not use table-level locking
+insert_low_prio : InnoDB does not use table-level locking
+select_high_prio : InnoDB does not use table-level locking
+update_low_prio : InnoDB does not use table-level locking
+
diff --git a/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff b/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff
new file mode 100644
index 00000000000..f668e44109c
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff
@@ -0,0 +1,150 @@
+--- suite/storage_engine/fulltext_search.result 2012-07-12 20:03:26.664053893 +0400
++++ suite/storage_engine/fulltext_search.reject 2012-07-15 17:49:03.616199102 +0400
+@@ -4,129 +4,27 @@
+ v2 TEXT <CUSTOM_COL_OPTIONS>,
+ FULLTEXT v1 (v1)
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW INDEXES IN t1;
+-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+-If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+-For developers who want to code on MariaDB or MySQL
+-* Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+-o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+-o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+-* MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+-o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+-For MariaDB / MySQL end users
+-* MariaDB Crash Course by Ben Forta
+-o First MariaDB book!
+-o For people who want to learn SQL and the basics of MariaDB.
+-o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+-* SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+-o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+-o Free to read in the Knowledgebase!
+-* MySQL (4th Edition) by Paul DuBois
+-o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+-* MySQL Cookbook by Paul DuBois
+-o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+-* High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+-o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+-
+- * MySQL Admin Cookbook
+- o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+-
+- * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+- o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
+-'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
+-
+- 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
+- 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
+- 3. With MariaDB everyone has access to the latest code.
+- 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
+- 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
+-The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
+- ), ('text2','test1','test2');
+-SELECT v0 FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+-v0
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
+-SELECT v0, MATCH(v1) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+-v0 rating
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
+-SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
+-v0 rating
+-text4 1.3705332279205322
+-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
+-v0
+-text1
+-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
+-v0
+-SELECT v0, MATCH(v1) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('database' WITH QUERY EXPANSION);
+-v0 rating
+-text1 178.11756896972656
+-DROP TABLE t1;
++ERROR HY000: The used table type doesn't support FULLTEXT indexes
++# ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_TABLE_CANT_HANDLE_FT.
++# FULLTEXT indexes or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ CREATE TABLE t1 (v0 VARCHAR(64) <CUSTOM_COL_OPTIONS>,
+ v1 VARCHAR(16384) <CUSTOM_COL_OPTIONS>,
+ v2 TEXT <CUSTOM_COL_OPTIONS>,
+ FULLTEXT v1 (v1),
+ FULLTEXT v1_v2 (v1,v2)
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW INDEXES IN t1;
+-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT
+-t1 1 v1_v2 1 v1 # # NULL NULL YES FULLTEXT
+-t1 1 v1_v2 2 v2 # # NULL NULL YES FULLTEXT
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+-If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+-For developers who want to code on MariaDB or MySQL
+-* Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+-o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+-o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+-* MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+-o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+-For MariaDB / MySQL end users
+-* MariaDB Crash Course by Ben Forta
+-o First MariaDB book!
+-o For people who want to learn SQL and the basics of MariaDB.
+-o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+-* SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+-o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+-o Free to read in the Knowledgebase!
+-* MySQL (4th Edition) by Paul DuBois
+-o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+-* MySQL Cookbook by Paul DuBois
+-o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+-* High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+-o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+-
+- * MySQL Admin Cookbook
+- o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+-
+- * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+- o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
+-'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
+-
+- 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
+- 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
+- 3. With MariaDB everyone has access to the latest code.
+- 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
+- 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
+-The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
+- ), ('text2','test1','test2');
+-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+-v0
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
+-SELECT v0, MATCH(v1,v2) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+-v0 rating
+-text1 0.2809644043445587
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
+-SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
+-v0 rating
+-text4 1.3705332279205322
+-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
+-v0
+-text1
+-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
+-v0
+-SELECT v0, MATCH(v1,v2) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('database' WITH QUERY EXPANSION);
+-v0 rating
+-text1 190.56150817871094
+-text4 1.1758291721343994
+-DROP TABLE t1;
++ERROR HY000: The used table type doesn't support FULLTEXT indexes
++# ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_TABLE_CANT_HANDLE_FT.
++# FULLTEXT indexes or multiple keys or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
diff --git a/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff b/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff
new file mode 100644
index 00000000000..23aa66d2568
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff
@@ -0,0 +1,33 @@
+--- suite/storage_engine/index_enable_disable.result 2012-07-15 00:30:05.296641931 +0400
++++ suite/storage_engine/index_enable_disable.reject 2012-07-15 17:49:12.988081281 +0400
+@@ -11,15 +11,19 @@
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+ t1 1 a 1 a # # NULL NULL YES BTREE
+ ALTER TABLE t1 DISABLE KEYS;
++Warnings:
++Note 1031 Table storage engine for 't1' doesn't have this option
+ SHOW INDEX IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL YES BTREE disabled
++t1 1 a 1 a # # NULL NULL YES BTREE
+ EXPLAIN SELECT a FROM t1 ORDER BY a;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using filesort
++1 SIMPLE t1 index NULL a 5 NULL 19 Using index
+ INSERT INTO t1 (a) VALUES
+ (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+ ALTER TABLE t1 ENABLE KEYS;
++Warnings:
++Note 1031 Table storage engine for 't1' doesn't have this option
+ SHOW INDEX IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+ t1 1 a 1 a # # NULL NULL YES BTREE
+@@ -32,6 +36,8 @@
+ (1),(2),(3),(4),(5),(6),(7),(8),(9),
+ (21),(22),(23),(24),(25),(26),(27),(28),(29);
+ ALTER TABLE t1 DISABLE KEYS;
++Warnings:
++Note 1031 Table storage engine for 't1' doesn't have this option
+ INSERT INTO t1 (a) VALUES (29);
+ ERROR 23000: Duplicate entry '29' for key 'a'
+ # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
diff --git a/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff b/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff
new file mode 100644
index 00000000000..02f9d93588f
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff
@@ -0,0 +1,60 @@
+--- suite/storage_engine/index_type_hash.result 2012-07-15 01:10:17.919128889 +0400
++++ suite/storage_engine/index_type_hash.reject 2012-07-15 17:49:26.135915989 +0400
+@@ -4,7 +4,7 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL # HASH
++t1 1 a 1 a # # NULL NULL # BTREE
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -12,8 +12,8 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a_b 1 a # # NULL NULL # HASH a_b index
+-t1 1 a_b 2 b # # NULL NULL # HASH a_b index
++t1 1 a_b 1 a # # NULL NULL # BTREE a_b index
++t1 1 a_b 2 b # # NULL NULL # BTREE a_b index
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -22,8 +22,8 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL # HASH
+-t1 1 b 1 b # # NULL NULL # HASH
++t1 1 a 1 a # # NULL NULL # BTREE
++t1 1 b 1 b # # NULL NULL # BTREE
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -31,7 +31,7 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 0 a 1 a # # NULL NULL # HASH
++t1 0 a 1 a # # NULL NULL # BTREE
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ ERROR 23000: Duplicate entry '1' for key 'a'
+@@ -43,7 +43,7 @@
+ ALTER TABLE t1 ADD <CUSTOM_INDEX> (a) USING HASH COMMENT 'simple index on a';
+ SHOW INDEX FROM t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL # HASH simple index on a
++t1 1 a 1 a # # NULL NULL # BTREE simple index on a
+ ALTER TABLE t1 DROP KEY a;
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+@@ -52,7 +52,7 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 0 a 1 a # # NULL NULL # HASH
++t1 0 a 1 a # # NULL NULL # BTREE
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ ERROR 23000: Duplicate entry '1' for key 'a'
diff --git a/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff b/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff
new file mode 100644
index 00000000000..62895fa928f
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff
@@ -0,0 +1,26 @@
+--- suite/storage_engine/insert_delayed.result 2012-07-12 20:04:07.143544998 +0400
++++ suite/storage_engine/insert_delayed.reject 2012-07-15 17:49:34.551810189 +0400
+@@ -5,7 +5,16 @@
+ connect con0,localhost,root,,;
+ SET lock_wait_timeout = 1;
+ INSERT DELAYED INTO t1 (a,b) VALUES (3,'c');
++ERROR HY000: DELAYED option not supported for table 't1'
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_DELAYED_NOT_SUPPORTED.
++# INSERT DELAYED or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ INSERT DELAYED INTO t1 SET a=4, b='d';
++ERROR HY000: DELAYED option not supported for table 't1'
+ INSERT DELAYED INTO t1 SELECT 5, 'e';
+ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ disconnect con0;
+@@ -20,6 +29,4 @@
+ a b
+ 1 f
+ 2 b
+-3 c
+-4 d
+ DROP TABLE t1;
diff --git a/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff b/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff
new file mode 100644
index 00000000000..fe4a0087fa9
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff
@@ -0,0 +1,22 @@
+--- suite/storage_engine/lock_concurrent.result 2012-06-24 23:55:19.539380000 +0400
++++ suite/storage_engine/lock_concurrent.reject 2012-07-15 17:50:21.279222746 +0400
+@@ -3,10 +3,19 @@
+ LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
+ SET lock_wait_timeout = 1;
+ LOCK TABLES t1 READ LOCAL;
++ERROR HY000: Lock wait timeout exceeded; try restarting transaction
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_LOCK_WAIT_TIMEOUT.
++# LOCK .. WRITE CONCURRENT or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ UNLOCK TABLES;
+ UNLOCK TABLES;
+ LOCK TABLES t1 READ LOCAL;
+ LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
++ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ UNLOCK TABLES;
+ UNLOCK TABLES;
+ DROP TABLE t1;
diff --git a/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff b/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff
new file mode 100644
index 00000000000..54d1f600516
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff
@@ -0,0 +1,37 @@
+--- suite/storage_engine/optimize_table.result 2012-07-12 19:13:53.741428591 +0400
++++ suite/storage_engine/optimize_table.reject 2012-07-15 17:50:30.843102510 +0400
+@@ -5,25 +5,32 @@
+ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+ OPTIMIZE TABLE t1;
+ Table Op Msg_type Msg_text
++test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t1 optimize status OK
+ INSERT INTO t2 (a,b) VALUES (4,'d');
+ OPTIMIZE NO_WRITE_TO_BINLOG TABLE t2;
+ Table Op Msg_type Msg_text
++test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t2 optimize status OK
+ INSERT INTO t2 (a,b) VALUES (5,'e');
+ INSERT INTO t1 (a,b) VALUES (6,'f');
+ OPTIMIZE LOCAL TABLE t1, t2;
+ Table Op Msg_type Msg_text
++test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t1 optimize status OK
++test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t2 optimize status OK
+ OPTIMIZE TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 optimize status Table is already up to date
+-test.t2 optimize status Table is already up to date
++test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
++test.t1 optimize status OK
++test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
++test.t2 optimize status OK
+ DROP TABLE t1, t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(100,'b'),(2,'c'),(3,'d');
+ OPTIMIZE TABLE t1;
+ Table Op Msg_type Msg_text
++test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t1 optimize status OK
+ DROP TABLE t1;
diff --git a/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff
new file mode 100644
index 00000000000..3d4d2a683d9
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff
@@ -0,0 +1,22 @@
+--- suite/storage_engine/parts/checksum_table.result 2012-07-12 21:41:00.754458011 +0400
++++ suite/storage_engine/parts/checksum_table.reject 2012-07-15 20:04:35.881962676 +0400
+@@ -24,15 +24,15 @@
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=1 PARTITION BY HASH(a) PARTITIONS 2;
+ CHECKSUM TABLE t1;
+ Table Checksum
+-test.t1 0
++test.t1 4272806499
+ CHECKSUM TABLE t2, t1;
+ Table Checksum
+ test.t2 0
+-test.t1 0
++test.t1 4272806499
+ CHECKSUM TABLE t1, t2 QUICK;
+ Table Checksum
+-test.t1 0
+-test.t2 0
++test.t1 NULL
++test.t2 NULL
+ CHECKSUM TABLE t1, t2 EXTENDED;
+ Table Checksum
+ test.t1 4272806499
diff --git a/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff
new file mode 100644
index 00000000000..0df91c6fc6e
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff
@@ -0,0 +1,20 @@
+--- suite/storage_engine/parts/create_table.result 2012-07-12 21:56:38.618667460 +0400
++++ suite/storage_engine/parts/create_table.reject 2012-07-15 20:06:43.496358345 +0400
+@@ -65,7 +65,7 @@
+ 1 SIMPLE t1 abc,def # # # # # # #
+ EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
+ id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE NULL NULL # # # # # # #
++1 SIMPLE t1 def # # # # # # #
+ INSERT INTO t1 (a) VALUES (50);
+ ERROR HY000: Table has no partition for value 50
+ DROP TABLE t1;
+@@ -81,7 +81,7 @@
+ 1 SIMPLE t1 abc_abcsp0,def_defsp0 # # # # # # #
+ EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
+ id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE NULL NULL # # # # # # #
++1 SIMPLE t1 def_defsp0 # # # # # # #
+ SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, PARTITION_METHOD, SUBPARTITION_METHOD
+ FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1';
+ TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_METHOD SUBPARTITION_METHOD
diff --git a/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff
new file mode 100644
index 00000000000..77ee7e2eb31
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff
@@ -0,0 +1,58 @@
+--- suite/storage_engine/parts/optimize_table.result 2012-07-12 22:16:39.343572304 +0400
++++ suite/storage_engine/parts/optimize_table.reject 2012-07-15 20:07:01.632130348 +0400
+@@ -9,18 +9,22 @@
+ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+ ALTER TABLE t1 OPTIMIZE PARTITION p1;
+ Table Op Msg_type Msg_text
++test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t1 optimize status OK
+ INSERT INTO t2 (a,b) VALUES (4,'d');
+ ALTER TABLE t2 OPTIMIZE PARTITION p0 NO_WRITE_TO_BINLOG;
+ Table Op Msg_type Msg_text
++test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t2 optimize status OK
+ INSERT INTO t1 (a,b) VALUES (6,'f');
+ ALTER TABLE t1 OPTIMIZE PARTITION ALL LOCAL;
+ Table Op Msg_type Msg_text
++test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t1 optimize status OK
+ INSERT INTO t2 (a,b) VALUES (5,'e');
+ ALTER TABLE t2 OPTIMIZE PARTITION p1,p0;
+ Table Op Msg_type Msg_text
++test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t2 optimize status OK
+ DROP TABLE t1, t2;
+ DROP TABLE IF EXISTS t1,t2;
+@@ -30,25 +34,32 @@
+ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+ OPTIMIZE TABLE t1;
+ Table Op Msg_type Msg_text
++test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t1 optimize status OK
+ INSERT INTO t2 (a,b) VALUES (4,'d');
+ OPTIMIZE NO_WRITE_TO_BINLOG TABLE t2;
+ Table Op Msg_type Msg_text
++test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t2 optimize status OK
+ INSERT INTO t2 (a,b) VALUES (5,'e');
+ INSERT INTO t1 (a,b) VALUES (6,'f');
+ OPTIMIZE LOCAL TABLE t1, t2;
+ Table Op Msg_type Msg_text
++test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t1 optimize status OK
++test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t2 optimize status OK
+ OPTIMIZE TABLE t1, t2;
+ Table Op Msg_type Msg_text
++test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t1 optimize status OK
++test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t2 optimize status OK
+ DROP TABLE t1, t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(100,'b'),(2,'c'),(3,'d');
+ OPTIMIZE TABLE t1;
+ Table Op Msg_type Msg_text
++test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+ test.t1 optimize status OK
+ DROP TABLE t1;
diff --git a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff
new file mode 100644
index 00000000000..aab866fde83
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff
@@ -0,0 +1,228 @@
+--- suite/storage_engine/parts/repair_table.result 2012-07-15 01:22:58.861853325 +0400
++++ suite/storage_engine/parts/repair_table.reject 2012-07-15 20:07:11.268009209 +0400
+@@ -9,27 +9,27 @@
+ INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+ ALTER TABLE t1 REPAIR PARTITION p0;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 VALUES (3,'c');
+ ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+ ALTER TABLE t2 REPAIR PARTITION LOCAL p1;
+ Table Op Msg_type Msg_text
+-test.t2 repair status OK
++test.t2 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ ALTER TABLE t1 REPAIR PARTITION LOCAL ALL EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 VALUES (10,'j');
+ ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t2 (a,b) VALUES (12,'l');
+ ALTER TABLE t2 REPAIR PARTITION NO_WRITE_TO_BINLOG ALL QUICK EXTENDED USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t2 repair status OK
++test.t2 repair note The storage engine for the table doesn't support repair
+ DROP TABLE t1, t2;
+ DROP TABLE IF EXISTS t1,t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+@@ -37,35 +37,35 @@
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (3,'c');
+ INSERT INTO t2 (a,b) VALUES (4,'d');
+ REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-test.t2 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
++test.t2 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+ REPAIR LOCAL TABLE t2;
+ Table Op Msg_type Msg_text
+-test.t2 repair status OK
++test.t2 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ INSERT INTO t2 (a,b) VALUES (9,'i');
+ REPAIR LOCAL TABLE t2, t1 EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t2 repair status OK
+-test.t1 repair status OK
++test.t2 repair note The storage engine for the table doesn't support repair
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (10,'j');
+ INSERT INTO t2 (a,b) VALUES (11,'k');
+ REPAIR TABLE t1, t2 QUICK USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-test.t2 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
++test.t2 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (12,'l');
+ INSERT INTO t2 (a,b) VALUES (13,'m');
+ REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2 QUICK EXTENDED USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-test.t2 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
++test.t2 repair note The storage engine for the table doesn't support repair
+ FLUSH TABLE t1;
+ INSERT INTO t1 (a,b) VALUES (14,'n');
+ ERROR HY000: Failed to read from the .par file
+@@ -93,127 +93,21 @@
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ REPAIR TABLE t1 EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (10,'j');
+ REPAIR TABLE t1 USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
++test.t1 repair note The storage engine for the table doesn't support repair
+ t1.frm
+ t1.par
+ INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+ # Statement ended with one of expected results (0,144).
+ # If you got a difference in error message, just add it to rdiff file
+ FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1#P#p0.MYD
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check error Size of datafile is: 26 Should be: 39
+-test.t1 check error Partition p0 returned error
+-test.t1 check error Corrupt
+-SELECT * FROM t1;
+-a b
+-8 h
+-10 j
+-7 g
+-15 o
+-Warnings:
+-Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired
+-Error 1194 Table 't1' is marked as crashed and should be repaired
+-Error 1034 Number of rows changed from 3 to 2
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1#P#p0.MYI
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check warning Size of datafile is: 39 Should be: 26
+-test.t1 check error Record-count is not ok; is 3 Should be: 2
+-test.t1 check warning Found 3 key parts. Should be: 2
+-test.t1 check error Partition p0 returned error
+-test.t1 check error Corrupt
+-SELECT * FROM t1;
+-a b
+-8 h
+-10 j
+-14 n
+-7 g
+-15 o
+-15 o
+-Warnings:
+-Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired
+-Error 1194 Table 't1' is marked as crashed and should be repaired
+-Error 1034 Number of rows changed from 2 to 3
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1#P#p1.MYD
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check error Size of datafile is: 39 Should be: 52
+-test.t1 check error Partition p1 returned error
+-test.t1 check error Corrupt
+-SELECT * FROM t1;
+-a b
+-8 h
+-10 j
+-14 n
+-14 n
+-7 g
+-15 o
+-15 o
+-Warnings:
+-Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired
+-Error 1194 Table 't1' is marked as crashed and should be repaired
+-Error 1034 Number of rows changed from 4 to 3
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1#P#p1.MYI
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check warning Size of datafile is: 52 Should be: 39
+-test.t1 check error Record-count is not ok; is 4 Should be: 3
+-test.t1 check warning Found 4 key parts. Should be: 3
+-test.t1 check error Partition p1 returned error
+-test.t1 check error Corrupt
+-SELECT * FROM t1;
+-a b
+-8 h
+-10 j
+-14 n
+-14 n
+-14 n
+-7 g
+-15 o
+-15 o
+-15 o
+-Warnings:
+-Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired
+-Error 1194 Table 't1' is marked as crashed and should be repaired
+-Error 1034 Number of rows changed from 3 to 4
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+ Restoring <DATADIR>/test/t1.par
+ CHECK TABLE t1;
+ Table Op Msg_type Msg_text
+@@ -223,14 +117,8 @@
+ 8 h
+ 10 j
+ 14 n
+-14 n
+-14 n
+-14 n
+ 7 g
+ 15 o
+-15 o
+-15 o
+-15 o
+ # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+ # If you got a difference in error message, just add it to rdiff file
+ DROP TABLE t1;
diff --git a/storage/innobase/mysql-test/storage_engine/parts/suite.opt b/storage/innobase/mysql-test/storage_engine/parts/suite.opt
new file mode 100644
index 00000000000..28ae8786144
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/parts/suite.opt
@@ -0,0 +1,4 @@
+--ignore-builtin-innodb
+--plugin-load=ha_innodb
+--innodb
+
diff --git a/storage/innobase/mysql-test/storage_engine/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/repair_table.rdiff
new file mode 100644
index 00000000000..9c51fea47ff
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/repair_table.rdiff
@@ -0,0 +1,129 @@
+--- suite/storage_engine/repair_table.result 2012-07-15 01:26:44.347708000 +0400
++++ suite/storage_engine/repair_table.reject 2012-07-15 17:50:37.927013454 +0400
+@@ -4,56 +4,57 @@
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (3,'c');
+ INSERT INTO t2 (a,b) VALUES (4,'d');
+ REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-test.t2 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
++test.t2 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+ REPAIR LOCAL TABLE t2;
+ Table Op Msg_type Msg_text
+-test.t2 repair status OK
++test.t2 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ INSERT INTO t2 (a,b) VALUES (9,'i');
+ REPAIR LOCAL TABLE t2, t1 EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t2 repair status OK
+-test.t1 repair status OK
++test.t2 repair note The storage engine for the table doesn't support repair
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (10,'j');
+ INSERT INTO t2 (a,b) VALUES (11,'k');
+ REPAIR TABLE t1, t2 QUICK USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair warning Number of rows changed from 0 to 6
+-test.t1 repair status OK
+-test.t2 repair warning Number of rows changed from 0 to 5
+-test.t2 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
++test.t2 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (12,'l');
+ INSERT INTO t2 (a,b) VALUES (13,'m');
+ REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2 QUICK EXTENDED USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair warning Number of rows changed from 0 to 7
+-test.t1 repair status OK
+-test.t2 repair warning Number of rows changed from 0 to 6
+-test.t2 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
++test.t2 repair note The storage engine for the table doesn't support repair
+ FLUSH TABLE t1;
+ INSERT INTO t1 (a,b) VALUES (14,'n');
+-ERROR HY000: Incorrect file format 't1'
+ # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+ # If you got a difference in error message, just add it to rdiff file
+ CHECK TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 check Error Incorrect file format 't1'
+-test.t1 check error Corrupt
++test.t1 check status OK
+ SELECT * FROM t1;
+-ERROR HY000: Incorrect file format 't1'
++a b
++1 a
++2 b
++3 c
++7 g
++8 h
++10 j
++12 l
++14 n
+ # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+ # If you got a difference in error message, just add it to rdiff file
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair Error Incorrect file format 't1'
+-test.t1 repair error Corrupt
++test.t1 repair note The storage engine for the table doesn't support repair
+ DROP TABLE t1, t2;
+ call mtr.add_suppression("Got an error from thread_id=.*");
+ call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
+@@ -62,45 +63,14 @@
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ REPAIR TABLE t1 EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (10,'j');
+ REPAIR TABLE t1 USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair warning Number of rows changed from 0 to 3
+-test.t1 repair status OK
+-t1.MYD
+-t1.MYI
++test.t1 repair note The storage engine for the table doesn't support repair
+ t1.frm
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1.MYD
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check error Size of datafile is: 39 Should be: 65
+-test.t1 check error Corrupt
+-SELECT * FROM t1;
+-ERROR HY000: Incorrect key file for table 't1'; try to repair it
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1.MYI
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check warning Table is marked as crashed and last repair failed
+-test.t1 check error Size of datafile is: 39 Should be: 65
+-test.t1 check error Corrupt
+-SELECT * FROM t1;
+-ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+ DROP TABLE t1;
diff --git a/storage/innobase/mysql-test/storage_engine/suite.opt b/storage/innobase/mysql-test/storage_engine/suite.opt
new file mode 100644
index 00000000000..28ae8786144
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/suite.opt
@@ -0,0 +1,4 @@
+--ignore-builtin-innodb
+--plugin-load=ha_innodb
+--innodb
+
diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff
new file mode 100644
index 00000000000..47f624c73d9
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff
@@ -0,0 +1,18 @@
+--- suite/storage_engine/tbl_opt_data_index_dir.result 2012-06-24 23:55:19.539380000 +0400
++++ suite/storage_engine/tbl_opt_data_index_dir.reject 2012-07-15 17:51:04.070684784 +0400
+@@ -4,7 +4,7 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ Warnings:
+ Warning 1618 <INDEX DIRECTORY> option ignored
+ SHOW CREATE TABLE t1;
+@@ -12,5 +12,5 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ DROP TABLE t1;
diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff
new file mode 100644
index 00000000000..468b82926f0
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff
@@ -0,0 +1,11 @@
+--- suite/storage_engine/tbl_opt_insert_method.result 2012-06-24 23:55:19.539380000 +0400
++++ suite/storage_engine/tbl_opt_insert_method.reject 2012-07-15 17:51:09.978610512 +0400
+@@ -5,7 +5,7 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ ALTER TABLE t1 INSERT_METHOD=NO;
+ SHOW CREATE TABLE t1;
+ Table Create Table
diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_key_block_size.opt b/storage/innobase/mysql-test/storage_engine/tbl_opt_key_block_size.opt
new file mode 100644
index 00000000000..7cd737b2b87
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_key_block_size.opt
@@ -0,0 +1,3 @@
+--innodb-file-per-table=1
+--innodb-file-format=Barracuda
+
diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.opt b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.opt
new file mode 100644
index 00000000000..7cd737b2b87
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.opt
@@ -0,0 +1,3 @@
+--innodb-file-per-table=1
+--innodb-file-format=Barracuda
+
diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff
new file mode 100644
index 00000000000..4c0e0c375f5
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff
@@ -0,0 +1,10 @@
+--- suite/storage_engine/tbl_opt_row_format.result 2012-06-24 23:55:19.539380000 +0400
++++ suite/storage_engine/tbl_opt_row_format.reject 2012-07-15 19:26:02.235049157 +0400
+@@ -1,5 +1,7 @@
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> ROW_FORMAT=FIXED;
++Warnings:
++Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff
new file mode 100644
index 00000000000..cbdf5818022
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff
@@ -0,0 +1,16 @@
+--- suite/storage_engine/tbl_opt_union.result 2012-06-24 23:55:19.539380000 +0400
++++ suite/storage_engine/tbl_opt_union.reject 2012-07-15 17:51:31.014346053 +0400
+@@ -4,11 +4,11 @@
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`)
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ ALTER TABLE t1 UNION = (child1,child2);
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`,`child2`)
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ DROP TABLE t1, child1, child2;
diff --git a/storage/innobase/mysql-test/storage_engine/trx/disabled.def b/storage/innobase/mysql-test/storage_engine/trx/disabled.def
new file mode 100644
index 00000000000..7b8a16d0b7a
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/trx/disabled.def
@@ -0,0 +1,2 @@
+cons_snapshot_serializable : MySQL:65146 (CONSISTENT SNAPSHOT does not work with SERIALIZABLE)
+
diff --git a/storage/innobase/mysql-test/storage_engine/trx/suite.opt b/storage/innobase/mysql-test/storage_engine/trx/suite.opt
new file mode 100644
index 00000000000..2bf66f067f6
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/trx/suite.opt
@@ -0,0 +1,5 @@
+--ignore-builtin-innodb
+--plugin-load=ha_innodb
+--innodb
+--innodb-lock-wait-timeout=1
+
diff --git a/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff
new file mode 100644
index 00000000000..7fce0a108e9
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff
@@ -0,0 +1,20 @@
+--- suite/storage_engine/type_char_indexes.result 2012-07-12 19:27:42.191013570 +0400
++++ suite/storage_engine/type_char_indexes.reject 2012-07-15 17:51:55.810034331 +0400
+@@ -98,7 +98,7 @@
+ SET SESSION optimizer_switch = 'engine_condition_pushdown=on';
+ EXPLAIN SELECT * FROM t1 WHERE c > 'a';
+ id select_type table type possible_keys key key_len ref rows Extra
+-# # # range c_v c_v # # # Using index condition
++# # # range c_v c_v # # # Using where
+ SELECT * FROM t1 WHERE c > 'a';
+ c c20 v16 v128
+ b char3 varchar1a varchar1b
+@@ -135,7 +135,7 @@
+ r3a
+ EXPLAIN SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+ id select_type table type possible_keys key key_len ref rows Extra
+-# # # range # v16 # # # #
++# # # ALL # NULL # # # #
+ SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+ c c20 v16 v128
+ a char1 varchar1a varchar1b
diff --git a/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff
new file mode 100644
index 00000000000..6ebfd61d876
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff
@@ -0,0 +1,11 @@
+--- suite/storage_engine/type_float_indexes.result 2012-07-12 19:37:27.031661128 +0400
++++ suite/storage_engine/type_float_indexes.reject 2012-07-15 17:52:12.189828410 +0400
+@@ -60,7 +60,7 @@
+ ALTER TABLE t1 ADD UNIQUE KEY(d);
+ EXPLAIN SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d;
+ id select_type table type possible_keys key key_len ref rows Extra
+-# # # # # d # # # #
++# # # # # NULL # # # #
+ SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d;
+ d
+ 1.2345
diff --git a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
new file mode 100644
index 00000000000..9a9566deafb
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
@@ -0,0 +1,712 @@
+--- suite/storage_engine/type_spatial_indexes.result 2012-07-12 04:52:40.840023344 +0400
++++ suite/storage_engine/type_spatial_indexes.reject 2012-07-15 19:27:32.761911079 +0400
+@@ -702,699 +702,15 @@
+ DROP DATABASE IF EXISTS gis_ogs;
+ CREATE DATABASE gis_ogs;
+ CREATE TABLE gis_point (fid <INT_COLUMN>, g POINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-USE gis_ogs;
+-CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-shore POLYGON NOT NULL, SPATIAL INDEX s(shore)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
+-num_lanes INT <CUSTOM_COL_OPTIONS>,
+-centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-num_lanes INT <CUSTOM_COL_OPTIONS>,
+-centerlines MULTILINESTRING NOT NULL, SPATIAL INDEX c(centerlines)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-boundary MULTIPOLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-position POINT NOT NULL, SPATIAL INDEX p(position)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-position POINT NOT NULL,
+-footprint POLYGON NOT NULL, SPATIAL INDEX p(position), SPATIAL INDEX f(footprint)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-type CHAR(64) <CUSTOM_COL_OPTIONS>,
+-shores MULTIPOLYGON NOT NULL, SPATIAL INDEX s(shores)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-boundary POLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
+-neatline POLYGON NOT NULL, SPATIAL INDEX n(neatline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-USE test;
+-SHOW FIELDS FROM gis_point;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g point NO MUL NULL
+-SHOW FIELDS FROM gis_line;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g linestring NO MUL NULL
+-SHOW FIELDS FROM gis_polygon;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g polygon NO MUL NULL
+-SHOW FIELDS FROM gis_multi_point;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multipoint NO MUL NULL
+-SHOW FIELDS FROM gis_multi_line;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multilinestring NO MUL NULL
+-SHOW FIELDS FROM gis_multi_polygon;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multipolygon NO MUL NULL
+-SHOW FIELDS FROM gis_geometrycollection;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g geometrycollection NO MUL NULL
+-SHOW FIELDS FROM gis_geometry;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g geometry NO NULL
+-INSERT INTO gis_point VALUES
+-(101, PointFromText('POINT(10 10)')),
+-(102, PointFromText('POINT(20 10)')),
+-(103, PointFromText('POINT(20 20)')),
+-(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+-INSERT INTO gis_line VALUES
+-(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+-(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+-(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+-INSERT INTO gis_polygon VALUES
+-(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+-(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+-(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+-INSERT INTO gis_multi_point VALUES
+-(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+-(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+-(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+-INSERT INTO gis_multi_line VALUES
+-(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+-(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+-(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+-INSERT INTO gis_multi_polygon VALUES
+-(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+-(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+-(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+-INSERT INTO gis_geometrycollection VALUES
+-(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+-(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+-(122, GeomFromText('GeometryCollection()')),
+-(123, GeomFromText('GeometryCollection EMPTY'));
+-INSERT into gis_geometry SELECT * FROM gis_point;
+-INSERT into gis_geometry SELECT * FROM gis_line;
+-INSERT into gis_geometry SELECT * FROM gis_polygon;
+-INSERT into gis_geometry SELECT * FROM gis_multi_point;
+-INSERT into gis_geometry SELECT * FROM gis_multi_line;
+-INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+-INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+-SELECT fid, AsText(g) FROM gis_point;
+-fid AsText(g)
+-101 POINT(10 10)
+-102 POINT(20 10)
+-103 POINT(20 20)
+-104 POINT(10 20)
+-SELECT fid, AsText(g) FROM gis_line;
+-fid AsText(g)
+-105 LINESTRING(0 0,0 10,10 0)
+-106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-107 LINESTRING(10 10,40 10)
+-SELECT fid, AsText(g) FROM gis_polygon;
+-fid AsText(g)
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+-110 POLYGON((0 0,30 0,30 30,0 0))
+-SELECT fid, AsText(g) FROM gis_multi_point;
+-fid AsText(g)
+-111 MULTIPOINT(0 0,10 10,10 20,20 20)
+-112 MULTIPOINT(1 1,11 11,11 21,21 21)
+-113 MULTIPOINT(3 6,4 10)
+-SELECT fid, AsText(g) FROM gis_multi_line;
+-fid AsText(g)
+-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+-115 MULTILINESTRING((10 48,10 21,10 0))
+-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+-SELECT fid, AsText(g) FROM gis_multi_polygon;
+-fid AsText(g)
+-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+-SELECT fid, AsText(g) FROM gis_geometrycollection;
+-fid AsText(g)
+-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, AsText(g) FROM gis_geometry;
+-fid AsText(g)
+-101 POINT(10 10)
+-102 POINT(20 10)
+-103 POINT(20 20)
+-104 POINT(10 20)
+-105 LINESTRING(0 0,0 10,10 0)
+-106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-107 LINESTRING(10 10,40 10)
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+-110 POLYGON((0 0,30 0,30 30,0 0))
+-111 MULTIPOINT(0 0,10 10,10 20,20 20)
+-112 MULTIPOINT(1 1,11 11,11 21,21 21)
+-113 MULTIPOINT(3 6,4 10)
+-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+-115 MULTILINESTRING((10 48,10 21,10 0))
+-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, Dimension(g) FROM gis_geometry;
+-fid Dimension(g)
+-101 0
+-102 0
+-103 0
+-104 0
+-105 1
+-106 1
+-107 1
+-108 2
+-109 2
+-110 2
+-111 0
+-112 0
+-113 0
+-114 1
+-115 1
+-116 1
+-117 2
+-118 2
+-119 2
+-120 1
+-121 1
+-122 0
+-123 0
+-SELECT fid, GeometryType(g) FROM gis_geometry;
+-fid GeometryType(g)
+-101 POINT
+-102 POINT
+-103 POINT
+-104 POINT
+-105 LINESTRING
+-106 LINESTRING
+-107 LINESTRING
+-108 POLYGON
+-109 POLYGON
+-110 POLYGON
+-111 MULTIPOINT
+-112 MULTIPOINT
+-113 MULTIPOINT
+-114 MULTILINESTRING
+-115 MULTILINESTRING
+-116 MULTILINESTRING
+-117 MULTIPOLYGON
+-118 MULTIPOLYGON
+-119 MULTIPOLYGON
+-120 GEOMETRYCOLLECTION
+-121 GEOMETRYCOLLECTION
+-122 GEOMETRYCOLLECTION
+-123 GEOMETRYCOLLECTION
+-SELECT fid, IsEmpty(g) FROM gis_geometry;
+-fid IsEmpty(g)
+-101 0
+-102 0
+-103 0
+-104 0
+-105 0
+-106 0
+-107 0
+-108 0
+-109 0
+-110 0
+-111 0
+-112 0
+-113 0
+-114 0
+-115 0
+-116 0
+-117 0
+-118 0
+-119 0
+-120 0
+-121 0
+-122 0
+-123 0
+-SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+-fid AsText(Envelope(g))
+-101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+-102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+-103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+-104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+-105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+-106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+-110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+-111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+-112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+-113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+-114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+-115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+-116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+-117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+-118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+-119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+-120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+-121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, X(g) FROM gis_point;
+-fid X(g)
+-101 10
+-102 20
+-103 20
+-104 10
+-SELECT fid, Y(g) FROM gis_point;
+-fid Y(g)
+-101 10
+-102 10
+-103 20
+-104 20
+-SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+-fid AsText(StartPoint(g))
+-105 POINT(0 0)
+-106 POINT(10 10)
+-107 POINT(10 10)
+-SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+-fid AsText(EndPoint(g))
+-105 POINT(10 0)
+-106 POINT(10 10)
+-107 POINT(40 10)
+-SELECT fid, GLength(g) FROM gis_line;
+-fid GLength(g)
+-105 24.14213562373095
+-106 40
+-107 30
+-SELECT fid, NumPoints(g) FROM gis_line;
+-fid NumPoints(g)
+-105 3
+-106 5
+-107 2
+-SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+-fid AsText(PointN(g, 2))
+-105 POINT(0 10)
+-106 POINT(20 10)
+-107 POINT(40 10)
+-SELECT fid, IsClosed(g) FROM gis_line;
+-fid IsClosed(g)
+-105 0
+-106 1
+-107 0
+-SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+-fid AsText(Centroid(g))
+-108 POINT(15 15)
+-109 POINT(25.416666666666668 25.416666666666668)
+-110 POINT(20 10)
+-SELECT fid, Area(g) FROM gis_polygon;
+-fid Area(g)
+-108 100
+-109 2400
+-110 450
+-SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+-fid AsText(ExteriorRing(g))
+-108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+-110 LINESTRING(0 0,30 0,30 30,0 0)
+-SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+-fid NumInteriorRings(g)
+-108 0
+-109 1
+-110 0
+-SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+-fid AsText(InteriorRingN(g, 1))
+-108 NULL
+-109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-110 NULL
+-SELECT fid, IsClosed(g) FROM gis_multi_line;
+-fid IsClosed(g)
+-114 0
+-115 0
+-116 0
+-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+-fid AsText(Centroid(g))
+-117 POINT(55.58852775304245 17.426536064113982)
+-118 POINT(55.58852775304245 17.426536064113982)
+-119 POINT(2 2)
+-SELECT fid, Area(g) FROM gis_multi_polygon;
+-fid Area(g)
+-117 1684.5
+-118 1684.5
+-119 4.5
+-SELECT fid, NumGeometries(g) from gis_multi_point;
+-fid NumGeometries(g)
+-111 4
+-112 4
+-113 2
+-SELECT fid, NumGeometries(g) from gis_multi_line;
+-fid NumGeometries(g)
+-114 2
+-115 1
+-116 2
+-SELECT fid, NumGeometries(g) from gis_multi_polygon;
+-fid NumGeometries(g)
+-117 2
+-118 2
+-119 1
+-SELECT fid, NumGeometries(g) from gis_geometrycollection;
+-fid NumGeometries(g)
+-120 2
+-121 2
+-122 0
+-123 0
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+-fid AsText(GeometryN(g, 2))
+-111 POINT(10 10)
+-112 POINT(11 11)
+-113 POINT(4 10)
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+-fid AsText(GeometryN(g, 2))
+-114 LINESTRING(16 0,16 23,16 48)
+-115 NULL
+-116 LINESTRING(2 5,5 8,21 7)
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+-fid AsText(GeometryN(g, 2))
+-117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+-118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+-119 NULL
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+-fid AsText(GeometryN(g, 2))
+-120 LINESTRING(0 0,10 10)
+-121 LINESTRING(3 6,7 9)
+-122 NULL
+-123 NULL
+-SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+-fid AsText(GeometryN(g, 1))
+-120 POINT(0 0)
+-121 POINT(44 6)
+-122 NULL
+-123 NULL
+-SELECT g1.fid as first, g2.fid as second,
+-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+-first second w c o e d t i r
+-120 120 1 1 0 1 0 1 1 0
+-120 121 0 0 1 0 0 0 1 0
+-120 122 0 1 NULL 0 NULL 0 NULL 0
+-120 123 0 1 NULL 0 NULL 0 NULL 0
+-121 120 0 0 1 0 0 0 1 0
+-121 121 1 1 0 1 0 1 1 0
+-121 122 0 1 NULL 0 NULL 0 NULL 0
+-121 123 0 1 NULL 0 NULL 0 NULL 0
+-122 120 1 0 NULL 0 NULL 0 NULL 0
+-122 121 1 0 NULL 0 NULL 0 NULL 0
+-122 122 1 1 NULL 1 NULL 0 NULL 0
+-122 123 1 1 NULL 1 NULL 0 NULL 0
+-123 120 1 0 NULL 0 NULL 0 NULL 0
+-123 121 1 0 NULL 0 NULL 0 NULL 0
+-123 122 1 1 NULL 1 NULL 0 NULL 0
+-123 123 1 1 NULL 1 NULL 0 NULL 0
+-DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+-USE gis_ogs;
+-# Lakes
+-INSERT INTO lakes VALUES (
+-101, 'BLUE LAKE',
+-PolyFromText(
+-'POLYGON(
+- (52 18,66 23,73 9,48 6,52 18),
+- (59 18,67 18,67 13,59 13,59 18)
+- )',
+-101));
+-# Road Segments
+-INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+-LineFromText(
+-'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+-INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+-LineFromText(
+-'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+-INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+-LineFromText(
+-'LINESTRING( 70 38, 72 48 )' ,101));
+-INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+-LineFromText(
+-'LINESTRING( 70 38, 84 42 )' ,101));
+-INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+-1,
+-LineFromText(
+-'LINESTRING( 28 26, 28 0 )',101));
+-# DividedRoutes
+-INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+-MLineFromText(
+-'MULTILINESTRING((10 48,10 21,10 0),
+- (16 0,16 23,16 48))', 101));
+-# Forests
+-INSERT INTO forests VALUES(109, 'Green Forest',
+-MPolyFromText(
+-'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+- (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+-101));
+-# Bridges
+-INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+-'POINT( 44 31 )', 101));
+-# Streams
+-INSERT INTO streams VALUES(111, 'Cam Stream',
+-LineFromText(
+-'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+-INSERT INTO streams VALUES(112, NULL,
+-LineFromText(
+-'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+-# Buildings
+-INSERT INTO buildings VALUES(113, '123 Main Street',
+-PointFromText(
+-'POINT( 52 30 )', 101),
+-PolyFromText(
+-'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+-INSERT INTO buildings VALUES(114, '215 Main Street',
+-PointFromText(
+-'POINT( 64 33 )', 101),
+-PolyFromText(
+-'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+-# Ponds
+-INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+-MPolyFromText(
+-'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+- ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+-# Named Places
+-INSERT INTO named_places VALUES(117, 'Ashton',
+-PolyFromText(
+-'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+-INSERT INTO named_places VALUES(118, 'Goose Island',
+-PolyFromText(
+-'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+-# Map Neatlines
+-INSERT INTO map_neatlines VALUES(115,
+-PolyFromText(
+-'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+-SELECT Dimension(shore)
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-Dimension(shore)
+-2
+-SELECT GeometryType(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-GeometryType(centerlines)
+-MULTILINESTRING
+-SELECT AsText(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(boundary)
+-POLYGON((67 13,67 18,59 18,59 13,67 13))
+-SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(PolyFromWKB(AsBinary(boundary),101))
+-POLYGON((67 13,67 18,59 18,59 13,67 13))
+-SELECT SRID(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-SRID(boundary)
+-101
+-SELECT IsEmpty(centerline)
+-FROM road_segments
+-WHERE name = 'Route 5'
+-AND aliases = 'Main Street';
+-IsEmpty(centerline)
+-0
+-SELECT AsText(Envelope(boundary))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(Envelope(boundary))
+-POLYGON((59 13,67 13,67 18,59 18,59 13))
+-SELECT X(position)
+-FROM bridges
+-WHERE name = 'Cam Bridge';
+-X(position)
+-44
+-SELECT Y(position)
+-FROM bridges
+-WHERE name = 'Cam Bridge';
+-Y(position)
+-31
+-SELECT AsText(StartPoint(centerline))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(StartPoint(centerline))
+-POINT(0 18)
+-SELECT AsText(EndPoint(centerline))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(EndPoint(centerline))
+-POINT(44 31)
+-SELECT GLength(centerline)
+-FROM road_segments
+-WHERE fid = 106;
+-GLength(centerline)
+-26
+-SELECT NumPoints(centerline)
+-FROM road_segments
+-WHERE fid = 102;
+-NumPoints(centerline)
+-5
+-SELECT AsText(PointN(centerline, 1))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(PointN(centerline, 1))
+-POINT(0 18)
+-SELECT AsText(Centroid(boundary))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(Centroid(boundary))
+-POINT(63 15.5)
+-SELECT Area(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-Area(boundary)
+-40
+-SELECT AsText(ExteriorRing(shore))
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-AsText(ExteriorRing(shore))
+-LINESTRING(52 18,66 23,73 9,48 6,52 18)
+-SELECT NumInteriorRings(shore)
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-NumInteriorRings(shore)
+-1
+-SELECT AsText(InteriorRingN(shore, 1))
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-AsText(InteriorRingN(shore, 1))
+-LINESTRING(59 18,67 18,67 13,59 13,59 18)
+-SELECT NumGeometries(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-NumGeometries(centerlines)
+-2
+-SELECT AsText(GeometryN(centerlines, 2))
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-AsText(GeometryN(centerlines, 2))
+-LINESTRING(16 0,16 23,16 48)
+-SELECT IsClosed(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-IsClosed(centerlines)
+-0
+-SELECT GLength(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-GLength(centerlines)
+-96
+-SELECT AsText(Centroid(shores))
+-FROM ponds
+-WHERE fid = 120;
+-AsText(Centroid(shores))
+-POINT(25 42)
+-SELECT Area(shores)
+-FROM ponds
+-WHERE fid = 120;
+-Area(shores)
+-8
+-SELECT ST_Equals(boundary,
+-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-ST_Equals(boundary,
+-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+-1
+-SELECT ST_Disjoint(centerlines, boundary)
+-FROM divided_routes, named_places
+-WHERE divided_routes.name = 'Route 75'
+-AND named_places.name = 'Ashton';
+-ST_Disjoint(centerlines, boundary)
+-1
+-SELECT ST_Touches(centerline, shore)
+-FROM streams, lakes
+-WHERE streams.name = 'Cam Stream'
+-AND lakes.name = 'Blue Lake';
+-ST_Touches(centerline, shore)
+-1
+-SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+-FROM road_segments, divided_routes
+-WHERE road_segments.fid = 102
+-AND divided_routes.name = 'Route 75';
+-Crosses(road_segments.centerline, divided_routes.centerlines)
+-1
+-SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+-FROM road_segments, divided_routes
+-WHERE road_segments.fid = 102
+-AND divided_routes.name = 'Route 75';
+-ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+-1
+-SELECT ST_Contains(forests.boundary, named_places.boundary)
+-FROM forests, named_places
+-WHERE forests.name = 'Green Forest'
+-AND named_places.name = 'Ashton';
+-ST_Contains(forests.boundary, named_places.boundary)
+-0
+-SELECT ST_Distance(position, boundary)
+-FROM bridges, named_places
+-WHERE bridges.name = 'Cam Bridge'
+-AND named_places.name = 'Ashton';
+-ST_Distance(position, boundary)
+-12
+-SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+-FROM named_places, forests
+-WHERE named_places.name = 'Ashton'
+-AND forests.name = 'Green Forest';
+-AsText(ST_Difference(named_places.boundary, forests.boundary))
+-POLYGON((56 34,62 48,84 48,84 42,56 34))
+-SELECT AsText(ST_Union(shore, boundary))
+-FROM lakes, named_places
+-WHERE lakes.name = 'Blue Lake'
+-AND named_places.name = 'Goose Island';
+-AsText(ST_Union(shore, boundary))
+-POLYGON((48 6,52 18,66 23,73 9,48 6))
+-SELECT AsText(ST_SymDifference(shore, boundary))
+-FROM lakes, named_places
+-WHERE lakes.name = 'Blue Lake'
+-AND named_places.name = 'Ashton';
+-AsText(ST_SymDifference(shore, boundary))
+-MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
+-SELECT count(*)
+-FROM buildings, bridges
+-WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+-count(*)
+-1
++ERROR HY000: The used table type doesn't support SPATIAL indexes
++# ERROR: Statement ended with errno 1464, errname ER_TABLE_CANT_HANDLE_SPKEYS (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT NOT NULL, SPATIAL INDEX(g)) ENGINE=InnoDB /*!*/ /*Custom table options*/ ]
++# The statement|command finished with ER_TABLE_CANT_HANDLE_SPKEYS.
++# Geometry types or spatial indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP DATABASE gis_ogs;
+ USE test;
diff --git a/storage/innobase/mysql-test/storage_engine/vcol.rdiff b/storage/innobase/mysql-test/storage_engine/vcol.rdiff
new file mode 100644
index 00000000000..2226062834e
--- /dev/null
+++ b/storage/innobase/mysql-test/storage_engine/vcol.rdiff
@@ -0,0 +1,82 @@
+--- suite/storage_engine/vcol.result 2012-07-12 20:24:16.628339715 +0400
++++ suite/storage_engine/vcol.reject 2012-07-15 17:53:17.457007891 +0400
+@@ -1,69 +1,12 @@
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW COLUMNS IN t1;
+-Field Type Null Key Default Extra
+-a int(11) # #
+-b int(11) # # VIRTUAL
+-INSERT INTO t1 (a) VALUES (1),(2);
+-INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+-Warnings:
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-SELECT * FROM t1;
+-a b
+-1 2
+-2 3
+-3 4
+-4 5
+-DROP TABLE t1;
+-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW COLUMNS IN t1;
+-Field Type Null Key Default Extra
+-a int(11) # #
+-b int(11) # # PERSISTENT
+-INSERT INTO t1 (a) VALUES (1),(2);
+-INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+-Warnings:
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-SELECT * FROM t1;
+-a b
+-1 2
+-2 3
+-3 4
+-4 5
+-DROP TABLE t1;
+-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) VIRTUAL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW COLUMNS IN t1;
+-Field Type Null Key Default Extra
+-a int(11) # #
+-b int(11) # # VIRTUAL
+-INSERT INTO t1 (a) VALUES (1),(2);
+-INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+-Warnings:
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-SELECT * FROM t1;
+-a b
+-1 2
+-2 3
+-3 4
+-4 5
+-DROP TABLE t1;
+-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW COLUMNS IN t1;
+-Field Type Null Key Default Extra
+-a int(11) # #
+-b int(11) # # PERSISTENT
+-INSERT INTO t1 (a) VALUES (1),(2);
+-INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+-Warnings:
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-SELECT * FROM t1;
+-a b
+-1 2
+-2 3
+-3 4
+-4 5
+-DROP TABLE t1;
++ERROR HY000: InnoDB storage engine does not support computed columns
++# ERROR: Statement ended with errno 1910, errname ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/ GENERATED ALWAYS AS (a+1)) ENGINE=InnoDB /*!*/ /*Custom table options*/ ]
++# The statement|command finished with ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS.
++# Virtual columns or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 0694bf75ace..a99b6080e0a 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1433,7 +1433,8 @@ run_again:
check_index = foreign->foreign_index;
}
- if (check_table == NULL || check_table->ibd_file_missing) {
+ if (check_table == NULL || check_table->ibd_file_missing
+ || check_index == NULL) {
if (check_ref) {
FILE* ef = dict_foreign_err_file;
@@ -1465,9 +1466,6 @@ run_again:
goto exit_func;
}
- ut_a(check_table);
- ut_a(check_index);
-
if (check_table != table) {
/* We already have a LOCK_IX on table, but not necessarily
on check_table */
diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc
index 98ec4a3a13b..0aad8675ff8 100644
--- a/storage/innobase/row/row0vers.cc
+++ b/storage/innobase/row/row0vers.cc
@@ -158,18 +158,6 @@ row_vers_impl_x_locked_low(
prev_trx_id = row_get_rec_trx_id(
prev_version, clust_index, clust_offsets);
- /* If trx_id differs from prev_trx_id and if the
- prev_version is marked deleted then the prev_trx_id
- must have already committed for the trx_id to be able
- to modify the row. Therefore, prev_trx_id cannot hold
- any implicit lock. */
-
- if (vers_del && trx_id != prev_trx_id) {
-
- trx_id = 0;
- break;
- }
-
/* The stack of versions is locked by mtr. Thus, it
is safe to fetch the prefixes for externally stored
columns. */
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index c3a53a18d90..80ebe0df2b3 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1129,7 +1129,8 @@ trx_commit(
trx->must_flush_log_later = TRUE;
} else if (srv_flush_log_at_trx_commit == 0) {
/* Do nothing */
- } else if (srv_flush_log_at_trx_commit == 1) {
+ } else if (srv_flush_log_at_trx_commit == 1 ||
+ srv_flush_log_at_trx_commit == 3) {
if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
/* Write the log but do not flush it to disk */
@@ -1424,7 +1425,11 @@ trx_commit_complete_for_mysql(
/* Do nothing */
} else if (srv_flush_log_at_trx_commit == 0) {
/* Do nothing */
- } else if (srv_flush_log_at_trx_commit == 1) {
+ } else if (srv_flush_log_at_trx_commit == 1 && trx->active_commit_ordered) {
+ /* Do nothing - we already flushed the prepare and binlog write
+ to disk, so transaction is durable (will be recovered from
+ binlog if necessary) */
+ } else if (srv_flush_log_at_trx_commit == 1 || srv_flush_log_at_trx_commit == 3) {
if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
/* Write the log but do not flush it to disk */
@@ -1823,7 +1828,7 @@ trx_prepare(
if (srv_flush_log_at_trx_commit == 0) {
/* Do nothing */
- } else if (srv_flush_log_at_trx_commit == 1) {
+ } else if (srv_flush_log_at_trx_commit == 1 || srv_flush_log_at_trx_commit == 3) {
if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
/* Write the log but do not flush it to disk */
diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt
index 2817e11681c..9ca198873d1 100644
--- a/storage/maria/CMakeLists.txt
+++ b/storage/maria/CMakeLists.txt
@@ -68,7 +68,7 @@ SET_TARGET_PROPERTIES(aria_dump_log PROPERTIES COMPILE_FLAGS "-DMARIA_DUMP_LOG")
MYSQL_ADD_EXECUTABLE(aria_pack maria_pack.c COMPONENT Server)
TARGET_LINK_LIBRARIES(aria_pack aria)
-IF(WITH_UNIT_TESTS AND FALSE)
+IF(WITH_UNIT_TESTS)
ADD_EXECUTABLE(ma_test1 ma_test1.c)
TARGET_LINK_LIBRARIES(ma_test1 aria)
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 958b1b837f5..f6124fdd9ff 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -235,7 +235,7 @@ static MYSQL_SYSVAR_ULONG(pagecache_age_threshold,
"until it is considered aged enough to be downgraded to a warm block. "
"This specifies the percentage ratio of that number of hits to the "
"total number of blocks in the page cache.", 0, 0,
- 300, 100, ~0L, 100);
+ 300, 100, ~ (ulong) 0L, 100);
static MYSQL_SYSVAR_ULONGLONG(pagecache_buffer_size, pagecache_buffer_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
@@ -1012,6 +1012,28 @@ const char *ha_maria::index_type(uint key_number)
}
+ulong ha_maria::index_flags(uint inx, uint part, bool all_parts) const
+{
+ ulong flags;
+ if (table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT)
+ flags= 0;
+ else
+ if ((table_share->key_info[inx].flags & HA_SPATIAL ||
+ table_share->key_info[inx].algorithm == HA_KEY_ALG_RTREE))
+ {
+ /* All GIS scans are non-ROR scans. We also disable IndexConditionPushdown */
+ flags= HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
+ HA_READ_ORDER | HA_KEYREAD_ONLY | HA_KEY_SCAN_NOT_ROR;
+ }
+ else
+ {
+ flags= HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
+ HA_READ_ORDER | HA_KEYREAD_ONLY | HA_DO_INDEX_COND_PUSHDOWN;
+ }
+ return flags;
+}
+
+
double ha_maria::scan_time()
{
if (file->s->data_file_type == BLOCK_RECORD)
diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h
index aa8c0f17d48..2cba48c04aa 100644
--- a/storage/maria/ha_maria.h
+++ b/storage/maria/ha_maria.h
@@ -65,12 +65,7 @@ public:
const char **bas_ext() const;
ulonglong table_flags() const
{ return int_table_flags; }
- ulong index_flags(uint inx, uint part, bool all_parts) const
- {
- return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
- 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
- HA_READ_ORDER | HA_KEYREAD_ONLY | HA_DO_INDEX_COND_PUSHDOWN);
- }
+ ulong index_flags(uint inx, uint part, bool all_parts) const;
uint max_supported_keys() const
{ return MARIA_MAX_KEY; }
uint max_supported_key_length() const;
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 02cb01b581c..8e0407c9d7a 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -4677,6 +4677,8 @@ int _ma_read_block_record2(MARIA_HA *info, uchar *record,
MARIA_ROW *cur_row= &info->cur_row;
DBUG_ENTER("_ma_read_block_record2");
+ LINT_INIT(blob_buffer);
+
start_of_data= data;
flag= (uint) (uchar) data[0];
cur_null_bytes= share->base.original_null_bytes;
diff --git a/storage/maria/ma_ft_nlq_search.c b/storage/maria/ma_ft_nlq_search.c
index e57cc135ca1..5c1ab85ef8a 100644
--- a/storage/maria/ma_ft_nlq_search.c
+++ b/storage/maria/ma_ft_nlq_search.c
@@ -83,6 +83,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
#endif
DBUG_ENTER("walk_and_match");
+ LINT_INIT_STRUCT(subkeys);
+
word->weight=LWS_FOR_QUERY;
_ma_ft_make_key(info, &key, aio->keynr, keybuff, word, 0);
diff --git a/storage/maria/ma_key_recover.c b/storage/maria/ma_key_recover.c
index 8b2dc4a1e07..502ac2b8809 100644
--- a/storage/maria/ma_key_recover.c
+++ b/storage/maria/ma_key_recover.c
@@ -946,7 +946,9 @@ uint _ma_apply_redo_index(MARIA_HA *info,
uint page_offset= 0, org_page_length;
uint page_length, keypage_header, keynr;
uint max_page_size= share->max_index_block_size;
- uint __attribute__((unused)) new_page_length= 0;
+#ifndef DBUG_OFF
+ uint new_page_length= 0;
+#endif
int result;
MARIA_PAGE page;
DBUG_ENTER("_ma_apply_redo_index");
@@ -1108,7 +1110,9 @@ uint _ma_apply_redo_index(MARIA_HA *info,
DBUG_PRINT("redo", ("org_page_length: %u new_page_length: %u",
uint2korr(header), uint2korr(header+2)));
DBUG_ASSERT(uint2korr(header) == page_length);
+#ifndef DBUG_OFF
new_page_length= min(uint2korr(header+2), max_page_size);
+#endif
header+= 4;
break;
case KEY_OP_MAX_PAGELENGTH:
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index 2618d6a5b50..6aaccea219f 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -3372,6 +3372,7 @@ restart:
PAGECACHE_BLOCK_LINK *block;
uint status;
int page_st;
+ LINT_INIT(page_st);
pagecache_pthread_mutex_lock(&pagecache->cache_lock);
if (!pagecache->can_be_used)
diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c
index 3b774fb4283..ccb4bf77717 100644
--- a/storage/maria/ma_search.c
+++ b/storage/maria/ma_search.c
@@ -439,6 +439,10 @@ int _ma_prefix_search(const MARIA_KEY *key, const MARIA_PAGE *ma_page,
const uchar *sort_order= keyinfo->seg->charset->sort_order;
DBUG_ENTER("_ma_prefix_search");
+ LINT_INIT(seg_len_pack);
+ LINT_INIT(prefix_len);
+ LINT_INIT(length);
+
t_buff[0]=0; /* Avoid bugs */
page_flag= ma_page->flag;
nod_flag= ma_page->node;
diff --git a/storage/maria/ma_test_all.sh b/storage/maria/ma_test_all.sh
index 041fbf3abe6..4e9be4a5beb 100755
--- a/storage/maria/ma_test_all.sh
+++ b/storage/maria/ma_test_all.sh
@@ -7,13 +7,22 @@
#
#
+PRG='unittest/ma_test_all-t'
+UTST='../../unittest/unit.pl'
+
+if [ ! -x $PRG ] ; then
+ DIR=`dirname $0`
+ PRG="$DIR/unittest/ma_test_all-t"
+ UTST="$DIR/../../unittest/unit.pl"
+fi
+
if test -n "$1"; then
# unit.pl can't pass options to ma_test_all-t, so if anything
# was passed as an argument, assume the purpose was to pass
# them to ma_test_all-t and call it directly
- unittest/ma_test_all-t $@
+ $PRG $@
else
- perl ../../unittest/unit.pl run unittest/ma_test_all-t
+ perl $UTST run $PRG
fi
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 27653ae5574..62225a7a4b0 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -21,9 +21,6 @@
#include <m_ctype.h>
#include <stdarg.h>
#include <my_getopt.h>
-#ifdef HAVE_SYS_VADVICE_H
-#include <sys/vadvise.h>
-#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt
index 97c1bc78d95..f58c942b4d7 100644
--- a/storage/myisam/CMakeLists.txt
+++ b/storage/myisam/CMakeLists.txt
@@ -46,7 +46,7 @@ TARGET_LINK_LIBRARIES(myisamlog myisam)
MYSQL_ADD_EXECUTABLE(myisampack myisampack.c COMPONENT Server)
TARGET_LINK_LIBRARIES(myisampack myisam)
-IF(WITH_UNIT_TESTS AND FALSE)
+IF(WITH_UNIT_TESTS)
ADD_EXECUTABLE(mi_test1 mi_test1.c)
TARGET_LINK_LIBRARIES(mi_test1 myisam)
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index f419ac3d689..8b61e1dc4f2 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -352,7 +352,7 @@ static int _ftb_no_dupes_cmp(void* not_used __attribute__((unused)),
returns 1 if the search was finished (must-word wasn't found)
*/
-static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
+static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
{
int r;
int subkeys=1;
@@ -452,7 +452,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
ftbw->key_root=info->s->state.key_root[ftb->keynr];
ftbw->keyinfo=info->s->keyinfo+ftb->keynr;
ftbw->off=0;
- return _ft2_search(ftb, ftbw, 0);
+ return _ft2_search_no_lock(ftb, ftbw, 0);
}
/* matching key found */
@@ -480,6 +480,18 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
return 0;
}
+static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
+{
+ int r;
+ MYISAM_SHARE *share= ftb->info->s;
+ if (share->concurrent_insert)
+ mysql_rwlock_rdlock(&share->key_root_lock[ftb->keynr]);
+ r= _ft2_search_no_lock(ftb, ftbw, init_search);
+ if (share->concurrent_insert)
+ mysql_rwlock_unlock(&share->key_root_lock[ftb->keynr]);
+ return r;
+}
+
static void _ftb_init_index_search(FT_INFO *ftb)
{
int i;
diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c
index e31075e55d1..bafa7064e28 100644
--- a/storage/myisam/ft_nlq_search.c
+++ b/storage/myisam/ft_nlq_search.c
@@ -70,9 +70,10 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
TREE_ELEMENT *selem;
double gweight=1;
MI_INFO *info=aio->info;
+ MYISAM_SHARE *share= info->s;
uchar *keybuff=aio->keybuff;
MI_KEYDEF *keyinfo=info->s->keyinfo+aio->keynr;
- my_off_t key_root=info->s->state.key_root[aio->keynr];
+ my_off_t key_root;
uint extra= HA_FT_WLEN + info->s->rec_reflength;
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
float tmp_weight;
@@ -80,6 +81,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
#error
#endif
DBUG_ENTER("walk_and_match");
+ LINT_INIT_STRUCT(subkeys);
word->weight=LWS_FOR_QUERY;
@@ -87,6 +89,11 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
keylen-=HA_FT_WLEN;
doc_cnt=0;
+ if (share->concurrent_insert)
+ mysql_rwlock_rdlock(&share->key_root_lock[aio->keynr]);
+
+ key_root= share->state.key_root[aio->keynr];
+
/* Skip rows inserted by current inserted */
for (r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root) ;
!r &&
@@ -96,6 +103,9 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
info->lastkey_length, SEARCH_BIGGER, key_root))
;
+ if (share->concurrent_insert)
+ mysql_rwlock_unlock(&share->key_root_lock[aio->keynr]);
+
info->update|= HA_STATE_AKTIV; /* for _mi_test_if_changed() */
/* The following should be safe, even if we compare doubles */
@@ -119,6 +129,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
keyinfo=& info->s->ft2_keyinfo;
key_root=info->lastpos;
keylen=0;
+ if (share->concurrent_insert)
+ mysql_rwlock_rdlock(&share->key_root_lock[aio->keynr]);
r=_mi_search_first(info, keyinfo, key_root);
goto do_skip;
}
@@ -154,6 +166,9 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
if (gweight < 0 || doc_cnt > 2000000)
gweight=0;
+ if (share->concurrent_insert)
+ mysql_rwlock_rdlock(&share->key_root_lock[aio->keynr]);
+
if (_mi_test_if_changed(info) == 0)
r=_mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
@@ -166,6 +181,8 @@ do_skip:
r= _mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
+ if (share->concurrent_insert)
+ mysql_rwlock_unlock(&share->key_root_lock[aio->keynr]);
}
word->weight=gweight;
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 4ddaf520f7b..6eaf77a5d2d 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -689,6 +689,28 @@ const char *ha_myisam::index_type(uint key_number)
}
+ulong ha_myisam::index_flags(uint inx, uint part, bool all_parts) const
+{
+ ulong flags;
+ if (table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT)
+ flags= 0;
+ else
+ if ((table_share->key_info[inx].flags & HA_SPATIAL ||
+ table_share->key_info[inx].algorithm == HA_KEY_ALG_RTREE))
+ {
+ /* All GIS scans are non-ROR scans. We also disable IndexConditionPushdown */
+ flags= HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
+ HA_READ_ORDER | HA_KEYREAD_ONLY | HA_KEY_SCAN_NOT_ROR;
+ }
+ else
+ {
+ flags= HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
+ HA_READ_ORDER | HA_KEYREAD_ONLY | HA_DO_INDEX_COND_PUSHDOWN;
+ }
+ return flags;
+}
+
+
/* Name is here without an extension */
int ha_myisam::open(const char *name, int mode, uint test_if_locked)
{
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index 7b0e9e8a1d7..42b4f7f1653 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -64,12 +64,7 @@ class ha_myisam: public handler
int index_end();
int rnd_end();
- ulong index_flags(uint inx, uint part, bool all_parts) const
- {
- return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
- 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
- HA_READ_ORDER | HA_KEYREAD_ONLY | HA_DO_INDEX_COND_PUSHDOWN);
- }
+ ulong index_flags(uint inx, uint part, bool all_parts) const;
uint max_supported_keys() const { return MI_MAX_KEY; }
uint max_supported_key_parts() const { return HA_MAX_KEY_SEG; }
uint max_supported_key_length() const { return HA_MAX_KEY_LENGTH; }
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index 92d7459dfc5..dab1f66ed6d 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -330,9 +330,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
if (!share->temporary)
flush_key_blocks(share->key_cache, share->kfile, &share->dirty_part_map,
FLUSH_KEEP);
-#ifdef HAVE_PWRITE
_mi_decrement_open_count(info);
-#endif
if (share->not_flushed)
{
share->not_flushed=0;
diff --git a/storage/myisam/mi_test_all.sh b/storage/myisam/mi_test_all.sh
index 641f1cc0a35..c9c89a9ecac 100755
--- a/storage/myisam/mi_test_all.sh
+++ b/storage/myisam/mi_test_all.sh
@@ -99,7 +99,7 @@ if test -f mi_test1$MACH ; then suffix=$MACH ; else suffix=""; fi
# check of myisampack / myisamchk
./myisampack$suffix --force -s test1
# Ignore error for index file
-./myisamchk$suffix -es test1 2>&1 >& /dev/null
+./myisamchk$suffix -es test1 2>&1 > /dev/null
./myisamchk$suffix -rqs test1
./myisamchk$suffix -es test1
./myisamchk$suffix -rs test1
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index fa8cc679997..7d8b577e8b0 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -20,9 +20,6 @@
#include <stdarg.h>
#include <my_getopt.h>
#include <my_bit.h>
-#ifdef HAVE_SYS_VADVICE_H
-#include <sys/vadvise.h>
-#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
diff --git a/storage/myisam/mysql-test/mtr2/suite.pm b/storage/myisam/mysql-test/mtr2/suite.pm
new file mode 100644
index 00000000000..0f287e4a8ba
--- /dev/null
+++ b/storage/myisam/mysql-test/mtr2/suite.pm
@@ -0,0 +1,9 @@
+package My::Suite::MTR2::MyISAM;
+
+@ISA = qw(My::Suite);
+
+sub skip_combinations {(
+ 'combinations' => [ '1st' ],
+)}
+bless { };
+
diff --git a/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff
new file mode 100644
index 00000000000..3caf2ad6c3a
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff
@@ -0,0 +1,32 @@
+--- suite/storage_engine/alter_tablespace.result 2012-07-12 19:53:40.775419511 +0400
++++ suite/storage_engine/alter_tablespace.reject 2012-07-15 16:21:14.910435703 +0400
+@@ -1,19 +1,14 @@
+ DROP TABLE IF EXISTS t1, t2;
+ CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ ALTER TABLE t1 DISCARD TABLESPACE;
+-DROP TABLE t1;
+-CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-INSERT INTO t1 (a) VALUES (1),(2);
+-SELECT * FROM t1;
+-a
+-1
+-2
+-ALTER TABLE t1 DISCARD TABLESPACE;
+-SELECT * FROM t1;
+-ERROR HY000: Got error -1 from storage engine
+-ALTER TABLE t1 IMPORT TABLESPACE;
+-SELECT * FROM t1;
+-a
+-1
+-2
++ERROR HY000: Table storage engine for 't1' doesn't have this option
++# ERROR: Statement ended with errno 1031, errname ER_ILLEGAL_HA (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ ALTER TABLE t1 DISCARD TABLESPACE ]
++# The statement|command finished with ER_ILLEGAL_HA.
++# Tablespace operations or the syntax or the mix could be unsupported.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE t1;
diff --git a/storage/myisam/mysql-test/storage_engine/check_table.rdiff b/storage/myisam/mysql-test/storage_engine/check_table.rdiff
new file mode 100644
index 00000000000..48e8fc2e770
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/check_table.rdiff
@@ -0,0 +1,20 @@
+--- suite/storage_engine/check_table.result 2012-07-15 04:19:07.782936394 +0400
++++ suite/storage_engine/check_table.reject 2012-07-15 16:21:16.734412773 +0400
+@@ -18,7 +18,7 @@
+ INSERT INTO t1 (a,b) VALUES (6,'f');
+ CHECK TABLE t1 FAST;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check status Table is already up to date
+ INSERT INTO t1 (a,b) VALUES (7,'g');
+ INSERT INTO t2 (a,b) VALUES (8,'h');
+ CHECK TABLE t2, t1 MEDIUM;
+@@ -52,7 +52,7 @@
+ INSERT INTO t1 (a) VALUES (17),(120),(132);
+ CHECK TABLE t1 FAST;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check status Table is already up to date
+ INSERT INTO t1 (a) VALUES (801),(900),(7714);
+ CHECK TABLE t1 MEDIUM;
+ Table Op Msg_type Msg_text
diff --git a/storage/myisam/mysql-test/storage_engine/define_engine.inc b/storage/myisam/mysql-test/storage_engine/define_engine.inc
new file mode 100644
index 00000000000..d5e741629de
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/define_engine.inc
@@ -0,0 +1,45 @@
+###########################################
+#
+# This is a template of the include file define_engine.inc which
+# should be placed in storage/<engine>/mysql-test/storage_engine folder.
+#
+################################
+#
+# The name of the engine under test must be defined in $ENGINE variable.
+# You can set it either here (uncomment and edit) or in your environment.
+#
+let $ENGINE = MyISAM;
+#
+################################
+#
+# The following three variables define specific options for columns and tables.
+# Normally there should be none needed, but for some engines it can be different.
+# If the engine requires specific column option for all or indexed columns,
+# set them inside the comment, e.g. /*!NOT NULL*/.
+# Do the same for table options if needed, e.g. /*!INSERT_METHOD=LAST*/
+
+let $default_col_opts = /*!*/;
+let $default_col_indexed_opts = /*!*/;
+let $default_tbl_opts = /*!*/;
+
+# INDEX, UNIQUE INDEX, PRIMARY KEY, special index type - choose the fist that the engine allows,
+# or set it to /*!*/ if none is supported
+
+let $default_index = /*!INDEX*/;
+
+# If the engine does not support the following types, replace them with the closest possible
+
+let $default_int_type = INT(11);
+let $default_char_type = CHAR(8);
+
+################################
+
+--disable_query_log
+--disable_result_log
+
+# Here you can place your custom MTR code which needs to be executed before each test,
+# e.g. creation of an additional schema or table, etc.
+# The cleanup part should be defined in cleanup_engine.inc
+
+--enable_query_log
+--enable_result_log
diff --git a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff
new file mode 100644
index 00000000000..67157754c04
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff
@@ -0,0 +1,145 @@
+--- suite/storage_engine/foreign_keys.result 2012-07-12 18:56:19.782678645 +0400
++++ suite/storage_engine/foreign_keys.reject 2012-07-15 16:21:30.414240794 +0400
+@@ -12,29 +12,57 @@
+ t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL,
+- KEY `a` (`a`),
+- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
++ KEY `a` (`a`)
+ ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b');
+-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
++# ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'d');
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b');
+ UPDATE t2 SET a=a+1;
+-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
++# ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ UPDATE t1 SET a=3 WHERE a=2;
+-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2)
+ DELETE FROM t1 WHERE a=2;
+-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DELETE FROM t2 WHERE a=2;
+ SELECT * FROM t1;
+ a b
+ 1 c
+-2 d
++3 d
+ SELECT * FROM t2;
+ a b
+-1 a
++3 b
++3 b
+ DROP TABLE t1;
+-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE t2;
+ CREATE TABLE t2 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -46,26 +74,65 @@
+ t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL,
+- KEY `a` (`a`),
+- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE
++ KEY `a` (`a`)
+ ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d');
+-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE)
++# ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
+ INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'a');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(4,'e'),(3,'a');
+ UPDATE t1 SET a=a+1;
++ERROR 42S02: Table 'test.t1' doesn't exist
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_NO_SUCH_TABLE.
++# UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ SELECT * FROM t2;
+ a b
+-5 a
+-5 a
+-5 b
+-5 c
+-5 d
+-5 e
++1 a
++1 a
++2 b
++2 b
++3 a
++3 c
++3 c
++4 d
++4 d
++4 e
+ DELETE FROM t1 WHERE b='a' LIMIT 2;
++ERROR 42S02: Table 'test.t1' doesn't exist
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_NO_SUCH_TABLE.
++# DELETE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ SELECT * FROM t2;
+ a b
++1 a
++1 a
++2 b
++2 b
++3 a
++3 c
++3 c
++4 d
++4 d
++4 e
+ TRUNCATE TABLE t1;
+-ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`))
++ERROR 42S02: Table 'test.t1' doesn't exist
++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TRUNCATE_ILLEGAL_FK)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_NO_SUCH_TABLE.
++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE t2;
+ DROP TABLE t1;
++ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff b/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff
new file mode 100644
index 00000000000..e7fa0013fa9
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff
@@ -0,0 +1,60 @@
+--- suite/storage_engine/index_type_hash.result 2012-07-15 01:10:17.919128889 +0400
++++ suite/storage_engine/index_type_hash.reject 2012-07-15 16:21:32.806210722 +0400
+@@ -4,7 +4,7 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL # HASH
++t1 1 a 1 a # # NULL NULL # BTREE
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -12,8 +12,8 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a_b 1 a # # NULL NULL # HASH a_b index
+-t1 1 a_b 2 b # # NULL NULL # HASH a_b index
++t1 1 a_b 1 a # # NULL NULL # BTREE a_b index
++t1 1 a_b 2 b # # NULL NULL # BTREE a_b index
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -22,8 +22,8 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL # HASH
+-t1 1 b 1 b # # NULL NULL # HASH
++t1 1 a 1 a # # NULL NULL # BTREE
++t1 1 b 1 b # # NULL NULL # BTREE
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -31,7 +31,7 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 0 a 1 a # # NULL NULL # HASH
++t1 0 a 1 a # # NULL NULL # BTREE
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ ERROR 23000: Duplicate entry '1' for key 'a'
+@@ -43,7 +43,7 @@
+ ALTER TABLE t1 ADD <CUSTOM_INDEX> (a) USING HASH COMMENT 'simple index on a';
+ SHOW INDEX FROM t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL # HASH simple index on a
++t1 1 a 1 a # # NULL NULL # BTREE simple index on a
+ ALTER TABLE t1 DROP KEY a;
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+@@ -52,7 +52,7 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 0 a 1 a # # NULL NULL # HASH
++t1 0 a 1 a # # NULL NULL # BTREE
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ ERROR 23000: Duplicate entry '1' for key 'a'
diff --git a/storage/myisam/mysql-test/storage_engine/show_engine.rdiff b/storage/myisam/mysql-test/storage_engine/show_engine.rdiff
new file mode 100644
index 00000000000..4e6624653ea
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/show_engine.rdiff
@@ -0,0 +1,10 @@
+--- suite/storage_engine/show_engine.result 2012-06-24 23:55:19.539380000 +0400
++++ suite/storage_engine/show_engine.reject 2012-07-15 16:21:54.401939228 +0400
+@@ -4,7 +4,6 @@
+ # volatile data (timestamps, memory info, etc.)
+ SHOW ENGINE <STORAGE_ENGINE> STATUS;
+ Type Name Status
+-<STORAGE_ENGINE> ### Engine status, can be long and changeable ###
+ # For SHOW MUTEX even the number of lines is volatile, so the result logging is disabled,
+ # the test only checks that the command does not produce any errors
+ SHOW ENGINE <STORAGE_ENGINE> MUTEX;
diff --git a/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff
new file mode 100644
index 00000000000..a8df852515a
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff
@@ -0,0 +1,11 @@
+--- suite/storage_engine/tbl_opt_insert_method.result 2012-06-24 23:55:19.539380000 +0400
++++ suite/storage_engine/tbl_opt_insert_method.reject 2012-07-15 16:21:56.381914337 +0400
+@@ -5,7 +5,7 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ ALTER TABLE t1 INSERT_METHOD=NO;
+ SHOW CREATE TABLE t1;
+ Table Create Table
diff --git a/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff
new file mode 100644
index 00000000000..4fa164523db
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff
@@ -0,0 +1,16 @@
+--- suite/storage_engine/tbl_opt_union.result 2012-06-24 23:55:19.539380000 +0400
++++ suite/storage_engine/tbl_opt_union.reject 2012-07-15 16:21:58.121892463 +0400
+@@ -4,11 +4,11 @@
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`)
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ ALTER TABLE t1 UNION = (child1,child2);
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`,`child2`)
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+ DROP TABLE t1, child1, child2;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff
new file mode 100644
index 00000000000..8d1434ad2fe
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff
@@ -0,0 +1,9 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MyISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+13a20
+> 1
diff --git a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff
new file mode 100644
index 00000000000..8d1434ad2fe
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff
@@ -0,0 +1,9 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MyISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+13a20
+> 1
diff --git a/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff b/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff
new file mode 100644
index 00000000000..491b4636796
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff
@@ -0,0 +1,50 @@
+--- suite/storage_engine/trx/delete.result 2012-07-12 23:06:18.946113626 +0400
++++ suite/storage_engine/trx/delete.reject 2012-07-15 16:55:46.108397219 +0400
+@@ -1,3 +1,15 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support savepoints.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file (recommended), or add the test to disabled.def.
++# If savepoints should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(10000,'foobar');
+@@ -46,27 +58,17 @@
+ DELETE FROM t1;
+ RELEASE SAVEPOINT spt1;
+ ROLLBACK;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ SELECT * FROM t1;
+ a b
+-10000 foobar
+-10000 foobar
+-2 b
+-2 b
+-4 d
+-4 d
+-5 e
+-5 e
+-6 f
+-6 f
+-7 g
+-7 g
+-8 h
+-8 h
+ BEGIN;
+ DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
+ SAVEPOINT spt1;
+ DELETE FROM t1;
+ INSERT INTO t1 (a,b) VALUES (1,'a');
+ ROLLBACK TO SAVEPOINT spt1;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ COMMIT;
+ DROP TABLE t1;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff b/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff
new file mode 100644
index 00000000000..4619db1d095
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff
@@ -0,0 +1,65 @@
+--- suite/storage_engine/trx/insert.result 2012-07-12 23:09:44.663527407 +0400
++++ suite/storage_engine/trx/insert.reject 2012-07-15 16:55:46.676390078 +0400
+@@ -1,3 +1,15 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support savepoints.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file (recommended), or add the test to disabled.def.
++# If savepoints should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ BEGIN;
+@@ -21,8 +33,11 @@
+ RELEASE SAVEPOINT spt1;
+ INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT);
+ ROLLBACK;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ SELECT * FROM t1;
+ a b
++0 test
+ 1 a
+ 10 foo
+ 100 foo
+@@ -31,25 +46,34 @@
+ 3 c
+ 4 d
+ 5 e
++NULL NULL
++NULL NULL
+ BEGIN;
+ INSERT t1 (a) VALUE (10),(20);
+ SAVEPOINT spt1;
+ INSERT INTO t1 SET a = 11, b = 'f';
+ INSERT t1 SET b = DEFAULT;
+ ROLLBACK TO SAVEPOINT spt1;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ INSERT INTO t1 (b,a) VALUES ('test1',10);
+ COMMIT;
+ SELECT * FROM t1;
+ a b
++0 test
+ 1 a
+ 10 NULL
+ 10 foo
+ 10 test1
+ 100 foo
+ 11 abc
++11 f
+ 2 b
+ 20 NULL
+ 3 c
+ 4 d
+ 5 e
++NULL NULL
++NULL NULL
++NULL NULL
+ DROP TABLE t1;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff
new file mode 100644
index 00000000000..c0cc9ff9351
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff
@@ -0,0 +1,44 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MyISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+18a25
+> 1
+25a33,34
+> 1
+> 2
+30a40,43
+> 1
+> 101
+> 102
+> 2
+34a48,49
+> 101
+> 102
+39a55,56
+> 101
+> 102
+44a62,63
+> 101
+> 102
+51a71,72
+> 101
+> 102
+54a76,77
+> 301
+> 302
+58a82,83
+> 101
+> 102
+61a87,88
+> 301
+> 302
+65a93,94
+> 101
+> 102
+68a98,99
+> 301
+> 302
diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff
new file mode 100644
index 00000000000..2a7ddd33c8c
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff
@@ -0,0 +1,7 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MyISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff
new file mode 100644
index 00000000000..8b8df802275
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff
@@ -0,0 +1,53 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MyISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+18a25
+> 1
+25a33,34
+> 1
+> 2
+27,28c36
+< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
+---
+> # WARNING: Statement ended with errno 0, errname ''.
+31a40,43
+> 1
+> 101
+> 102
+> 2
+35a48,49
+> 101
+> 102
+40a55,56
+> 101
+> 102
+44a61,64
+> 1
+> 101
+> 102
+> 2
+49a70,73
+> 1
+> 101
+> 102
+> 2
+51a76,77
+> 301
+> 302
+55a82,83
+> 101
+> 102
+58a87,88
+> 301
+> 302
+62a93,94
+> 101
+> 102
+65a98,99
+> 301
+> 302
diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff
new file mode 100644
index 00000000000..bbcb8ac1838
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff
@@ -0,0 +1,69 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MyISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+14,15c20
+< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
+---
+> # WARNING: Statement ended with errno 0, errname ''.
+19a25
+> 1
+22,23c28
+< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
+---
+> # WARNING: Statement ended with errno 0, errname ''.
+27a33,34
+> 1
+> 2
+32a40,43
+> 1
+> 101
+> 102
+> 2
+35a47,50
+> 1
+> 101
+> 102
+> 2
+38a54,57
+> 1
+> 101
+> 102
+> 2
+41a61,64
+> 1
+> 101
+> 102
+> 2
+46a70,77
+> 1
+> 101
+> 102
+> 2
+> 201
+> 202
+> 301
+> 302
+49a81,88
+> 1
+> 101
+> 102
+> 2
+> 201
+> 202
+> 301
+> 302
+52a92,99
+> 1
+> 101
+> 102
+> 2
+> 201
+> 202
+> 301
+> 302
diff --git a/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff b/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff
new file mode 100644
index 00000000000..08e0802a28f
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff
@@ -0,0 +1,50 @@
+--- suite/storage_engine/trx/select_for_update.result 2012-07-13 01:26:07.612653808 +0400
++++ suite/storage_engine/trx/select_for_update.reject 2012-07-15 16:55:49.784351006 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
+@@ -14,16 +20,33 @@
+ 1 a
+ 3 a
+ SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
++a b
++1 a
++3 a
++# ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# SELECT .. FOR UPDATE or LOCK IN SHARE MODE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ UPDATE t1 SET b='c' WHERE b='a';
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
++# ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# UPDATE or SELECT .. FOR UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ connection con1;
+ COMMIT;
+ SELECT * FROM t1;
+ a b
+-1 a
++1 c
+ 2 b
+-3 a
++3 c
+ disconnect con1;
+ connection default;
+ UPDATE t1 SET b='c' WHERE b='a';
diff --git a/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff b/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff
new file mode 100644
index 00000000000..97941bbdb13
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff
@@ -0,0 +1,37 @@
+--- suite/storage_engine/trx/select_lock_in_share_mode.result 2012-07-13 01:30:17.505512229 +0400
++++ suite/storage_engine/trx/select_lock_in_share_mode.reject 2012-07-15 16:55:50.444342708 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
+@@ -18,14 +24,21 @@
+ 1 a
+ 3 a
+ UPDATE t1 SET b='c' WHERE b='a';
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
++# ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# LOCK IN SHARE MODE or UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ connection con1;
+ COMMIT;
+ SELECT * FROM t1;
+ a b
+-1 a
++1 c
+ 2 b
+-3 a
++3 c
+ disconnect con1;
+ connection default;
+ UPDATE t1 SET b='c' WHERE b='a';
diff --git a/storage/myisam/mysql-test/storage_engine/trx/update.rdiff b/storage/myisam/mysql-test/storage_engine/trx/update.rdiff
new file mode 100644
index 00000000000..131286d613c
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/update.rdiff
@@ -0,0 +1,58 @@
+--- suite/storage_engine/trx/update.result 2012-07-13 01:43:50.355293322 +0400
++++ suite/storage_engine/trx/update.reject 2012-07-15 16:55:51.016335518 +0400
+@@ -1,3 +1,15 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support savepoints.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file (recommended), or add the test to disabled.def.
++# If savepoints should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
+@@ -24,25 +36,29 @@
+ UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY a DESC, b ASC LIMIT 3;
+ UPDATE t1 SET b = '';
+ ROLLBACK;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ BEGIN;
+ UPDATE t1 SET b = 'update2' WHERE a <= 100;
+ SAVEPOINT spt1;
+ UPDATE t1 SET b = '';
+ ROLLBACK TO SAVEPOINT spt1;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ UPDATE t1 SET b = 'upd' WHERE a = 10050;
+ COMMIT;
+ SELECT * FROM t1;
+ a b
+ 10050 upd
+ 10050 upd
+-51 update2
+-51 update2
+-52 update2
+-52 update2
+-53 update2
+-53 update2
+-54 update2
+-54 update2
+-55 update2
+-55 update2
++51
++51
++52
++52
++53
++53
++54
++54
++55
++55
+ DROP TABLE t1;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff b/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff
new file mode 100644
index 00000000000..f445ad909f3
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff
@@ -0,0 +1,89 @@
+--- suite/storage_engine/trx/xa.result 2012-07-13 01:47:00.788899248 +0400
++++ suite/storage_engine/trx/xa.reject 2012-07-15 16:55:51.604328125 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support XA.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If XA should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ connect con2,localhost,root,,;
+@@ -9,17 +15,22 @@
+ connection con1;
+ SELECT * FROM t1;
+ a
++1
+ connection con2;
+ INSERT INTO t1 (a) VALUES (2);
+ XA END 'xa1';
+ connection con1;
+ SELECT * FROM t1;
+ a
++1
++2
+ connection con2;
+ XA PREPARE 'xa1';
+ connection con1;
+ SELECT * FROM t1;
+ a
++1
++2
+ connection con2;
+ XA RECOVER;
+ formatID gtrid_length bqual_length data
+@@ -38,6 +49,7 @@
+ a
+ 1
+ 2
++3
+ connection con2;
+ INSERT INTO t1 (a) VALUES (4);
+ XA END 'xa2';
+@@ -46,6 +58,8 @@
+ a
+ 1
+ 2
++3
++4
+ connection con2;
+ XA COMMIT 'xa2' ONE PHASE;
+ connection con1;
+@@ -65,6 +79,7 @@
+ 2
+ 3
+ 4
++5
+ connection con2;
+ INSERT INTO t1 (a) VALUES (6);
+ XA END 'xa3';
+@@ -75,6 +90,8 @@
+ 2
+ 3
+ 4
++5
++6
+ connection con2;
+ XA PREPARE 'xa3';
+ connection con1;
+@@ -84,8 +101,12 @@
+ 2
+ 3
+ 4
++5
++6
+ connection con2;
+ XA ROLLBACK 'xa3';
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ connection con1;
+ SELECT * FROM t1;
+ a
+@@ -93,4 +114,6 @@
+ 2
+ 3
+ 4
++5
++6
+ DROP TABLE t1;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff b/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff
new file mode 100644
index 00000000000..f4629fb19a0
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff
@@ -0,0 +1,33 @@
+--- suite/storage_engine/trx/xa_recovery.result 2012-07-13 01:48:46.859565758 +0400
++++ suite/storage_engine/trx/xa_recovery.reject 2012-07-15 16:55:53.740301272 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support XA.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If XA should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ call mtr.add_suppression("Found 2 prepared XA transactions");
+ FLUSH TABLES;
+ DROP TABLE IF EXISTS t1;
+@@ -18,12 +24,18 @@
+ connection default;
+ XA RECOVER;
+ formatID gtrid_length bqual_length data
+-1 3 0 xa1
+-1 3 0 xa2
+ XA ROLLBACK 'xa1';
++ERROR XAE04: XAER_NOTA: Unknown XID
+ XA COMMIT 'xa2';
++ERROR XAE04: XAER_NOTA: Unknown XID
+ SELECT * FROM t1;
+ a
++1
++2
+ 3
+ 4
++Warnings:
++Error 145 Table './test/t1' is marked as crashed and should be repaired
++Error 1194 Table 't1' is marked as crashed and should be repaired
++Error 1034 1 client is using or hasn't closed the table properly
+ DROP TABLE t1;
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 1fbdfe12d3d..093a2a6dcef 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -1635,6 +1635,47 @@ ha_rows ha_myisammrg::records()
return myrg_records(file);
}
+uint ha_myisammrg::count_query_cache_dependant_tables(uint8 *tables_type)
+{
+ MYRG_INFO *file = myrg_info();
+ /*
+ Here should be following statement
+ (*tables_type)|= HA_CACHE_TBL_NONTRANSACT;
+ but it has no effect because HA_CACHE_TBL_NONTRANSACT is 0
+ */
+ return (file->end_table - file->open_tables);
+}
+
+
+my_bool ha_myisammrg::register_query_cache_dependant_tables(THD *thd
+ __attribute__((unused)),
+ Query_cache *cache,
+ Query_cache_block_table **block_table,
+ uint *n)
+{
+ MYRG_INFO *file =myrg_info();
+ DBUG_ENTER("ha_myisammrg::register_query_cache_dependant_tables");
+
+ for (MYRG_TABLE *table =file->open_tables;
+ table != file->end_table ;
+ table++)
+ {
+ char key[MAX_DBKEY_LENGTH];
+ uint32 db_length;
+ uint key_length= cache->filename_2_table_key(key, table->table->filename,
+ &db_length);
+ (++(*block_table))->n= ++(*n);
+ /*
+ There are not callback function for for MyISAM, and engine data
+ */
+ if (!cache->insert_table(key_length, key, (*block_table),
+ db_length,
+ table_cache_type(),
+ 0, 0, TRUE))
+ DBUG_RETURN(TRUE);
+ }
+ DBUG_RETURN(FALSE);
+}
extern int myrg_panic(enum ha_panic_function flag);
int myisammrg_panic(handlerton *hton, ha_panic_function flag)
diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h
index e0dc6e07542..f5ba2ffef38 100644
--- a/storage/myisammrg/ha_myisammrg.h
+++ b/storage/myisammrg/ha_myisammrg.h
@@ -149,4 +149,10 @@ public:
bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
int check(THD* thd, HA_CHECK_OPT* check_opt);
ha_rows records();
+ virtual uint count_query_cache_dependant_tables(uint8 *tables_type);
+ virtual my_bool
+ register_query_cache_dependant_tables(THD *thd,
+ Query_cache *cache,
+ Query_cache_block_table **block,
+ uint *n);
};
diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_table.inc b/storage/myisammrg/mysql-test/storage_engine/alter_table.inc
new file mode 100644
index 00000000000..a978ade4f75
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/alter_table.inc
@@ -0,0 +1,116 @@
+##################################
+#
+# This include file will be used for all ALTER TABLE statements in the suite.
+# If you need to add additional steps or change the logic, copy the file
+# to storage/<engine>/mysql-test/storage_engine/ folder and modify it there.
+#
+##################
+#
+# Parameters:
+#
+# --let $alter_definition = <alter definition> # mandatory, everything that goes after the table name in ALTER statement
+# --let $table_name = <table name> # optional, default t1
+# --let $error_codes = <expected error codes, as in --error> # optional, default 0
+# --let $online = [0|1] # optional, default 0 (1 adds ONLINE)
+# --let $rename_to = <new table name> # optional, default empty.
+# # If set, means we are running RENAME TO, then alter definition is ignored
+#
+# Usage examples:
+#
+# --let $alter_definition = ADD COLUMN b $char_col DEFAULT ''
+#
+
+--let $child_alter_definition = $alter_definition
+
+if ($rename_to)
+{
+ --let $alter_definition = RENAME TO $rename_to
+ --let $child_alter_definition = RENAME TO mrg.$rename_to
+}
+
+if (!$alter_definition)
+{
+ --die # The ALTER statement is empty
+}
+
+--let $alter_statement = ALTER
+
+if ($online)
+{
+ --let $alter_statement = $alter_statement ONLINE
+}
+
+if (!$table_name)
+{
+ --let $table_name = t1
+}
+
+--let $alter_statement = $alter_statement TABLE $table_name $alter_definition
+# We don't want to do ONLINE on underlying tables, we are not testing MyISAM
+--let $child_statement = ALTER TABLE mrg.$table_name $child_alter_definition
+
+
+
+# We now have the complete ALTER statement in $alter_statement.
+# If your ALTER statement should be composed differently,
+# modify the logic above.
+
+#####################
+# Here you can add logic needed BEFORE the main statement
+# (e.g. base tables need to be altered, etc.).
+# Surround it by --disable_query_log/--enable_query_log
+# if you don't want it to appear in the result output.
+#####################
+
+--source obfuscate.inc
+
+eval $alter_statement;
+--source check_errors.inc
+
+# Make sure you don't add any statements between the main ALTER (above)
+# and saving mysql_errno and mysql_errname (below)
+# They are saved in case you want to add more logic after the main ALTER,
+# because we need the result code of the statement.
+# Also, do not change $alter_statement after it is executed!
+
+--let $my_errno = $mysql_errno
+--let $my_errname = $mysql_errname
+
+#####################
+# Here you can add logic needed AFTER the main statement.
+# Surround it by --disable_query_log/--enable_query_log
+# if you don't want it to appear in the result output.
+#####################
+--disable_query_log
+--disable_warnings
+--disable_result_log
+# We will only try to alter the underlying table if the main alter was successful
+if (!$my_errno)
+{
+ if ($rename_to)
+ {
+ eval ALTER TABLE $rename_to UNION(mrg.$rename_to);
+ }
+ # In the same section, the manual says that FLUSH TABLES should be performed before altering
+ # the underlying table, and later also says that it should be done after. We'll do both
+ FLUSH TABLES;
+ eval $child_statement;
+ FLUSH TABLES;
+}
+--enable_result_log
+--enable_warnings
+--enable_query_log
+
+# Unset the parameters, we don't want them to be accidentally reused later
+--let $alter_definition =
+--let $table_name =
+--let $error_codes =
+--let $online = 0
+--let $rename_to =
+
+# Restore the error codes of the main statement
+--let $mysql_errno = $my_errno
+--let $mysql_errname = $my_errname
+# Make sure you don't add any SQL statements after restoring
+# mysql_errno and mysql_errname (above)
+
diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff
new file mode 100644
index 00000000000..447a38a5b2b
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff
@@ -0,0 +1,68 @@
+11c11
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+19c19
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+27c27
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+35c35
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+43c43
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+51c51
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+59c59
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+67c67
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+75c75
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+82c82
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+91c91
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`)
+100c100
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+107c107
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+122c122
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+130c130
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+138c138
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+146c146
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff
new file mode 100644
index 00000000000..cfc821582ed
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff
@@ -0,0 +1,27 @@
+4,18c4,13
+< DROP TABLE t1;
+< CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< INSERT INTO t1 (a) VALUES (1),(2);
+< SELECT * FROM t1;
+< a
+< 1
+< 2
+< ALTER TABLE t1 DISCARD TABLESPACE;
+< SELECT * FROM t1;
+< ERROR HY000: Got error -1 from storage engine
+< ALTER TABLE t1 IMPORT TABLESPACE;
+< SELECT * FROM t1;
+< a
+< 1
+< 2
+---
+> ERROR HY000: 'test.t1' is not BASE TABLE
+> # ERROR: Statement ended with errno 1347, errname ER_WRONG_OBJECT (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ ALTER TABLE t1 DISCARD TABLESPACE ]
+> # The statement|command finished with ER_WRONG_OBJECT.
+> # Tablespace operations or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff
new file mode 100644
index 00000000000..139bcc00a81
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff
@@ -0,0 +1,22 @@
+8c8
+< test.t1 analyze status OK
+---
+> test.t1 analyze note The storage engine for the table doesn't support analyze
+12c12
+< test.t2 analyze status OK
+---
+> test.t2 analyze note The storage engine for the table doesn't support analyze
+17,18c17,18
+< test.t1 analyze status OK
+< test.t2 analyze status OK
+---
+> test.t1 analyze note The storage engine for the table doesn't support analyze
+> test.t2 analyze note The storage engine for the table doesn't support analyze
+24c24
+< test.t1 analyze status OK
+---
+> test.t1 analyze note The storage engine for the table doesn't support analyze
+28c28
+< test.t1 analyze status OK
+---
+> test.t1 analyze note The storage engine for the table doesn't support analyze
diff --git a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff
new file mode 100644
index 00000000000..e9095aa3944
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff
@@ -0,0 +1,34 @@
+9c9
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+55c55
+< t1 <STORAGE_ENGINE> # # # # # # # # 6 # # # # # # #
+---
+> t1 <STORAGE_ENGINE> # # # # # # # # 0 # # # # # # #
+62c62
+< t1 # # # # # # # # # 8 # # # # # # #
+---
+> t1 # # # # # # # # # 0 # # # # # # #
+81c81
+< t1 # # # # # # # # # 10 # # # # # # #
+---
+> t1 # # # # # # # # # 0 # # # # # # #
+85c85
+< t1 # # # # # # # # # 21 # # # # # # #
+---
+> t1 # # # # # # # # # 0 # # # # # # #
+106c106
+< t1 # # # # # # # # # 22 # # # # # # #
+---
+> t1 # # # # # # # # # 0 # # # # # # #
+128,129c128,129
+< 100 a
+< 101 b
+---
+> 1 a
+> 2 b
+132c132
+< 100
+---
+> 1
diff --git a/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff b/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff
new file mode 100644
index 00000000000..e10b22a8e66
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff
@@ -0,0 +1,46 @@
+15,16c15,16
+< test.t1 assign_to_keycache status OK
+< test.t2 assign_to_keycache status OK
+---
+> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+> test.t2 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+19,20c19,20
+< test.t1 preload_keys status OK
+< test.t2 preload_keys status OK
+---
+> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+> test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
+25,26c25,26
+< test.t1 preload_keys status OK
+< test.t2 preload_keys status OK
+---
+> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+> test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
+31c31
+< test.t1 preload_keys status OK
+---
+> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+35c35
+< test.t1 assign_to_keycache status OK
+---
+> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+39c39
+< test.t1 preload_keys status OK
+---
+> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+50c50
+< test.t1 assign_to_keycache status OK
+---
+> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+54c54
+< test.t1 preload_keys status OK
+---
+> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+62c62
+< test.t1 assign_to_keycache status OK
+---
+> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+66c66
+< test.t1 preload_keys status OK
+---
+> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
diff --git a/storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff
diff --git a/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff b/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff
new file mode 100644
index 00000000000..1710cc18fea
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff
@@ -0,0 +1,6 @@
+14,15c14,15
+< test.t1 4272806499
+< test.t2 0
+---
+> test.t1 NULL
+> test.t2 NULL
diff --git a/storage/myisammrg/mysql-test/storage_engine/cleanup_engine.inc b/storage/myisammrg/mysql-test/storage_engine/cleanup_engine.inc
new file mode 100644
index 00000000000..b8f84110c76
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/cleanup_engine.inc
@@ -0,0 +1,16 @@
+###########################################
+#
+# This is a stub of the include file cleanup_engine.inc which
+# should be placed in storage/<engine>/mysql-test/storage_engine folder.
+#
+################################
+#
+# Here you can add whatever is needed to cleanup
+# in case your define_engine.inc created any artefacts,
+# e.g. an additional schema and/or tables.
+--disable_query_log
+--disable_warnings
+DROP DATABASE IF EXISTS mrg;
+--enable_warnings
+--enable_query_log
+
diff --git a/storage/myisammrg/mysql-test/storage_engine/create_table.inc b/storage/myisammrg/mysql-test/storage_engine/create_table.inc
new file mode 100644
index 00000000000..c74460d42fb
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/create_table.inc
@@ -0,0 +1,208 @@
+##################################
+#
+# This include file will be used for all CREATE TABLE statements in the suite.
+# If you need to add additional steps or change the logic, copy the file
+# to storage/<engine>/mysql-test/storage_engine/ folder and modify it there.
+#
+##################
+#
+# Parameters:
+#
+# --let $create_definition = <column names, types, indexes) # optional, default a $int_col, b $char_col (based on defaults)
+# --let $table_name = <table name> # optional, default t1
+# --let $table_options = <table options> # optional, default based on define_engine.inc
+# --let $partition_options = <partitioning definition> # optional, default none
+# --let $as_select = <SELECT statement> # optional, default empty
+# --let $error_codes = <expected error codes, as in --error> # optional, default 0
+# --let $if_not_exists = [0|1] # optional, default 0 (1 adds IF NOT EXISTS clause)
+# --let $default_engine = [0|1] # optional, default 0 (with 1 will rely on default engine, no ENGINE=)
+# --let $temporary = [0|1] # optional, default 0 (1 adds TEMPORARY)
+# --let $disable_query_log = [0|1] # optional, default 0 (1 disables logging of CREATE)
+#
+# Usage examples:
+#
+# --source create_table.inc -- creates a default table
+#
+# --let $create_definition = a INT NOT NULL, b CHAR(1) PRIMARY KEY, INDEX(a)
+# --let $table_options = AUTO_INCREMENT = 100
+# --let $partition_options = PARTITION BY HASH(a) PARTITIONS 2
+# --let $as_select = SELECT 1, 'a'
+# --source create_table.inc
+#
+# Additionally, a test can define $extra_tbl_options. The difference with $table_options
+# is that its value is persistent and will be used until it is unset explicitly, or
+# until the test ends. The purpose of it is to allow one test to call another test,
+# when the called test does not know about specific options the calling test might require,
+# and thus cannot set them on per-create basis.
+
+--let $create_statement = CREATE
+
+if ($temporary)
+{
+ --let $create_statement = $create_statement TEMPORARY
+}
+
+--let $create_statement = $create_statement TABLE
+
+if ($if_not_exists)
+{
+ --let $create_statement = $create_statement IF NOT EXISTS
+}
+
+if (!$table_name)
+{
+ --let $table_name = t1
+}
+
+# Child statement is a statement that will create an underlying table.
+# From this point, it will deviate from the main statement, that's why
+# we start creating it here in parallel with the main one.
+# For underlying tables, we will create a table in mrg schema, e.g.
+# for table t1 the underlying table will be mrg.t1, etc.
+# Since we will only create one child here, it should be enough. If we want more,
+# we can always add a suffix, e.g. mrg.t1_child1, mrg.t1_child2, etc.
+
+--let $child_statement = $create_statement mrg.$table_name
+--let $create_statement = $create_statement $table_name
+
+if (!$create_definition)
+{
+ # If $create_definition is not defined, and AS SELECT is requested,
+ # we should not set $create_definition to the default value,
+ # because it might be inconsistent with the SELECT.
+ if (!$as_select)
+ {
+ --let $create_definition = a $int_col, b $char_col
+ }
+}
+
+if ($create_definition)
+{
+ --let $create_statement = $create_statement ($create_definition)
+ # Table definition for the underlying table should be the same
+ # as for the MERGE table
+ --let $child_statement = $child_statement ($create_definition)
+}
+
+# If $default_engine is set, we will rely on the default storage engine
+
+if (!$default_engine)
+{
+ --let $create_statement = $create_statement ENGINE=$storage_engine
+}
+# Engine for an underlying table differs
+--let $child_statement = $child_statement ENGINE=MyISAM
+
+# Save default table options, we will want to restore them later
+--let $default_tbl_opts_saved = $default_tbl_opts
+--let $default_tbl_opts = $default_tbl_opts UNION(mrg.$table_name) INSERT_METHOD=LAST
+
+# Default table options from define_engine.inc
+--let $create_statement = $create_statement $default_tbl_opts
+
+# The calling script could request additional table options
+if ($table_options)
+{
+ --let $create_statement = $create_statement $table_options
+ --let $child_statement = $child_statement $table_options
+}
+
+# The difference between $extra_tbl_opts and $table_options
+# is that its $extra_tbl_opts is persistent -- it will not be unset at the end of this file,
+# and will be used until it is unset explicitly by the calling test,
+# or until the test ends. The purpose of it is to allow one test to call another test,
+# when the called test does not know about specific options the calling test might require,
+# and thus cannot set them on per-create basis.
+
+if ($extra_tbl_opts)
+{
+ --let $create_statement = $create_statement $extra_tbl_opts
+ --let $child_statement = $child_statement $extra_tbl_opts
+}
+
+if ($as_select)
+{
+ --let $create_statement = $create_statement AS $as_select
+ --let $child_statement = $child_statement AS $as_select
+}
+
+if ($partition_options)
+{
+ --let $create_statement = $create_statement $partition_options
+ --let $child_statement = $child_statement $partition_options
+}
+
+# We now have the complete CREATE statement in $create_statement.
+# If your CREATE statement should be composed differently,
+# modify the logic above.
+
+#####################
+# Here you can add logic needed BEFORE the main table creation
+# (e.g. the table needs a base table, a reference table, etc.).
+# Surround it by --disable_query_log/--enable_query_log
+# if you don't want it to appear in the result output.
+#####################
+--disable_warnings
+--disable_query_log
+--disable_result_log
+eval DROP TABLE IF EXISTS mrg.$table_name;
+eval $child_statement;
+--enable_result_log
+--enable_query_log
+--enable_warnings
+
+if ($disable_query_log)
+{
+ --disable_query_log
+}
+
+--source obfuscate.inc
+
+eval $create_statement;
+--source strict_check_errors.inc
+
+# Make sure you don't add any statements between the main CREATE (above)
+# and saving mysql_errno and mysql_errname (below)
+# They are saved in case you want to add more logic after the main CREATE,
+# because we need the result code of the table creation.
+# Also, do not change $create_statement after it is executed!
+
+--let $my_errno = $mysql_errno
+--let $my_errname = $mysql_errname
+
+
+if ($disable_query_log)
+{
+ --enable_query_log
+}
+
+#####################
+# Here you can add logic needed AFTER the main table creation,
+# e.g. triggers creation.
+# Surround it by --disable_query_log/--enable_query_log
+# if you don't want it to appear in the result output.
+#####################
+
+
+# Unset the parameters, we don't want them to be accidentally reused later
+--let $create_definition =
+--let $table_name = t1
+--let $table_options =
+--let $partition_options =
+--let $as_select = 0
+--let $error_codes =
+--let $if_not_exists = 0
+--let $default_engine = 0
+--let $temporary = 0
+--let $disable_query_log = 0
+
+# Restore default table options now
+--let $default_tbl_opts = $default_tbl_opts_saved
+
+
+# Restore the error codes of the main statement
+--let $mysql_errno = $my_errno
+--let $mysql_errname = $my_errname
+# Make sure you don't add any SQL statements after restoring
+# mysql_errno and mysql_errname (above)
+
diff --git a/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff
new file mode 100644
index 00000000000..5d3578ad3cd
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff
@@ -0,0 +1,37 @@
+7c7
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+16c16
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+22c22
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+27,36c27,35
+< SHOW CREATE TABLE t1;
+< Table Create Table
+< t1 CREATE TABLE `t1` (
+< `1` bigint(20) NOT NULL DEFAULT '0'
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+< SELECT * FROM t1;
+< 1
+< 1
+< 2
+< DROP TABLE t1;
+---
+> ERROR HY000: 'test.t1' is not BASE TABLE
+> # ERROR: Statement ended with errno 1347, errname ER_WRONG_OBJECT (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command finished with ER_WRONG_OBJECT.
+> # CREATE TABLE .. AS SELECT or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+43c42
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/define_engine.inc b/storage/myisammrg/mysql-test/storage_engine/define_engine.inc
new file mode 100644
index 00000000000..aabd1747737
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/define_engine.inc
@@ -0,0 +1,49 @@
+###########################################
+#
+# This is a template of the include file define_engine.inc which
+# should be placed in storage/<engine>/mysql-test/storage_engine folder.
+#
+################################
+#
+# The name of the engine under test must be defined in $ENGINE variable.
+# You can set it either here (uncomment and edit) or in your environment.
+#
+let $ENGINE = MRG_MYISAM;
+#
+################################
+#
+# The following three variables define specific options for columns and tables.
+# Normally there should be none needed, but for some engines it can be different.
+# If the engine requires specific column option for all or indexed columns,
+# set them inside the comment, e.g. /*!NOT NULL*/.
+# Do the same for table options if needed, e.g. /*!INSERT_METHOD=LAST*/
+
+let $default_col_opts = /*!*/;
+let $default_col_indexed_opts = /*!*/;
+let $default_tbl_opts = /*!*/;
+
+# INDEX, UNIQUE INDEX, PRIMARY KEY, special index type - choose the fist that the engine allows,
+# or set it to /*!*/ if none is supported
+
+let $default_index = /*!INDEX*/;
+
+# If the engine does not support the following types, replace them with the closest possible
+
+let $default_int_type = INT(11);
+let $default_char_type = CHAR(8);
+
+################################
+
+--disable_query_log
+--disable_result_log
+
+# Here you can place your custom MTR code which needs to be executed before each test,
+# e.g. creation of an additional schema or table, etc.
+# The cleanup part should be defined in cleanup_engine.inc
+--disable_warnings
+DROP DATABASE IF EXISTS mrg;
+--enable_warnings
+CREATE DATABASE mrg;
+
+--enable_query_log
+--enable_result_log
diff --git a/storage/myisammrg/mysql-test/storage_engine/disabled.def b/storage/myisammrg/mysql-test/storage_engine/disabled.def
new file mode 100644
index 00000000000..9f7569a2d24
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/disabled.def
@@ -0,0 +1,2 @@
+alter_table_online : MySQL:57657 (Temporary MERGE table with temporary underlying is broken by ALTER)
+
diff --git a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff
new file mode 100644
index 00000000000..7362bd282a5
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff
@@ -0,0 +1,138 @@
+15,17c15,16
+< KEY `a` (`a`),
+< CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> KEY `a` (`a`)
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`)
+19c18,25
+< ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+---
+> # ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command succeeded unexpectedly.
+> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+23c29,36
+< ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+---
+> # ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command succeeded unexpectedly.
+> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+25c38
+< ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+---
+> # ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2)
+27c40,47
+< ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+---
+> # ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command succeeded unexpectedly.
+> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+32c52
+< 2 d
+---
+> 3 d
+35c55,56
+< 1 a
+---
+> 3 b
+> 3 b
+37c58,65
+< ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+---
+> # ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command succeeded unexpectedly.
+> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+49,51c77,78
+< KEY `a` (`a`),
+< CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> KEY `a` (`a`)
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`)
+53c80
+< ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE)
+---
+> # ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
+54a82
+> ERROR 42S02: Table 'test.t1' doesn't exist
+56a85,92
+> ERROR 42S02: Table 'test.t1' doesn't exist
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command finished with ER_NO_SUCH_TABLE.
+> # UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+59,64c95,104
+< 5 a
+< 5 a
+< 5 b
+< 5 c
+< 5 d
+< 5 e
+---
+> 1 a
+> 1 a
+> 2 b
+> 2 b
+> 3 a
+> 3 c
+> 3 c
+> 4 d
+> 4 d
+> 4 e
+65a106,113
+> ERROR 42S02: Table 'test.t1' doesn't exist
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command finished with ER_NO_SUCH_TABLE.
+> # DELETE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+67a116,125
+> 1 a
+> 1 a
+> 2 b
+> 2 b
+> 3 a
+> 3 c
+> 3 c
+> 4 d
+> 4 d
+> 4 e
+69c127,135
+< ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`))
+---
+> ERROR 42S02: Table 'test.t1' doesn't exist
+> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TRUNCATE_ILLEGAL_FK)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command finished with ER_NO_SUCH_TABLE.
+> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+71a138
+> ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff b/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff
new file mode 100644
index 00000000000..262370f01ed
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff
@@ -0,0 +1,142 @@
+7,64c7,15
+< SHOW INDEXES IN t1;
+< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+< t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT
+< INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+< If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+< For developers who want to code on MariaDB or MySQL
+< * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+< o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+< o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+< * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+< o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+< For MariaDB / MySQL end users
+< * MariaDB Crash Course by Ben Forta
+< o First MariaDB book!
+< o For people who want to learn SQL and the basics of MariaDB.
+< o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+< * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+< o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+< o Free to read in the Knowledgebase!
+< * MySQL (4th Edition) by Paul DuBois
+< o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+< * MySQL Cookbook by Paul DuBois
+< o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+< * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+< o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+<
+< * MySQL Admin Cookbook
+< o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+<
+< * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+< o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
+< 'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
+<
+< 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
+< 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
+< 3. With MariaDB everyone has access to the latest code.
+< 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
+< 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
+< The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
+< ), ('text2','test1','test2');
+< SELECT v0 FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+< v0
+< INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
+< SELECT v0, MATCH(v1) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+< v0 rating
+< INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
+< SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
+< v0 rating
+< text4 1.3705332279205322
+< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
+< v0
+< text1
+< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
+< v0
+< SELECT v0, MATCH(v1) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('database' WITH QUERY EXPANSION);
+< v0 rating
+< text1 178.11756896972656
+< DROP TABLE t1;
+---
+> ERROR HY000: The used table type doesn't support FULLTEXT indexes
+> # ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command finished with ER_TABLE_CANT_HANDLE_FT.
+> # FULLTEXT indexes or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+71,132c22,30
+< SHOW INDEXES IN t1;
+< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+< t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT
+< t1 1 v1_v2 1 v1 # # NULL NULL YES FULLTEXT
+< t1 1 v1_v2 2 v2 # # NULL NULL YES FULLTEXT
+< INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+< If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+< For developers who want to code on MariaDB or MySQL
+< * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+< o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+< o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+< * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+< o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+< For MariaDB / MySQL end users
+< * MariaDB Crash Course by Ben Forta
+< o First MariaDB book!
+< o For people who want to learn SQL and the basics of MariaDB.
+< o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+< * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+< o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+< o Free to read in the Knowledgebase!
+< * MySQL (4th Edition) by Paul DuBois
+< o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+< * MySQL Cookbook by Paul DuBois
+< o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+< * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+< o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+<
+< * MySQL Admin Cookbook
+< o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+<
+< * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+< o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
+< 'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
+<
+< 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
+< 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
+< 3. With MariaDB everyone has access to the latest code.
+< 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
+< 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
+< The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
+< ), ('text2','test1','test2');
+< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+< v0
+< INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
+< SELECT v0, MATCH(v1,v2) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+< v0 rating
+< text1 0.2809644043445587
+< INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
+< SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
+< v0 rating
+< text4 1.3705332279205322
+< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
+< v0
+< text1
+< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
+< v0
+< SELECT v0, MATCH(v1,v2) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('database' WITH QUERY EXPANSION);
+< v0 rating
+< text1 190.56150817871094
+< text4 1.1758291721343994
+< DROP TABLE t1;
+---
+> ERROR HY000: The used table type doesn't support FULLTEXT indexes
+> # ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command finished with ER_TABLE_CANT_HANDLE_FT.
+> # FULLTEXT indexes or multiple keys or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/handler.rdiff b/storage/myisammrg/mysql-test/storage_engine/handler.rdiff
new file mode 100644
index 00000000000..f0c01085ad9
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/handler.rdiff
@@ -0,0 +1,79 @@
+5,47c5,12
+< HANDLER t1 READ FIRST;
+< ERROR 42S02: Unknown table 't1' in HANDLER
+< HANDLER h1 READ FIRST;
+< a b
+< foobar 1000
+< HANDLER h1 READ NEXT;
+< a b
+< a 1
+< HANDLER h1 READ FIRST WHERE a < 'foo';
+< a b
+< a 1
+< HANDLER h1 READ NEXT;
+< a b
+< bar 200
+< HANDLER h1 READ NEXT;
+< a b
+< foo 100
+< HANDLER h1 READ NEXT;
+< a b
+< HANDLER h1 READ FIRST LIMIT 2;
+< a b
+< foobar 1000
+< a 1
+< HANDLER h1 READ NEXT;
+< a b
+< bar 200
+< HANDLER h1 READ NEXT WHERE b>500 LIMIT 2;
+< a b
+< HANDLER t1 OPEN;
+< HANDLER h1 READ FIRST WHERE b>500 LIMIT 5;
+< a b
+< foobar 1000
+< HANDLER t1 READ NEXT;
+< a b
+< foobar 1000
+< HANDLER h1 READ NEXT WHERE b<100;
+< a b
+< HANDLER t1 CLOSE;
+< HANDLER h1 READ FIRST;
+< a b
+< foobar 1000
+< HANDLER t1 CLOSE;
+< ERROR 42S02: Unknown table 't1' in HANDLER
+---
+> ERROR HY000: Table storage engine for 'h1' doesn't have this option
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command finished with ER_ILLEGAL_HA.
+> # Functionality or the syntax or the mix could be unsupported.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+54,76c19
+< HANDLER h1 READ a = (100);
+< a b
+< 100 f
+< HANDLER h1 READ a <= (100) WHERE b < 'f';
+< a b
+< 2 c
+< HANDLER h1 READ a > (2) WHERE b IS NOT NULL LIMIT 2;
+< a b
+< 100 f
+< 101 b
+< HANDLER h1 READ a FIRST;
+< a b
+< 1 a
+< HANDLER h1 READ a LAST;
+< a b
+< 200 b
+< HANDLER h1 READ a PREV;
+< a b
+< 101 b
+< HANDLER h1 READ a NEXT;
+< a b
+< 200 b
+< HANDLER h1 CLOSE;
+---
+> ERROR HY000: Table storage engine for 'h1' doesn't have this option
diff --git a/storage/myisammrg/mysql-test/storage_engine/index.rdiff b/storage/myisammrg/mysql-test/storage_engine/index.rdiff
new file mode 100644
index 00000000000..6e6f18e39bc
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/index.rdiff
@@ -0,0 +1,6 @@
+64,66c64
+< ERROR 23000: Duplicate entry '1' for key 'a'
+< # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+< # If you got a difference in error message, just add it to rdiff file
+---
+> # ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY)
diff --git a/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff
new file mode 100644
index 00000000000..8913f17a2a6
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff
@@ -0,0 +1,17 @@
+13a14,15
+> Warnings:
+> Note 1031 Table storage engine for 't1' doesn't have this option
+16c18
+< t1 1 a 1 a # # NULL NULL YES BTREE disabled
+---
+> t1 1 a 1 a # # NULL NULL YES BTREE
+19c21
+< 1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using filesort
+---
+> 1 SIMPLE t1 index NULL a 5 NULL 19 Using index
+22a25,26
+> Warnings:
+> Note 1031 Table storage engine for 't1' doesn't have this option
+34a39,40
+> Warnings:
+> Note 1031 Table storage engine for 't1' doesn't have this option
diff --git a/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff
new file mode 100644
index 00000000000..6e6f18e39bc
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff
@@ -0,0 +1,6 @@
+64,66c64
+< ERROR 23000: Duplicate entry '1' for key 'a'
+< # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+< # If you got a difference in error message, just add it to rdiff file
+---
+> # ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY)
diff --git a/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff
new file mode 100644
index 00000000000..1b57afe5b64
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff
@@ -0,0 +1,34 @@
+7c7
+< t1 1 a 1 a # # NULL NULL # HASH
+---
+> t1 1 a 1 a # # NULL NULL # BTREE
+15,16c15,16
+< t1 1 a_b 1 a # # NULL NULL # HASH a_b index
+< t1 1 a_b 2 b # # NULL NULL # HASH a_b index
+---
+> t1 1 a_b 1 a # # NULL NULL # BTREE a_b index
+> t1 1 a_b 2 b # # NULL NULL # BTREE a_b index
+25,26c25,26
+< t1 1 a 1 a # # NULL NULL # HASH
+< t1 1 b 1 b # # NULL NULL # HASH
+---
+> t1 1 a 1 a # # NULL NULL # BTREE
+> t1 1 b 1 b # # NULL NULL # BTREE
+34c34
+< t1 0 a 1 a # # NULL NULL # HASH
+---
+> t1 0 a 1 a # # NULL NULL # BTREE
+46c46
+< t1 1 a 1 a # # NULL NULL # HASH simple index on a
+---
+> t1 1 a 1 a # # NULL NULL # BTREE simple index on a
+55c55
+< t1 0 a 1 a # # NULL NULL # HASH
+---
+> t1 0 a 1 a # # NULL NULL # BTREE
+64,66c64
+< ERROR 23000: Duplicate entry '1' for key 'a'
+< # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+< # If you got a difference in error message, just add it to rdiff file
+---
+> # ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY)
diff --git a/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff b/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff
new file mode 100644
index 00000000000..e0d0eefabe4
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff
@@ -0,0 +1,14 @@
+7a8,15
+> ERROR HY000: DELAYED option not supported for table 't1'
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command finished with ER_DELAYED_NOT_SUPPORTED.
+> # INSERT DELAYED or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+8a17
+> ERROR HY000: DELAYED option not supported for table 't1'
+23,24d31
+< 3 c
+< 4 d
diff --git a/storage/myisammrg/mysql-test/storage_engine/lock.rdiff b/storage/myisammrg/mysql-test/storage_engine/lock.rdiff
new file mode 100644
index 00000000000..d035648551a
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/lock.rdiff
@@ -0,0 +1,62 @@
+44a45,46
+> ERROR HY000: Table 't1' was not locked with LOCK TABLES
+> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
+45a48,49
+> ERROR HY000: Table 't2' was not locked with LOCK TABLES
+> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
+46a51
+> ERROR HY000: Table 't2' was not locked with LOCK TABLES
+47a53
+> ERROR HY000: Table 't2' was not locked with LOCK TABLES
+48a55
+> ERROR 42S02: Table 'test.t1' doesn't exist
+49a57
+> ERROR 42S02: Table 'test.t1' doesn't exist
+50a59
+> ERROR 42S02: Table 'test.t1' doesn't exist
+52a62
+> ERROR 42S02: Table 'test.t1' doesn't exist
+54c64,65
+< ERROR HY000: Table 't1' was not locked with LOCK TABLES
+---
+> ERROR 42S02: Table 'test.t1' doesn't exist
+> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TABLE_NOT_LOCKED)
+56a68
+> ERROR 42S02: Table 'test.t1' doesn't exist
+57a70
+> ERROR 42S02: Table 'test.t1' doesn't exist
+59c72,73
+< ERROR HY000: Table 't2' was not locked with LOCK TABLES
+---
+> ERROR 42S02: Unknown table 't1,t2'
+> # ERROR: Statement ended with errno 1051, errname ER_BAD_TABLE_ERROR (expected results: ER_TABLE_NOT_LOCKED)
+61a76
+> ERROR 42S02: Unknown table 't1,t2'
+67a83,84
+> ERROR HY000: Table 't1' was not locked with LOCK TABLES
+> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
+68a86,87
+> ERROR HY000: Table 't2' was not locked with LOCK TABLES
+> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
+69a89,90
+> ERROR HY000: Table 't3' was not locked with LOCK TABLES
+> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
+70a92
+> ERROR 42S02: Table 'test.t1' doesn't exist
+71a94,103
+> ERROR 42S02: Table 'test.t2' doesn't exist
+> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ ALTER TABLE t2 ADD COLUMN c2 INT(11) /*!*/ /*Custom column options*/ ]
+> # The statement|command finished with ER_NO_SUCH_TABLE.
+> # ALTER TABLE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+72a105
+> ERROR 42S02: Unknown table 't1,t2,t3'
+109c142
+< a b
+---
+> ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
diff --git a/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff
new file mode 100644
index 00000000000..f74c49cedea
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff
@@ -0,0 +1,24 @@
+8c8
+< test.t1 optimize status OK
+---
+> test.t1 optimize note The storage engine for the table doesn't support optimize
+12c12
+< test.t2 optimize status OK
+---
+> test.t2 optimize note The storage engine for the table doesn't support optimize
+17,18c17,18
+< test.t1 optimize status OK
+< test.t2 optimize status OK
+---
+> test.t1 optimize note The storage engine for the table doesn't support optimize
+> test.t2 optimize note The storage engine for the table doesn't support optimize
+21,22c21,22
+< test.t1 optimize status Table is already up to date
+< test.t2 optimize status Table is already up to date
+---
+> test.t1 optimize note The storage engine for the table doesn't support optimize
+> test.t2 optimize note The storage engine for the table doesn't support optimize
+28c28
+< test.t1 optimize status OK
+---
+> test.t1 optimize note The storage engine for the table doesn't support optimize
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff
new file mode 100644
index 00000000000..a2cb0c1dcb1
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff
@@ -0,0 +1,63 @@
+3,36c3,12
+< INSERT INTO t1 (a) VALUES (1),(2),(2),(3),(4);
+< ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p3 # # # # # # #
+< ALTER TABLE t1 COALESCE PARTITION 1;
+< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0 # # # # # # #
+< ALTER TABLE t1 REORGANIZE PARTITION;
+< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0 # # # # # # #
+< ALTER TABLE t1 REBUILD PARTITION p0;
+< EXPLAIN PARTiTIONS SELECT a FROM t1;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0 # # # # # # #
+< ALTER TABLE t1 REMOVE PARTITIONING;
+< EXPLAIN PARTiTIONS SELECT a FROM t1;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 NULL # # # # # # #
+< ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (101,102));
+< ERROR HY000: Table has no partition for value 4
+< ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3,4), PARTITION p1 VALUES IN (101,102));
+< INSERT INTO t1 (a) VALUES (50);
+< ERROR HY000: Table has no partition for value 50
+< ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (50,51));
+< INSERT INTO t1 (a) VALUES (50);
+< ALTER TABLE t1 DROP PARTITION p1;
+< ALTER TABLE t1 REORGANIZE PARTITION p0, p2 INTO (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4), PARTITION p2 VALUES IN (50,51), PARTITION p3 VALUES IN (101,102));
+< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0 # # # # # # #
+< DROP TABLE t1;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+41,42c17,29
+< ALTER TABLE t1 DROP PARTITION abc;
+< DROP TABLE t1;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+> PARTITION abc VALUES IN (1,2,3),
+> PARTITION def VALUES IN (100,101,102)
+> ) ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or subpartitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff
new file mode 100644
index 00000000000..ce29f3dcf52
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff
@@ -0,0 +1,83 @@
+3,18c3,12
+< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< INSERT INTO t2 (a,b) SELECT a,b FROM t1;
+< INSERT INTO t1 (a,b) VALUES (3,'c');
+< ALTER TABLE t1 ANALYZE PARTITION p0;
+< Table Op Msg_type Msg_text
+< test.t1 analyze status OK
+< INSERT INTO t2 (a,b) VALUES (4,'d'), (1000,'e');
+< ALTER TABLE t1 ANALYZE PARTITION LOCAL ALL;
+< Table Op Msg_type Msg_text
+< test.t1 analyze status OK
+< INSERT INTO t1 (a,b) VALUES (5,'f'),(50,'g');
+< ALTER TABLE t1 ANALYZE PARTITION NO_WRITE_TO_BINLOG p1,p0;
+< Table Op Msg_type Msg_text
+< test.t1 analyze status OK
+< DROP TABLE t1, t2;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+20a15,16
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+21a18
+> ERROR 42S02: Table 'test.t1' doesn't exist
+22a20,21
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+23a23
+> ERROR 42S02: Table 'test.t1' doesn't exist
+26c26,27
+< test.t1 analyze status OK
+---
+> test.t1 analyze Error Table 'test.t1' doesn't exist
+> test.t1 analyze status Operation failed
+27a29
+> ERROR 42S02: Table 'test.t2' doesn't exist
+30c32,33
+< test.t2 analyze status OK
+---
+> test.t2 analyze Error Table 'test.t2' doesn't exist
+> test.t2 analyze status Operation failed
+31a35
+> ERROR 42S02: Table 'test.t1' doesn't exist
+32a37
+> ERROR 42S02: Table 'test.t2' doesn't exist
+35,36c40,43
+< test.t1 analyze status OK
+< test.t2 analyze status OK
+---
+> test.t1 analyze Error Table 'test.t1' doesn't exist
+> test.t1 analyze status Operation failed
+> test.t2 analyze Error Table 'test.t2' doesn't exist
+> test.t2 analyze status Operation failed
+37a45
+> ERROR 42S02: Unknown table 't1,t2'
+38a47,48
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+39a50
+> ERROR 42S02: Table 'test.t1' doesn't exist
+42c53,54
+< test.t1 analyze status OK
+---
+> test.t1 analyze Error Table 'test.t1' doesn't exist
+> test.t1 analyze status Operation failed
+43a56
+> ERROR 42S02: Table 'test.t1' doesn't exist
+46c59,60
+< test.t1 analyze status OK
+---
+> test.t1 analyze Error Table 'test.t1' doesn't exist
+> test.t1 analyze status Operation failed
+47a62
+> ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff
new file mode 100644
index 00000000000..3f3db85a23e
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff
@@ -0,0 +1,172 @@
+3,36c3,12
+< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+< PARTITION p0 VALUES LESS THAN (100),
+< PARTITION p1 VALUES LESS THAN MAXVALUE
+< );
+< INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+< ALTER TABLE t1 CHECK PARTITION p0;
+< Table Op Msg_type Msg_text
+< test.t1 check status OK
+< INSERT INTO t1 (a,b) VALUES (3,'c');
+< ALTER TABLE t1 CHECK PARTITION p0, p1 FOR UPGRADE;
+< Table Op Msg_type Msg_text
+< test.t1 check status OK
+< INSERT INTO t2 (a,b) VALUES (10000,'e');
+< ALTER TABLE t2 CHECK PARTITION p0 QUICK;
+< Table Op Msg_type Msg_text
+< test.t2 check status OK
+< INSERT INTO t1 (a,b) VALUES (6,'f');
+< ALTER TABLE t1 CHECK PARTITION p1 FAST;
+< Table Op Msg_type Msg_text
+< test.t1 check status OK
+< INSERT INTO t2 (a,b) VALUES (8,'h');
+< ALTER TABLE t2 CHECK PARTITION p1 MEDIUM;
+< Table Op Msg_type Msg_text
+< test.t2 check status OK
+< INSERT INTO t1 (a,b) VALUES (9,'i');
+< ALTER TABLE t1 CHECK PARTITION ALL EXTENDED;
+< Table Op Msg_type Msg_text
+< test.t1 check status OK
+< INSERT INTO t1 (a,b) VALUES (11,'k');
+< ALTER TABLE t1 CHECK PARTITION p0 CHANGED;
+< Table Op Msg_type Msg_text
+< test.t1 check status OK
+< DROP TABLE t1, t2;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+38a15,16
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+39a18
+> ERROR 42S02: Table 'test.t1' doesn't exist
+40a20,21
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+43c24,25
+< test.t1 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+44a27
+> ERROR 42S02: Table 'test.t1' doesn't exist
+45a29
+> ERROR 42S02: Table 'test.t2' doesn't exist
+48,49c32,35
+< test.t1 check status OK
+< test.t2 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+> test.t2 check Error Table 'test.t2' doesn't exist
+> test.t2 check status Operation failed
+50a37
+> ERROR 42S02: Table 'test.t2' doesn't exist
+53c40,41
+< test.t2 check status OK
+---
+> test.t2 check Error Table 'test.t2' doesn't exist
+> test.t2 check status Operation failed
+54a43
+> ERROR 42S02: Table 'test.t1' doesn't exist
+57c46,47
+< test.t1 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+58a49
+> ERROR 42S02: Table 'test.t1' doesn't exist
+59a51
+> ERROR 42S02: Table 'test.t2' doesn't exist
+62,63c54,57
+< test.t2 check status OK
+< test.t1 check status OK
+---
+> test.t2 check Error Table 'test.t2' doesn't exist
+> test.t2 check status Operation failed
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+64a59
+> ERROR 42S02: Table 'test.t1' doesn't exist
+65a61
+> ERROR 42S02: Table 'test.t2' doesn't exist
+68,69c64,67
+< test.t1 check status OK
+< test.t2 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+> test.t2 check Error Table 'test.t2' doesn't exist
+> test.t2 check status Operation failed
+70a69
+> ERROR 42S02: Table 'test.t1' doesn't exist
+73c72,73
+< test.t1 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+74a75
+> ERROR 42S02: Unknown table 't1,t2'
+75a77,78
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+76a80
+> ERROR 42S02: Table 'test.t1' doesn't exist
+79c83,84
+< test.t1 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+80a86
+> ERROR 42S02: Table 'test.t1' doesn't exist
+83c89,90
+< test.t1 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+84a92
+> ERROR 42S02: Table 'test.t1' doesn't exist
+87c95,96
+< test.t1 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+88a98
+> ERROR 42S02: Table 'test.t1' doesn't exist
+91c101,102
+< test.t1 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+92a104
+> ERROR 42S02: Table 'test.t1' doesn't exist
+95c107,108
+< test.t1 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+96a110
+> ERROR 42S02: Table 'test.t1' doesn't exist
+99c113,114
+< test.t1 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+100a116
+> ERROR 42S02: Table 'test.t1' doesn't exist
+103c119,120
+< test.t1 check status OK
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+104a122
+> ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff
new file mode 100644
index 00000000000..bc5b07686bf
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff
@@ -0,0 +1,81 @@
+2a3,4
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+3a6
+> ERROR 42S02: Table 'test.t1' doesn't exist
+4a8,9
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+7c12,14
+< test.t1 4272806499
+---
+> test.t1 NULL
+> Warnings:
+> Error 1146 Table 'test.t1' doesn't exist
+10,11c17,21
+< test.t2 0
+< test.t1 4272806499
+---
+> test.t2 NULL
+> test.t1 NULL
+> Warnings:
+> Error 1146 Table 'test.t2' doesn't exist
+> Error 1146 Table 'test.t1' doesn't exist
+15a26,28
+> Warnings:
+> Error 1146 Table 'test.t1' doesn't exist
+> Error 1146 Table 'test.t2' doesn't exist
+18,19c31,35
+< test.t1 4272806499
+< test.t2 0
+---
+> test.t1 NULL
+> test.t2 NULL
+> Warnings:
+> Error 1146 Table 'test.t1' doesn't exist
+> Error 1146 Table 'test.t2' doesn't exist
+20a37
+> ERROR 42S02: Unknown table 't1,t2'
+22a40,41
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+23a43
+> ERROR 42S02: Table 'test.t1' doesn't exist
+24a45,46
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+27c49,51
+< test.t1 0
+---
+> test.t1 NULL
+> Warnings:
+> Error 1146 Table 'test.t1' doesn't exist
+30,31c54,58
+< test.t2 0
+< test.t1 0
+---
+> test.t2 NULL
+> test.t1 NULL
+> Warnings:
+> Error 1146 Table 'test.t2' doesn't exist
+> Error 1146 Table 'test.t1' doesn't exist
+34,35c61,65
+< test.t1 0
+< test.t2 0
+---
+> test.t1 NULL
+> test.t2 NULL
+> Warnings:
+> Error 1146 Table 'test.t1' doesn't exist
+> Error 1146 Table 'test.t2' doesn't exist
+38,39c68,72
+< test.t1 4272806499
+< test.t2 0
+---
+> test.t1 NULL
+> test.t2 NULL
+> Warnings:
+> Error 1146 Table 'test.t1' doesn't exist
+> Error 1146 Table 'test.t2' doesn't exist
+40a74
+> ERROR 42S02: Unknown table 't1,t2'
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff
new file mode 100644
index 00000000000..11fbc4812dc
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff
@@ -0,0 +1,156 @@
+3,10c3,12
+< INSERT INTO t1 (a) VALUES (1),(2),(3),(2);
+< EXPLAIN PARTITIONS SELECT a FROM t1;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0,p1 # # # # # # #
+< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0 # # # # # # #
+< DROP TABLE t1;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+12,19c14,23
+< INSERT INTO t1 (a) VALUES ('a'),('b'),('c');
+< EXPLAIN PARTITIONS SELECT a FROM t1;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0,p1 # # # # # # #
+< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 'b';
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p1 # # # # # # #
+< DROP TABLE t1;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or CHAR types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+21,31c25,34
+< SHOW INDEX IN t1;
+< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+< t1 1 a 1 a # # NULL NULL # #
+< INSERT INTO t1 (a) VALUES (1),(2),(3),(5);
+< EXPLAIN PARTITIONS SELECT a FROM t1;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0,p1 # # # # # # #
+< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a IN (1,3);
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0 # # # # # # #
+< DROP TABLE t1;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/, /*!INDEX*/ /*Custom index*/ (a)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+33,43c36,45
+< SHOW INDEX IN t1;
+< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+< t1 0 PRIMARY 1 a # # NULL NULL # #
+< INSERT INTO t1 (a) VALUES (1),(200),(3),(2);
+< EXPLAIN PARTITIONS SELECT a FROM t1;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0,p1 # # # # # # #
+< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p1 # # # # # # #
+< DROP TABLE t1;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/ PRIMARY KEY) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY() PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # PK or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+48,58c50,63
+< INSERT INTO t1 (a) VALUES (1),(2),(400);
+< EXPLAIN PARTITIONS SELECT a FROM t1;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0,p1 # # # # # # #
+< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 2;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0 # # # # # # #
+< INSERT INTO t1 (a) VALUES (10000);
+< ERROR HY000: Table has no partition for value 10000
+< DROP TABLE t1;
+< CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) (
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY RANGE(a) (
+> PARTITION p0 VALUES LESS THAN (10),
+> PARTITION p1 VALUES LESS THAN (1000)
+> ) ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+> CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+62,72c67,70
+< INSERT INTO t1 (a) VALUES (1),(101),(1);
+< EXPLAIN PARTITIONS SELECT a FROM t1;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 abc,def # # # # # # #
+< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE NULL NULL # # # # # # #
+< INSERT INTO t1 (a) VALUES (50);
+< ERROR HY000: Table has no partition for value 50
+< DROP TABLE t1;
+< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+75,91c73,79
+< );
+< SHOW INDEX IN t1;
+< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+< INSERT INTO t1 (a,b) VALUES (1,1),(101,2),(1,3);
+< EXPLAIN PARTITIONS SELECT a FROM t1;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 abc_abcsp0,def_defsp0 # # # # # # #
+< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE NULL NULL # # # # # # #
+< SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, PARTITION_METHOD, SUBPARTITION_METHOD
+< FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1';
+< TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_METHOD SUBPARTITION_METHOD
+< test t1 abc abcsp0 LIST HASH
+< test t1 def defsp0 LIST HASH
+< SELECT * FROM INFORMATION_SCHEMA.PARTITIONS;
+< DROP TABLE t1;
+---
+> ) ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or subpartitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff
new file mode 100644
index 00000000000..350d93fe91f
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff
@@ -0,0 +1,91 @@
+3,25c3,12
+< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+< PARTITION p0 VALUES LESS THAN (100),
+< PARTITION p1 VALUES LESS THAN MAXVALUE
+< );
+< INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+< INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+< ALTER TABLE t1 OPTIMIZE PARTITION p1;
+< Table Op Msg_type Msg_text
+< test.t1 optimize status OK
+< INSERT INTO t2 (a,b) VALUES (4,'d');
+< ALTER TABLE t2 OPTIMIZE PARTITION p0 NO_WRITE_TO_BINLOG;
+< Table Op Msg_type Msg_text
+< test.t2 optimize status OK
+< INSERT INTO t1 (a,b) VALUES (6,'f');
+< ALTER TABLE t1 OPTIMIZE PARTITION ALL LOCAL;
+< Table Op Msg_type Msg_text
+< test.t1 optimize status OK
+< INSERT INTO t2 (a,b) VALUES (5,'e');
+< ALTER TABLE t2 OPTIMIZE PARTITION p1,p0;
+< Table Op Msg_type Msg_text
+< test.t2 optimize status OK
+< DROP TABLE t1, t2;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+27a15,16
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+28a18
+> ERROR 42S02: Table 'test.t1' doesn't exist
+29a20,21
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+30a23
+> ERROR 42S02: Table 'test.t1' doesn't exist
+33c26,27
+< test.t1 optimize status OK
+---
+> test.t1 optimize Error Table 'test.t1' doesn't exist
+> test.t1 optimize status Operation failed
+34a29
+> ERROR 42S02: Table 'test.t2' doesn't exist
+37c32,33
+< test.t2 optimize status OK
+---
+> test.t2 optimize Error Table 'test.t2' doesn't exist
+> test.t2 optimize status Operation failed
+38a35
+> ERROR 42S02: Table 'test.t2' doesn't exist
+39a37
+> ERROR 42S02: Table 'test.t1' doesn't exist
+42,43c40,43
+< test.t1 optimize status OK
+< test.t2 optimize status OK
+---
+> test.t1 optimize Error Table 'test.t1' doesn't exist
+> test.t1 optimize status Operation failed
+> test.t2 optimize Error Table 'test.t2' doesn't exist
+> test.t2 optimize status Operation failed
+46,47c46,49
+< test.t1 optimize status OK
+< test.t2 optimize status OK
+---
+> test.t1 optimize Error Table 'test.t1' doesn't exist
+> test.t1 optimize status Operation failed
+> test.t2 optimize Error Table 'test.t2' doesn't exist
+> test.t2 optimize status Operation failed
+48a51
+> ERROR 42S02: Unknown table 't1,t2'
+49a53,54
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+50a56
+> ERROR 42S02: Table 'test.t1' doesn't exist
+53c59,60
+< test.t1 optimize status OK
+---
+> test.t1 optimize Error Table 'test.t1' doesn't exist
+> test.t1 optimize status Operation failed
+54a62
+> ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff
new file mode 100644
index 00000000000..4c39421261c
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff
@@ -0,0 +1,295 @@
+4,33c4,13
+< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+< PARTITION p0 VALUES LESS THAN (100),
+< PARTITION p1 VALUES LESS THAN MAXVALUE
+< );
+< INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+< ALTER TABLE t1 REPAIR PARTITION p0;
+< Table Op Msg_type Msg_text
+< test.t1 repair status OK
+< INSERT INTO t1 VALUES (3,'c');
+< ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1;
+< Table Op Msg_type Msg_text
+< test.t1 repair status OK
+< INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+< ALTER TABLE t2 REPAIR PARTITION LOCAL p1;
+< Table Op Msg_type Msg_text
+< test.t2 repair status OK
+< INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+< ALTER TABLE t1 REPAIR PARTITION LOCAL ALL EXTENDED;
+< Table Op Msg_type Msg_text
+< test.t1 repair status OK
+< INSERT INTO t1 VALUES (10,'j');
+< ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM;
+< Table Op Msg_type Msg_text
+< test.t1 repair status OK
+< INSERT INTO t2 (a,b) VALUES (12,'l');
+< ALTER TABLE t2 REPAIR PARTITION NO_WRITE_TO_BINLOG ALL QUICK EXTENDED USE_FRM;
+< Table Op Msg_type Msg_text
+< test.t2 repair status OK
+< DROP TABLE t1, t2;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+35a16,17
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+36a19
+> ERROR 42S02: Table 'test.t1' doesn't exist
+37a21,22
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+40c25,26
+< test.t1 repair status OK
+---
+> test.t1 repair Error Table 'test.t1' doesn't exist
+> test.t1 repair status Operation failed
+41a28
+> ERROR 42S02: Table 'test.t1' doesn't exist
+42a30
+> ERROR 42S02: Table 'test.t2' doesn't exist
+45,46c33,36
+< test.t1 repair status OK
+< test.t2 repair status OK
+---
+> test.t1 repair Error Table 'test.t1' doesn't exist
+> test.t1 repair status Operation failed
+> test.t2 repair Error Table 'test.t2' doesn't exist
+> test.t2 repair status Operation failed
+47a38
+> ERROR 42S02: Table 'test.t2' doesn't exist
+50c41,42
+< test.t2 repair status OK
+---
+> test.t2 repair Error Table 'test.t2' doesn't exist
+> test.t2 repair status Operation failed
+51a44
+> ERROR 42S02: Table 'test.t1' doesn't exist
+52a46
+> ERROR 42S02: Table 'test.t2' doesn't exist
+55,56c49,52
+< test.t2 repair status OK
+< test.t1 repair status OK
+---
+> test.t2 repair Error Table 'test.t2' doesn't exist
+> test.t2 repair status Operation failed
+> test.t1 repair Error Table 'test.t1' doesn't exist
+> test.t1 repair status Operation failed
+57a54
+> ERROR 42S02: Table 'test.t1' doesn't exist
+58a56
+> ERROR 42S02: Table 'test.t2' doesn't exist
+61,62c59,62
+< test.t1 repair status OK
+< test.t2 repair status OK
+---
+> test.t1 repair Error Table 'test.t1' doesn't exist
+> test.t1 repair status Operation failed
+> test.t2 repair Error Table 'test.t2' doesn't exist
+> test.t2 repair status Operation failed
+63a64
+> ERROR 42S02: Table 'test.t1' doesn't exist
+64a66
+> ERROR 42S02: Table 'test.t2' doesn't exist
+67,68c69,72
+< test.t1 repair status OK
+< test.t2 repair status OK
+---
+> test.t1 repair Error Table 'test.t1' doesn't exist
+> test.t1 repair status Operation failed
+> test.t2 repair Error Table 'test.t2' doesn't exist
+> test.t2 repair status Operation failed
+71,73c75,76
+< ERROR HY000: Failed to read from the .par file
+< # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+< # If you got a difference in error message, just add it to rdiff file
+---
+> ERROR 42S02: Table 'test.t1' doesn't exist
+> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY)
+76,78c79,80
+< test.t1 check Error Failed to read from the .par file
+< test.t1 check Error Incorrect information in file: './test/t1.frm'
+< test.t1 check error Corrupt
+---
+> test.t1 check Error Table 'test.t1' doesn't exist
+> test.t1 check status Operation failed
+80,82c82,83
+< ERROR HY000: Failed to read from the .par file
+< # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+< # If you got a difference in error message, just add it to rdiff file
+---
+> ERROR 42S02: Table 'test.t1' doesn't exist
+> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY)
+85,87c86,87
+< test.t1 repair Error Failed to read from the .par file
+< test.t1 repair Error Incorrect information in file: './test/t1.frm'
+< test.t1 repair error Corrupt
+---
+> test.t1 repair Error Table 'test.t1' doesn't exist
+> test.t1 repair status Operation failed
+88a89
+> ERROR 42S02: Unknown table 't1,t2'
+93a95,96
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+96c99,100
+< test.t1 repair status OK
+---
+> test.t1 repair Error Table 'test.t1' doesn't exist
+> test.t1 repair status Operation failed
+97a102
+> ERROR 42S02: Table 'test.t1' doesn't exist
+100c105,106
+< test.t1 repair status OK
+---
+> test.t1 repair Error Table 'test.t1' doesn't exist
+> test.t1 repair status Operation failed
+101a108
+> ERROR 42S02: Table 'test.t1' doesn't exist
+104,235c111,112
+< test.t1 repair status OK
+< t1#P#p0.MYD
+< t1#P#p0.MYI
+< t1#P#p1.MYD
+< t1#P#p1.MYI
+< t1.frm
+< t1.par
+< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+< # Statement ended with one of expected results (0,144).
+< # If you got a difference in error message, just add it to rdiff file
+< FLUSH TABLE t1;
+< Restoring <DATADIR>/test/t1#P#p0.MYD
+< CHECK TABLE t1;
+< Table Op Msg_type Msg_text
+< test.t1 check error Size of datafile is: 26 Should be: 39
+< test.t1 check error Partition p0 returned error
+< test.t1 check error Corrupt
+< SELECT * FROM t1;
+< a b
+< 8 h
+< 10 j
+< 7 g
+< 15 o
+< Warnings:
+< Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired
+< Error 1194 Table 't1' is marked as crashed and should be repaired
+< Error 1034 Number of rows changed from 3 to 2
+< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+< # If you got a difference in error message, just add it to rdiff file
+< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+< # Statement ended with one of expected results (0,144).
+< # If you got a difference in error message, just add it to rdiff file
+< FLUSH TABLE t1;
+< Restoring <DATADIR>/test/t1#P#p0.MYI
+< CHECK TABLE t1;
+< Table Op Msg_type Msg_text
+< test.t1 check warning Size of datafile is: 39 Should be: 26
+< test.t1 check error Record-count is not ok; is 3 Should be: 2
+< test.t1 check warning Found 3 key parts. Should be: 2
+< test.t1 check error Partition p0 returned error
+< test.t1 check error Corrupt
+< SELECT * FROM t1;
+< a b
+< 8 h
+< 10 j
+< 14 n
+< 7 g
+< 15 o
+< 15 o
+< Warnings:
+< Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired
+< Error 1194 Table 't1' is marked as crashed and should be repaired
+< Error 1034 Number of rows changed from 2 to 3
+< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+< # If you got a difference in error message, just add it to rdiff file
+< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+< # Statement ended with one of expected results (0,144).
+< # If you got a difference in error message, just add it to rdiff file
+< FLUSH TABLE t1;
+< Restoring <DATADIR>/test/t1#P#p1.MYD
+< CHECK TABLE t1;
+< Table Op Msg_type Msg_text
+< test.t1 check error Size of datafile is: 39 Should be: 52
+< test.t1 check error Partition p1 returned error
+< test.t1 check error Corrupt
+< SELECT * FROM t1;
+< a b
+< 8 h
+< 10 j
+< 14 n
+< 14 n
+< 7 g
+< 15 o
+< 15 o
+< Warnings:
+< Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired
+< Error 1194 Table 't1' is marked as crashed and should be repaired
+< Error 1034 Number of rows changed from 4 to 3
+< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+< # If you got a difference in error message, just add it to rdiff file
+< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+< # Statement ended with one of expected results (0,144).
+< # If you got a difference in error message, just add it to rdiff file
+< FLUSH TABLE t1;
+< Restoring <DATADIR>/test/t1#P#p1.MYI
+< CHECK TABLE t1;
+< Table Op Msg_type Msg_text
+< test.t1 check warning Size of datafile is: 52 Should be: 39
+< test.t1 check error Record-count is not ok; is 4 Should be: 3
+< test.t1 check warning Found 4 key parts. Should be: 3
+< test.t1 check error Partition p1 returned error
+< test.t1 check error Corrupt
+< SELECT * FROM t1;
+< a b
+< 8 h
+< 10 j
+< 14 n
+< 14 n
+< 14 n
+< 7 g
+< 15 o
+< 15 o
+< 15 o
+< Warnings:
+< Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired
+< Error 1194 Table 't1' is marked as crashed and should be repaired
+< Error 1034 Number of rows changed from 3 to 4
+< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+< # If you got a difference in error message, just add it to rdiff file
+< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+< # Statement ended with one of expected results (0,144).
+< # If you got a difference in error message, just add it to rdiff file
+< FLUSH TABLE t1;
+< Restoring <DATADIR>/test/t1.par
+< CHECK TABLE t1;
+< Table Op Msg_type Msg_text
+< test.t1 check status OK
+< SELECT * FROM t1;
+< a b
+< 8 h
+< 10 j
+< 14 n
+< 14 n
+< 14 n
+< 14 n
+< 7 g
+< 15 o
+< 15 o
+< 15 o
+< 15 o
+< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+< # If you got a difference in error message, just add it to rdiff file
+---
+> test.t1 repair Error Table 'test.t1' doesn't exist
+> test.t1 repair status Operation failed
+236a114
+> ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff
new file mode 100644
index 00000000000..2c1364d52e1
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff
@@ -0,0 +1,100 @@
+3,8c3,12
+< TRUNCATE TABLE t1;
+< INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
+< TRUNCATE TABLE t1;
+< SELECT * FROM t1;
+< a b
+< DROP TABLE t1;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+10,52c14,23
+< SHOW CREATE TABLE t1;
+< Table Create Table
+< t1 CREATE TABLE `t1` (
+< `a` int(11) NOT NULL AUTO_INCREMENT,
+< `c` char(8) DEFAULT NULL,
+< PRIMARY KEY (`a`)
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+< /*!50100 PARTITION BY HASH (a)
+< PARTITIONS 2 */
+< INSERT INTO t1 (c) VALUES ('a'),('b'),('c');
+< SHOW CREATE TABLE t1;
+< Table Create Table
+< t1 CREATE TABLE `t1` (
+< `a` int(11) NOT NULL AUTO_INCREMENT,
+< `c` char(8) DEFAULT NULL,
+< PRIMARY KEY (`a`)
+< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+< /*!50100 PARTITION BY HASH (a)
+< PARTITIONS 2 */
+< TRUNCATE TABLE t1;
+< SHOW CREATE TABLE t1;
+< Table Create Table
+< t1 CREATE TABLE `t1` (
+< `a` int(11) NOT NULL AUTO_INCREMENT,
+< `c` char(8) DEFAULT NULL,
+< PRIMARY KEY (`a`)
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+< /*!50100 PARTITION BY HASH (a)
+< PARTITIONS 2 */
+< INSERT INTO t1 (c) VALUES ('d');
+< SHOW CREATE TABLE t1;
+< Table Create Table
+< t1 CREATE TABLE `t1` (
+< `a` int(11) NOT NULL AUTO_INCREMENT,
+< `c` char(8) DEFAULT NULL,
+< PRIMARY KEY (`a`)
+< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+< /*!50100 PARTITION BY HASH (a)
+< PARTITIONS 2 */
+< SELECT * FROM t1;
+< a c
+< 1 d
+< DROP TABLE t1;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/ KEY AUTO_INCREMENT, c CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or PK or auto-increment or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+54,68c25,34
+< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+< ALTER TABLE t1 TRUNCATE PARTITION p0;
+< SELECT * FROM t1;
+< a b
+< 1 a
+< 101 g
+< 3 c
+< EXPLAIN PARTITIONS SELECT * FROM t1;
+< id select_type table partitions type possible_keys key key_len ref rows Extra
+< 1 SIMPLE t1 p0,p1 # # # # # #
+< INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
+< ALTER TABLE t1 TRUNCATE PARTITION ALL;
+< SELECT * FROM t1;
+< a b
+< DROP TABLE t1;
+---
+> ERROR HY000: Engine cannot be used in partitioned tables
+> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
+> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
+> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff
new file mode 100644
index 00000000000..180647323bc
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff
@@ -0,0 +1,103 @@
+7c7
+< test.t1 repair status OK
+---
+> test.t1 repair note The storage engine for the table doesn't support repair
+12,13c12,13
+< test.t1 repair status OK
+< test.t2 repair status OK
+---
+> test.t1 repair note The storage engine for the table doesn't support repair
+> test.t2 repair note The storage engine for the table doesn't support repair
+17c17
+< test.t2 repair status OK
+---
+> test.t2 repair note The storage engine for the table doesn't support repair
+22,23c22,23
+< test.t2 repair status OK
+< test.t1 repair status OK
+---
+> test.t2 repair note The storage engine for the table doesn't support repair
+> test.t1 repair note The storage engine for the table doesn't support repair
+28,31c28,29
+< test.t1 repair warning Number of rows changed from 0 to 6
+< test.t1 repair status OK
+< test.t2 repair warning Number of rows changed from 0 to 5
+< test.t2 repair status OK
+---
+> test.t1 repair note The storage engine for the table doesn't support repair
+> test.t2 repair note The storage engine for the table doesn't support repair
+36,39c34,35
+< test.t1 repair warning Number of rows changed from 0 to 7
+< test.t1 repair status OK
+< test.t2 repair warning Number of rows changed from 0 to 6
+< test.t2 repair status OK
+---
+> test.t1 repair note The storage engine for the table doesn't support repair
+> test.t2 repair note The storage engine for the table doesn't support repair
+42c38
+< ERROR HY000: Incorrect file format 't1'
+---
+> ERROR HY000: Table 't1' is read only
+47,48c43
+< test.t1 check Error Incorrect file format 't1'
+< test.t1 check error Corrupt
+---
+> test.t1 check status OK
+50c45
+< ERROR HY000: Incorrect file format 't1'
+---
+> a b
+55,56c50
+< test.t1 repair Error Incorrect file format 't1'
+< test.t1 repair error Corrupt
+---
+> test.t1 repair note The storage engine for the table doesn't support repair
+65c59
+< test.t1 repair status OK
+---
+> test.t1 repair note The storage engine for the table doesn't support repair
+69c63
+< test.t1 repair status OK
+---
+> test.t1 repair note The storage engine for the table doesn't support repair
+73,76c67,68
+< test.t1 repair warning Number of rows changed from 0 to 3
+< test.t1 repair status OK
+< t1.MYD
+< t1.MYI
+---
+> test.t1 repair note The storage engine for the table doesn't support repair
+> t1.MRG
+82c74
+< Restoring <DATADIR>/test/t1.MYD
+---
+> Restoring <DATADIR>/test/t1.MRG
+85,86c77
+< test.t1 check error Size of datafile is: 39 Should be: 65
+< test.t1 check error Corrupt
+---
+> test.t1 check status OK
+88,103c79,84
+< ERROR HY000: Incorrect key file for table 't1'; try to repair it
+< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+< # If you got a difference in error message, just add it to rdiff file
+< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+< ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
+< # Statement ended with one of expected results (0,144).
+< # If you got a difference in error message, just add it to rdiff file
+< FLUSH TABLE t1;
+< Restoring <DATADIR>/test/t1.MYI
+< CHECK TABLE t1;
+< Table Op Msg_type Msg_text
+< test.t1 check warning Table is marked as crashed and last repair failed
+< test.t1 check error Size of datafile is: 39 Should be: 65
+< test.t1 check error Corrupt
+< SELECT * FROM t1;
+< ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
+---
+> a b
+> 7 g
+> 8 h
+> 10 j
+> 14 n
+> 15 o
diff --git a/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff b/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff
new file mode 100644
index 00000000000..e7c9b0176b6
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff
@@ -0,0 +1,2 @@
+7d6
+< <STORAGE_ENGINE> ### Engine status, can be long and changeable ###
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff
new file mode 100644
index 00000000000..bca6fa60d13
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff
@@ -0,0 +1,8 @@
+7c7
+< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+13c13
+< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=100 DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff
new file mode 100644
index 00000000000..7a3ac54fd3e
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff
@@ -0,0 +1,8 @@
+8c8
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff
new file mode 100644
index 00000000000..ecb3fadb479
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff
@@ -0,0 +1,8 @@
+8c8
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff
new file mode 100644
index 00000000000..d3ebd87ad1e
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff
@@ -0,0 +1,8 @@
+13c13
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection'
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) CONNECTION='test_connection'
+20c20
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection2'
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) CONNECTION='test_connection2'
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff
new file mode 100644
index 00000000000..3c15e10d1f1
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff
@@ -0,0 +1,8 @@
+7c7
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff
new file mode 100644
index 00000000000..5723e425b4d
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff
@@ -0,0 +1,8 @@
+8c8
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff
new file mode 100644
index 00000000000..2ced7647483
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff
@@ -0,0 +1,8 @@
+8c8
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff
new file mode 100644
index 00000000000..8378f04ebcb
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff
@@ -0,0 +1,8 @@
+8c8
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff
new file mode 100644
index 00000000000..f89147826c6
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff
@@ -0,0 +1,8 @@
+8c8
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff
new file mode 100644
index 00000000000..3ce28480dcf
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff
@@ -0,0 +1,8 @@
+8c8
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff
new file mode 100644
index 00000000000..246c7397a96
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff
@@ -0,0 +1,8 @@
+8c8
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff
new file mode 100644
index 00000000000..b1ef20c6f30
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff
@@ -0,0 +1,8 @@
+8c8
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff
new file mode 100644
index 00000000000..9c72c7c06ba
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff
@@ -0,0 +1,8 @@
+8c8
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+15c15
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff
new file mode 100644
index 00000000000..f77753f4d6b
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff
@@ -0,0 +1,8 @@
+7c7
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`)
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`child1`)
+13c13
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`,`child2`)
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`child1`,`child2`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff
new file mode 100644
index 00000000000..9b7ffc6af76
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff
@@ -0,0 +1,8 @@
+11c11
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='standard table options'
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) COMMENT='standard table options'
+18c18
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='table altered'
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) COMMENT='table altered'
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff
new file mode 100644
index 00000000000..45a229c98eb
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff
@@ -0,0 +1,4 @@
+9c9
+< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+---
+> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
diff --git a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff
new file mode 100644
index 00000000000..3a89f730540
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff
@@ -0,0 +1,35 @@
+12c12
+< t1 # # # # # # # # # 1 # # # # # # #
+---
+> t1 # # # # # # # # # 0 # # # # # # #
+16c16
+< t1 # # # # # # # # # 4 # # # # # # #
+---
+> t1 # # # # # # # # # 0 # # # # # # #
+20c20
+< t1 # # # # # # # # # 1 # # # # # # #
+---
+> t1 # # # # # # # # # 0 # # # # # # #
+24c24
+< t1 # # # # # # # # # 2 # # # # # # #
+---
+> t1 # # # # # # # # # 0 # # # # # # #
+32,40c32,39
+< HANDLER h1 READ FIRST;
+< a b
+< 1 a
+< TRUNCATE TABLE t1;
+< HANDLER h1 READ NEXT;
+< ERROR 42S02: Unknown table 'h1' in HANDLER
+< HANDLER t1 OPEN AS h2;
+< HANDLER h2 READ FIRST;
+< a b
+---
+> ERROR HY000: Table storage engine for 'h1' doesn't have this option
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command finished with ER_ILLEGAL_HA.
+> # HANDLER or the syntax or the mix could be unsupported.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff
new file mode 100644
index 00000000000..018b28bd24c
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff
@@ -0,0 +1,9 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+13a20
+> 1
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff
new file mode 100644
index 00000000000..018b28bd24c
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff
@@ -0,0 +1,9 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+13a20
+> 1
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff
new file mode 100644
index 00000000000..45a3e5fb52d
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff
@@ -0,0 +1,34 @@
+0a1,12
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support savepoints.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file (recommended), or add the test to disabled.def.
+> # If savepoints should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+48a61,62
+> Warnings:
+> Warning 1196 Some non-transactional changed tables couldn't be rolled back
+51,64d64
+< 10000 foobar
+< 10000 foobar
+< 2 b
+< 2 b
+< 4 d
+< 4 d
+< 5 e
+< 5 e
+< 6 f
+< 6 f
+< 7 g
+< 7 g
+< 8 h
+< 8 h
+70a71,72
+> Warnings:
+> Warning 1196 Some non-transactional changed tables couldn't be rolled back
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff
new file mode 100644
index 00000000000..69981f90e13
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff
@@ -0,0 +1,32 @@
+0a1,12
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support savepoints.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file (recommended), or add the test to disabled.def.
+> # If savepoints should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+23a36,37
+> Warnings:
+> Warning 1196 Some non-transactional changed tables couldn't be rolled back
+25a40
+> 0 test
+33a49,50
+> NULL NULL
+> NULL NULL
+39a57,58
+> Warnings:
+> Warning 1196 Some non-transactional changed tables couldn't be rolled back
+43a63
+> 0 test
+49a70
+> 11 f
+54a76,78
+> NULL NULL
+> NULL NULL
+> NULL NULL
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff
new file mode 100644
index 00000000000..0837c74f5ff
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff
@@ -0,0 +1,44 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+18a25
+> 1
+25a33,34
+> 1
+> 2
+30a40,43
+> 1
+> 101
+> 102
+> 2
+34a48,49
+> 101
+> 102
+39a55,56
+> 101
+> 102
+44a62,63
+> 101
+> 102
+51a71,72
+> 101
+> 102
+54a76,77
+> 301
+> 302
+58a82,83
+> 101
+> 102
+61a87,88
+> 301
+> 302
+65a93,94
+> 101
+> 102
+68a98,99
+> 301
+> 302
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff
new file mode 100644
index 00000000000..bd9569267e5
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff
@@ -0,0 +1,7 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff
new file mode 100644
index 00000000000..82f7c5c5ba6
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff
@@ -0,0 +1,53 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+18a25
+> 1
+25a33,34
+> 1
+> 2
+27,28c36
+< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
+---
+> # WARNING: Statement ended with errno 0, errname ''.
+31a40,43
+> 1
+> 101
+> 102
+> 2
+35a48,49
+> 101
+> 102
+40a55,56
+> 101
+> 102
+44a61,64
+> 1
+> 101
+> 102
+> 2
+49a70,73
+> 1
+> 101
+> 102
+> 2
+51a76,77
+> 301
+> 302
+55a82,83
+> 101
+> 102
+58a87,88
+> 301
+> 302
+62a93,94
+> 101
+> 102
+65a98,99
+> 301
+> 302
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff
new file mode 100644
index 00000000000..3924b3784a9
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff
@@ -0,0 +1,69 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+14,15c20
+< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
+---
+> # WARNING: Statement ended with errno 0, errname ''.
+19a25
+> 1
+22,23c28
+< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
+---
+> # WARNING: Statement ended with errno 0, errname ''.
+27a33,34
+> 1
+> 2
+32a40,43
+> 1
+> 101
+> 102
+> 2
+35a47,50
+> 1
+> 101
+> 102
+> 2
+38a54,57
+> 1
+> 101
+> 102
+> 2
+41a61,64
+> 1
+> 101
+> 102
+> 2
+46a70,77
+> 1
+> 101
+> 102
+> 2
+> 201
+> 202
+> 301
+> 302
+49a81,88
+> 1
+> 101
+> 102
+> 2
+> 201
+> 202
+> 301
+> 302
+52a92,99
+> 1
+> 101
+> 102
+> 2
+> 201
+> 202
+> 301
+> 302
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff
new file mode 100644
index 00000000000..f8ffe67586d
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff
@@ -0,0 +1,40 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+17c23,33
+< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+---
+> a b
+> 1 a
+> 3 a
+> # ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command succeeded unexpectedly.
+> # SELECT .. FOR UPDATE or LOCK IN SHARE MODE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+19c35,42
+< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+---
+> # ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command succeeded unexpectedly.
+> # UPDATE or SELECT .. FOR UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+24c47
+< 1 a
+---
+> 1 c
+26c49
+< 3 a
+---
+> 3 c
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff
new file mode 100644
index 00000000000..e316993830a
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff
@@ -0,0 +1,26 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+21c27,34
+< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+---
+> # ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
+> # ------------ UNEXPECTED RESULT ------------
+> # The statement|command succeeded unexpectedly.
+> # LOCK IN SHARE MODE or UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+26c39
+< 1 a
+---
+> 1 c
+28c41
+< 3 a
+---
+> 3 c
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff
new file mode 100644
index 00000000000..7ad463053eb
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff
@@ -0,0 +1,41 @@
+0a1,12
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If transactions should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support savepoints.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file (recommended), or add the test to disabled.def.
+> # If savepoints should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+26a39,40
+> Warnings:
+> Warning 1196 Some non-transactional changed tables couldn't be rolled back
+31a46,47
+> Warnings:
+> Warning 1196 Some non-transactional changed tables couldn't be rolled back
+38,47c54,63
+< 51 update2
+< 51 update2
+< 52 update2
+< 52 update2
+< 53 update2
+< 53 update2
+< 54 update2
+< 54 update2
+< 55 update2
+< 55 update2
+---
+> 51
+> 51
+> 52
+> 52
+> 53
+> 53
+> 54
+> 54
+> 55
+> 55
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff
new file mode 100644
index 00000000000..ee7c2a984be
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff
@@ -0,0 +1,34 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support XA.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If XA should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+11a18
+> 1
+17a25,26
+> 1
+> 2
+22a32,33
+> 1
+> 2
+40a52
+> 3
+48a61,62
+> 3
+> 4
+67a82
+> 5
+77a93,94
+> 5
+> 6
+86a104,105
+> 5
+> 6
+88a108,109
+> Warnings:
+> Warning 1196 Some non-transactional changed tables couldn't be rolled back
+95a117,118
+> 5
+> 6
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff
new file mode 100644
index 00000000000..362e3a8914a
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff
@@ -0,0 +1,22 @@
+0a1,6
+> # -- WARNING ----------------------------------------------------------------
+> # According to I_S.ENGINES, MRG_MYISAM does not support XA.
+> # If it is true, the test will most likely fail; you can
+> # either create an rdiff file, or add the test to disabled.def.
+> # If XA should be supported, check the data in Information Schema.
+> # ---------------------------------------------------------------------------
+21,22d26
+< 1 3 0 xa1
+< 1 3 0 xa2
+23a28
+> ERROR XAE04: XAER_NOTA: Unknown XID
+24a30
+> ERROR XAE04: XAER_NOTA: Unknown XID
+26a33,34
+> 1
+> 2
+28a37,40
+> Warnings:
+> Error 145 Table './mrg/t1' is marked as crashed and should be repaired
+> Error 1194 Table 't1' is marked as crashed and should be repaired
+> Error 1034 1 client is using or hasn't closed the table properly
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff
new file mode 100644
index 00000000000..a0a418e0bcc
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff
@@ -0,0 +1,8 @@
+101c101
+< # # # range c_v c_v # # # Using index condition
+---
+> # # # ALL c_v NULL # # # Using where
+138c138
+< # # # range # v16 # # # #
+---
+> # # # ALL # NULL # # # #
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff
new file mode 100644
index 00000000000..640e1050a99
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff
@@ -0,0 +1,4 @@
+63c63
+< # # # # # d # # # #
+---
+> # # # # # NULL # # # #
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
new file mode 100644
index 00000000000..a4d7d4390b8
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
@@ -0,0 +1,706 @@
+5,698c5,14
+< CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< USE gis_ogs;
+< CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< shore POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
+< num_lanes INT <CUSTOM_COL_OPTIONS>,
+< centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< num_lanes INT <CUSTOM_COL_OPTIONS>,
+< centerlines MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< boundary MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< position POINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< position POINT,
+< footprint POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< type CHAR(64) <CUSTOM_COL_OPTIONS>,
+< shores MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< boundary POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
+< neatline POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< USE test;
+< SHOW FIELDS FROM gis_point;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g point YES NULL
+< SHOW FIELDS FROM gis_line;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g linestring YES NULL
+< SHOW FIELDS FROM gis_polygon;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g polygon YES NULL
+< SHOW FIELDS FROM gis_multi_point;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g multipoint YES NULL
+< SHOW FIELDS FROM gis_multi_line;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g multilinestring YES NULL
+< SHOW FIELDS FROM gis_multi_polygon;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g multipolygon YES NULL
+< SHOW FIELDS FROM gis_geometrycollection;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g geometrycollection YES NULL
+< SHOW FIELDS FROM gis_geometry;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g geometry YES NULL
+< INSERT INTO gis_point VALUES
+< (101, PointFromText('POINT(10 10)')),
+< (102, PointFromText('POINT(20 10)')),
+< (103, PointFromText('POINT(20 20)')),
+< (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+< INSERT INTO gis_line VALUES
+< (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+< (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+< (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+< INSERT INTO gis_polygon VALUES
+< (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+< (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+< (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+< INSERT INTO gis_multi_point VALUES
+< (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+< (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+< (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+< INSERT INTO gis_multi_line VALUES
+< (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+< (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+< (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+< INSERT INTO gis_multi_polygon VALUES
+< (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+< (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+< (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+< INSERT INTO gis_geometrycollection VALUES
+< (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+< (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+< (122, GeomFromText('GeometryCollection()')),
+< (123, GeomFromText('GeometryCollection EMPTY'));
+< INSERT into gis_geometry SELECT * FROM gis_point;
+< INSERT into gis_geometry SELECT * FROM gis_line;
+< INSERT into gis_geometry SELECT * FROM gis_polygon;
+< INSERT into gis_geometry SELECT * FROM gis_multi_point;
+< INSERT into gis_geometry SELECT * FROM gis_multi_line;
+< INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+< INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+< SELECT fid, AsText(g) FROM gis_point;
+< fid AsText(g)
+< 101 POINT(10 10)
+< 102 POINT(20 10)
+< 103 POINT(20 20)
+< 104 POINT(10 20)
+< SELECT fid, AsText(g) FROM gis_line;
+< fid AsText(g)
+< 105 LINESTRING(0 0,0 10,10 0)
+< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 107 LINESTRING(10 10,40 10)
+< SELECT fid, AsText(g) FROM gis_polygon;
+< fid AsText(g)
+< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+< 110 POLYGON((0 0,30 0,30 30,0 0))
+< SELECT fid, AsText(g) FROM gis_multi_point;
+< fid AsText(g)
+< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
+< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
+< 113 MULTIPOINT(3 6,4 10)
+< SELECT fid, AsText(g) FROM gis_multi_line;
+< fid AsText(g)
+< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+< 115 MULTILINESTRING((10 48,10 21,10 0))
+< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+< SELECT fid, AsText(g) FROM gis_multi_polygon;
+< fid AsText(g)
+< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+< SELECT fid, AsText(g) FROM gis_geometrycollection;
+< fid AsText(g)
+< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+< 122 GEOMETRYCOLLECTION EMPTY
+< 123 GEOMETRYCOLLECTION EMPTY
+< SELECT fid, AsText(g) FROM gis_geometry;
+< fid AsText(g)
+< 101 POINT(10 10)
+< 102 POINT(20 10)
+< 103 POINT(20 20)
+< 104 POINT(10 20)
+< 105 LINESTRING(0 0,0 10,10 0)
+< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 107 LINESTRING(10 10,40 10)
+< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+< 110 POLYGON((0 0,30 0,30 30,0 0))
+< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
+< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
+< 113 MULTIPOINT(3 6,4 10)
+< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+< 115 MULTILINESTRING((10 48,10 21,10 0))
+< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+< 122 GEOMETRYCOLLECTION EMPTY
+< 123 GEOMETRYCOLLECTION EMPTY
+< SELECT fid, Dimension(g) FROM gis_geometry;
+< fid Dimension(g)
+< 101 0
+< 102 0
+< 103 0
+< 104 0
+< 105 1
+< 106 1
+< 107 1
+< 108 2
+< 109 2
+< 110 2
+< 111 0
+< 112 0
+< 113 0
+< 114 1
+< 115 1
+< 116 1
+< 117 2
+< 118 2
+< 119 2
+< 120 1
+< 121 1
+< 122 0
+< 123 0
+< SELECT fid, GeometryType(g) FROM gis_geometry;
+< fid GeometryType(g)
+< 101 POINT
+< 102 POINT
+< 103 POINT
+< 104 POINT
+< 105 LINESTRING
+< 106 LINESTRING
+< 107 LINESTRING
+< 108 POLYGON
+< 109 POLYGON
+< 110 POLYGON
+< 111 MULTIPOINT
+< 112 MULTIPOINT
+< 113 MULTIPOINT
+< 114 MULTILINESTRING
+< 115 MULTILINESTRING
+< 116 MULTILINESTRING
+< 117 MULTIPOLYGON
+< 118 MULTIPOLYGON
+< 119 MULTIPOLYGON
+< 120 GEOMETRYCOLLECTION
+< 121 GEOMETRYCOLLECTION
+< 122 GEOMETRYCOLLECTION
+< 123 GEOMETRYCOLLECTION
+< SELECT fid, IsEmpty(g) FROM gis_geometry;
+< fid IsEmpty(g)
+< 101 0
+< 102 0
+< 103 0
+< 104 0
+< 105 0
+< 106 0
+< 107 0
+< 108 0
+< 109 0
+< 110 0
+< 111 0
+< 112 0
+< 113 0
+< 114 0
+< 115 0
+< 116 0
+< 117 0
+< 118 0
+< 119 0
+< 120 0
+< 121 0
+< 122 0
+< 123 0
+< SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+< fid AsText(Envelope(g))
+< 101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+< 102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+< 103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+< 104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+< 105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+< 106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+< 110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+< 111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+< 112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+< 113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+< 114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+< 115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+< 116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+< 117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+< 118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+< 119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+< 120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+< 121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+< 122 GEOMETRYCOLLECTION EMPTY
+< 123 GEOMETRYCOLLECTION EMPTY
+< SELECT fid, X(g) FROM gis_point;
+< fid X(g)
+< 101 10
+< 102 20
+< 103 20
+< 104 10
+< SELECT fid, Y(g) FROM gis_point;
+< fid Y(g)
+< 101 10
+< 102 10
+< 103 20
+< 104 20
+< SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+< fid AsText(StartPoint(g))
+< 105 POINT(0 0)
+< 106 POINT(10 10)
+< 107 POINT(10 10)
+< SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+< fid AsText(EndPoint(g))
+< 105 POINT(10 0)
+< 106 POINT(10 10)
+< 107 POINT(40 10)
+< SELECT fid, GLength(g) FROM gis_line;
+< fid GLength(g)
+< 105 24.14213562373095
+< 106 40
+< 107 30
+< SELECT fid, NumPoints(g) FROM gis_line;
+< fid NumPoints(g)
+< 105 3
+< 106 5
+< 107 2
+< SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+< fid AsText(PointN(g, 2))
+< 105 POINT(0 10)
+< 106 POINT(20 10)
+< 107 POINT(40 10)
+< SELECT fid, IsClosed(g) FROM gis_line;
+< fid IsClosed(g)
+< 105 0
+< 106 1
+< 107 0
+< SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+< fid AsText(Centroid(g))
+< 108 POINT(15 15)
+< 109 POINT(25.416666666666668 25.416666666666668)
+< 110 POINT(20 10)
+< SELECT fid, Area(g) FROM gis_polygon;
+< fid Area(g)
+< 108 100
+< 109 2400
+< 110 450
+< SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+< fid AsText(ExteriorRing(g))
+< 108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+< 110 LINESTRING(0 0,30 0,30 30,0 0)
+< SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+< fid NumInteriorRings(g)
+< 108 0
+< 109 1
+< 110 0
+< SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+< fid AsText(InteriorRingN(g, 1))
+< 108 NULL
+< 109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 110 NULL
+< SELECT fid, IsClosed(g) FROM gis_multi_line;
+< fid IsClosed(g)
+< 114 0
+< 115 0
+< 116 0
+< SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+< fid AsText(Centroid(g))
+< 117 POINT(55.58852775304245 17.426536064113982)
+< 118 POINT(55.58852775304245 17.426536064113982)
+< 119 POINT(2 2)
+< SELECT fid, Area(g) FROM gis_multi_polygon;
+< fid Area(g)
+< 117 1684.5
+< 118 1684.5
+< 119 4.5
+< SELECT fid, NumGeometries(g) from gis_multi_point;
+< fid NumGeometries(g)
+< 111 4
+< 112 4
+< 113 2
+< SELECT fid, NumGeometries(g) from gis_multi_line;
+< fid NumGeometries(g)
+< 114 2
+< 115 1
+< 116 2
+< SELECT fid, NumGeometries(g) from gis_multi_polygon;
+< fid NumGeometries(g)
+< 117 2
+< 118 2
+< 119 1
+< SELECT fid, NumGeometries(g) from gis_geometrycollection;
+< fid NumGeometries(g)
+< 120 2
+< 121 2
+< 122 0
+< 123 0
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+< fid AsText(GeometryN(g, 2))
+< 111 POINT(10 10)
+< 112 POINT(11 11)
+< 113 POINT(4 10)
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+< fid AsText(GeometryN(g, 2))
+< 114 LINESTRING(16 0,16 23,16 48)
+< 115 NULL
+< 116 LINESTRING(2 5,5 8,21 7)
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+< fid AsText(GeometryN(g, 2))
+< 117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+< 118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+< 119 NULL
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+< fid AsText(GeometryN(g, 2))
+< 120 LINESTRING(0 0,10 10)
+< 121 LINESTRING(3 6,7 9)
+< 122 NULL
+< 123 NULL
+< SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+< fid AsText(GeometryN(g, 1))
+< 120 POINT(0 0)
+< 121 POINT(44 6)
+< 122 NULL
+< 123 NULL
+< SELECT g1.fid as first, g2.fid as second,
+< Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+< Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+< Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+< FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+< first second w c o e d t i r
+< 120 120 1 1 0 1 0 1 1 0
+< 120 121 0 0 1 0 0 0 1 0
+< 120 122 0 1 NULL 0 NULL 0 NULL 0
+< 120 123 0 1 NULL 0 NULL 0 NULL 0
+< 121 120 0 0 1 0 0 0 1 0
+< 121 121 1 1 0 1 0 1 1 0
+< 121 122 0 1 NULL 0 NULL 0 NULL 0
+< 121 123 0 1 NULL 0 NULL 0 NULL 0
+< 122 120 1 0 NULL 0 NULL 0 NULL 0
+< 122 121 1 0 NULL 0 NULL 0 NULL 0
+< 122 122 1 1 NULL 1 NULL 0 NULL 0
+< 122 123 1 1 NULL 1 NULL 0 NULL 0
+< 123 120 1 0 NULL 0 NULL 0 NULL 0
+< 123 121 1 0 NULL 0 NULL 0 NULL 0
+< 123 122 1 1 NULL 1 NULL 0 NULL 0
+< 123 123 1 1 NULL 1 NULL 0 NULL 0
+< DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+< USE gis_ogs;
+< # Lakes
+< INSERT INTO lakes VALUES (
+< 101, 'BLUE LAKE',
+< PolyFromText(
+< 'POLYGON(
+< (52 18,66 23,73 9,48 6,52 18),
+< (59 18,67 18,67 13,59 13,59 18)
+< )',
+< 101));
+< # Road Segments
+< INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+< LineFromText(
+< 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+< INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+< LineFromText(
+< 'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+< INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+< LineFromText(
+< 'LINESTRING( 70 38, 72 48 )' ,101));
+< INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+< LineFromText(
+< 'LINESTRING( 70 38, 84 42 )' ,101));
+< INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+< 1,
+< LineFromText(
+< 'LINESTRING( 28 26, 28 0 )',101));
+< # DividedRoutes
+< INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+< MLineFromText(
+< 'MULTILINESTRING((10 48,10 21,10 0),
+< (16 0,16 23,16 48))', 101));
+< # Forests
+< INSERT INTO forests VALUES(109, 'Green Forest',
+< MPolyFromText(
+< 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+< (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+< 101));
+< # Bridges
+< INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+< 'POINT( 44 31 )', 101));
+< # Streams
+< INSERT INTO streams VALUES(111, 'Cam Stream',
+< LineFromText(
+< 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+< INSERT INTO streams VALUES(112, NULL,
+< LineFromText(
+< 'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+< # Buildings
+< INSERT INTO buildings VALUES(113, '123 Main Street',
+< PointFromText(
+< 'POINT( 52 30 )', 101),
+< PolyFromText(
+< 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+< INSERT INTO buildings VALUES(114, '215 Main Street',
+< PointFromText(
+< 'POINT( 64 33 )', 101),
+< PolyFromText(
+< 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+< # Ponds
+< INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+< MPolyFromText(
+< 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+< ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+< # Named Places
+< INSERT INTO named_places VALUES(117, 'Ashton',
+< PolyFromText(
+< 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+< INSERT INTO named_places VALUES(118, 'Goose Island',
+< PolyFromText(
+< 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+< # Map Neatlines
+< INSERT INTO map_neatlines VALUES(115,
+< PolyFromText(
+< 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+< SELECT Dimension(shore)
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< Dimension(shore)
+< 2
+< SELECT GeometryType(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< GeometryType(centerlines)
+< MULTILINESTRING
+< SELECT AsText(boundary)
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(boundary)
+< POLYGON((67 13,67 18,59 18,59 13,67 13))
+< SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(PolyFromWKB(AsBinary(boundary),101))
+< POLYGON((67 13,67 18,59 18,59 13,67 13))
+< SELECT SRID(boundary)
+< FROM named_places
+< WHERE name = 'Goose Island';
+< SRID(boundary)
+< 101
+< SELECT IsEmpty(centerline)
+< FROM road_segments
+< WHERE name = 'Route 5'
+< AND aliases = 'Main Street';
+< IsEmpty(centerline)
+< 0
+< SELECT AsText(Envelope(boundary))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(Envelope(boundary))
+< POLYGON((59 13,67 13,67 18,59 18,59 13))
+< SELECT X(position)
+< FROM bridges
+< WHERE name = 'Cam Bridge';
+< X(position)
+< 44
+< SELECT Y(position)
+< FROM bridges
+< WHERE name = 'Cam Bridge';
+< Y(position)
+< 31
+< SELECT AsText(StartPoint(centerline))
+< FROM road_segments
+< WHERE fid = 102;
+< AsText(StartPoint(centerline))
+< POINT(0 18)
+< SELECT AsText(EndPoint(centerline))
+< FROM road_segments
+< WHERE fid = 102;
+< AsText(EndPoint(centerline))
+< POINT(44 31)
+< SELECT GLength(centerline)
+< FROM road_segments
+< WHERE fid = 106;
+< GLength(centerline)
+< 26
+< SELECT NumPoints(centerline)
+< FROM road_segments
+< WHERE fid = 102;
+< NumPoints(centerline)
+< 5
+< SELECT AsText(PointN(centerline, 1))
+< FROM road_segments
+< WHERE fid = 102;
+< AsText(PointN(centerline, 1))
+< POINT(0 18)
+< SELECT AsText(Centroid(boundary))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(Centroid(boundary))
+< POINT(63 15.5)
+< SELECT Area(boundary)
+< FROM named_places
+< WHERE name = 'Goose Island';
+< Area(boundary)
+< 40
+< SELECT AsText(ExteriorRing(shore))
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< AsText(ExteriorRing(shore))
+< LINESTRING(52 18,66 23,73 9,48 6,52 18)
+< SELECT NumInteriorRings(shore)
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< NumInteriorRings(shore)
+< 1
+< SELECT AsText(InteriorRingN(shore, 1))
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< AsText(InteriorRingN(shore, 1))
+< LINESTRING(59 18,67 18,67 13,59 13,59 18)
+< SELECT NumGeometries(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< NumGeometries(centerlines)
+< 2
+< SELECT AsText(GeometryN(centerlines, 2))
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< AsText(GeometryN(centerlines, 2))
+< LINESTRING(16 0,16 23,16 48)
+< SELECT IsClosed(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< IsClosed(centerlines)
+< 0
+< SELECT GLength(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< GLength(centerlines)
+< 96
+< SELECT AsText(Centroid(shores))
+< FROM ponds
+< WHERE fid = 120;
+< AsText(Centroid(shores))
+< POINT(25 42)
+< SELECT Area(shores)
+< FROM ponds
+< WHERE fid = 120;
+< Area(shores)
+< 8
+< SELECT ST_Equals(boundary,
+< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< ST_Equals(boundary,
+< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+< 1
+< SELECT ST_Disjoint(centerlines, boundary)
+< FROM divided_routes, named_places
+< WHERE divided_routes.name = 'Route 75'
+< AND named_places.name = 'Ashton';
+< ST_Disjoint(centerlines, boundary)
+< 1
+< SELECT ST_Touches(centerline, shore)
+< FROM streams, lakes
+< WHERE streams.name = 'Cam Stream'
+< AND lakes.name = 'Blue Lake';
+< ST_Touches(centerline, shore)
+< 1
+< SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+< FROM road_segments, divided_routes
+< WHERE road_segments.fid = 102
+< AND divided_routes.name = 'Route 75';
+< Crosses(road_segments.centerline, divided_routes.centerlines)
+< 1
+< SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+< FROM road_segments, divided_routes
+< WHERE road_segments.fid = 102
+< AND divided_routes.name = 'Route 75';
+< ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+< 1
+< SELECT ST_Contains(forests.boundary, named_places.boundary)
+< FROM forests, named_places
+< WHERE forests.name = 'Green Forest'
+< AND named_places.name = 'Ashton';
+< ST_Contains(forests.boundary, named_places.boundary)
+< 0
+< SELECT ST_Distance(position, boundary)
+< FROM bridges, named_places
+< WHERE bridges.name = 'Cam Bridge'
+< AND named_places.name = 'Ashton';
+< ST_Distance(position, boundary)
+< 12
+< SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+< FROM named_places, forests
+< WHERE named_places.name = 'Ashton'
+< AND forests.name = 'Green Forest';
+< AsText(ST_Difference(named_places.boundary, forests.boundary))
+< POLYGON((56 34,62 48,84 48,84 42,56 34))
+< SELECT AsText(ST_Union(shore, boundary))
+< FROM lakes, named_places
+< WHERE lakes.name = 'Blue Lake'
+< AND named_places.name = 'Goose Island';
+< AsText(ST_Union(shore, boundary))
+< POLYGON((48 6,52 18,66 23,73 9,48 6))
+< SELECT AsText(ST_SymDifference(shore, boundary))
+< FROM lakes, named_places
+< WHERE lakes.name = 'Blue Lake'
+< AND named_places.name = 'Ashton';
+< AsText(ST_SymDifference(shore, boundary))
+< MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
+< SELECT count(*)
+< FROM buildings, bridges
+< WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+< count(*)
+< 1
+---
+> ERROR 42000: The storage engine for the table doesn't support GEOMETRY
+> # ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ]
+> # The statement|command finished with ER_CHECK_NOT_IMPLEMENTED.
+> # Geometry types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
new file mode 100644
index 00000000000..89f1100f550
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
@@ -0,0 +1,1412 @@
+5,698c5,14
+< CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON, <CUSTOM_INDEX> g(g(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT, <CUSTOM_INDEX> g(g(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< USE gis_ogs;
+< CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< shore POLYGON, <CUSTOM_INDEX> s(shore(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
+< num_lanes INT <CUSTOM_COL_OPTIONS>,
+< centerline LINESTRING, <CUSTOM_INDEX> c(centerline(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< num_lanes INT <CUSTOM_COL_OPTIONS>,
+< centerlines MULTILINESTRING, <CUSTOM_INDEX> c(centerlines(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< boundary MULTIPOLYGON, <CUSTOM_INDEX> b(boundary(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< position POINT, <CUSTOM_INDEX> p(`position`(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< centerline LINESTRING, <CUSTOM_INDEX> c(centerline(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< position POINT,
+< footprint POLYGON, <CUSTOM_INDEX> p(`position`(64)), <CUSTOM_INDEX> f(footprint(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< type CHAR(64) <CUSTOM_COL_OPTIONS>,
+< shores MULTIPOLYGON, <CUSTOM_INDEX> s(shores(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< boundary POLYGON, <CUSTOM_INDEX> b(boundary(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
+< neatline POLYGON, <CUSTOM_INDEX> n(neatline(700))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< USE test;
+< SHOW FIELDS FROM gis_point;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g point YES MUL NULL
+< SHOW FIELDS FROM gis_line;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g linestring YES MUL NULL
+< SHOW FIELDS FROM gis_polygon;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g polygon YES MUL NULL
+< SHOW FIELDS FROM gis_multi_point;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g multipoint YES MUL NULL
+< SHOW FIELDS FROM gis_multi_line;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g multilinestring YES MUL NULL
+< SHOW FIELDS FROM gis_multi_polygon;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g multipolygon YES NULL
+< SHOW FIELDS FROM gis_geometrycollection;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g geometrycollection YES NULL
+< SHOW FIELDS FROM gis_geometry;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g geometry YES NULL
+< INSERT INTO gis_point VALUES
+< (101, PointFromText('POINT(10 10)')),
+< (102, PointFromText('POINT(20 10)')),
+< (103, PointFromText('POINT(20 20)')),
+< (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+< INSERT INTO gis_line VALUES
+< (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+< (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+< (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+< INSERT INTO gis_polygon VALUES
+< (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+< (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+< (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+< INSERT INTO gis_multi_point VALUES
+< (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+< (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+< (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+< INSERT INTO gis_multi_line VALUES
+< (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+< (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+< (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+< INSERT INTO gis_multi_polygon VALUES
+< (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+< (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+< (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+< INSERT INTO gis_geometrycollection VALUES
+< (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+< (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+< (122, GeomFromText('GeometryCollection()')),
+< (123, GeomFromText('GeometryCollection EMPTY'));
+< INSERT into gis_geometry SELECT * FROM gis_point;
+< INSERT into gis_geometry SELECT * FROM gis_line;
+< INSERT into gis_geometry SELECT * FROM gis_polygon;
+< INSERT into gis_geometry SELECT * FROM gis_multi_point;
+< INSERT into gis_geometry SELECT * FROM gis_multi_line;
+< INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+< INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+< SELECT fid, AsText(g) FROM gis_point;
+< fid AsText(g)
+< 101 POINT(10 10)
+< 102 POINT(20 10)
+< 103 POINT(20 20)
+< 104 POINT(10 20)
+< SELECT fid, AsText(g) FROM gis_line;
+< fid AsText(g)
+< 105 LINESTRING(0 0,0 10,10 0)
+< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 107 LINESTRING(10 10,40 10)
+< SELECT fid, AsText(g) FROM gis_polygon;
+< fid AsText(g)
+< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+< 110 POLYGON((0 0,30 0,30 30,0 0))
+< SELECT fid, AsText(g) FROM gis_multi_point;
+< fid AsText(g)
+< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
+< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
+< 113 MULTIPOINT(3 6,4 10)
+< SELECT fid, AsText(g) FROM gis_multi_line;
+< fid AsText(g)
+< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+< 115 MULTILINESTRING((10 48,10 21,10 0))
+< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+< SELECT fid, AsText(g) FROM gis_multi_polygon;
+< fid AsText(g)
+< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+< SELECT fid, AsText(g) FROM gis_geometrycollection;
+< fid AsText(g)
+< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+< 122 GEOMETRYCOLLECTION EMPTY
+< 123 GEOMETRYCOLLECTION EMPTY
+< SELECT fid, AsText(g) FROM gis_geometry;
+< fid AsText(g)
+< 101 POINT(10 10)
+< 102 POINT(20 10)
+< 103 POINT(20 20)
+< 104 POINT(10 20)
+< 105 LINESTRING(0 0,0 10,10 0)
+< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 107 LINESTRING(10 10,40 10)
+< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+< 110 POLYGON((0 0,30 0,30 30,0 0))
+< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
+< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
+< 113 MULTIPOINT(3 6,4 10)
+< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+< 115 MULTILINESTRING((10 48,10 21,10 0))
+< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+< 122 GEOMETRYCOLLECTION EMPTY
+< 123 GEOMETRYCOLLECTION EMPTY
+< SELECT fid, Dimension(g) FROM gis_geometry;
+< fid Dimension(g)
+< 101 0
+< 102 0
+< 103 0
+< 104 0
+< 105 1
+< 106 1
+< 107 1
+< 108 2
+< 109 2
+< 110 2
+< 111 0
+< 112 0
+< 113 0
+< 114 1
+< 115 1
+< 116 1
+< 117 2
+< 118 2
+< 119 2
+< 120 1
+< 121 1
+< 122 0
+< 123 0
+< SELECT fid, GeometryType(g) FROM gis_geometry;
+< fid GeometryType(g)
+< 101 POINT
+< 102 POINT
+< 103 POINT
+< 104 POINT
+< 105 LINESTRING
+< 106 LINESTRING
+< 107 LINESTRING
+< 108 POLYGON
+< 109 POLYGON
+< 110 POLYGON
+< 111 MULTIPOINT
+< 112 MULTIPOINT
+< 113 MULTIPOINT
+< 114 MULTILINESTRING
+< 115 MULTILINESTRING
+< 116 MULTILINESTRING
+< 117 MULTIPOLYGON
+< 118 MULTIPOLYGON
+< 119 MULTIPOLYGON
+< 120 GEOMETRYCOLLECTION
+< 121 GEOMETRYCOLLECTION
+< 122 GEOMETRYCOLLECTION
+< 123 GEOMETRYCOLLECTION
+< SELECT fid, IsEmpty(g) FROM gis_geometry;
+< fid IsEmpty(g)
+< 101 0
+< 102 0
+< 103 0
+< 104 0
+< 105 0
+< 106 0
+< 107 0
+< 108 0
+< 109 0
+< 110 0
+< 111 0
+< 112 0
+< 113 0
+< 114 0
+< 115 0
+< 116 0
+< 117 0
+< 118 0
+< 119 0
+< 120 0
+< 121 0
+< 122 0
+< 123 0
+< SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+< fid AsText(Envelope(g))
+< 101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+< 102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+< 103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+< 104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+< 105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+< 106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+< 110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+< 111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+< 112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+< 113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+< 114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+< 115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+< 116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+< 117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+< 118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+< 119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+< 120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+< 121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+< 122 GEOMETRYCOLLECTION EMPTY
+< 123 GEOMETRYCOLLECTION EMPTY
+< SELECT fid, X(g) FROM gis_point;
+< fid X(g)
+< 101 10
+< 102 20
+< 103 20
+< 104 10
+< SELECT fid, Y(g) FROM gis_point;
+< fid Y(g)
+< 101 10
+< 102 10
+< 103 20
+< 104 20
+< SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+< fid AsText(StartPoint(g))
+< 105 POINT(0 0)
+< 106 POINT(10 10)
+< 107 POINT(10 10)
+< SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+< fid AsText(EndPoint(g))
+< 105 POINT(10 0)
+< 106 POINT(10 10)
+< 107 POINT(40 10)
+< SELECT fid, GLength(g) FROM gis_line;
+< fid GLength(g)
+< 105 24.14213562373095
+< 106 40
+< 107 30
+< SELECT fid, NumPoints(g) FROM gis_line;
+< fid NumPoints(g)
+< 105 3
+< 106 5
+< 107 2
+< SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+< fid AsText(PointN(g, 2))
+< 105 POINT(0 10)
+< 106 POINT(20 10)
+< 107 POINT(40 10)
+< SELECT fid, IsClosed(g) FROM gis_line;
+< fid IsClosed(g)
+< 105 0
+< 106 1
+< 107 0
+< SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+< fid AsText(Centroid(g))
+< 108 POINT(15 15)
+< 109 POINT(25.416666666666668 25.416666666666668)
+< 110 POINT(20 10)
+< SELECT fid, Area(g) FROM gis_polygon;
+< fid Area(g)
+< 108 100
+< 109 2400
+< 110 450
+< SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+< fid AsText(ExteriorRing(g))
+< 108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+< 110 LINESTRING(0 0,30 0,30 30,0 0)
+< SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+< fid NumInteriorRings(g)
+< 108 0
+< 109 1
+< 110 0
+< SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+< fid AsText(InteriorRingN(g, 1))
+< 108 NULL
+< 109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 110 NULL
+< SELECT fid, IsClosed(g) FROM gis_multi_line;
+< fid IsClosed(g)
+< 114 0
+< 115 0
+< 116 0
+< SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+< fid AsText(Centroid(g))
+< 117 POINT(55.58852775304245 17.426536064113982)
+< 118 POINT(55.58852775304245 17.426536064113982)
+< 119 POINT(2 2)
+< SELECT fid, Area(g) FROM gis_multi_polygon;
+< fid Area(g)
+< 117 1684.5
+< 118 1684.5
+< 119 4.5
+< SELECT fid, NumGeometries(g) from gis_multi_point;
+< fid NumGeometries(g)
+< 111 4
+< 112 4
+< 113 2
+< SELECT fid, NumGeometries(g) from gis_multi_line;
+< fid NumGeometries(g)
+< 114 2
+< 115 1
+< 116 2
+< SELECT fid, NumGeometries(g) from gis_multi_polygon;
+< fid NumGeometries(g)
+< 117 2
+< 118 2
+< 119 1
+< SELECT fid, NumGeometries(g) from gis_geometrycollection;
+< fid NumGeometries(g)
+< 120 2
+< 121 2
+< 122 0
+< 123 0
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+< fid AsText(GeometryN(g, 2))
+< 111 POINT(10 10)
+< 112 POINT(11 11)
+< 113 POINT(4 10)
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+< fid AsText(GeometryN(g, 2))
+< 114 LINESTRING(16 0,16 23,16 48)
+< 115 NULL
+< 116 LINESTRING(2 5,5 8,21 7)
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+< fid AsText(GeometryN(g, 2))
+< 117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+< 118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+< 119 NULL
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+< fid AsText(GeometryN(g, 2))
+< 120 LINESTRING(0 0,10 10)
+< 121 LINESTRING(3 6,7 9)
+< 122 NULL
+< 123 NULL
+< SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+< fid AsText(GeometryN(g, 1))
+< 120 POINT(0 0)
+< 121 POINT(44 6)
+< 122 NULL
+< 123 NULL
+< SELECT g1.fid as first, g2.fid as second,
+< Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+< Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+< Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+< FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+< first second w c o e d t i r
+< 120 120 1 1 0 1 0 1 1 0
+< 120 121 0 0 1 0 0 0 1 0
+< 120 122 0 1 NULL 0 NULL 0 NULL 0
+< 120 123 0 1 NULL 0 NULL 0 NULL 0
+< 121 120 0 0 1 0 0 0 1 0
+< 121 121 1 1 0 1 0 1 1 0
+< 121 122 0 1 NULL 0 NULL 0 NULL 0
+< 121 123 0 1 NULL 0 NULL 0 NULL 0
+< 122 120 1 0 NULL 0 NULL 0 NULL 0
+< 122 121 1 0 NULL 0 NULL 0 NULL 0
+< 122 122 1 1 NULL 1 NULL 0 NULL 0
+< 122 123 1 1 NULL 1 NULL 0 NULL 0
+< 123 120 1 0 NULL 0 NULL 0 NULL 0
+< 123 121 1 0 NULL 0 NULL 0 NULL 0
+< 123 122 1 1 NULL 1 NULL 0 NULL 0
+< 123 123 1 1 NULL 1 NULL 0 NULL 0
+< DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+< USE gis_ogs;
+< # Lakes
+< INSERT INTO lakes VALUES (
+< 101, 'BLUE LAKE',
+< PolyFromText(
+< 'POLYGON(
+< (52 18,66 23,73 9,48 6,52 18),
+< (59 18,67 18,67 13,59 13,59 18)
+< )',
+< 101));
+< # Road Segments
+< INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+< LineFromText(
+< 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+< INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+< LineFromText(
+< 'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+< INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+< LineFromText(
+< 'LINESTRING( 70 38, 72 48 )' ,101));
+< INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+< LineFromText(
+< 'LINESTRING( 70 38, 84 42 )' ,101));
+< INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+< 1,
+< LineFromText(
+< 'LINESTRING( 28 26, 28 0 )',101));
+< # DividedRoutes
+< INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+< MLineFromText(
+< 'MULTILINESTRING((10 48,10 21,10 0),
+< (16 0,16 23,16 48))', 101));
+< # Forests
+< INSERT INTO forests VALUES(109, 'Green Forest',
+< MPolyFromText(
+< 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+< (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+< 101));
+< # Bridges
+< INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+< 'POINT( 44 31 )', 101));
+< # Streams
+< INSERT INTO streams VALUES(111, 'Cam Stream',
+< LineFromText(
+< 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+< INSERT INTO streams VALUES(112, NULL,
+< LineFromText(
+< 'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+< # Buildings
+< INSERT INTO buildings VALUES(113, '123 Main Street',
+< PointFromText(
+< 'POINT( 52 30 )', 101),
+< PolyFromText(
+< 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+< INSERT INTO buildings VALUES(114, '215 Main Street',
+< PointFromText(
+< 'POINT( 64 33 )', 101),
+< PolyFromText(
+< 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+< # Ponds
+< INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+< MPolyFromText(
+< 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+< ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+< # Named Places
+< INSERT INTO named_places VALUES(117, 'Ashton',
+< PolyFromText(
+< 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+< INSERT INTO named_places VALUES(118, 'Goose Island',
+< PolyFromText(
+< 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+< # Map Neatlines
+< INSERT INTO map_neatlines VALUES(115,
+< PolyFromText(
+< 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+< SELECT Dimension(shore)
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< Dimension(shore)
+< 2
+< SELECT GeometryType(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< GeometryType(centerlines)
+< MULTILINESTRING
+< SELECT AsText(boundary)
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(boundary)
+< POLYGON((67 13,67 18,59 18,59 13,67 13))
+< SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(PolyFromWKB(AsBinary(boundary),101))
+< POLYGON((67 13,67 18,59 18,59 13,67 13))
+< SELECT SRID(boundary)
+< FROM named_places
+< WHERE name = 'Goose Island';
+< SRID(boundary)
+< 101
+< SELECT IsEmpty(centerline)
+< FROM road_segments
+< WHERE name = 'Route 5'
+< AND aliases = 'Main Street';
+< IsEmpty(centerline)
+< 0
+< SELECT AsText(Envelope(boundary))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(Envelope(boundary))
+< POLYGON((59 13,67 13,67 18,59 18,59 13))
+< SELECT X(position)
+< FROM bridges
+< WHERE name = 'Cam Bridge';
+< X(position)
+< 44
+< SELECT Y(position)
+< FROM bridges
+< WHERE name = 'Cam Bridge';
+< Y(position)
+< 31
+< SELECT AsText(StartPoint(centerline))
+< FROM road_segments
+< WHERE fid = 102;
+< AsText(StartPoint(centerline))
+< POINT(0 18)
+< SELECT AsText(EndPoint(centerline))
+< FROM road_segments
+< WHERE fid = 102;
+< AsText(EndPoint(centerline))
+< POINT(44 31)
+< SELECT GLength(centerline)
+< FROM road_segments
+< WHERE fid = 106;
+< GLength(centerline)
+< 26
+< SELECT NumPoints(centerline)
+< FROM road_segments
+< WHERE fid = 102;
+< NumPoints(centerline)
+< 5
+< SELECT AsText(PointN(centerline, 1))
+< FROM road_segments
+< WHERE fid = 102;
+< AsText(PointN(centerline, 1))
+< POINT(0 18)
+< SELECT AsText(Centroid(boundary))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(Centroid(boundary))
+< POINT(63 15.5)
+< SELECT Area(boundary)
+< FROM named_places
+< WHERE name = 'Goose Island';
+< Area(boundary)
+< 40
+< SELECT AsText(ExteriorRing(shore))
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< AsText(ExteriorRing(shore))
+< LINESTRING(52 18,66 23,73 9,48 6,52 18)
+< SELECT NumInteriorRings(shore)
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< NumInteriorRings(shore)
+< 1
+< SELECT AsText(InteriorRingN(shore, 1))
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< AsText(InteriorRingN(shore, 1))
+< LINESTRING(59 18,67 18,67 13,59 13,59 18)
+< SELECT NumGeometries(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< NumGeometries(centerlines)
+< 2
+< SELECT AsText(GeometryN(centerlines, 2))
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< AsText(GeometryN(centerlines, 2))
+< LINESTRING(16 0,16 23,16 48)
+< SELECT IsClosed(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< IsClosed(centerlines)
+< 0
+< SELECT GLength(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< GLength(centerlines)
+< 96
+< SELECT AsText(Centroid(shores))
+< FROM ponds
+< WHERE fid = 120;
+< AsText(Centroid(shores))
+< POINT(25 42)
+< SELECT Area(shores)
+< FROM ponds
+< WHERE fid = 120;
+< Area(shores)
+< 8
+< SELECT ST_Equals(boundary,
+< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< ST_Equals(boundary,
+< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+< 1
+< SELECT ST_Disjoint(centerlines, boundary)
+< FROM divided_routes, named_places
+< WHERE divided_routes.name = 'Route 75'
+< AND named_places.name = 'Ashton';
+< ST_Disjoint(centerlines, boundary)
+< 1
+< SELECT ST_Touches(centerline, shore)
+< FROM streams, lakes
+< WHERE streams.name = 'Cam Stream'
+< AND lakes.name = 'Blue Lake';
+< ST_Touches(centerline, shore)
+< 1
+< SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+< FROM road_segments, divided_routes
+< WHERE road_segments.fid = 102
+< AND divided_routes.name = 'Route 75';
+< Crosses(road_segments.centerline, divided_routes.centerlines)
+< 1
+< SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+< FROM road_segments, divided_routes
+< WHERE road_segments.fid = 102
+< AND divided_routes.name = 'Route 75';
+< ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+< 1
+< SELECT ST_Contains(forests.boundary, named_places.boundary)
+< FROM forests, named_places
+< WHERE forests.name = 'Green Forest'
+< AND named_places.name = 'Ashton';
+< ST_Contains(forests.boundary, named_places.boundary)
+< 0
+< SELECT ST_Distance(position, boundary)
+< FROM bridges, named_places
+< WHERE bridges.name = 'Cam Bridge'
+< AND named_places.name = 'Ashton';
+< ST_Distance(position, boundary)
+< 12
+< SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+< FROM named_places, forests
+< WHERE named_places.name = 'Ashton'
+< AND forests.name = 'Green Forest';
+< AsText(ST_Difference(named_places.boundary, forests.boundary))
+< POLYGON((56 34,62 48,84 48,84 42,56 34))
+< SELECT AsText(ST_Union(shore, boundary))
+< FROM lakes, named_places
+< WHERE lakes.name = 'Blue Lake'
+< AND named_places.name = 'Goose Island';
+< AsText(ST_Union(shore, boundary))
+< POLYGON((48 6,52 18,66 23,73 9,48 6))
+< SELECT AsText(ST_SymDifference(shore, boundary))
+< FROM lakes, named_places
+< WHERE lakes.name = 'Blue Lake'
+< AND named_places.name = 'Ashton';
+< AsText(ST_SymDifference(shore, boundary))
+< MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
+< SELECT count(*)
+< FROM buildings, bridges
+< WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+< count(*)
+< 1
+---
+> ERROR 42000: The storage engine for the table doesn't support GEOMETRY
+> # ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT, /*!INDEX*/ /*Custom index*/ g(g(128))) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ]
+> # The statement|command finished with ER_CHECK_NOT_IMPLEMENTED.
+> # Geometry types or indexes on them or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
+705,1398c21,30
+< CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< USE gis_ogs;
+< CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< shore POLYGON NOT NULL, SPATIAL INDEX s(shore)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
+< num_lanes INT <CUSTOM_COL_OPTIONS>,
+< centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< num_lanes INT <CUSTOM_COL_OPTIONS>,
+< centerlines MULTILINESTRING NOT NULL, SPATIAL INDEX c(centerlines)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< boundary MULTIPOLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< position POINT NOT NULL, SPATIAL INDEX p(position)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< position POINT NOT NULL,
+< footprint POLYGON NOT NULL, SPATIAL INDEX p(position), SPATIAL INDEX f(footprint)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< type CHAR(64) <CUSTOM_COL_OPTIONS>,
+< shores MULTIPOLYGON NOT NULL, SPATIAL INDEX s(shores)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
+< name CHAR(64) <CUSTOM_COL_OPTIONS>,
+< boundary POLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
+< neatline POLYGON NOT NULL, SPATIAL INDEX n(neatline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< USE test;
+< SHOW FIELDS FROM gis_point;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g point NO MUL NULL
+< SHOW FIELDS FROM gis_line;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g linestring NO MUL NULL
+< SHOW FIELDS FROM gis_polygon;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g polygon NO MUL NULL
+< SHOW FIELDS FROM gis_multi_point;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g multipoint NO MUL NULL
+< SHOW FIELDS FROM gis_multi_line;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g multilinestring NO MUL NULL
+< SHOW FIELDS FROM gis_multi_polygon;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g multipolygon NO MUL NULL
+< SHOW FIELDS FROM gis_geometrycollection;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g geometrycollection NO MUL NULL
+< SHOW FIELDS FROM gis_geometry;
+< Field Type Null Key Default Extra
+< fid int(11) YES NULL
+< g geometry NO NULL
+< INSERT INTO gis_point VALUES
+< (101, PointFromText('POINT(10 10)')),
+< (102, PointFromText('POINT(20 10)')),
+< (103, PointFromText('POINT(20 20)')),
+< (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+< INSERT INTO gis_line VALUES
+< (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+< (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+< (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+< INSERT INTO gis_polygon VALUES
+< (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+< (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+< (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+< INSERT INTO gis_multi_point VALUES
+< (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+< (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+< (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+< INSERT INTO gis_multi_line VALUES
+< (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+< (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+< (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+< INSERT INTO gis_multi_polygon VALUES
+< (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+< (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+< (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+< INSERT INTO gis_geometrycollection VALUES
+< (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+< (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+< (122, GeomFromText('GeometryCollection()')),
+< (123, GeomFromText('GeometryCollection EMPTY'));
+< INSERT into gis_geometry SELECT * FROM gis_point;
+< INSERT into gis_geometry SELECT * FROM gis_line;
+< INSERT into gis_geometry SELECT * FROM gis_polygon;
+< INSERT into gis_geometry SELECT * FROM gis_multi_point;
+< INSERT into gis_geometry SELECT * FROM gis_multi_line;
+< INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+< INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+< SELECT fid, AsText(g) FROM gis_point;
+< fid AsText(g)
+< 101 POINT(10 10)
+< 102 POINT(20 10)
+< 103 POINT(20 20)
+< 104 POINT(10 20)
+< SELECT fid, AsText(g) FROM gis_line;
+< fid AsText(g)
+< 105 LINESTRING(0 0,0 10,10 0)
+< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 107 LINESTRING(10 10,40 10)
+< SELECT fid, AsText(g) FROM gis_polygon;
+< fid AsText(g)
+< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+< 110 POLYGON((0 0,30 0,30 30,0 0))
+< SELECT fid, AsText(g) FROM gis_multi_point;
+< fid AsText(g)
+< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
+< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
+< 113 MULTIPOINT(3 6,4 10)
+< SELECT fid, AsText(g) FROM gis_multi_line;
+< fid AsText(g)
+< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+< 115 MULTILINESTRING((10 48,10 21,10 0))
+< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+< SELECT fid, AsText(g) FROM gis_multi_polygon;
+< fid AsText(g)
+< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+< SELECT fid, AsText(g) FROM gis_geometrycollection;
+< fid AsText(g)
+< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+< 122 GEOMETRYCOLLECTION EMPTY
+< 123 GEOMETRYCOLLECTION EMPTY
+< SELECT fid, AsText(g) FROM gis_geometry;
+< fid AsText(g)
+< 101 POINT(10 10)
+< 102 POINT(20 10)
+< 103 POINT(20 20)
+< 104 POINT(10 20)
+< 105 LINESTRING(0 0,0 10,10 0)
+< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 107 LINESTRING(10 10,40 10)
+< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+< 110 POLYGON((0 0,30 0,30 30,0 0))
+< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
+< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
+< 113 MULTIPOINT(3 6,4 10)
+< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+< 115 MULTILINESTRING((10 48,10 21,10 0))
+< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+< 122 GEOMETRYCOLLECTION EMPTY
+< 123 GEOMETRYCOLLECTION EMPTY
+< SELECT fid, Dimension(g) FROM gis_geometry;
+< fid Dimension(g)
+< 101 0
+< 102 0
+< 103 0
+< 104 0
+< 105 1
+< 106 1
+< 107 1
+< 108 2
+< 109 2
+< 110 2
+< 111 0
+< 112 0
+< 113 0
+< 114 1
+< 115 1
+< 116 1
+< 117 2
+< 118 2
+< 119 2
+< 120 1
+< 121 1
+< 122 0
+< 123 0
+< SELECT fid, GeometryType(g) FROM gis_geometry;
+< fid GeometryType(g)
+< 101 POINT
+< 102 POINT
+< 103 POINT
+< 104 POINT
+< 105 LINESTRING
+< 106 LINESTRING
+< 107 LINESTRING
+< 108 POLYGON
+< 109 POLYGON
+< 110 POLYGON
+< 111 MULTIPOINT
+< 112 MULTIPOINT
+< 113 MULTIPOINT
+< 114 MULTILINESTRING
+< 115 MULTILINESTRING
+< 116 MULTILINESTRING
+< 117 MULTIPOLYGON
+< 118 MULTIPOLYGON
+< 119 MULTIPOLYGON
+< 120 GEOMETRYCOLLECTION
+< 121 GEOMETRYCOLLECTION
+< 122 GEOMETRYCOLLECTION
+< 123 GEOMETRYCOLLECTION
+< SELECT fid, IsEmpty(g) FROM gis_geometry;
+< fid IsEmpty(g)
+< 101 0
+< 102 0
+< 103 0
+< 104 0
+< 105 0
+< 106 0
+< 107 0
+< 108 0
+< 109 0
+< 110 0
+< 111 0
+< 112 0
+< 113 0
+< 114 0
+< 115 0
+< 116 0
+< 117 0
+< 118 0
+< 119 0
+< 120 0
+< 121 0
+< 122 0
+< 123 0
+< SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+< fid AsText(Envelope(g))
+< 101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+< 102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+< 103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+< 104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+< 105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+< 106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+< 109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+< 110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+< 111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+< 112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+< 113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+< 114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+< 115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+< 116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+< 117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+< 118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+< 119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+< 120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+< 121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+< 122 GEOMETRYCOLLECTION EMPTY
+< 123 GEOMETRYCOLLECTION EMPTY
+< SELECT fid, X(g) FROM gis_point;
+< fid X(g)
+< 101 10
+< 102 20
+< 103 20
+< 104 10
+< SELECT fid, Y(g) FROM gis_point;
+< fid Y(g)
+< 101 10
+< 102 10
+< 103 20
+< 104 20
+< SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+< fid AsText(StartPoint(g))
+< 105 POINT(0 0)
+< 106 POINT(10 10)
+< 107 POINT(10 10)
+< SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+< fid AsText(EndPoint(g))
+< 105 POINT(10 0)
+< 106 POINT(10 10)
+< 107 POINT(40 10)
+< SELECT fid, GLength(g) FROM gis_line;
+< fid GLength(g)
+< 105 24.14213562373095
+< 106 40
+< 107 30
+< SELECT fid, NumPoints(g) FROM gis_line;
+< fid NumPoints(g)
+< 105 3
+< 106 5
+< 107 2
+< SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+< fid AsText(PointN(g, 2))
+< 105 POINT(0 10)
+< 106 POINT(20 10)
+< 107 POINT(40 10)
+< SELECT fid, IsClosed(g) FROM gis_line;
+< fid IsClosed(g)
+< 105 0
+< 106 1
+< 107 0
+< SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+< fid AsText(Centroid(g))
+< 108 POINT(15 15)
+< 109 POINT(25.416666666666668 25.416666666666668)
+< 110 POINT(20 10)
+< SELECT fid, Area(g) FROM gis_polygon;
+< fid Area(g)
+< 108 100
+< 109 2400
+< 110 450
+< SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+< fid AsText(ExteriorRing(g))
+< 108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+< 110 LINESTRING(0 0,30 0,30 30,0 0)
+< SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+< fid NumInteriorRings(g)
+< 108 0
+< 109 1
+< 110 0
+< SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+< fid AsText(InteriorRingN(g, 1))
+< 108 NULL
+< 109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+< 110 NULL
+< SELECT fid, IsClosed(g) FROM gis_multi_line;
+< fid IsClosed(g)
+< 114 0
+< 115 0
+< 116 0
+< SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+< fid AsText(Centroid(g))
+< 117 POINT(55.58852775304245 17.426536064113982)
+< 118 POINT(55.58852775304245 17.426536064113982)
+< 119 POINT(2 2)
+< SELECT fid, Area(g) FROM gis_multi_polygon;
+< fid Area(g)
+< 117 1684.5
+< 118 1684.5
+< 119 4.5
+< SELECT fid, NumGeometries(g) from gis_multi_point;
+< fid NumGeometries(g)
+< 111 4
+< 112 4
+< 113 2
+< SELECT fid, NumGeometries(g) from gis_multi_line;
+< fid NumGeometries(g)
+< 114 2
+< 115 1
+< 116 2
+< SELECT fid, NumGeometries(g) from gis_multi_polygon;
+< fid NumGeometries(g)
+< 117 2
+< 118 2
+< 119 1
+< SELECT fid, NumGeometries(g) from gis_geometrycollection;
+< fid NumGeometries(g)
+< 120 2
+< 121 2
+< 122 0
+< 123 0
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+< fid AsText(GeometryN(g, 2))
+< 111 POINT(10 10)
+< 112 POINT(11 11)
+< 113 POINT(4 10)
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+< fid AsText(GeometryN(g, 2))
+< 114 LINESTRING(16 0,16 23,16 48)
+< 115 NULL
+< 116 LINESTRING(2 5,5 8,21 7)
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+< fid AsText(GeometryN(g, 2))
+< 117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+< 118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+< 119 NULL
+< SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+< fid AsText(GeometryN(g, 2))
+< 120 LINESTRING(0 0,10 10)
+< 121 LINESTRING(3 6,7 9)
+< 122 NULL
+< 123 NULL
+< SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+< fid AsText(GeometryN(g, 1))
+< 120 POINT(0 0)
+< 121 POINT(44 6)
+< 122 NULL
+< 123 NULL
+< SELECT g1.fid as first, g2.fid as second,
+< Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+< Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+< Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+< FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+< first second w c o e d t i r
+< 120 120 1 1 0 1 0 1 1 0
+< 120 121 0 0 1 0 0 0 1 0
+< 120 122 0 1 NULL 0 NULL 0 NULL 0
+< 120 123 0 1 NULL 0 NULL 0 NULL 0
+< 121 120 0 0 1 0 0 0 1 0
+< 121 121 1 1 0 1 0 1 1 0
+< 121 122 0 1 NULL 0 NULL 0 NULL 0
+< 121 123 0 1 NULL 0 NULL 0 NULL 0
+< 122 120 1 0 NULL 0 NULL 0 NULL 0
+< 122 121 1 0 NULL 0 NULL 0 NULL 0
+< 122 122 1 1 NULL 1 NULL 0 NULL 0
+< 122 123 1 1 NULL 1 NULL 0 NULL 0
+< 123 120 1 0 NULL 0 NULL 0 NULL 0
+< 123 121 1 0 NULL 0 NULL 0 NULL 0
+< 123 122 1 1 NULL 1 NULL 0 NULL 0
+< 123 123 1 1 NULL 1 NULL 0 NULL 0
+< DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+< USE gis_ogs;
+< # Lakes
+< INSERT INTO lakes VALUES (
+< 101, 'BLUE LAKE',
+< PolyFromText(
+< 'POLYGON(
+< (52 18,66 23,73 9,48 6,52 18),
+< (59 18,67 18,67 13,59 13,59 18)
+< )',
+< 101));
+< # Road Segments
+< INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+< LineFromText(
+< 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+< INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+< LineFromText(
+< 'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+< INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+< LineFromText(
+< 'LINESTRING( 70 38, 72 48 )' ,101));
+< INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+< LineFromText(
+< 'LINESTRING( 70 38, 84 42 )' ,101));
+< INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+< 1,
+< LineFromText(
+< 'LINESTRING( 28 26, 28 0 )',101));
+< # DividedRoutes
+< INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+< MLineFromText(
+< 'MULTILINESTRING((10 48,10 21,10 0),
+< (16 0,16 23,16 48))', 101));
+< # Forests
+< INSERT INTO forests VALUES(109, 'Green Forest',
+< MPolyFromText(
+< 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+< (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+< 101));
+< # Bridges
+< INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+< 'POINT( 44 31 )', 101));
+< # Streams
+< INSERT INTO streams VALUES(111, 'Cam Stream',
+< LineFromText(
+< 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+< INSERT INTO streams VALUES(112, NULL,
+< LineFromText(
+< 'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+< # Buildings
+< INSERT INTO buildings VALUES(113, '123 Main Street',
+< PointFromText(
+< 'POINT( 52 30 )', 101),
+< PolyFromText(
+< 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+< INSERT INTO buildings VALUES(114, '215 Main Street',
+< PointFromText(
+< 'POINT( 64 33 )', 101),
+< PolyFromText(
+< 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+< # Ponds
+< INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+< MPolyFromText(
+< 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+< ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+< # Named Places
+< INSERT INTO named_places VALUES(117, 'Ashton',
+< PolyFromText(
+< 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+< INSERT INTO named_places VALUES(118, 'Goose Island',
+< PolyFromText(
+< 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+< # Map Neatlines
+< INSERT INTO map_neatlines VALUES(115,
+< PolyFromText(
+< 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+< SELECT Dimension(shore)
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< Dimension(shore)
+< 2
+< SELECT GeometryType(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< GeometryType(centerlines)
+< MULTILINESTRING
+< SELECT AsText(boundary)
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(boundary)
+< POLYGON((67 13,67 18,59 18,59 13,67 13))
+< SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(PolyFromWKB(AsBinary(boundary),101))
+< POLYGON((67 13,67 18,59 18,59 13,67 13))
+< SELECT SRID(boundary)
+< FROM named_places
+< WHERE name = 'Goose Island';
+< SRID(boundary)
+< 101
+< SELECT IsEmpty(centerline)
+< FROM road_segments
+< WHERE name = 'Route 5'
+< AND aliases = 'Main Street';
+< IsEmpty(centerline)
+< 0
+< SELECT AsText(Envelope(boundary))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(Envelope(boundary))
+< POLYGON((59 13,67 13,67 18,59 18,59 13))
+< SELECT X(position)
+< FROM bridges
+< WHERE name = 'Cam Bridge';
+< X(position)
+< 44
+< SELECT Y(position)
+< FROM bridges
+< WHERE name = 'Cam Bridge';
+< Y(position)
+< 31
+< SELECT AsText(StartPoint(centerline))
+< FROM road_segments
+< WHERE fid = 102;
+< AsText(StartPoint(centerline))
+< POINT(0 18)
+< SELECT AsText(EndPoint(centerline))
+< FROM road_segments
+< WHERE fid = 102;
+< AsText(EndPoint(centerline))
+< POINT(44 31)
+< SELECT GLength(centerline)
+< FROM road_segments
+< WHERE fid = 106;
+< GLength(centerline)
+< 26
+< SELECT NumPoints(centerline)
+< FROM road_segments
+< WHERE fid = 102;
+< NumPoints(centerline)
+< 5
+< SELECT AsText(PointN(centerline, 1))
+< FROM road_segments
+< WHERE fid = 102;
+< AsText(PointN(centerline, 1))
+< POINT(0 18)
+< SELECT AsText(Centroid(boundary))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< AsText(Centroid(boundary))
+< POINT(63 15.5)
+< SELECT Area(boundary)
+< FROM named_places
+< WHERE name = 'Goose Island';
+< Area(boundary)
+< 40
+< SELECT AsText(ExteriorRing(shore))
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< AsText(ExteriorRing(shore))
+< LINESTRING(52 18,66 23,73 9,48 6,52 18)
+< SELECT NumInteriorRings(shore)
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< NumInteriorRings(shore)
+< 1
+< SELECT AsText(InteriorRingN(shore, 1))
+< FROM lakes
+< WHERE name = 'Blue Lake';
+< AsText(InteriorRingN(shore, 1))
+< LINESTRING(59 18,67 18,67 13,59 13,59 18)
+< SELECT NumGeometries(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< NumGeometries(centerlines)
+< 2
+< SELECT AsText(GeometryN(centerlines, 2))
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< AsText(GeometryN(centerlines, 2))
+< LINESTRING(16 0,16 23,16 48)
+< SELECT IsClosed(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< IsClosed(centerlines)
+< 0
+< SELECT GLength(centerlines)
+< FROM divided_routes
+< WHERE name = 'Route 75';
+< GLength(centerlines)
+< 96
+< SELECT AsText(Centroid(shores))
+< FROM ponds
+< WHERE fid = 120;
+< AsText(Centroid(shores))
+< POINT(25 42)
+< SELECT Area(shores)
+< FROM ponds
+< WHERE fid = 120;
+< Area(shores)
+< 8
+< SELECT ST_Equals(boundary,
+< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+< FROM named_places
+< WHERE name = 'Goose Island';
+< ST_Equals(boundary,
+< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+< 1
+< SELECT ST_Disjoint(centerlines, boundary)
+< FROM divided_routes, named_places
+< WHERE divided_routes.name = 'Route 75'
+< AND named_places.name = 'Ashton';
+< ST_Disjoint(centerlines, boundary)
+< 1
+< SELECT ST_Touches(centerline, shore)
+< FROM streams, lakes
+< WHERE streams.name = 'Cam Stream'
+< AND lakes.name = 'Blue Lake';
+< ST_Touches(centerline, shore)
+< 1
+< SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+< FROM road_segments, divided_routes
+< WHERE road_segments.fid = 102
+< AND divided_routes.name = 'Route 75';
+< Crosses(road_segments.centerline, divided_routes.centerlines)
+< 1
+< SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+< FROM road_segments, divided_routes
+< WHERE road_segments.fid = 102
+< AND divided_routes.name = 'Route 75';
+< ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+< 1
+< SELECT ST_Contains(forests.boundary, named_places.boundary)
+< FROM forests, named_places
+< WHERE forests.name = 'Green Forest'
+< AND named_places.name = 'Ashton';
+< ST_Contains(forests.boundary, named_places.boundary)
+< 0
+< SELECT ST_Distance(position, boundary)
+< FROM bridges, named_places
+< WHERE bridges.name = 'Cam Bridge'
+< AND named_places.name = 'Ashton';
+< ST_Distance(position, boundary)
+< 12
+< SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+< FROM named_places, forests
+< WHERE named_places.name = 'Ashton'
+< AND forests.name = 'Green Forest';
+< AsText(ST_Difference(named_places.boundary, forests.boundary))
+< POLYGON((56 34,62 48,84 48,84 42,56 34))
+< SELECT AsText(ST_Union(shore, boundary))
+< FROM lakes, named_places
+< WHERE lakes.name = 'Blue Lake'
+< AND named_places.name = 'Goose Island';
+< AsText(ST_Union(shore, boundary))
+< POLYGON((48 6,52 18,66 23,73 9,48 6))
+< SELECT AsText(ST_SymDifference(shore, boundary))
+< FROM lakes, named_places
+< WHERE lakes.name = 'Blue Lake'
+< AND named_places.name = 'Ashton';
+< AsText(ST_SymDifference(shore, boundary))
+< MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
+< SELECT count(*)
+< FROM buildings, bridges
+< WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+< count(*)
+< 1
+---
+> ERROR 42000: The storage engine for the table doesn't support GEOMETRY
+> # ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT NOT NULL, SPATIAL INDEX(g)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ]
+> # The statement|command finished with ER_CHECK_NOT_IMPLEMENTED.
+> # Geometry types or spatial indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff
new file mode 100644
index 00000000000..20431a9c713
--- /dev/null
+++ b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff
@@ -0,0 +1,79 @@
+3,69c3,12
+< SHOW COLUMNS IN t1;
+< Field Type Null Key Default Extra
+< a int(11) # #
+< b int(11) # # VIRTUAL
+< INSERT INTO t1 (a) VALUES (1),(2);
+< INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+< Warnings:
+< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+< SELECT * FROM t1;
+< a b
+< 1 2
+< 2 3
+< 3 4
+< 4 5
+< DROP TABLE t1;
+< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< SHOW COLUMNS IN t1;
+< Field Type Null Key Default Extra
+< a int(11) # #
+< b int(11) # # PERSISTENT
+< INSERT INTO t1 (a) VALUES (1),(2);
+< INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+< Warnings:
+< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+< SELECT * FROM t1;
+< a b
+< 1 2
+< 2 3
+< 3 4
+< 4 5
+< DROP TABLE t1;
+< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) VIRTUAL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< SHOW COLUMNS IN t1;
+< Field Type Null Key Default Extra
+< a int(11) # #
+< b int(11) # # VIRTUAL
+< INSERT INTO t1 (a) VALUES (1),(2);
+< INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+< Warnings:
+< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+< SELECT * FROM t1;
+< a b
+< 1 2
+< 2 3
+< 3 4
+< 4 5
+< DROP TABLE t1;
+< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+< SHOW COLUMNS IN t1;
+< Field Type Null Key Default Extra
+< a int(11) # #
+< b int(11) # # PERSISTENT
+< INSERT INTO t1 (a) VALUES (1),(2);
+< INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+< Warnings:
+< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+< SELECT * FROM t1;
+< a b
+< 1 2
+< 2 3
+< 3 4
+< 4 5
+< DROP TABLE t1;
+---
+> ERROR HY000: MRG_MYISAM storage engine does not support computed columns
+> # ERROR: Statement ended with errno 1910, errname ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS (expected to succeed)
+> # ------------ UNEXPECTED RESULT ------------
+> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/ GENERATED ALWAYS AS (a+1)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST ]
+> # The statement|command finished with ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS.
+> # Virtual columns or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
+> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
+> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
+> # -------------------------------------------
diff --git a/storage/oqgraph/CMakeLists.txt b/storage/oqgraph/CMakeLists.txt
index 4b8dac20350..83acb99b2a2 100644
--- a/storage/oqgraph/CMakeLists.txt
+++ b/storage/oqgraph/CMakeLists.txt
@@ -1,14 +1,24 @@
-FIND_PACKAGE(Boost 1.45.0) # we need at least 1.45 if we want -fno-rtti for the server
+FIND_PACKAGE(Boost 1.40.0)
IF(NOT Boost_FOUND)
RETURN()
ENDIF()
INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
-# lp:756966 OQGRAPH on Win64 does not compile
-IF(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET(BOOST_OK 0)
+IF(MSVC)
+ # lp:756966 OQGRAPH on Win64 does not compile
+ IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(BOOST_OK 0)
+ ELSE()
+ SET(BOOST_OK 1)
+ ENDIF()
ELSE()
- SET(BOOST_OK 1)
+# See if that works. On old gcc it'll fail because of -fno-rtti
+CHECK_CXX_SOURCE_COMPILES(
+"
+#include <boost/config.hpp>
+#include <boost/property_map/property_map.hpp>
+int main() { return 0; }
+" BOOST_OK)
ENDIF()
IF(BOOST_OK)
@@ -16,7 +26,7 @@ IF(BOOST_OK)
IF(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
ELSE(MSVC)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -fno-strict-aliasing")
STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
ENDIF(MSVC)
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 27a463bf61f..97e83cd9221 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -3591,12 +3591,12 @@ struct st_mysql_storage_engine sphinx_storage_engine =
struct st_mysql_show_var sphinx_status_vars[] =
{
- {"sphinx_total", (char *)sphinx_showfunc_total, SHOW_FUNC},
- {"sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_FUNC},
- {"sphinx_time", (char *)sphinx_showfunc_time, SHOW_FUNC},
- {"sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_FUNC},
- {"sphinx_words", (char *)sphinx_showfunc_words, SHOW_FUNC},
- {"sphinx_error", (char *)sphinx_showfunc_error, SHOW_FUNC},
+ {"sphinx_total", (char *)sphinx_showfunc_total, SHOW_SIMPLE_FUNC},
+ {"sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_SIMPLE_FUNC},
+ {"sphinx_time", (char *)sphinx_showfunc_time, SHOW_SIMPLE_FUNC},
+ {"sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_SIMPLE_FUNC},
+ {"sphinx_words", (char *)sphinx_showfunc_words, SHOW_SIMPLE_FUNC},
+ {"sphinx_error", (char *)sphinx_showfunc_error, SHOW_SIMPLE_FUNC},
{0, 0, (enum_mysql_show_type)0}
};
diff --git a/storage/xtradb/btr/btr0btr.c b/storage/xtradb/btr/btr0btr.c
index 1fa6df44f7c..3f11684cb34 100644
--- a/storage/xtradb/btr/btr0btr.c
+++ b/storage/xtradb/btr/btr0btr.c
@@ -42,6 +42,7 @@ Created 6/2/1994 Heikki Tuuri
#include "ibuf0ibuf.h"
#include "trx0trx.h"
+#endif /* UNIV_HOTBACKUP */
/**************************************************************//**
Report that an index page is corrupted. */
UNIV_INTERN
@@ -61,9 +62,10 @@ btr_corruption_report(
buf_block_get_zip_size(block),
BUF_PAGE_PRINT_NO_CRASH);
}
- buf_page_print(buf_block_get_frame(block), 0, 0);
+ buf_page_print(buf_block_get_frame_fast(block), 0, 0);
}
+#ifndef UNIV_HOTBACKUP
#ifdef UNIV_BLOB_DEBUG
# include "srv0srv.h"
# include "ut0rbt.h"
@@ -1622,7 +1624,9 @@ btr_page_reorganize_low(
dict_index_t* index, /*!< in: record descriptor */
mtr_t* mtr) /*!< in: mtr */
{
+#ifndef UNIV_HOTBACKUP
buf_pool_t* buf_pool = buf_pool_from_bpage(&block->page);
+#endif /* !UNIV_HOTBACKUP */
page_t* page = buf_block_get_frame(block);
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
buf_block_t* temp_block;
diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c
index e093dabebf1..26db7329b7e 100644
--- a/storage/xtradb/btr/btr0cur.c
+++ b/storage/xtradb/btr/btr0cur.c
@@ -3604,6 +3604,8 @@ btr_estimate_n_rows_in_range(
n_rows = n_rows * 2;
}
+ DBUG_EXECUTE_IF("bug14007649", return(n_rows););
+
/* Do not estimate the number of rows in the range
to over 1 / 2 of the estimated rows in the whole
table */
diff --git a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c
index fd7b8959473..a2ff171e0c5 100644
--- a/storage/xtradb/buf/buf0buf.c
+++ b/storage/xtradb/buf/buf0buf.c
@@ -344,7 +344,6 @@ be effective only if PFS_GROUP_BUFFER_SYNC is defined. */
// was allocated for the frames */
// buf_block_t* blocks; /*!< array of buffer control blocks */
//};
-#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
Gets the smallest oldest_modification lsn for any page in the pool. Returns
@@ -482,6 +481,7 @@ buf_block_alloc(
return(block);
}
+#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
Calculates a page checksum which is stored to the page when it is written
@@ -3907,9 +3907,10 @@ buf_mark_space_corrupt(
/********************************************************************//**
Completes an asynchronous read or write request of a file page to or from
-the buffer pool. */
+the buffer pool.
+@return TRUE if successful */
UNIV_INTERN
-void
+ibool
buf_page_io_complete(
/*=================*/
buf_page_t* bpage) /*!< in: pointer to the block in question */
@@ -4057,7 +4058,7 @@ corrupt:
table as corrupted instead of crashing server */
if (bpage->space > TRX_SYS_SPACE
&& buf_mark_space_corrupt(bpage)) {
- return;
+ return(FALSE);
} else {
fputs("InnoDB: Ending processing"
" because of"
@@ -4176,6 +4177,8 @@ retry_mutex:
buf_pool_mutex_exit(buf_pool);
mutex_exit(block_mutex);
+
+ return(TRUE);
}
/********************************************************************//**
diff --git a/storage/xtradb/buf/buf0flu.c b/storage/xtradb/buf/buf0flu.c
index bb921928653..39351cd3678 100644
--- a/storage/xtradb/buf/buf0flu.c
+++ b/storage/xtradb/buf/buf0flu.c
@@ -1846,8 +1846,6 @@ buf_flush_batch(
}
#endif /* UNIV_DEBUG */
- srv_buf_pool_flushed += count;
-
return(count);
}
@@ -1874,13 +1872,6 @@ buf_flush_common(
#endif /* UNIV_DEBUG */
srv_buf_pool_flushed += page_count;
-
- if (flush_type == BUF_FLUSH_LRU) {
- /* We keep track of all flushes happening as part of LRU
- flush. When estimating the desired rate at which flush_list
- should be flushed we factor in this value. */
- buf_lru_flush_page_count += page_count;
- }
}
/******************************************************************//**
diff --git a/storage/xtradb/buf/buf0lru.c b/storage/xtradb/buf/buf0lru.c
index f7b5db2d0cc..16a91358080 100644
--- a/storage/xtradb/buf/buf0lru.c
+++ b/storage/xtradb/buf/buf0lru.c
@@ -374,7 +374,7 @@ next_page:
/******************************************************************//**
While flushing (or removing dirty) pages from a tablespace we don't
-want to hog the CPU and resources. Release the buffer pool and block
+want to hog the CPU and resources. Release the LRU list and block
mutex and try to force a context switch. Then reacquire the same mutexes.
The current page is "fixed" before the release of the mutexes and then
"unfixed" again once we have reacquired the mutexes. */
@@ -387,7 +387,7 @@ buf_flush_yield(
{
mutex_t* block_mutex;
- ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_ad(buf_page_in_file(bpage));
block_mutex = buf_page_get_mutex(bpage);
@@ -399,13 +399,13 @@ buf_flush_yield(
buf_page_set_sticky(bpage);
/* Now it is safe to release the buf_pool->mutex. */
- buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
mutex_exit(block_mutex);
/* Try and force a context switch. */
os_thread_yield();
- buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
mutex_enter(block_mutex);
/* "Unfix" the block now that we have both the
@@ -415,9 +415,9 @@ buf_flush_yield(
}
/******************************************************************//**
-If we have hogged the resources for too long then release the buffer
-pool and flush list mutex and do a thread yield. Set the current page
-to "sticky" so that it is not relocated during the yield.
+If we have hogged the resources for too long then release the LRU list
+and flush list mutex and do a thread yield. Set the current page to
+"sticky" so that it is not relocated during the yield.
@return TRUE if yielded */
static
ibool
@@ -439,7 +439,7 @@ buf_flush_try_yield(
buf_flush_list_mutex_exit(buf_pool);
- /* Release the buffer pool and block mutex
+ /* Release the LRU list and block mutex
to give the other threads a go. */
buf_flush_yield(buf_pool, bpage);
@@ -472,7 +472,7 @@ buf_flush_or_remove_page(
mutex_t* block_mutex;
ibool processed = FALSE;
- ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_ad(buf_flush_list_mutex_own(buf_pool));
block_mutex = buf_page_get_mutex(bpage);
@@ -595,11 +595,11 @@ buf_flush_dirty_pages(
ibool all_freed;
do {
- buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
all_freed = buf_flush_or_remove_pages(buf_pool, id);
- buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
ut_ad(buf_flush_validate(buf_pool));
@@ -659,8 +659,16 @@ scan_again:
goto next_page;
} else {
- block_mutex = buf_page_get_mutex(bpage);
- mutex_enter(block_mutex);
+ block_mutex = buf_page_get_mutex_enter(bpage);
+
+ if (!block_mutex) {
+ /* It may be impossible case...
+ Something wrong, so will be scan_again */
+
+ all_freed = FALSE;
+ goto next_page;
+ }
+
if (bpage->buf_fix_count > 0) {
@@ -694,7 +702,8 @@ scan_again:
ulint page_no;
ulint zip_size;
- buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
zip_size = buf_page_get_zip_size(bpage);
page_no = buf_page_get_page_no(bpage);
@@ -2370,9 +2379,23 @@ buf_LRU_free_one_page(
be in a state where it can be freed; there
may or may not be a hash index to the page */
{
+#ifdef UNIV_DEBUG
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+#endif
+ mutex_t* block_mutex = buf_page_get_mutex(bpage);
+
+ ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(block_mutex));
+
if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
!= BUF_BLOCK_ZIP_FREE) {
buf_LRU_block_free_hashed_page((buf_block_t*) bpage, TRUE);
+ } else {
+ /* The block_mutex should have been released by
+ buf_LRU_block_remove_hashed_page() when it returns
+ BUF_BLOCK_ZIP_FREE. */
+ ut_ad(block_mutex == &buf_pool->zip_mutex);
+ mutex_enter(block_mutex);
}
}
diff --git a/storage/xtradb/buf/buf0rea.c b/storage/xtradb/buf/buf0rea.c
index 4ba0d2cf577..c29dcbf0444 100644
--- a/storage/xtradb/buf/buf0rea.c
+++ b/storage/xtradb/buf/buf0rea.c
@@ -51,6 +51,44 @@ i/o-fixed buffer blocks */
#define BUF_READ_AHEAD_PEND_LIMIT 2
/********************************************************************//**
+Unfixes the pages, unlatches the page,
+removes it from page_hash and removes it from LRU. */
+static
+void
+buf_read_page_handle_error(
+/*=======================*/
+ buf_page_t* bpage) /*!< in: pointer to the block */
+{
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ const ibool uncompressed = (buf_page_get_state(bpage)
+ == BUF_BLOCK_FILE_PAGE);
+
+ /* First unfix and release lock on the bpage */
+ buf_pool_mutex_enter(buf_pool);
+ mutex_enter(buf_page_get_mutex(bpage));
+ ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ);
+ ut_ad(bpage->buf_fix_count == 0);
+
+ /* Set BUF_IO_NONE before we remove the block from LRU list */
+ buf_page_set_io_fix(bpage, BUF_IO_NONE);
+
+ if (uncompressed) {
+ rw_lock_x_unlock_gen(
+ &((buf_block_t*) bpage)->lock,
+ BUF_IO_READ);
+ }
+
+ /* remove the block from LRU list */
+ buf_LRU_free_one_page(bpage);
+
+ ut_ad(buf_pool->n_pend_reads > 0);
+ buf_pool->n_pend_reads--;
+
+ mutex_exit(buf_page_get_mutex(bpage));
+ buf_pool_mutex_exit(buf_pool);
+}
+
+/********************************************************************//**
Low-level function which reads a page asynchronously from a file to the
buffer buf_pool if it is not already there, in which case does nothing.
Sets the io_fix flag and sets an exclusive lock on the buffer frame. The
@@ -198,6 +236,11 @@ not_to_recover:
((buf_block_t*) bpage)->frame, bpage, trx);
}
+ if (*err == DB_TABLESPACE_DELETED) {
+ buf_read_page_handle_error(bpage);
+ return(0);
+ }
+
if (srv_pass_corrupt_table) {
if (*err != DB_SUCCESS) {
bpage->is_corrupt = TRUE;
@@ -210,7 +253,9 @@ not_to_recover:
thd_wait_end(NULL);
/* The i/o is already completed when we arrive from
fil_read */
- buf_page_io_complete(bpage);
+ if (!buf_page_io_complete(bpage)) {
+ return(0);
+ }
}
return(1);
diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c
index 3ee045807ed..516b6e927e0 100644
--- a/storage/xtradb/dict/dict0dict.c
+++ b/storage/xtradb/dict/dict0dict.c
@@ -170,6 +170,7 @@ void
dict_field_print_low(
/*=================*/
const dict_field_t* field); /*!< in: field */
+#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
Frees a foreign key struct. */
static
@@ -183,7 +184,7 @@ and unique key errors */
UNIV_INTERN FILE* dict_foreign_err_file = NULL;
/* mutex protecting the foreign and unique error buffers */
UNIV_INTERN mutex_t dict_foreign_err_mutex;
-
+#endif /* !UNIV_HOTBACKUP */
/******************************************************************//**
Makes all characters in a NUL-terminated UTF-8 string lower case. */
UNIV_INTERN
@@ -2318,6 +2319,7 @@ dict_index_build_internal_non_clust(
return(new_index);
}
+#ifndef UNIV_HOTBACKUP
/*====================== FOREIGN KEY PROCESSING ========================*/
/*********************************************************************//**
@@ -2582,6 +2584,7 @@ dict_foreign_find_equiv_index(
FALSE/* allow columns to be NULL */));
}
+#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
Returns an index object by matching on the name and column names and
if more than one index matches return the index with the max id
@@ -2641,6 +2644,7 @@ dict_table_get_index_by_max_id(
return(found);
}
+#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Report an error in a foreign key definition. */
static
@@ -2806,6 +2810,7 @@ dict_foreign_add_to_cache(
return(DB_SUCCESS);
}
+#endif /* !UNIV_HOTBACKUP */
/*********************************************************************//**
Scans from pointer onwards. Stops if is at the start of a copy of
'string' where characters are compared without case sensitivity, and
@@ -3285,6 +3290,7 @@ end_of_string:
}
}
+#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
Finds the highest [number] for foreign key constraints of the table. Looks
only at the >= 4.0.18-format id's, which are of the form
@@ -4121,7 +4127,7 @@ syntax_error:
}
/*==================== END OF FOREIGN KEY PROCESSING ====================*/
-
+#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
Returns an index object if it is found in the dictionary cache.
Assumes that dict_sys->mutex is already being held.
@@ -4654,12 +4660,6 @@ next_rec:
}
btr_pcur_close(&pcur);
mtr_commit(&mtr);
-
- if (rests) {
- fprintf(stderr, "InnoDB: Warning: failed to store %lu stats entries"
- " of %s/%s to SYS_STATS system table.\n",
- rests, index->table_name, index->name);
- }
}
/*===========================================*/
@@ -4895,6 +4895,7 @@ next_rec:
}
}
+#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Prints info of a foreign key constraint. */
static
@@ -4925,6 +4926,7 @@ dict_foreign_print_low(
fputs(" )\n", stderr);
}
+#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
Prints a table data. */
UNIV_INTERN
@@ -5107,6 +5109,7 @@ dict_field_print_low(
}
}
+#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Outputs info on a foreign key of a table in a format suitable for
CREATE TABLE. */
@@ -5295,6 +5298,7 @@ dict_print_info_on_foreign_keys(
mutex_exit(&(dict_sys->mutex));
}
+#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
Displays the names of the index and the table. */
UNIV_INTERN
@@ -5425,6 +5429,28 @@ dict_table_replace_index_in_foreign_list(
foreign->foreign_index = new_index;
}
}
+
+
+ for (foreign = UT_LIST_GET_FIRST(table->referenced_list);
+ foreign;
+ foreign = UT_LIST_GET_NEXT(referenced_list, foreign)) {
+
+ dict_index_t* new_index;
+
+ if (foreign->referenced_index == index) {
+ ut_ad(foreign->referenced_table == index->table);
+
+ new_index = dict_foreign_find_index(
+ foreign->referenced_table,
+ foreign->referenced_col_names,
+ foreign->n_fields, index,
+ /*check_charsets=*/TRUE, /*check_null=*/FALSE);
+ ut_ad(new_index || !trx->check_foreigns);
+ ut_ad(!new_index || new_index->table == index->table);
+
+ foreign->referenced_index = new_index;
+ }
+ }
}
/**********************************************************************//**
diff --git a/storage/xtradb/dict/dict0load.c b/storage/xtradb/dict/dict0load.c
index 44492960bb8..0ef74ea8b7c 100644
--- a/storage/xtradb/dict/dict0load.c
+++ b/storage/xtradb/dict/dict0load.c
@@ -178,7 +178,7 @@ dict_print(void)
monitor printout */
mutex_enter(&kernel_mutex);
- srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
+ srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION;
mutex_exit(&kernel_mutex);
heap = mem_heap_create(1000);
@@ -215,7 +215,7 @@ dict_print(void)
/* Restore the fatal semaphore wait timeout */
mutex_enter(&kernel_mutex);
- srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
+ srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION;
mutex_exit(&kernel_mutex);
}
diff --git a/storage/xtradb/dict/dict0mem.c b/storage/xtradb/dict/dict0mem.c
index 617c68925cb..6b8c11dfa7a 100644
--- a/storage/xtradb/dict/dict0mem.c
+++ b/storage/xtradb/dict/dict0mem.c
@@ -33,8 +33,8 @@ Created 1/8/1996 Heikki Tuuri
#include "data0type.h"
#include "mach0data.h"
#include "dict0dict.h"
-#include "ha_prototypes.h" /* innobase_casedn_str()*/
#ifndef UNIV_HOTBACKUP
+# include "ha_prototypes.h" /* innobase_casedn_str()*/
# include "lock0lock.h"
#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_BLOB_DEBUG
@@ -274,6 +274,7 @@ dict_mem_index_create(
return(index);
}
+#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Creates and initializes a foreign constraint memory object.
@return own: foreign constraint struct */
@@ -348,6 +349,7 @@ dict_mem_referenced_table_name_lookup_set(
}
}
+#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
Adds a field definition to an index. NOTE: does not take a copy
of the column name if the field is a column. The memory occupied
diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c
index 2b67bdafeb9..4ab2c16d41f 100644
--- a/storage/xtradb/fil/fil0fil.c
+++ b/storage/xtradb/fil/fil0fil.c
@@ -867,8 +867,10 @@ fil_node_close_file(
ut_a(node->open);
ut_a(node->n_pending == 0 || node->space->is_being_deleted);
ut_a(node->n_pending_flushes == 0);
+#ifndef UNIV_HOTBACKUP
ut_a(node->modification_counter == node->flush_counter
|| srv_fast_shutdown == 2);
+#endif /* !UNIV_HOTBACKUP */
ret = os_file_close(node->handle);
ut_a(ret);
@@ -1932,7 +1934,7 @@ fil_inc_pending_ops(
if (space == NULL) {
fprintf(stderr,
- "InnoDB: Error: trying to do ibuf merge to a"
+ "InnoDB: Error: trying to do an operation on a"
" dropped tablespace %lu\n",
(ulong) id);
}
@@ -3440,6 +3442,7 @@ skip_info:
for (offset = 0; offset < free_limit_bytes;
offset += zip_size ? zip_size : UNIV_PAGE_SIZE) {
ibool page_is_corrupt;
+ ibool is_descr_page = FALSE;
success = os_file_read(file, page,
(ulint)(offset & 0xFFFFFFFFUL),
@@ -3478,6 +3481,7 @@ skip_info:
/* store as descr page */
memcpy(descr_page, page, (zip_size ? zip_size : UNIV_PAGE_SIZE));
+ is_descr_page = TRUE;
} else if (descr_is_corrupt) {
/* unknown state of the page */
@@ -3554,7 +3558,8 @@ skip_info:
}
}
- if (fil_page_get_type(page) == FIL_PAGE_INDEX) {
+ if (fil_page_get_type(page) ==
+ FIL_PAGE_INDEX && !is_descr_page) {
index_id_t tmp = mach_read_from_8(page + (PAGE_HEADER + PAGE_INDEX_ID));
for (i = 0; i < n_index; i++) {
diff --git a/storage/xtradb/ha/ha0ha.c b/storage/xtradb/ha/ha0ha.c
index 2f5051e541f..b9499607bce 100644
--- a/storage/xtradb/ha/ha0ha.c
+++ b/storage/xtradb/ha/ha0ha.c
@@ -28,6 +28,7 @@ Created 8/22/1994 Heikki Tuuri
#include "ha0ha.ic"
#endif
+#ifndef UNIV_HOTBACKUP
#ifdef UNIV_DEBUG
# include "buf0buf.h"
#endif /* UNIV_DEBUG */
@@ -51,17 +52,13 @@ ha_create_func(
hash table: must be a power of 2, or 0 */
{
hash_table_t* table;
-#ifndef UNIV_HOTBACKUP
ulint i;
-#endif /* !UNIV_HOTBACKUP */
ut_ad(ut_is_2pow(n_mutexes));
table = hash_create(n);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-# ifndef UNIV_HOTBACKUP
table->adaptive = TRUE;
-# endif /* !UNIV_HOTBACKUP */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
/* Creating MEM_HEAP_BTR_SEARCH type heaps can potentially fail,
but in practise it never should in this case, hence the asserts. */
@@ -74,7 +71,6 @@ ha_create_func(
return(table);
}
-#ifndef UNIV_HOTBACKUP
hash_create_mutexes(table, n_mutexes, mutex_level);
table->heaps = mem_alloc(n_mutexes * sizeof(void*));
@@ -83,7 +79,6 @@ ha_create_func(
table->heaps[i] = mem_heap_create_in_btr_search(4096);
ut_a(table->heaps[i]);
}
-#endif /* !UNIV_HOTBACKUP */
return(table);
}
@@ -134,7 +129,6 @@ ha_insert_for_fold_func(
while (prev_node != NULL) {
if (prev_node->fold == fold) {
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-# ifndef UNIV_HOTBACKUP
if (table->adaptive) {
buf_block_t* prev_block = prev_node->block;
ut_a(prev_block->frame
@@ -143,7 +137,6 @@ ha_insert_for_fold_func(
prev_block->n_pointers--;
block->n_pointers++;
}
-# endif /* !UNIV_HOTBACKUP */
prev_node->block = block;
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -171,11 +164,9 @@ ha_insert_for_fold_func(
ha_node_set_data(node, block, data);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-# ifndef UNIV_HOTBACKUP
if (table->adaptive) {
block->n_pointers++;
}
-# endif /* !UNIV_HOTBACKUP */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
node->fold = fold;
@@ -217,13 +208,11 @@ ha_delete_hash_node(
#endif /* UNIV_SYNC_DEBUG */
ut_ad(btr_search_enabled);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-# ifndef UNIV_HOTBACKUP
if (table->adaptive) {
ut_a(del_node->block->frame = page_align(del_node->data));
ut_a(del_node->block->n_pointers > 0);
del_node->block->n_pointers--;
}
-# endif /* !UNIV_HOTBACKUP */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
HASH_DELETE_AND_COMPACT(ha_node_t, next, table, del_node);
@@ -264,13 +253,11 @@ ha_search_and_update_if_found_func(
if (node) {
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-# ifndef UNIV_HOTBACKUP
if (table->adaptive) {
ut_a(node->block->n_pointers > 0);
node->block->n_pointers--;
new_block->n_pointers++;
}
-# endif /* !UNIV_HOTBACKUP */
node->block = new_block;
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -278,7 +265,6 @@ ha_search_and_update_if_found_func(
}
}
-#ifndef UNIV_HOTBACKUP
/*****************************************************************//**
Removes from the chain determined by fold all nodes whose data pointer
points to the page given. */
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index cd11e46358b..39d6fb4bf11 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -49,6 +49,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include <sql_acl.h> // PROCESS_ACL
#include <m_ctype.h>
+#include <debug_sync.h> // DEBUG_SYNC
#include <mysys_err.h>
#include <mysql/plugin.h>
#include <innodb_priv.h>
@@ -383,6 +384,7 @@ static int innobase_rollback_to_savepoint(handlerton *hton, THD* thd,
static int innobase_savepoint(handlerton *hton, THD* thd, void *savepoint);
static int innobase_release_savepoint(handlerton *hton, THD* thd,
void *savepoint);
+static void innobase_checkpoint_request(handlerton *hton, void *cookie);
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
@@ -483,10 +485,17 @@ static MYSQL_THDVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG,
NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0);
static MYSQL_THDVAR_ULONG(flush_log_at_trx_commit, PLUGIN_VAR_OPCMDARG,
- "Set to 0 (write and flush once per second),"
- " 1 (write and flush at each commit)"
- " or 2 (write at commit, flush once per second).",
- NULL, NULL, 1, 0, 2, 0);
+ "Controls the durability/speed trade-off for commits."
+ " Set to 0 (write and flush redo log to disk only once per second),"
+ " 1 (flush to disk at each commit),"
+ " 2 (write to log at commit but flush to disk only once per second)"
+ " or 3 (flush to disk at prepare and at commit, slower and usually redundant)."
+ " 1 and 3 guarantees that after a crash, committed transactions will"
+ " not be lost and will be consistent with the binlog and other transactional"
+ " engines. 2 can get inconsistent and lose transactions if there is a"
+ " power failure or kernel crash but not if mysqld crashes. 0 has no"
+ " guarantees in case of crash. 0 and 2 can be faster than 1 or 3.",
+ NULL, NULL, 1, 0, 3, 0);
static MYSQL_THDVAR_BOOL(fake_changes, PLUGIN_VAR_OPCMDARG,
"In the transaction after enabled, UPDATE, INSERT and DELETE only move the cursor to the records "
@@ -494,6 +503,9 @@ static MYSQL_THDVAR_BOOL(fake_changes, PLUGIN_VAR_OPCMDARG,
"This is to cause replication prefetch IO. ATTENTION: the transaction started after enabled is affected.",
NULL, NULL, FALSE);
+static MYSQL_THDVAR_ULONG(merge_sort_block_size, PLUGIN_VAR_RQCMDARG,
+ "The block size used doing external merge-sort for secondary index creation.",
+ NULL, NULL, 1UL << 20, 1UL << 20, 1UL << 30, 0);
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
@@ -1010,6 +1022,20 @@ thd_flush_log_at_trx_commit(
return(THDVAR((THD*) thd, flush_log_at_trx_commit));
}
+/******************************************************************//**
+Returns the merge-sort block size used for the secondary index creation
+for the current connection.
+@return the merge-sort block size, in bytes */
+extern "C" UNIV_INTERN
+ulong
+thd_merge_sort_block_size(
+/*================================*/
+ void* thd) /*!< in: thread handle (THD*), or NULL to query
++ the global merge_sort_block_size */
+{
+ return(THDVAR((THD*) thd, merge_sort_block_size));
+}
+
/********************************************************************//**
Obtain the InnoDB transaction of a MySQL thread.
@return reference to transaction pointer */
@@ -1646,6 +1672,15 @@ innobase_next_autoinc(
ut_a(block > 0);
ut_a(max_value > 0);
+ /*
+ Allow auto_increment to go over max_value up to max ulonglong.
+ This allows us to detect that all values are exhausted.
+ If we don't do this, we will return max_value several times
+ and get duplicate key errors instead of auto increment value
+ out of range.
+ */
+ max_value= (~(ulonglong) 0);
+
/* Current value should never be greater than the maximum. */
ut_a(current <= max_value);
@@ -2469,6 +2504,7 @@ innobase_init(
innobase_hton->recover=innobase_xa_recover;
innobase_hton->commit_by_xid=innobase_commit_by_xid;
innobase_hton->rollback_by_xid=innobase_rollback_by_xid;
+ innobase_hton->commit_checkpoint_request=innobase_checkpoint_request;
innobase_hton->checkpoint_state= innobase_checkpoint_state;
innobase_hton->create_cursor_read_view=innobase_create_cursor_view;
innobase_hton->set_cursor_read_view=innobase_set_cursor_view;
@@ -2870,6 +2906,7 @@ innobase_change_buffering_inited_ok:
srv_read_ahead &= 3;
srv_adaptive_flushing_method %= 3;
+ srv_flush_neighbor_pages %= 3;
srv_force_recovery = (ulint) innobase_force_recovery;
@@ -3153,7 +3190,9 @@ innobase_commit_low(
#ifdef MYSQL_SERVER
THD *thd=current_thd;
- if (thd && thd_is_replication_slave_thread(thd)) {
+ if (innobase_overwrite_relay_log_info &&
+ thd && thd_is_replication_slave_thread(thd) &&
+ thd->connection_name.length) {
/* Update the replication position info inside InnoDB.
In embedded server, does nothing. */
const char *log_file_name, *group_relay_log_name;
@@ -3492,6 +3531,19 @@ innobase_rollback_trx(
}
/*****************************************************************//**
+Handle a commit checkpoint request from server layer.
+We simply flush the redo log immediately and do the notify call.*/
+static
+void
+innobase_checkpoint_request(
+ handlerton *hton,
+ void *cookie)
+{
+ log_buffer_flush_to_disk();
+ commit_checkpoint_notify_ha(hton, cookie);
+}
+
+/*****************************************************************//**
Rolls back a transaction to a savepoint.
@return 0 if success, HA_ERR_NO_SAVEPOINT if no savepoint with the
given name */
@@ -4701,6 +4753,27 @@ table_opened:
}
UNIV_INTERN
+handler*
+ha_innobase::clone(
+/*===============*/
+ const char* name, /*!< in: table name */
+ MEM_ROOT* mem_root) /*!< in: memory context */
+{
+ ha_innobase* new_handler;
+
+ DBUG_ENTER("ha_innobase::clone");
+
+ new_handler = static_cast<ha_innobase*>(handler::clone(name,
+ mem_root));
+ if (new_handler) {
+ new_handler->prebuilt->select_lock_type
+ = prebuilt->select_lock_type;
+ }
+
+ DBUG_RETURN(new_handler);
+}
+
+UNIV_INTERN
uint
ha_innobase::max_supported_key_part_length() const
{
@@ -5957,7 +6030,10 @@ no_commit:
goto report_error;
}
- /* MySQL errors are passed straight back. */
+ /* MySQL errors are passed straight back. except for
+ HA_ERR_AUTO_INC_READ_FAILED. This can only happen
+ for values out of range.
+ */
error_result = (int) error;
goto func_exit;
}
@@ -6661,6 +6737,7 @@ ha_innobase::index_read(
ulint ret;
DBUG_ENTER("index_read");
+ DEBUG_SYNC_C("ha_innobase_index_read_begin");
ut_a(prebuilt->trx == thd_to_trx(user_thd));
ut_ad(key_len != 0 || find_flag != HA_READ_KEY_EXACT);
@@ -8538,6 +8615,8 @@ ha_innobase::rename_table(
error = innobase_rename_table(trx, from, to, TRUE);
+ DEBUG_SYNC(thd, "after_innobase_rename_table");
+
/* Tell the InnoDB server that there might be work for
utility threads: */
@@ -8865,10 +8944,15 @@ innobase_get_mysql_key_number_for_index(
}
}
- /* Print an error message if we cannot find the index
- ** in the "index translation table". */
- sql_print_error("Cannot find index %s in InnoDB index "
- "translation table.", index->name);
+ /* If index_count in translation table is set to 0, it
+ is possible we are in the process of rebuilding table,
+ do not spit error in this case */
+ if (share->idx_trans_tbl.index_count) {
+ /* Print an error message if we cannot find the index
+ ** in the "index translation table". */
+ sql_print_error("Cannot find index %s in InnoDB index "
+ "translation table.", index->name);
+ }
}
/* If we do not have an "index translation table", or not able
@@ -9262,9 +9346,10 @@ ha_innobase::info_low(
}
else if (rec_per_key > 1) {
rec_per_key =
- (ha_rows) (k_rec_per_key *
- (double)rec_per_key /
- n_rows);
+ (ha_rows)
+ (k_rec_per_key *
+ (double)rec_per_key /
+ n_rows);
}
key_info->rec_per_key[k++]=
@@ -9432,7 +9517,7 @@ ha_innobase::check(
/* Enlarge the fatal lock wait timeout during CHECK TABLE. */
mutex_enter(&kernel_mutex);
- srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
+ srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION;
mutex_exit(&kernel_mutex);
for (index = dict_table_get_first_index(prebuilt->table);
@@ -9573,7 +9658,7 @@ ha_innobase::check(
/* Restore the fatal lock wait timeout after CHECK TABLE. */
mutex_enter(&kernel_mutex);
- srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
+ srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION;
mutex_exit(&kernel_mutex);
prebuilt->trx->op_info = "";
@@ -10455,6 +10540,7 @@ innodb_show_status(
const long MAX_STATUS_SIZE = 1048576;
ulint trx_list_start = ULINT_UNDEFINED;
ulint trx_list_end = ULINT_UNDEFINED;
+ bool res;
DBUG_ENTER("innodb_show_status");
DBUG_ASSERT(hton == innodb_hton_ptr);
@@ -10518,12 +10604,13 @@ innodb_show_status(
mutex_exit(&srv_monitor_file_mutex);
- stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name),
- STRING_WITH_LEN(""), str, flen);
+ res= stat_print(thd, innobase_hton_name,
+ (uint) strlen(innobase_hton_name),
+ STRING_WITH_LEN(""), str, flen);
my_free(str);
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(res);
}
/************************************************************************//**
@@ -11135,13 +11222,17 @@ ha_innobase::get_auto_increment(
/* Not in the middle of a mult-row INSERT. */
} else if (prebuilt->autoinc_last_value == 0) {
set_if_bigger(*first_value, autoinc);
- /* Check for -ve values. */
- } else if (*first_value > col_max_value && trx->n_autoinc_rows > 0) {
- /* Set to next logical value. */
- ut_a(autoinc > trx->n_autoinc_rows);
- *first_value = (autoinc - trx->n_autoinc_rows) - 1;
}
+ if (*first_value > col_max_value)
+ {
+ /* Out of range number. Let handler::update_auto_increment()
+ take care of this */
+ prebuilt->autoinc_last_value = 0;
+ dict_table_autoinc_unlock(prebuilt->table);
+ *nb_reserved_values = 0;
+ return;
+ }
*nb_reserved_values = trx->n_autoinc_rows;
/* With old style AUTOINC locking we only update the table's
@@ -11150,7 +11241,7 @@ ha_innobase::get_auto_increment(
ulonglong current;
ulonglong next_value;
- current = *first_value > col_max_value ? autoinc : *first_value;
+ current = *first_value;
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
@@ -12368,7 +12459,7 @@ static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
PLUGIN_VAR_RQCMDARG,
"Number of IOPs the server can do. Tunes the background IO rate",
- NULL, NULL, 200, 100, ~0L, 0);
+ NULL, NULL, 200, 100, ~0UL, 0);
static MYSQL_SYSVAR_ULONG(purge_batch_size, srv_purge_batch_size,
PLUGIN_VAR_OPCMDARG,
@@ -12501,7 +12592,7 @@ static MYSQL_SYSVAR_BOOL(adaptive_flushing, srv_adaptive_flushing,
static MYSQL_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
PLUGIN_VAR_RQCMDARG,
"Desired maximum length of the purge queue (0 = no limit)",
- NULL, NULL, 0, 0, ~0L, 0);
+ NULL, NULL, 0, 0, ~0UL, 0);
static MYSQL_SYSVAR_BOOL(rollback_on_timeout, innobase_rollback_on_timeout,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
@@ -12605,7 +12696,7 @@ static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
static MYSQL_SYSVAR_ULONG(concurrency_tickets, srv_n_free_tickets_to_enter,
PLUGIN_VAR_RQCMDARG,
"Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
- NULL, NULL, 500L, 1L, ~0L, 0);
+ NULL, NULL, 500L, 1L, ~0UL, 0);
#ifdef EXTENDED_FOR_KILLIDLE
#define kill_idle_help_text "If non-zero value, the idle session with transaction which is idle over the value in seconds is killed by InnoDB."
@@ -12675,12 +12766,12 @@ static MYSQL_SYSVAR_LONG(open_files, innobase_open_files,
static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
PLUGIN_VAR_RQCMDARG,
"Count of spin-loop rounds in InnoDB mutexes (30 by default)",
- NULL, NULL, 30L, 0L, ~0L, 0);
+ NULL, NULL, 30L, 0L, ~0UL, 0);
static MYSQL_SYSVAR_ULONG(spin_wait_delay, srv_spin_wait_delay,
PLUGIN_VAR_OPCMDARG,
"Maximum delay between polling for a spin lock (6 by default)",
- NULL, NULL, 6L, 0L, ~0L, 0);
+ NULL, NULL, 6L, 0L, ~0UL, 0);
static MYSQL_SYSVAR_BOOL(thread_concurrency_timer_based,
innobase_thread_concurrency_timer_based,
@@ -12696,7 +12787,7 @@ static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
static MYSQL_SYSVAR_ULONG(thread_sleep_delay, srv_thread_sleep_delay,
PLUGIN_VAR_RQCMDARG,
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep",
- NULL, NULL, 10000L, 0L, ~0L, 0);
+ NULL, NULL, 10000L, 0L, ~0UL, 0);
static MYSQL_SYSVAR_STR(data_file_path, innobase_data_file_path,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
@@ -12871,7 +12962,7 @@ innodb_adaptive_flushing_method_update(
void* var_ptr,
const void* save)
{
- *(long *)var_ptr= (*(long *)save) % 4;
+ *(long *)var_ptr= (*(long *)save) % 3;
}
const char *adaptive_flushing_method_names[]=
{
@@ -12934,7 +13025,7 @@ static MYSQL_SYSVAR_ENUM(corrupt_table_action, srv_pass_corrupt_table,
"Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, "
"when used with file_per_table. "
"All file io for the datafile after detected as corrupt are disabled, "
- "except for the deletion.",
+ "except for the deletion. Possible options are 'assert', 'warn' & 'salvage'",
NULL, NULL, 0, &corrupt_table_action_typelib);
static MYSQL_SYSVAR_ULINT(lazy_drop_table, srv_lazy_drop_table,
@@ -13049,6 +13140,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(corrupt_table_action),
MYSQL_SYSVAR(lazy_drop_table),
MYSQL_SYSVAR(fake_changes),
+ MYSQL_SYSVAR(merge_sort_block_size),
NULL
};
@@ -13069,6 +13161,7 @@ maria_declare_plugin(xtradb)
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
},
i_s_innodb_rseg_maria,
+i_s_innodb_undo_logs_maria,
i_s_innodb_trx_maria,
i_s_innodb_locks_maria,
i_s_innodb_lock_waits_maria,
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index b48805ad0a5..933d75cf0d2 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -134,6 +134,7 @@ class ha_innobase: public handler
const key_map* keys_to_use_for_scanning();
int open(const char *name, int mode, uint test_if_locked);
+ handler* clone(const char *name, MEM_ROOT *mem_root);
int close(void);
double scan_time();
double read_time(uint index, uint ranges, ha_rows rows);
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index 92e51d37d7d..0496cb98080 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -713,6 +713,10 @@ ha_innobase::add_index(
ut_a(indexed_table == prebuilt->table);
+ if (indexed_table->tablespace_discarded) {
+ DBUG_RETURN(-1);
+ }
+
/* Check that index keys are sensible */
error = innobase_check_index_keys(key_info, num_of_keys, prebuilt->table);
@@ -781,7 +785,7 @@ ha_innobase::add_index(
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
/* If a new primary key is defined for the table we need
to drop the original table and rebuild all indexes. */
@@ -817,7 +821,7 @@ ha_innobase::add_index(
}
ut_d(dict_table_check_for_dup_indexes(prebuilt->table,
- FALSE));
+ TRUE));
mem_heap_free(heap);
trx_general_rollback_for_mysql(trx, NULL);
row_mysql_unlock_data_dictionary(trx);
@@ -1071,7 +1075,7 @@ ha_innobase::final_add_index(
trx_commit_for_mysql(prebuilt->trx);
}
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
row_mysql_unlock_data_dictionary(trx);
trx_free_for_mysql(trx);
@@ -1118,7 +1122,7 @@ ha_innobase::prepare_drop_index(
/* Test and mark all the indexes to be dropped */
row_mysql_lock_data_dictionary(trx);
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
/* Check that none of the indexes have previously been flagged
for deletion. */
@@ -1289,7 +1293,7 @@ func_exit:
} while (index);
}
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
row_mysql_unlock_data_dictionary(trx);
DBUG_RETURN(err);
@@ -1342,7 +1346,7 @@ ha_innobase::final_drop_index(
prebuilt->table->flags, user_thd);
row_mysql_lock_data_dictionary(trx);
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
if (UNIV_UNLIKELY(err)) {
@@ -1386,7 +1390,7 @@ ha_innobase::final_drop_index(
share->idx_trans_tbl.index_count = 0;
func_exit:
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
trx_commit_for_mysql(trx);
trx_commit_for_mysql(prebuilt->trx);
row_mysql_unlock_data_dictionary(trx);
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index 1c40b87bbbd..5d86ea98d27 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -49,6 +49,7 @@ extern "C" {
#include "trx0i_s.h"
#include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */
#include "trx0rseg.h" /* for trx_rseg_struct */
+#include "trx0undo.h" /* for trx_undo_struct */
#include "trx0sys.h" /* for trx_sys */
#include "dict0dict.h" /* for dict_sys */
#include "buf0lru.h" /* for XTRA_LRU_[DUMP/RESTORE] */
@@ -1578,6 +1579,8 @@ i_s_sys_tables_fill_table(
DBUG_ENTER("i_s_sys_tables_fill_table");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
@@ -1833,6 +1836,8 @@ i_s_sys_tables_fill_table_stats(
DBUG_ENTER("i_s_sys_tables_fill_table_stats");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
@@ -2029,6 +2034,8 @@ i_s_sys_indexes_fill_table(
DBUG_ENTER("i_s_sys_indexes_fill_table");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
@@ -2218,6 +2225,8 @@ i_s_sys_columns_fill_table(
DBUG_ENTER("i_s_sys_columns_fill_table");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
@@ -2372,6 +2381,8 @@ i_s_sys_fields_fill_table(
DBUG_ENTER("i_s_sys_fields_fill_table");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
@@ -2553,6 +2564,8 @@ i_s_sys_foreign_fill_table(
DBUG_ENTER("i_s_sys_foreign_fill_table");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
@@ -2716,6 +2729,8 @@ i_s_sys_foreign_cols_fill_table(
DBUG_ENTER("i_s_sys_foreign_cols_fill_table");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
DBUG_RETURN(0);
@@ -2883,6 +2898,8 @@ i_s_sys_stats_fill_table(
DBUG_ENTER("i_s_sys_stats_fill_table");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
DBUG_RETURN(0);
@@ -3199,6 +3216,8 @@ i_s_innodb_table_stats_fill(
DBUG_ENTER("i_s_innodb_table_stats_fill");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
DBUG_RETURN(0);
@@ -3262,6 +3281,8 @@ i_s_innodb_index_stats_fill(
DBUG_ENTER("i_s_innodb_index_stats_fill");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
DBUG_RETURN(0);
@@ -3422,6 +3443,8 @@ i_s_innodb_admin_command_fill(
DBUG_ENTER("i_s_innodb_admin_command_fill");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
DBUG_RETURN(0);
@@ -4415,3 +4438,292 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_pool_pages_blob_maria =
NULL,
INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
};
+
+
+static ST_FIELD_INFO i_s_innodb_undo_logs_fields_info[] =
+{
+#define IDX_USEG_TRX_ID 0
+ {STRUCT_FLD(field_name, "trx_id"),
+ STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define IDX_USEG_RSEG_ID 1
+ {STRUCT_FLD(field_name, "rseg_id"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define IDX_USEG_USEG_ID 2
+ {STRUCT_FLD(field_name, "useg_id"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define IDX_USEG_TYPE 3
+#define USEG_TYPE_MAX_LEN 256
+ {STRUCT_FLD(field_name, "type"),
+ STRUCT_FLD(field_length, USEG_TYPE_MAX_LEN),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+ #define IDX_USEG_STATE 4
+ #define USEG_STATE_MAX_LEN 256
+ {STRUCT_FLD(field_name, "state"),
+ STRUCT_FLD(field_length, USEG_STATE_MAX_LEN),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+#define IDX_USEG_SIZE 5
+ {STRUCT_FLD(field_name, "size"),
+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
+ END_OF_ST_FIELD_INFO
+};
+static
+int
+i_s_innodb_undo_logs_fill_store(
+/*=================*/
+ THD* thd, /* in: thread */
+ TABLE* table, /* in/out: table to fill */
+ trx_undo_t* useg) /* in: useg to fill from */
+{
+ char trx_id[TRX_ID_MAX_LEN + 1];
+
+ DBUG_ENTER("i_s_innodb_undo_logs_fill_store");
+
+ switch (useg->type) {
+ case TRX_UNDO_INSERT:
+ OK(field_store_string(table->field[IDX_USEG_TYPE], "INSERT"));
+ break;
+ case TRX_UNDO_UPDATE:
+ OK(field_store_string(table->field[IDX_USEG_TYPE], "UPDATE"));
+ break;
+ default:
+ OK(field_store_string(table->field[IDX_USEG_TYPE], "UNKNOWN"));
+ break;
+ }
+
+ ut_snprintf(trx_id, sizeof(trx_id), TRX_ID_FMT, useg->trx_id);
+
+ switch (useg->state) {
+ case TRX_UNDO_ACTIVE:
+ OK(field_store_string(table->field[IDX_USEG_TRX_ID], trx_id));
+ OK(field_store_string(table->field[IDX_USEG_STATE], "ACTIVE"));
+ break;
+ case TRX_UNDO_CACHED:
+ OK(field_store_string(table->field[IDX_USEG_TRX_ID], NULL));
+ OK(field_store_string(table->field[IDX_USEG_STATE], "CACHED"));
+ break;
+ case TRX_UNDO_TO_FREE:
+ OK(field_store_string(table->field[IDX_USEG_TRX_ID], NULL));
+ OK(field_store_string(table->field[IDX_USEG_STATE], "TO_FREE"));
+ break;
+ case TRX_UNDO_TO_PURGE:
+ OK(field_store_string(table->field[IDX_USEG_TRX_ID], NULL));
+ OK(field_store_string(table->field[IDX_USEG_STATE], "TO_PURGE"));
+ break;
+ case TRX_UNDO_PREPARED:
+ OK(field_store_string(table->field[IDX_USEG_TRX_ID], trx_id));
+ OK(field_store_string(table->field[IDX_USEG_STATE], "PREPARED"));
+ break;
+ default:
+ OK(field_store_string(table->field[IDX_USEG_TRX_ID], trx_id));
+ OK(field_store_string(table->field[IDX_USEG_STATE], "UNKNOWN"));
+ break;
+ }
+
+ table->field[IDX_USEG_RSEG_ID]->store(useg->rseg->id);
+ table->field[IDX_USEG_USEG_ID]->store(useg->id);
+ table->field[IDX_USEG_SIZE]->store(useg->size);
+ if (schema_table_store_record(thd, table)) {
+ DBUG_RETURN(1);
+ }
+ DBUG_RETURN(0);
+}
+static
+int
+i_s_innodb_undo_logs_fill(
+/*=================*/
+ THD* thd, /* in: thread */
+ TABLE_LIST* tables, /* in/out: tables to fill */
+ COND* cond) /* in: condition (ignored) */
+{
+ TABLE* table = (TABLE *) tables->table;
+ int status = 0;
+ trx_rseg_t* rseg;
+ trx_undo_t* useg;
+
+ DBUG_ENTER("i_s_innodb_undo_logs_fill");
+
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+ DBUG_RETURN(0);
+ }
+
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
+
+ rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
+ while (rseg && status == 0) {
+ mutex_enter(&(rseg->mutex));
+ useg = UT_LIST_GET_FIRST(rseg->update_undo_list);
+ while (useg && status == 0) {
+ status = i_s_innodb_undo_logs_fill_store(thd, table, useg);
+ useg = UT_LIST_GET_NEXT(undo_list, useg);
+ }
+
+ useg = UT_LIST_GET_FIRST(rseg->update_undo_cached);
+ while (useg && status == 0) {
+ status = i_s_innodb_undo_logs_fill_store(thd, table, useg);
+ useg = UT_LIST_GET_NEXT(undo_list, useg);
+ }
+
+ useg = UT_LIST_GET_FIRST(rseg->insert_undo_list);
+ while (useg && status == 0) {
+ status = i_s_innodb_undo_logs_fill_store(thd, table, useg);
+ useg = UT_LIST_GET_NEXT(undo_list, useg);
+ }
+
+ useg = UT_LIST_GET_FIRST(rseg->insert_undo_cached);
+ while (useg && status == 0) {
+ status = i_s_innodb_undo_logs_fill_store(thd, table, useg);
+ useg = UT_LIST_GET_NEXT(undo_list, useg);
+ }
+ mutex_exit(&(rseg->mutex));
+ rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
+ }
+
+ DBUG_RETURN(status);
+}
+
+static
+int
+i_s_innodb_undo_logs_init(
+/*=================*/
+ /* out: 0 on success */
+ void* p) /* in/out: table schema object */
+{
+ DBUG_ENTER("i_s_innodb_undo_logs_init");
+ ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
+
+ schema->fields_info = i_s_innodb_undo_logs_fields_info;
+ schema->fill_table = i_s_innodb_undo_logs_fill;
+
+ DBUG_RETURN(0);
+}
+
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_undo_logs =
+{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_UNDO_LOGS"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB rollback undo segment information"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, i_s_innodb_undo_logs_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */ STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ STRUCT_FLD(version, 0x0100 /* 1.0 */),
+
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
+
+ /* reserved for dependency checking */
+ /* void* */
+ STRUCT_FLD(__reserved1, NULL),
+
+ /* Plugin flags */
+ /* unsigned long */
+ STRUCT_FLD(flags, 0UL),
+};
+
+UNIV_INTERN struct st_maria_plugin i_s_innodb_undo_logs_maria =
+{
+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ /* int */
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
+
+ /* pointer to type-specific plugin descriptor */
+ /* void* */
+ STRUCT_FLD(info, &i_s_info),
+
+ /* plugin name */
+ /* const char* */
+ STRUCT_FLD(name, "INNODB_UNDO_LOGS"),
+
+ /* plugin author (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(author, "Percona"),
+
+ /* general descriptive text (for SHOW PLUGINS) */
+ /* const char* */
+ STRUCT_FLD(descr, "InnoDB rollback undo segment information"),
+
+ /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /* int */
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
+
+ /* the function to invoke when plugin is loaded */
+ /* int (*)(void*); */
+ STRUCT_FLD(init, i_s_innodb_undo_logs_init),
+
+ /* the function to invoke when plugin is unloaded */
+ /* int (*)(void*); */ STRUCT_FLD(deinit, i_s_common_deinit),
+
+ /* plugin version (for SHOW PLUGINS) */
+ STRUCT_FLD(version, 0x0100 /* 1.0 */),
+
+ /* struct st_mysql_show_var* */
+ STRUCT_FLD(status_vars, NULL),
+
+ /* struct st_mysql_sys_var** */
+ STRUCT_FLD(system_vars, NULL),
+
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE
+};
diff --git a/storage/xtradb/handler/i_s.h b/storage/xtradb/handler/i_s.h
index f39172ea0a9..329cc2f5f91 100644
--- a/storage/xtradb/handler/i_s.h
+++ b/storage/xtradb/handler/i_s.h
@@ -43,6 +43,7 @@ extern struct st_mysql_plugin i_s_innodb_sys_fields;
extern struct st_mysql_plugin i_s_innodb_sys_foreign;
extern struct st_mysql_plugin i_s_innodb_sys_foreign_cols;
extern struct st_mysql_plugin i_s_innodb_rseg;
+extern struct st_mysql_plugin i_s_innodb_undo_logs;
extern struct st_mysql_plugin i_s_innodb_sys_stats;
extern struct st_mysql_plugin i_s_innodb_table_stats;
extern struct st_mysql_plugin i_s_innodb_index_stats;
@@ -67,6 +68,7 @@ extern struct st_maria_plugin i_s_innodb_sys_foreign_maria;
extern struct st_maria_plugin i_s_innodb_sys_foreign_cols_maria;
extern struct st_maria_plugin i_s_innodb_sys_stats_maria;
extern struct st_maria_plugin i_s_innodb_rseg_maria;
+extern struct st_maria_plugin i_s_innodb_undo_logs_maria;
extern struct st_maria_plugin i_s_innodb_table_stats_maria;
extern struct st_maria_plugin i_s_innodb_index_stats_maria;
extern struct st_maria_plugin i_s_innodb_admin_command_maria;
diff --git a/storage/xtradb/include/btr0btr.h b/storage/xtradb/include/btr0btr.h
index 520527d0375..03e89ae3f7d 100644
--- a/storage/xtradb/include/btr0btr.h
+++ b/storage/xtradb/include/btr0btr.h
@@ -92,6 +92,8 @@ insert/delete buffer when the record is not in the buffer pool. */
buffer when the record is not in the buffer pool. */
#define BTR_DELETE 8192
+#endif /* UNIV_HOTBACKUP */
+
/**************************************************************//**
Report that an index page is corrupted. */
UNIV_INTERN
@@ -112,6 +114,7 @@ btr_corruption_report(
ut_error; \
}
+#ifndef UNIV_HOTBACKUP
#ifdef UNIV_BLOB_DEBUG
# include "ut0rbt.h"
/** An index->blobs entry for keeping track of off-page column references */
diff --git a/storage/xtradb/include/btr0types.h b/storage/xtradb/include/btr0types.h
index 6f515c3f58c..43c6b425688 100644
--- a/storage/xtradb/include/btr0types.h
+++ b/storage/xtradb/include/btr0types.h
@@ -39,6 +39,8 @@ typedef struct btr_cur_struct btr_cur_t;
/** B-tree search information for the adaptive hash index */
typedef struct btr_search_struct btr_search_t;
+#ifndef UNIV_HOTBACKUP
+
/** @brief The latch protecting the adaptive search system
This latch protects the
@@ -56,6 +58,8 @@ Bear in mind (3) and (4) when using the hash index.
extern rw_lock_t** btr_search_latch_part;
+#endif /* UNIV_HOTBACKUP */
+
/** The latch protecting the adaptive search system */
//#define btr_search_latch (*btr_search_latch_temp)
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index 7502942d681..1a4990be69f 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -608,34 +608,34 @@ ib_uint64_t
buf_block_get_modify_clock(
/*=======================*/
buf_block_t* block); /*!< in: block */
-#else /* !UNIV_HOTBACKUP */
-# define buf_block_modify_clock_inc(block) ((void) 0)
-#endif /* !UNIV_HOTBACKUP */
/*******************************************************************//**
Increments the bufferfix count. */
UNIV_INLINE
void
buf_block_buf_fix_inc_func(
/*=======================*/
-#ifdef UNIV_SYNC_DEBUG
+# ifdef UNIV_SYNC_DEBUG
const char* file, /*!< in: file name */
ulint line, /*!< in: line */
-#endif /* UNIV_SYNC_DEBUG */
+# endif /* UNIV_SYNC_DEBUG */
buf_block_t* block) /*!< in/out: block to bufferfix */
__attribute__((nonnull));
-#ifdef UNIV_SYNC_DEBUG
+# ifdef UNIV_SYNC_DEBUG
/** Increments the bufferfix count.
@param b in/out: block to bufferfix
@param f in: file name where requested
@param l in: line number where requested */
# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(f,l,b)
-#else /* UNIV_SYNC_DEBUG */
+# else /* UNIV_SYNC_DEBUG */
/** Increments the bufferfix count.
@param b in/out: block to bufferfix
@param f in: file name where requested
@param l in: line number where requested */
# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(b)
-#endif /* UNIV_SYNC_DEBUG */
+# endif /* UNIV_SYNC_DEBUG */
+#else /* !UNIV_HOTBACKUP */
+# define buf_block_modify_clock_inc(block) ((void) 0)
+#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
Calculates a page checksum which is stored to the page when it is written
to a file. Note that we must be careful to calculate the same value
@@ -1063,8 +1063,10 @@ buf_block_get_frame(
/*================*/
const buf_block_t* block) /*!< in: pointer to the control block */
__attribute__((pure));
+# define buf_block_get_frame_fast(block) buf_block_get_frame(block)
#else /* UNIV_DEBUG */
# define buf_block_get_frame(block) (block ? (block)->frame : 0)
+# define buf_block_get_frame_fast(block) (block)->frame
#endif /* UNIV_DEBUG */
/*********************************************************************//**
Gets the space id of a block.
@@ -1191,9 +1193,10 @@ buf_page_init_for_read(
ulint offset);/*!< in: page number */
/********************************************************************//**
Completes an asynchronous read or write request of a file page to or from
-the buffer pool. */
+the buffer pool.
+@return TRUE if successful */
UNIV_INTERN
-void
+ibool
buf_page_io_complete(
/*=================*/
buf_page_t* bpage); /*!< in: pointer to the block in question */
diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic
index 66006d366c6..6595e86a8fe 100644
--- a/storage/xtradb/include/buf0buf.ic
+++ b/storage/xtradb/include/buf0buf.ic
@@ -31,6 +31,7 @@ Created 11/5/1995 Heikki Tuuri
*******************************************************/
#include "mtr0mtr.h"
+#ifndef UNIV_HOTBACKUP
#include "buf0flu.h"
#include "buf0lru.h"
#include "buf0rea.h"
@@ -180,6 +181,7 @@ buf_page_peek_if_too_old(
return(!buf_page_peek_if_young(bpage));
}
}
+#endif /* !UNIV_HOTBACKUP */
/*********************************************************************//**
Gets the state of a block.
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index 6974e480144..de3605b1dfb 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -750,6 +750,7 @@ ulint
dict_table_zip_size(
/*================*/
const dict_table_t* table); /*!< in: table */
+#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
Obtain exclusive locks on all index trees of the table. This is to prevent
accessing index trees while InnoDB is updating internal metadata for
@@ -766,6 +767,7 @@ void
dict_table_x_unlock_indexes(
/*========================*/
dict_table_t* table); /*!< in: table */
+#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
Checks if a column is in the ordering columns of the clustered index of a
table. Column prefixes are treated like whole columns.
@@ -1278,7 +1280,7 @@ UNIV_INTERN
void
dict_close(void);
/*============*/
-
+#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Check whether the table is corrupted.
@return nonzero for corrupted table, zero for valid tables */
@@ -1299,6 +1301,7 @@ dict_index_is_corrupted(
const dict_index_t* index) /*!< in: index */
__attribute__((nonnull, pure, warn_unused_result));
+#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
Flags an index and table corrupted both in the data dictionary cache
and in the system table SYS_INDEXES. */
diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic
index 5ed9b182d6c..02eafcc5d9c 100644
--- a/storage/xtradb/include/dict0dict.ic
+++ b/storage/xtradb/include/dict0dict.ic
@@ -491,6 +491,7 @@ dict_table_zip_size(
return(dict_table_flags_to_zip_size(table->flags));
}
+#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
Obtain exclusive locks on all index trees of the table. This is to prevent
accessing index trees while InnoDB is updating internal metadata for
@@ -533,6 +534,7 @@ dict_table_x_unlock_indexes(
rw_lock_x_unlock(dict_index_get_lock(index));
}
}
+#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
Gets the number of fields in the internal representation of an index,
including fields added by the dictionary system.
diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h
index 2e200ba7f43..2907365a32a 100644
--- a/storage/xtradb/include/ha_prototypes.h
+++ b/storage/xtradb/include/ha_prototypes.h
@@ -312,4 +312,15 @@ innobase_get_lower_case_table_names(void);
/*=====================================*/
+/********************************************************************//**
+Returns the merge-sort block size used for the secondary index creation
+for the current connection.
+@return the merge-sort block size, in bytes */
+
+ulong
+thd_merge_sort_block_size(
+/*======================*/
+ void* thd); /*!< in: thread handle (THD*), or NULL to query
+ the global merge_sort_block_size */
+
#endif
diff --git a/storage/xtradb/include/log0log.h b/storage/xtradb/include/log0log.h
index 6b1c2859cf7..857ec0946c2 100644
--- a/storage/xtradb/include/log0log.h
+++ b/storage/xtradb/include/log0log.h
@@ -780,7 +780,6 @@ struct log_struct{
buffer */
#ifndef UNIV_HOTBACKUP
mutex_t mutex; /*!< mutex protecting the log */
-#endif /* !UNIV_HOTBACKUP */
mutex_t log_flush_order_mutex;/*!< mutex to serialize access to
the flush list when we are putting
@@ -790,6 +789,7 @@ struct log_struct{
mtr_commit and still ensure that
insertions in the flush_list happen
in the LSN order. */
+#endif /* !UNIV_HOTBACKUP */
byte* buf_ptr; /* unaligned log buffer */
byte* buf; /*!< log buffer */
ulint buf_size; /*!< log buffer size in bytes */
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index b153b0dba7f..5b1f9339845 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/include/os0file.h
@@ -316,7 +316,7 @@ to original un-instrumented file I/O APIs */
os_file_create_func(name, create, purpose, type, success)
# define os_file_create_simple(key, name, create, access, success) \
- os_file_create_simple_func(name, create_mode, access, success)
+ os_file_create_simple_func(name, create, access, success)
# define os_file_create_simple_no_error_handling( \
key, name, create_mode, access, success) \
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index e6db7fab158..a40683e00f1 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -117,13 +117,13 @@ extern ulint srv_max_file_format_at_startup;
/** Place locks to records only i.e. do not use next-key locking except
on duplicate key checking and foreign key checking */
extern ibool srv_locks_unsafe_for_binlog;
-#endif /* !UNIV_HOTBACKUP */
/* If this flag is TRUE, then we will use the native aio of the
OS (provided we compiled Innobase with it in), otherwise we will
use simulated aio we build below with threads.
Currently we support native aio on windows and linux */
extern my_bool srv_use_native_aio;
+#endif /* !UNIV_HOTBACKUP */
#ifdef __WIN__
extern ibool srv_use_native_conditions;
#endif
@@ -301,6 +301,7 @@ extern ibool srv_print_latch_waits;
extern ulint srv_activity_count;
extern ulint srv_fatal_semaphore_wait_threshold;
+#define SRV_SEMAPHORE_WAIT_EXTENSION 7200
extern ulint srv_dml_needed_delay;
extern long long srv_kill_idle_transaction;
diff --git a/storage/xtradb/include/trx0sys.h b/storage/xtradb/include/trx0sys.h
index 976cb31563f..c933fb405e1 100644
--- a/storage/xtradb/include/trx0sys.h
+++ b/storage/xtradb/include/trx0sys.h
@@ -248,7 +248,6 @@ UNIV_INLINE
trx_id_t
trx_sys_get_new_trx_id(void);
/*========================*/
-#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_DEBUG
/* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */
@@ -265,7 +264,6 @@ trx_write_trx_id(
/*=============*/
byte* ptr, /*!< in: pointer to memory where written */
trx_id_t id); /*!< in: id */
-#ifndef UNIV_HOTBACKUP
/*****************************************************************//**
Reads a trx id from an index page. In case that the id size changes in
some future version, this function should be used instead of
@@ -603,7 +601,6 @@ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_NO. */
#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE
/* @} */
-#ifndef UNIV_HOTBACKUP
/** File format tag */
/* @{ */
/** The offset of the file format tag on the trx system header page
@@ -622,6 +619,7 @@ identifier is added to this 64-bit constant. */
| TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW)
/* @} */
+#ifndef UNIV_HOTBACKUP
/** Doublewrite control struct */
struct trx_doublewrite_struct{
mutex_t mutex; /*!< mutex protecting the first_free field and
diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h
index eded5c303fa..a03f7aceafa 100644
--- a/storage/xtradb/include/trx0trx.h
+++ b/storage/xtradb/include/trx0trx.h
@@ -494,7 +494,6 @@ struct trx_struct{
this is set to 1 then registered should
also be set to 1. This is used in the
XA code */
- unsigned called_commit_ordered:1;/* 1 if innobase_commit_ordered has run. */
/*------------------------------*/
ulint isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */
ulint check_foreigns; /* normally TRUE, but if the user
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index f4b06ccefa4..ce59a3f2741 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -54,10 +54,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_BUGFIX 8
#ifndef PERCONA_INNODB_VERSION
-/* this is *not* the version of XtraDB as in Percona-Server sources,
- but the version of Percona-Server, where this XtraDB was taken from.
- Because Percona does not update XtraDB version for every release */
-#define PERCONA_INNODB_VERSION 26.0
+#define PERCONA_INNODB_VERSION 28.1
#endif
/* The following is the InnoDB version as shown in
diff --git a/storage/xtradb/log/log0recv.c b/storage/xtradb/log/log0recv.c
index c4429af5112..a554c576b6d 100644
--- a/storage/xtradb/log/log0recv.c
+++ b/storage/xtradb/log/log0recv.c
@@ -2980,7 +2980,7 @@ recv_recovery_from_checkpoint_start_func(
ib_uint64_t checkpoint_lsn;
ib_uint64_t checkpoint_no;
ib_uint64_t old_scanned_lsn;
- ib_uint64_t group_scanned_lsn;
+ ib_uint64_t group_scanned_lsn= 0;
ib_uint64_t contiguous_lsn;
#ifdef UNIV_LOG_ARCHIVE
ib_uint64_t archived_lsn;
diff --git a/storage/xtradb/mem/mem0dbg.c b/storage/xtradb/mem/mem0dbg.c
index ae43d6097a6..0909b7c9a64 100644
--- a/storage/xtradb/mem/mem0dbg.c
+++ b/storage/xtradb/mem/mem0dbg.c
@@ -24,7 +24,9 @@ but is included in mem0mem.* !
Created 6/9/1994 Heikki Tuuri
*************************************************************************/
-#include "ha_prototypes.h"
+#ifndef UNIV_HOTBACKUP
+# include "ha_prototypes.h"
+#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_MEM_DEBUG
# ifndef UNIV_HOTBACKUP
diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c
index 5d249d52ce9..061d556c6e7 100644
--- a/storage/xtradb/os/os0file.c
+++ b/storage/xtradb/os/os0file.c
@@ -303,6 +303,7 @@ UNIV_INTERN ulint os_n_pending_writes = 0;
UNIV_INTERN ulint os_n_pending_reads = 0;
#ifdef UNIV_DEBUG
+# ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Validates the consistency the aio system some of the time.
@return TRUE if ok or the check was skipped */
@@ -329,6 +330,7 @@ os_aio_validate_skip(void)
os_aio_validate_count = OS_AIO_VALIDATE_SKIP;
return(os_aio_validate());
}
+# endif /* !UNIV_HOTBACKUP */
#endif /* UNIV_DEBUG */
#ifdef _WIN32
diff --git a/storage/xtradb/page/page0zip.c b/storage/xtradb/page/page0zip.c
index d4b0dd8339d..4751f4816a9 100644
--- a/storage/xtradb/page/page0zip.c
+++ b/storage/xtradb/page/page0zip.c
@@ -4437,7 +4437,9 @@ page_zip_reorganize(
dict_index_t* index, /*!< in: index of the B-tree node */
mtr_t* mtr) /*!< in: mini-transaction */
{
+#ifndef UNIV_HOTBACKUP
buf_pool_t* buf_pool = buf_pool_from_block(block);
+#endif /* !UNIV_HOTBACKUP */
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
page_t* page = buf_block_get_frame(block);
buf_block_t* temp_block;
diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c
index a629a4fb195..b21d48c7552 100644
--- a/storage/xtradb/row/row0ins.c
+++ b/storage/xtradb/row/row0ins.c
@@ -1281,7 +1281,8 @@ run_again:
check_index = foreign->foreign_index;
}
- if (check_table == NULL || check_table->ibd_file_missing) {
+ if (check_table == NULL || check_table->ibd_file_missing
+ || check_index == NULL) {
if (check_ref) {
FILE* ef = dict_foreign_err_file;
@@ -1316,9 +1317,6 @@ run_again:
goto exit_func;
}
- ut_a(check_table);
- ut_a(check_index);
-
if (check_table != table) {
/* We already have a LOCK_IX on table, but not necessarily
on check_table */
diff --git a/storage/xtradb/row/row0merge.c b/storage/xtradb/row/row0merge.c
index f00706da0d3..c7d6304d6a7 100644
--- a/storage/xtradb/row/row0merge.c
+++ b/storage/xtradb/row/row0merge.c
@@ -89,8 +89,9 @@ rounded to a power of 2.
When not creating a PRIMARY KEY that contains column prefixes, this
can be set as small as UNIV_PAGE_SIZE / 2. See the comment above
-ut_ad(data_size < sizeof(row_merge_block_t)). */
-typedef byte row_merge_block_t[1048576];
+ut_ad(data_size < sizeof(row_merge_block_t)).
+1MB is the default merge-sort block size for innodb */
+typedef byte* row_merge_block_t;
/** @brief Secondary buffer for I/O operations of merge records.
@@ -184,7 +185,6 @@ row_merge_buf_create_low(
row_merge_buf_t* buf;
ut_ad(max_tuples > 0);
- ut_ad(max_tuples <= sizeof(row_merge_block_t));
ut_ad(max_tuples < buf_size);
buf = mem_heap_zalloc(heap, buf_size);
@@ -205,19 +205,19 @@ static
row_merge_buf_t*
row_merge_buf_create(
/*=================*/
- dict_index_t* index) /*!< in: secondary index */
+ dict_index_t* index, /*!< in: secondary index */
+ ulint block_size) /*!< in: merge block buffer size */
{
row_merge_buf_t* buf;
ulint max_tuples;
ulint buf_size;
mem_heap_t* heap;
- max_tuples = sizeof(row_merge_block_t)
- / ut_max(1, dict_index_get_min_size(index));
+ max_tuples = block_size / ut_max(1, dict_index_get_min_size(index));
buf_size = (sizeof *buf) + (max_tuples - 1) * sizeof *buf->tuples;
- heap = mem_heap_create(buf_size + sizeof(row_merge_block_t));
+ heap = mem_heap_create(buf_size + block_size);
buf = row_merge_buf_create_low(heap, index, max_tuples, buf_size);
@@ -265,8 +265,10 @@ row_merge_buf_add(
/*==============*/
row_merge_buf_t* buf, /*!< in/out: sort buffer */
const dtuple_t* row, /*!< in: row in clustered index */
- const row_ext_t* ext) /*!< in: cache of externally stored
+ const row_ext_t* ext, /*!< in: cache of externally stored
column prefixes, or NULL */
+ ulint block_size)
+ /*!< in: merge block buffer size */
{
ulint i;
ulint n_fields;
@@ -391,10 +393,10 @@ row_merge_buf_add(
page_zip_rec_needs_ext() limit. However, no further columns
will be moved to external storage until the record is inserted
to the clustered index B-tree. */
- ut_ad(data_size < sizeof(row_merge_block_t));
+ ut_ad(data_size < block_size);
/* Reserve one byte for the end marker of row_merge_block_t. */
- if (buf->total_size + data_size >= sizeof(row_merge_block_t) - 1) {
+ if (buf->total_size + data_size >= block_size - 1) {
return(FALSE);
}
@@ -700,9 +702,11 @@ row_merge_read(
ulint offset, /*!< in: offset where to read
in number of row_merge_block_t
elements */
- row_merge_block_t* buf) /*!< out: data */
+ row_merge_block_t buf, /*!< out: data */
+ ulint block_size)
+ /*!< in: merge block buffer size */
{
- ib_uint64_t ofs = ((ib_uint64_t) offset) * sizeof *buf;
+ ib_uint64_t ofs = ((ib_uint64_t) offset) * block_size;
ibool success;
#ifdef UNIV_DEBUG
@@ -715,7 +719,7 @@ row_merge_read(
success = os_file_read_no_error_handling(OS_FILE_FROM_FD(fd), buf,
(ulint) (ofs & 0xFFFFFFFF),
(ulint) (ofs >> 32),
- sizeof *buf);
+ block_size);
#ifdef POSIX_FADV_DONTNEED
/* Each block is read exactly once. Free up the file cache. */
posix_fadvise(fd, ofs, sizeof *buf, POSIX_FADV_DONTNEED);
@@ -740,16 +744,17 @@ row_merge_write(
int fd, /*!< in: file descriptor */
ulint offset, /*!< in: offset where to write,
in number of row_merge_block_t elements */
- const void* buf) /*!< in: data */
+ const void* buf, /*!< in: data */
+ ulint block_size)
+ /*!< in: merge block buffer size */
{
- size_t buf_len = sizeof(row_merge_block_t);
- ib_uint64_t ofs = buf_len * (ib_uint64_t) offset;
+ ib_uint64_t ofs = block_size * (ib_uint64_t) offset;
ibool ret;
ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf,
(ulint) (ofs & 0xFFFFFFFF),
(ulint) (ofs >> 32),
- buf_len);
+ block_size);
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
@@ -761,7 +766,7 @@ row_merge_write(
#ifdef POSIX_FADV_DONTNEED
/* The block will be needed on the next merge pass,
but it can be evicted from the file cache meanwhile. */
- posix_fadvise(fd, ofs, buf_len, POSIX_FADV_DONTNEED);
+ posix_fadvise(fd, ofs, block_size, POSIX_FADV_DONTNEED);
#endif /* POSIX_FADV_DONTNEED */
return(UNIV_LIKELY(ret));
@@ -783,7 +788,9 @@ row_merge_read_rec(
const mrec_t** mrec, /*!< out: pointer to merge record,
or NULL on end of list
(non-NULL on I/O error) */
- ulint* offsets)/*!< out: offsets of mrec */
+ ulint* offsets,/*!< out: offsets of mrec */
+ ulint block_size)
+ /*!< in: merge block buffer size */
{
ulint extra_size;
ulint data_size;
@@ -820,7 +827,8 @@ row_merge_read_rec(
/* Read another byte of extra_size. */
if (UNIV_UNLIKELY(b >= block[1])) {
- if (!row_merge_read(fd, ++(*foffs), block)) {
+ if (!row_merge_read(fd, ++(*foffs), block[0],
+ block_size)) {
err_exit:
/* Signal I/O error. */
*mrec = b;
@@ -849,7 +857,8 @@ err_exit:
memcpy(*buf, b, avail_size);
- if (!row_merge_read(fd, ++(*foffs), block)) {
+ if (!row_merge_read(fd, ++(*foffs), block[0],
+ block_size)) {
goto err_exit;
}
@@ -870,7 +879,7 @@ err_exit:
/* These overflows should be impossible given that
records are much smaller than either buffer, and
the record starts near the beginning of each buffer. */
- ut_a(extra_size + data_size < sizeof *buf);
+ ut_a(extra_size + data_size < block_size);
ut_a(b + data_size < block[1]);
/* Copy the data bytes. */
@@ -885,7 +894,7 @@ err_exit:
rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets);
data_size = rec_offs_data_size(offsets);
- ut_ad(extra_size + data_size < sizeof *buf);
+ ut_ad(extra_size + data_size < block_size);
b += extra_size + data_size;
@@ -910,7 +919,8 @@ err_exit:
offsets[3] = (ulint) index;
#endif /* UNIV_DEBUG */
- if (!row_merge_read(fd, ++(*foffs), block)) {
+ if (!row_merge_read(fd, ++(*foffs), block[0],
+ block_size)) {
goto err_exit;
}
@@ -992,7 +1002,9 @@ row_merge_write_rec(
int fd, /*!< in: file descriptor */
ulint* foffs, /*!< in/out: file offset */
const mrec_t* mrec, /*!< in: record to write */
- const ulint* offsets)/*!< in: offsets of mrec */
+ const ulint* offsets,/*!< in: offsets of mrec */
+ ulint block_size)
+ /*!< in: merge block buffer size */
{
ulint extra_size;
ulint size;
@@ -1027,11 +1039,12 @@ row_merge_write_rec(
record to the head of the new block. */
memcpy(b, buf[0], avail_size);
- if (!row_merge_write(fd, (*foffs)++, block)) {
+ if (!row_merge_write(fd, (*foffs)++, block[0],
+ block_size)) {
return(NULL);
}
- UNIV_MEM_INVALID(block[0], sizeof block[0]);
+ UNIV_MEM_INVALID(block[0], block_size);
/* Copy the rest. */
b = block[0];
@@ -1056,7 +1069,9 @@ row_merge_write_eof(
row_merge_block_t* block, /*!< in/out: file buffer */
byte* b, /*!< in: pointer to end of block */
int fd, /*!< in: file descriptor */
- ulint* foffs) /*!< in/out: file offset */
+ ulint* foffs, /*!< in/out: file offset */
+ ulint block_size)
+ /*!< in: merge block buffer size */
{
ut_ad(block);
ut_ad(b >= block[0]);
@@ -1071,18 +1086,19 @@ row_merge_write_eof(
*b++ = 0;
UNIV_MEM_ASSERT_RW(block[0], b - block[0]);
- UNIV_MEM_ASSERT_W(block[0], sizeof block[0]);
+ UNIV_MEM_ASSERT_W(block[0], block_size);
#ifdef UNIV_DEBUG_VALGRIND
/* The rest of the block is uninitialized. Initialize it
to avoid bogus warnings. */
memset(b, 0xff, block[1] - b);
#endif /* UNIV_DEBUG_VALGRIND */
- if (!row_merge_write(fd, (*foffs)++, block)) {
+ if (!row_merge_write(fd, (*foffs)++, block[0],
+ block_size)) {
return(NULL);
}
- UNIV_MEM_INVALID(block[0], sizeof block[0]);
+ UNIV_MEM_INVALID(block[0], block_size);
return(block[0]);
}
@@ -1140,7 +1156,9 @@ row_merge_read_clustered_index(
dict_index_t** index, /*!< in: indexes to be created */
merge_file_t* files, /*!< in: temporary files */
ulint n_index,/*!< in: number of indexes to create */
- row_merge_block_t* block) /*!< in/out: file buffer */
+ row_merge_block_t* block, /*!< in/out: file buffer */
+ ulint block_size)
+ /*!< in: merge block buffer size */
{
dict_index_t* clust_index; /* Clustered index */
mem_heap_t* row_heap; /* Heap memory to create
@@ -1168,7 +1186,7 @@ row_merge_read_clustered_index(
merge_buf = mem_alloc(n_index * sizeof *merge_buf);
for (i = 0; i < n_index; i++) {
- merge_buf[i] = row_merge_buf_create(index[i]);
+ merge_buf[i] = row_merge_buf_create(index[i], block_size);
}
mtr_start(&mtr);
@@ -1300,7 +1318,8 @@ row_merge_read_clustered_index(
const dict_index_t* index = buf->index;
if (UNIV_LIKELY
- (row && row_merge_buf_add(buf, row, ext))) {
+ (row && row_merge_buf_add(buf, row, ext,
+ block_size))) {
file->n_rec++;
continue;
}
@@ -1335,12 +1354,12 @@ err_exit:
row_merge_buf_write(buf, file, block);
if (!row_merge_write(file->fd, file->offset++,
- block)) {
+ block[0], block_size)) {
err = DB_OUT_OF_FILE_SPACE;
goto err_exit;
}
- UNIV_MEM_INVALID(block[0], sizeof block[0]);
+ UNIV_MEM_INVALID(block[0], block_size);
merge_buf[i] = row_merge_buf_empty(buf);
if (UNIV_LIKELY(row != NULL)) {
@@ -1349,7 +1368,8 @@ err_exit:
and emptied. */
if (UNIV_UNLIKELY
- (!row_merge_buf_add(buf, row, ext))) {
+ (!row_merge_buf_add(buf, row, ext,
+ block_size))) {
/* An empty buffer should have enough
room for at least one record. */
ut_error;
@@ -1393,14 +1413,16 @@ func_exit:
do { \
b2 = row_merge_write_rec(&block[2], &buf[2], b2, \
of->fd, &of->offset, \
- mrec##N, offsets##N); \
+ mrec##N, offsets##N, \
+ block_size); \
if (UNIV_UNLIKELY(!b2 || ++of->n_rec > file->n_rec)) { \
goto corrupt; \
} \
b##N = row_merge_read_rec(&block[N], &buf[N], \
b##N, index, \
file->fd, foffs##N, \
- &mrec##N, offsets##N); \
+ &mrec##N, offsets##N, \
+ block_size); \
if (UNIV_UNLIKELY(!b##N)) { \
if (mrec##N) { \
goto corrupt; \
@@ -1425,9 +1447,11 @@ row_merge_blocks(
ulint* foffs1, /*!< in/out: offset of second
source list in the file */
merge_file_t* of, /*!< in/out: output file */
- struct TABLE* table) /*!< in/out: MySQL table, for
+ struct TABLE* table, /*!< in/out: MySQL table, for
reporting erroneous key value
if applicable */
+ ulint block_size)
+ /*!< in: merge block buffer size */
{
mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
@@ -1457,8 +1481,10 @@ row_merge_blocks(
/* Write a record and read the next record. Split the output
file in two halves, which can be merged on the following pass. */
- if (!row_merge_read(file->fd, *foffs0, &block[0])
- || !row_merge_read(file->fd, *foffs1, &block[1])) {
+ if (!row_merge_read(file->fd, *foffs0, block[0],
+ block_size)
+ || !row_merge_read(file->fd, *foffs1, block[1],
+ block_size)) {
corrupt:
mem_heap_free(heap);
return(DB_CORRUPTION);
@@ -1469,9 +1495,9 @@ corrupt:
b2 = block[2];
b0 = row_merge_read_rec(&block[0], &buf[0], b0, index, file->fd,
- foffs0, &mrec0, offsets0);
+ foffs0, &mrec0, offsets0, block_size);
b1 = row_merge_read_rec(&block[1], &buf[1], b1, index, file->fd,
- foffs1, &mrec1, offsets1);
+ foffs1, &mrec1, offsets1, block_size);
if (UNIV_UNLIKELY(!b0 && mrec0)
|| UNIV_UNLIKELY(!b1 && mrec1)) {
@@ -1521,7 +1547,8 @@ done0:
done1:
mem_heap_free(heap);
- b2 = row_merge_write_eof(&block[2], b2, of->fd, &of->offset);
+ b2 = row_merge_write_eof(&block[2], b2, of->fd, &of->offset,
+ block_size);
return(b2 ? DB_SUCCESS : DB_CORRUPTION);
}
@@ -1536,7 +1563,9 @@ row_merge_blocks_copy(
const merge_file_t* file, /*!< in: input file */
row_merge_block_t* block, /*!< in/out: 3 buffers */
ulint* foffs0, /*!< in/out: input file offset */
- merge_file_t* of) /*!< in/out: output file */
+ merge_file_t* of, /*!< in/out: output file */
+ ulint block_size)
+ /*!< in: merge block buffer size */
{
mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
@@ -1563,7 +1592,7 @@ row_merge_blocks_copy(
/* Write a record and read the next record. Split the output
file in two halves, which can be merged on the following pass. */
- if (!row_merge_read(file->fd, *foffs0, &block[0])) {
+ if (!row_merge_read(file->fd, *foffs0, block[0], block_size)) {
corrupt:
mem_heap_free(heap);
return(FALSE);
@@ -1573,7 +1602,7 @@ corrupt:
b2 = block[2];
b0 = row_merge_read_rec(&block[0], &buf[0], b0, index, file->fd,
- foffs0, &mrec0, offsets0);
+ foffs0, &mrec0, offsets0, block_size);
if (UNIV_UNLIKELY(!b0 && mrec0)) {
goto corrupt;
@@ -1592,8 +1621,8 @@ done0:
(*foffs0)++;
mem_heap_free(heap);
- return(row_merge_write_eof(&block[2], b2, of->fd, &of->offset)
- != NULL);
+ return(row_merge_write_eof(&block[2], b2, of->fd, &of->offset,
+ block_size) != NULL);
}
/*************************************************************//**
@@ -1614,9 +1643,10 @@ row_merge(
if applicable */
ulint* num_run,/*!< in/out: Number of runs remain
to be merged */
- ulint* run_offset) /*!< in/out: Array contains the
+ ulint* run_offset, /*!< in/out: Array contains the
first offset number for each merge
run */
+ ulint block_size) /*!< in: merge block buffer size */
{
ulint foffs0; /*!< first input offset */
ulint foffs1; /*!< second input offset */
@@ -1627,7 +1657,7 @@ row_merge(
ulint n_run = 0;
/*!< num of runs generated from this merge */
- UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]);
+ UNIV_MEM_ASSERT_W(block[0], 3 * block_size);
ut_ad(ihalf < file->offset);
@@ -1659,7 +1689,8 @@ row_merge(
run_offset[n_run++] = of.offset;
error = row_merge_blocks(index, file, block,
- &foffs0, &foffs1, &of, table);
+ &foffs0, &foffs1, &of, table,
+ block_size);
if (error != DB_SUCCESS) {
return(error);
@@ -1677,7 +1708,8 @@ row_merge(
/* Remember the offset number for this run */
run_offset[n_run++] = of.offset;
- if (!row_merge_blocks_copy(index, file, block, &foffs0, &of)) {
+ if (!row_merge_blocks_copy(index, file, block, &foffs0, &of,
+ block_size)) {
return(DB_CORRUPTION);
}
}
@@ -1692,7 +1724,8 @@ row_merge(
/* Remember the offset number for this run */
run_offset[n_run++] = of.offset;
- if (!row_merge_blocks_copy(index, file, block, &foffs1, &of)) {
+ if (!row_merge_blocks_copy(index, file, block, &foffs1, &of,
+ block_size)) {
return(DB_CORRUPTION);
}
}
@@ -1721,7 +1754,7 @@ row_merge(
*tmpfd = file->fd;
*file = of;
- UNIV_MEM_INVALID(block[0], 3 * sizeof block[0]);
+ UNIV_MEM_INVALID(block[0], 3 * block_size);
return(DB_SUCCESS);
}
@@ -1739,9 +1772,11 @@ row_merge_sort(
index entries */
row_merge_block_t* block, /*!< in/out: 3 buffers */
int* tmpfd, /*!< in/out: temporary file handle */
- struct TABLE* table) /*!< in/out: MySQL table, for
+ struct TABLE* table, /*!< in/out: MySQL table, for
reporting erroneous key value
if applicable */
+ ulint block_size)
+ /*!< in: merge block buffer size */
{
ulint half = file->offset / 2;
ulint num_runs;
@@ -1770,7 +1805,7 @@ row_merge_sort(
/* Merge the runs until we have one big run */
do {
error = row_merge(trx, index, file, block, tmpfd,
- table, &num_runs, run_offset);
+ table, &num_runs, run_offset, block_size);
UNIV_MEM_ASSERT_RW(run_offset, num_runs * sizeof *run_offset);
@@ -1841,7 +1876,9 @@ row_merge_insert_index_tuples(
ulint zip_size,/*!< in: compressed page size of
the old table, or 0 if uncompressed */
int fd, /*!< in: file descriptor */
- row_merge_block_t* block) /*!< in/out: file buffer */
+ row_merge_block_t* block, /*!< in/out: file buffer */
+ ulint block_size)
+ /*! in: merge block buffer size */
{
const byte* b;
que_thr_t* thr;
@@ -1880,7 +1917,7 @@ row_merge_insert_index_tuples(
b = *block;
- if (!row_merge_read(fd, foffs, block)) {
+ if (!row_merge_read(fd, foffs, block[0], block_size)) {
error = DB_CORRUPTION;
} else {
mrec_buf_t* buf = mem_heap_alloc(graph_heap, sizeof *buf);
@@ -1891,7 +1928,8 @@ row_merge_insert_index_tuples(
ulint n_ext;
b = row_merge_read_rec(block, buf, b, index,
- fd, &foffs, &mrec, offsets);
+ fd, &foffs, &mrec, offsets,
+ block_size);
if (UNIV_UNLIKELY(!b)) {
/* End of list, or I/O error */
if (mrec) {
@@ -2656,11 +2694,16 @@ row_merge_build_indexes(
if applicable */
{
merge_file_t* merge_files;
- row_merge_block_t* block;
+ /* Some code uses block[1] as the synonym for block + block_size. So
+ we initialize block[3] to the address boundary of block[2], even
+ though space for 3 only buffers is allocated. */
+ row_merge_block_t block[4];
ulint block_size;
ulint i;
ulint error;
int tmpfd;
+ ulint merge_sort_block_size;
+ void* block_mem;
ut_ad(trx);
ut_ad(old_table);
@@ -2668,14 +2711,21 @@ row_merge_build_indexes(
ut_ad(indexes);
ut_ad(n_indexes);
+ merge_sort_block_size = thd_merge_sort_block_size(trx->mysql_thd);
+
trx_start_if_not_started(trx);
/* Allocate memory for merge file data structure and initialize
fields */
merge_files = mem_alloc(n_indexes * sizeof *merge_files);
- block_size = 3 * sizeof *block;
- block = os_mem_alloc_large(&block_size);
+ block_size = 3 * merge_sort_block_size;
+ block_mem = os_mem_alloc_large(&block_size);
+
+ for (i = 0; i < UT_ARR_SIZE(block); i++) {
+ block[i] = (row_merge_block_t ) ((byte *) block_mem +
+ i * merge_sort_block_size);
+ }
for (i = 0; i < n_indexes; i++) {
@@ -2693,7 +2743,7 @@ row_merge_build_indexes(
error = row_merge_read_clustered_index(
trx, table, old_table, new_table, indexes,
- merge_files, n_indexes, block);
+ merge_files, n_indexes, block, merge_sort_block_size);
if (error != DB_SUCCESS) {
@@ -2705,13 +2755,15 @@ row_merge_build_indexes(
for (i = 0; i < n_indexes; i++) {
error = row_merge_sort(trx, indexes[i], &merge_files[i],
- block, &tmpfd, table);
+ block, &tmpfd, table,
+ merge_sort_block_size);
if (error == DB_SUCCESS) {
error = row_merge_insert_index_tuples(
trx, indexes[i], new_table,
dict_table_zip_size(old_table),
- merge_files[i].fd, block);
+ merge_files[i].fd, block,
+ merge_sort_block_size);
}
/* Close the temporary file to free up space. */
@@ -2731,7 +2783,7 @@ func_exit:
}
mem_free(merge_files);
- os_mem_free_large(block, block_size);
+ os_mem_free_large(block_mem, block_size);
return(error);
}
diff --git a/storage/xtradb/row/row0vers.c b/storage/xtradb/row/row0vers.c
index 5fd7d082194..6d83dbaf8ee 100644
--- a/storage/xtradb/row/row0vers.c
+++ b/storage/xtradb/row/row0vers.c
@@ -209,17 +209,6 @@ row_vers_impl_x_locked_off_kernel(
prev_trx_id = row_get_rec_trx_id(prev_version, clust_index,
clust_offsets);
- /* If the trx_id and prev_trx_id are different and if
- the prev_version is marked deleted then the
- prev_trx_id must have already committed for the trx_id
- to be able to modify the row. Therefore, prev_trx_id
- cannot hold any implicit lock. */
- if (vers_del && trx_id != prev_trx_id) {
-
- mutex_enter(&kernel_mutex);
- break;
- }
-
/* The stack of versions is locked by mtr. Thus, it
is safe to fetch the prefixes for externally stored
columns. */
diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c
index 75e8097ee0b..d1329f445aa 100644
--- a/storage/xtradb/srv/srv0start.c
+++ b/storage/xtradb/srv/srv0start.c
@@ -1512,8 +1512,7 @@ innobase_start_or_create_for_mysql(void)
if (!os_aio_init(io_limit,
srv_n_read_io_threads,
srv_n_write_io_threads,
- SRV_MAX_N_PENDING_SYNC_IOS))
- {
+ SRV_MAX_N_PENDING_SYNC_IOS)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Fatal error: cannot initialize AIO"
diff --git a/storage/xtradb/sync/sync0arr.c b/storage/xtradb/sync/sync0arr.c
index b47c32f5bbf..5f293ad6a55 100644
--- a/storage/xtradb/sync/sync0arr.c
+++ b/storage/xtradb/sync/sync0arr.c
@@ -926,6 +926,11 @@ sync_array_print_long_waits(
ibool fatal = FALSE;
double longest_diff = 0;
+ /* For huge tables, skip the check during CHECK TABLE etc... */
+ if (fatal_timeout > SRV_SEMAPHORE_WAIT_EXTENSION) {
+ return(FALSE);
+ }
+
#ifdef UNIV_DEBUG_VALGRIND
/* Increase the timeouts if running under valgrind because it executes
extremely slowly. UNIV_DEBUG_VALGRIND does not necessary mean that
diff --git a/storage/xtradb/trx/trx0sys.c b/storage/xtradb/trx/trx0sys.c
index dd869a787bd..7d303c2563c 100644
--- a/storage/xtradb/trx/trx0sys.c
+++ b/storage/xtradb/trx/trx0sys.c
@@ -137,12 +137,12 @@ UNIV_INTERN mysql_pfs_key_t trx_doublewrite_mutex_key;
UNIV_INTERN mysql_pfs_key_t file_format_max_mutex_key;
#endif /* UNIV_PFS_MUTEX */
+#ifndef UNIV_HOTBACKUP
#ifdef UNIV_DEBUG
/* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */
uint trx_rseg_n_slots_debug = 0;
#endif
-#ifndef UNIV_HOTBACKUP
/** This is used to track the maximum file format id known to InnoDB. It's
updated via SET GLOBAL innodb_file_format_max = 'x' or when we open
or create a table. */
diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c
index c9fccaad16b..b703a04b1b0 100644
--- a/storage/xtradb/trx/trx0trx.c
+++ b/storage/xtradb/trx/trx0trx.c
@@ -1099,7 +1099,8 @@ trx_commit_off_kernel(
trx->must_flush_log_later = TRUE;
} else if (flush_log_at_trx_commit == 0) {
/* Do nothing */
- } else if (flush_log_at_trx_commit == 1) {
+ } else if (flush_log_at_trx_commit == 1 ||
+ flush_log_at_trx_commit == 3) {
if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
/* Write the log but do not flush it to disk */
@@ -1809,7 +1810,11 @@ trx_commit_complete_for_mysql(
/* Do nothing */
} else if (flush_log_at_trx_commit == 0) {
/* Do nothing */
- } else if (flush_log_at_trx_commit == 1) {
+ } else if (flush_log_at_trx_commit == 1 && trx->active_commit_ordered) {
+ /* Do nothing - we already flushed the prepare and binlog write
+ to disk, so transaction is durable (will be recovered from
+ binlog if necessary) */
+ } else if (flush_log_at_trx_commit == 1 || flush_log_at_trx_commit == 3) {
if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
/* Write the log but do not flush it to disk */
@@ -2097,7 +2102,7 @@ trx_prepare_off_kernel(
if (flush_log_at_trx_commit == 0) {
/* Do nothing */
- } else if (flush_log_at_trx_commit == 1) {
+ } else if (flush_log_at_trx_commit == 1 || flush_log_at_trx_commit == 3) {
if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
/* Write the log but do not flush it to disk */
diff --git a/storage/xtradb/ut/ut0dbg.c b/storage/xtradb/ut/ut0dbg.c
index 64fadd76d1c..53ed4a53044 100644
--- a/storage/xtradb/ut/ut0dbg.c
+++ b/storage/xtradb/ut/ut0dbg.c
@@ -25,7 +25,9 @@ Created 1/30/1994 Heikki Tuuri
#include "univ.i"
#include "ut0dbg.h"
-#include "ha_prototypes.h"
+#ifndef UNIV_HOTBACKUP
+# include "ha_prototypes.h"
+#endif /* !UNIV_HOTBACKUP */
#if defined(__GNUC__) && (__GNUC__ > 2)
#else
@@ -56,7 +58,7 @@ ut_dbg_assertion_failed(
ut_print_timestamp(stderr);
#ifdef UNIV_HOTBACKUP
fprintf(stderr, " InnoDB: Assertion failure in file %s line %lu\n",
- innobase_basename(file), line);
+ file, line);
#else /* UNIV_HOTBACKUP */
fprintf(stderr,
" InnoDB: Assertion failure in thread %lu"
diff --git a/storage/xtradb/ut/ut0ut.c b/storage/xtradb/ut/ut0ut.c
index 60def59193a..31c8351a518 100644
--- a/storage/xtradb/ut/ut0ut.c
+++ b/storage/xtradb/ut/ut0ut.c
@@ -245,7 +245,9 @@ ut_print_timestamp(
(int)cal_tm.wMinute,
(int)cal_tm.wSecond);
#else
+#ifdef HAVE_LOCALTIME_R
struct tm cal_tm;
+#endif
struct tm* cal_tm_ptr;
time_t tm;
@@ -288,7 +290,9 @@ ut_sprintf_timestamp(
(int)cal_tm.wMinute,
(int)cal_tm.wSecond);
#else
+#ifdef HAVE_LOCALTIME_R
struct tm cal_tm;
+#endif
struct tm* cal_tm_ptr;
time_t tm;
@@ -333,7 +337,9 @@ ut_sprintf_timestamp_without_extra_chars(
(int)cal_tm.wMinute,
(int)cal_tm.wSecond);
#else
+#ifdef HAVE_LOCALTIME_R
struct tm cal_tm;
+#endif
struct tm* cal_tm_ptr;
time_t tm;
@@ -374,7 +380,9 @@ ut_get_year_month_day(
*month = (ulint)cal_tm.wMonth;
*day = (ulint)cal_tm.wDay;
#else
+#ifdef HAVE_LOCALTIME_R
struct tm cal_tm;
+#endif
struct tm* cal_tm_ptr;
time_t tm;
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index f4ae1306c2e..52eaece5528 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -2317,13 +2317,18 @@ void my_fill_utf32(CHARSET_INFO *cs,
char *s, size_t slen, int fill)
{
char buf[10];
- uint __attribute__((unused)) buflen;
+#ifndef DBUG_OFF
+ uint buflen;
+#endif
char *e= s + slen;
DBUG_ASSERT((slen % 4) == 0);
- buflen= cs->cset->wc_mb(cs, (my_wc_t) fill, (uchar*) buf,
- (uchar*) buf + sizeof(buf));
+#ifndef DBUG_OFF
+ buflen=
+#endif
+ cs->cset->wc_mb(cs, (my_wc_t) fill, (uchar*) buf,
+ (uchar*) buf + sizeof(buf));
DBUG_ASSERT(buflen == 4);
while (s < e)
{
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 7ef0ebf7a12..c38cd91e807 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -100,6 +100,7 @@ static const char *get_length_arg(const char *fmt, ARGS_INFO *args_arr,
(*length)--;
DBUG_ASSERT(*fmt == '$' && *length < MAX_ARGS);
args_arr[*length].arg_type= 'd';
+ args_arr[*length].have_longlong= 0;
return fmt+1;
}
@@ -730,8 +731,53 @@ size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
int my_vfprintf(FILE *stream, const char* format, va_list args)
{
char cvtbuf[1024];
- (void) my_vsnprintf(cvtbuf, sizeof(cvtbuf), format, args);
- return fprintf(stream, "%s\n", cvtbuf);
+ int alloc= 0;
+ char *p= cvtbuf;
+ size_t cur_len= sizeof(cvtbuf);
+ int ret;
+
+ /*
+ We do not know how much buffer we need.
+ So start with a reasonably-sized stack-allocated buffer, and increase
+ it exponentially until it is big enough.
+ */
+ for (;;)
+ {
+ size_t new_len;
+ size_t actual= my_vsnprintf(p, cur_len, format, args);
+ if (actual < cur_len - 1)
+ break;
+ /*
+ Not enough space (or just enough with nothing to spare - but we cannot
+ distinguish this case from the return value). Allocate a bigger buffer
+ and try again.
+ */
+ if (alloc)
+ (*my_str_free)(p);
+ else
+ alloc= 1;
+ new_len= cur_len*2;
+ if (new_len < cur_len)
+ return 0; /* Overflow */
+ cur_len= new_len;
+ p= (*my_str_malloc)(cur_len);
+ if (!p)
+ return 0;
+ }
+ ret= fprintf(stream, "%s", p);
+ if (alloc)
+ (*my_str_free)(p);
+ return ret;
+}
+
+int my_fprintf(FILE *stream, const char* format, ...)
+{
+ int result;
+ va_list args;
+ va_start(args, format);
+ result= my_vfprintf(stream, format, args);
+ va_end(args);
+ return result;
}
diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp
index 4d8478828c2..107c306421a 100644
--- a/support-files/compiler_warnings.supp
+++ b/support-files/compiler_warnings.supp
@@ -171,6 +171,7 @@ vio/viosslfactories\.c: discards ~const~ qualifier from pointer target type
#
.*/my_config\.h : _FILE_OFFSET_BITS
/usr/include/sys/feature_tests.h : this is the location of the previous definition
+.*auth_pam\.c : initialization from incompatible pointer type : 100-200
#
# Unexplanable (?) stuff
@@ -192,6 +193,8 @@ ma_packrec\.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 550
#
.* : .*no matching operator delete found; memory will not be freed if initialization throws an exception.*
ctype-simple\.c : .*unary minus operator applied to unsigned type, result still unsigned.*
+sql/sys_vars\.cc : invalid access to non-static data member
+sql/sys_vars\.cc : perhaps the 'offsetof' macro was used incorrectly
# Wrong warning due to GCC bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29478
regexec\.c : passing argument 3 of.*matcher.* discards qualifiers from pointer target type
diff --git a/support-files/my-huge.cnf.sh b/support-files/my-huge.cnf.sh
index 896b139273b..4e083488285 100644
--- a/support-files/my-huge.cnf.sh
+++ b/support-files/my-huge.cnf.sh
@@ -121,7 +121,7 @@ server-id = 1
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = @localstatedir@
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
-o#innodb_log_group_home_dir = @localstatedir@
+#innodb_log_group_home_dir = @localstatedir@
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index a3d8554188e..5b9a296d90a 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -176,7 +176,7 @@
%endif
%else
%if %(test -f /etc/SuSE-release && echo 1 || echo 0)
- %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release)
+ %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release | cut -d. -f1)
%if "%susever" == "10"
%define distro_description SUSE Linux Enterprise Server 10
%define distro_releasetag sles10
diff --git a/tests/mysql_client_fw.c b/tests/mysql_client_fw.c
new file mode 100644
index 00000000000..979d47cb0b8
--- /dev/null
+++ b/tests/mysql_client_fw.c
@@ -0,0 +1,1440 @@
+/* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <my_global.h>
+#include <my_sys.h>
+#include <mysql.h>
+#include <errmsg.h>
+#include <my_compare.h>
+#include <my_getopt.h>
+#include <m_string.h>
+#include <mysqld_error.h>
+#include <sql_common.h>
+#include <mysql/client_plugin.h>
+
+/*
+ If non_blocking_api_enabled is true, we will re-define all the blocking
+ API functions as wrappers that call the corresponding non-blocking API
+ and use poll()/select() to wait for them to complete. This way we can get
+ a good coverage testing of the non-blocking API as well.
+*/
+static my_bool non_blocking_api_enabled= 0;
+#if !defined(EMBEDDED_LIBRARY)
+#define WRAP_NONBLOCK_ENABLED non_blocking_api_enabled
+#include "nonblock-wrappers.h"
+#endif
+
+#define VER "2.1"
+#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
+#define MAX_KEY MAX_INDEXES
+#define MAX_SERVER_ARGS 64
+
+/* set default options */
+static int opt_testcase __attribute__((unused)) = 0;
+static char *opt_db= 0;
+static char *opt_user= 0;
+static char *opt_password= 0;
+static char *opt_host= 0;
+static char *opt_unix_socket= 0;
+#ifdef HAVE_SMEM
+static char *shared_memory_base_name= 0;
+#endif
+static unsigned int opt_port;
+static my_bool tty_password= 0, opt_silent= 0;
+
+static MYSQL *mysql= 0;
+static char current_db[]= "client_test_db";
+static unsigned int test_count= 0;
+static unsigned int opt_count= 0;
+static unsigned int iter_count= 0;
+static my_bool have_innodb= FALSE;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
+
+static const char *opt_basedir= "./";
+static const char *opt_vardir= "mysql-test/var";
+
+static longlong opt_getopt_ll_test= 0;
+
+static int embedded_server_arg_count= 0;
+static char *embedded_server_args[MAX_SERVER_ARGS];
+
+static const char *embedded_server_groups[]= {
+ "server",
+ "embedded",
+ "mysql_client_test_SERVER",
+ NullS
+};
+
+static time_t start_time, end_time;
+static double total_time;
+
+const char *default_dbug_option= "d:t:o,/tmp/mysql_client_test.trace";
+
+struct my_tests_st
+{
+ const char *name;
+ void (*function)();
+};
+
+#define myheader(str) \
+DBUG_PRINT("test", ("name: %s", str)); \
+ if (opt_silent < 2) \
+ { \
+ fprintf(stdout, "\n\n#####################################\n"); \
+ fprintf(stdout, "%u of (%u/%u): %s", test_count++, iter_count, \
+ opt_count, str); \
+ fprintf(stdout, " \n#####################################\n"); \
+ }
+
+#define myheader_r(str) \
+DBUG_PRINT("test", ("name: %s", str)); \
+ if (!opt_silent) \
+ { \
+ fprintf(stdout, "\n\n#####################################\n"); \
+ fprintf(stdout, "%s", str); \
+ fprintf(stdout, " \n#####################################\n"); \
+ }
+
+static void print_error(const char *msg);
+static void print_st_error(MYSQL_STMT *stmt, const char *msg);
+static void client_disconnect(MYSQL* mysql, my_bool drop_db);
+
+
+/*
+ Abort unless given experssion is non-zero.
+
+ SYNOPSIS
+ DIE_UNLESS(expr)
+
+ DESCRIPTION
+ We can't use any kind of system assert as we need to
+ preserve tested invariants in release builds as well.
+*/
+
+#define DIE_UNLESS(expr) \
+ ((void) ((expr) ? 0 : (die(__FILE__, __LINE__, #expr), 0)))
+#define DIE_IF(expr) \
+ ((void) ((expr) ? (die(__FILE__, __LINE__, #expr), 0) : 0))
+#define DIE(expr) \
+ die(__FILE__, __LINE__, #expr)
+
+static void die(const char *file, int line, const char *expr)
+{
+ fflush(stdout);
+ fprintf(stderr, "%s:%d: check failed: '%s'\n", file, line, expr);
+ fflush(stderr);
+ exit(1);
+}
+
+
+#define myerror(msg) print_error(msg)
+#define mysterror(stmt, msg) print_st_error(stmt, msg)
+
+#define myquery(RES) \
+{ \
+ int r= (RES); \
+ if (r) \
+ myerror(NULL); \
+ DIE_UNLESS(r == 0); \
+}
+
+#define myquery_r(r) \
+{ \
+ if (r) \
+ myerror(NULL); \
+ DIE_UNLESS(r != 0); \
+}
+
+#define check_execute(stmt, r) \
+{ \
+ if (r) \
+ mysterror(stmt, NULL); \
+ DIE_UNLESS(r == 0); \
+}
+
+#define check_execute_r(stmt, r) \
+{ \
+ if (r) \
+ mysterror(stmt, NULL); \
+ DIE_UNLESS(r != 0); \
+}
+
+#define check_stmt(stmt) \
+{ \
+ if ( stmt == 0) \
+ myerror(NULL); \
+ DIE_UNLESS(stmt != 0); \
+}
+
+#define check_stmt_r(stmt) \
+{ \
+ if (stmt == 0) \
+ myerror(NULL); \
+ DIE_UNLESS(stmt == 0); \
+}
+
+#define mytest(x) if (!(x)) {myerror(NULL);DIE_UNLESS(FALSE);}
+#define mytest_r(x) if ((x)) {myerror(NULL);DIE_UNLESS(FALSE);}
+
+
+/* A workaround for Sun Forte 5.6 on Solaris x86 */
+
+static int cmp_double(double *a, double *b)
+{
+ return *a == *b;
+}
+
+
+/* Print the error message */
+
+static void print_error(const char *msg)
+{
+ if (!opt_silent)
+ {
+ if (mysql && mysql_errno(mysql))
+ {
+ if (mysql->server_version)
+ fprintf(stdout, "\n [MySQL-%s]", mysql->server_version);
+ else
+ fprintf(stdout, "\n [MySQL]");
+ fprintf(stdout, "[%d] %s\n", mysql_errno(mysql), mysql_error(mysql));
+ }
+ else if (msg)
+ fprintf(stderr, " [MySQL] %s\n", msg);
+ }
+}
+
+
+static void print_st_error(MYSQL_STMT *stmt, const char *msg)
+{
+ if (!opt_silent)
+ {
+ if (stmt && mysql_stmt_errno(stmt))
+ {
+ if (stmt->mysql && stmt->mysql->server_version)
+ fprintf(stdout, "\n [MySQL-%s]", stmt->mysql->server_version);
+ else
+ fprintf(stdout, "\n [MySQL]");
+
+ fprintf(stdout, "[%d] %s\n", mysql_stmt_errno(stmt),
+ mysql_stmt_error(stmt));
+ }
+ else if (msg)
+ fprintf(stderr, " [MySQL] %s\n", msg);
+ }
+}
+
+/*
+ Enhanced version of mysql_client_init(), which may also set shared memory
+ base on Windows.
+*/
+static MYSQL *mysql_client_init(MYSQL* con)
+{
+ MYSQL* res = mysql_init(con);
+#ifdef HAVE_SMEM
+ if (res && shared_memory_base_name)
+ mysql_options(res, MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name);
+#endif
+ if (res && non_blocking_api_enabled)
+ mysql_options(res, MYSQL_OPT_NONBLOCK, 0);
+ if (opt_plugin_dir && *opt_plugin_dir)
+ mysql_options(res, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+ if (opt_default_auth && *opt_default_auth)
+ mysql_options(res, MYSQL_DEFAULT_AUTH, opt_default_auth);
+ return res;
+}
+
+/*
+ Disable direct calls of mysql_init, as it disregards shared memory base.
+*/
+#define mysql_init(A) Please use mysql_client_init instead of mysql_init
+
+
+/* Check if the connection has InnoDB tables */
+
+static my_bool check_have_innodb(MYSQL *conn)
+{
+ MYSQL_RES *res;
+ MYSQL_ROW row;
+ int rc;
+ my_bool result;
+
+ rc= mysql_query(conn, "show variables like 'have_innodb'");
+ myquery(rc);
+ res= mysql_use_result(conn);
+ DIE_UNLESS(res);
+
+ row= mysql_fetch_row(res);
+ DIE_UNLESS(row);
+
+ result= strcmp(row[1], "YES") == 0;
+ mysql_free_result(res);
+ return result;
+}
+
+
+/*
+ This is to be what mysql_query() is for mysql_real_query(), for
+ mysql_simple_prepare(): a variant without the 'length' parameter.
+*/
+
+static MYSQL_STMT *STDCALL
+mysql_simple_prepare(MYSQL *mysql_arg, const char *query)
+{
+ MYSQL_STMT *stmt= mysql_stmt_init(mysql_arg);
+ if (stmt && mysql_stmt_prepare(stmt, query, (uint) strlen(query)))
+ {
+ mysql_stmt_close(stmt);
+ return 0;
+ }
+ return stmt;
+}
+
+
+/**
+ Connect to the server with options given by arguments to this application,
+ stored in global variables opt_host, opt_user, opt_password, opt_db,
+ opt_port and opt_unix_socket.
+
+ @param flag[in] client_flag passed on to mysql_real_connect
+ @param protocol[in] MYSQL_PROTOCOL_* to use for this connection
+ @param auto_reconnect[in] set to 1 for auto reconnect
+
+ @return pointer to initialized and connected MYSQL object
+*/
+static MYSQL* client_connect(ulong flag, uint protocol, my_bool auto_reconnect)
+{
+ MYSQL* mysql;
+ int rc;
+ static char query[MAX_TEST_QUERY_LENGTH];
+ myheader_r("client_connect");
+
+ if (!opt_silent)
+ fprintf(stdout, "\n Establishing a connection to '%s' ...",
+ opt_host ? opt_host : "");
+
+ if (!(mysql= mysql_client_init(NULL)))
+ {
+ opt_silent= 0;
+ myerror("mysql_client_init() failed");
+ exit(1);
+ }
+ /* enable local infile, in non-binary builds often disabled by default */
+ mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0);
+ mysql_options(mysql, MYSQL_OPT_PROTOCOL, &protocol);
+ if (opt_plugin_dir && *opt_plugin_dir)
+ mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+ if (opt_default_auth && *opt_default_auth)
+ mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
+
+ if (!(mysql_real_connect(mysql, opt_host, opt_user,
+ opt_password, opt_db ? opt_db:"test", opt_port,
+ opt_unix_socket, flag)))
+ {
+ opt_silent= 0;
+ myerror("connection failed");
+ mysql_close(mysql);
+ fprintf(stdout, "\n Check the connection options using --help or -?\n");
+ exit(1);
+ }
+ mysql->reconnect= auto_reconnect;
+
+ if (!opt_silent)
+ fprintf(stdout, "OK");
+
+ /* set AUTOCOMMIT to ON*/
+ mysql_autocommit(mysql, TRUE);
+
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\nConnected to MySQL server version: %s (%lu)\n",
+ mysql_get_server_info(mysql),
+ (ulong) mysql_get_server_version(mysql));
+ fprintf(stdout, "\n Creating a test database '%s' ...", current_db);
+ }
+ strxmov(query, "CREATE DATABASE IF NOT EXISTS ", current_db, NullS);
+
+ rc= mysql_query(mysql, query);
+ myquery(rc);
+
+ strxmov(query, "USE ", current_db, NullS);
+ rc= mysql_query(mysql, query);
+ myquery(rc);
+ have_innodb= check_have_innodb(mysql);
+
+ if (!opt_silent)
+ fprintf(stdout, "OK\n");
+
+ return mysql;
+}
+
+
+/* Close the connection */
+
+static void client_disconnect(MYSQL* mysql, my_bool drop_db)
+{
+ static char query[MAX_TEST_QUERY_LENGTH];
+
+ myheader_r("client_disconnect");
+
+ if (mysql)
+ {
+ if (drop_db)
+ {
+ if (!opt_silent)
+ fprintf(stdout, "\n dropping the test database '%s' ...", current_db);
+ strxmov(query, "DROP DATABASE IF EXISTS ", current_db, NullS);
+
+ mysql_query(mysql, query);
+ if (!opt_silent)
+ fprintf(stdout, "OK");
+ }
+
+ if (!opt_silent)
+ fprintf(stdout, "\n closing the connection ...");
+ mysql_close(mysql);
+ if (!opt_silent)
+ fprintf(stdout, "OK\n");
+ }
+}
+
+
+/* Print dashes */
+
+static void my_print_dashes(MYSQL_RES *result)
+{
+ MYSQL_FIELD *field;
+ unsigned int i, j;
+
+ mysql_field_seek(result, 0);
+ fputc('\t', stdout);
+ fputc('+', stdout);
+
+ for(i= 0; i< mysql_num_fields(result); i++)
+ {
+ field= mysql_fetch_field(result);
+ for(j= 0; j < field->max_length+2; j++)
+ fputc('-', stdout);
+ fputc('+', stdout);
+ }
+ fputc('\n', stdout);
+}
+
+
+/* Print resultset metadata information */
+
+static void my_print_result_metadata(MYSQL_RES *result)
+{
+ MYSQL_FIELD *field;
+ unsigned int i, j;
+ unsigned int field_count;
+
+ mysql_field_seek(result, 0);
+ if (!opt_silent)
+ {
+ fputc('\n', stdout);
+ fputc('\n', stdout);
+ }
+
+ field_count= mysql_num_fields(result);
+ for(i= 0; i< field_count; i++)
+ {
+ field= mysql_fetch_field(result);
+ j= strlen(field->name);
+ if (j < field->max_length)
+ j= field->max_length;
+ if (j < 4 && !IS_NOT_NULL(field->flags))
+ j= 4;
+ field->max_length= j;
+ }
+ if (!opt_silent)
+ {
+ my_print_dashes(result);
+ fputc('\t', stdout);
+ fputc('|', stdout);
+ }
+
+ mysql_field_seek(result, 0);
+ for(i= 0; i< field_count; i++)
+ {
+ field= mysql_fetch_field(result);
+ if (!opt_silent)
+ fprintf(stdout, " %-*s |", (int) field->max_length, field->name);
+ }
+ if (!opt_silent)
+ {
+ fputc('\n', stdout);
+ my_print_dashes(result);
+ }
+}
+
+
+/* Process the result set */
+
+static int my_process_result_set(MYSQL_RES *result)
+{
+ MYSQL_ROW row;
+ MYSQL_FIELD *field;
+ unsigned int i;
+ unsigned int row_count= 0;
+
+ if (!result)
+ return 0;
+
+ my_print_result_metadata(result);
+
+ while ((row= mysql_fetch_row(result)) != NULL)
+ {
+ mysql_field_seek(result, 0);
+ if (!opt_silent)
+ {
+ fputc('\t', stdout);
+ fputc('|', stdout);
+ }
+
+ for(i= 0; i< mysql_num_fields(result); i++)
+ {
+ field= mysql_fetch_field(result);
+ if (!opt_silent)
+ {
+ if (row[i] == NULL)
+ fprintf(stdout, " %-*s |", (int) field->max_length, "NULL");
+ else if (IS_NUM(field->type))
+ fprintf(stdout, " %*s |", (int) field->max_length, row[i]);
+ else
+ fprintf(stdout, " %-*s |", (int) field->max_length, row[i]);
+ }
+ }
+ if (!opt_silent)
+ {
+ fputc('\t', stdout);
+ fputc('\n', stdout);
+ }
+ row_count++;
+ }
+ if (!opt_silent)
+ {
+ if (row_count)
+ my_print_dashes(result);
+
+ if (mysql_errno(mysql) != 0)
+ fprintf(stderr, "\n\tmysql_fetch_row() failed\n");
+ else
+ fprintf(stdout, "\n\t%d %s returned\n", row_count,
+ row_count == 1 ? "row" : "rows");
+ }
+ return row_count;
+}
+
+
+static int my_process_result(MYSQL *mysql_arg)
+{
+ MYSQL_RES *result;
+ int row_count;
+
+ if (!(result= mysql_store_result(mysql_arg)))
+ return 0;
+
+ row_count= my_process_result_set(result);
+
+ mysql_free_result(result);
+ return row_count;
+}
+
+
+/* Process the statement result set */
+
+#define MAX_RES_FIELDS 50
+#define MAX_FIELD_DATA_SIZE 255
+
+static int my_process_stmt_result(MYSQL_STMT *stmt)
+{
+ int field_count;
+ int row_count= 0;
+ MYSQL_BIND buffer[MAX_RES_FIELDS];
+ MYSQL_FIELD *field;
+ MYSQL_RES *result;
+ char data[MAX_RES_FIELDS][MAX_FIELD_DATA_SIZE];
+ ulong length[MAX_RES_FIELDS];
+ my_bool is_null[MAX_RES_FIELDS];
+ int rc, i;
+
+ if (!(result= mysql_stmt_result_metadata(stmt))) /* No meta info */
+ {
+ while (!mysql_stmt_fetch(stmt))
+ row_count++;
+ return row_count;
+ }
+
+ field_count= min(mysql_num_fields(result), MAX_RES_FIELDS);
+
+ bzero((char*) buffer, sizeof(buffer));
+ bzero((char*) length, sizeof(length));
+ bzero((char*) is_null, sizeof(is_null));
+
+ for(i= 0; i < field_count; i++)
+ {
+ buffer[i].buffer_type= MYSQL_TYPE_STRING;
+ buffer[i].buffer_length= MAX_FIELD_DATA_SIZE;
+ buffer[i].length= &length[i];
+ buffer[i].buffer= (void *) data[i];
+ buffer[i].is_null= &is_null[i];
+ }
+
+ rc= mysql_stmt_bind_result(stmt, buffer);
+ check_execute(stmt, rc);
+
+ rc= 1;
+ mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*)&rc);
+ rc= mysql_stmt_store_result(stmt);
+ check_execute(stmt, rc);
+ my_print_result_metadata(result);
+
+ mysql_field_seek(result, 0);
+ while ((rc= mysql_stmt_fetch(stmt)) == 0)
+ {
+ if (!opt_silent)
+ {
+ fputc('\t', stdout);
+ fputc('|', stdout);
+ }
+ mysql_field_seek(result, 0);
+ for (i= 0; i < field_count; i++)
+ {
+ field= mysql_fetch_field(result);
+ if (!opt_silent)
+ {
+ if (is_null[i])
+ fprintf(stdout, " %-*s |", (int) field->max_length, "NULL");
+ else if (length[i] == 0)
+ {
+ data[i][0]= '\0'; /* unmodified buffer */
+ fprintf(stdout, " %*s |", (int) field->max_length, data[i]);
+ }
+ else if (IS_NUM(field->type))
+ fprintf(stdout, " %*s |", (int) field->max_length, data[i]);
+ else
+ fprintf(stdout, " %-*s |", (int) field->max_length, data[i]);
+ }
+ }
+ if (!opt_silent)
+ {
+ fputc('\t', stdout);
+ fputc('\n', stdout);
+ }
+ row_count++;
+ }
+ DIE_UNLESS(rc == MYSQL_NO_DATA);
+ if (!opt_silent)
+ {
+ if (row_count)
+ my_print_dashes(result);
+ fprintf(stdout, "\n\t%d %s returned\n", row_count,
+ row_count == 1 ? "row" : "rows");
+ }
+ mysql_free_result(result);
+ return row_count;
+}
+
+
+/* Prepare statement, execute, and process result set for given query */
+
+int my_stmt_result(const char *buff)
+{
+ MYSQL_STMT *stmt;
+ int row_count;
+ int rc;
+
+ if (!opt_silent)
+ fprintf(stdout, "\n\n %s", buff);
+ stmt= mysql_simple_prepare(mysql, buff);
+ check_stmt(stmt);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ row_count= my_process_stmt_result(stmt);
+ mysql_stmt_close(stmt);
+
+ return row_count;
+}
+
+/* Print the total number of warnings and the warnings themselves. */
+
+void my_process_warnings(MYSQL *conn, unsigned expected_warning_count)
+{
+ MYSQL_RES *result;
+ int rc;
+
+ if (!opt_silent)
+ fprintf(stdout, "\n total warnings: %u (expected: %u)\n",
+ mysql_warning_count(conn), expected_warning_count);
+
+ DIE_UNLESS(mysql_warning_count(mysql) == expected_warning_count);
+
+ rc= mysql_query(conn, "SHOW WARNINGS");
+ DIE_UNLESS(rc == 0);
+
+ result= mysql_store_result(conn);
+ mytest(result);
+
+ rc= my_process_result_set(result);
+ mysql_free_result(result);
+}
+
+
+/* Utility function to verify a particular column data */
+
+static void verify_col_data(const char *table, const char *col,
+ const char *exp_data)
+{
+ static char query[MAX_TEST_QUERY_LENGTH];
+ MYSQL_RES *result;
+ MYSQL_ROW row;
+ int rc, field= 1;
+
+ if (table && col)
+ {
+ strxmov(query, "SELECT ", col, " FROM ", table, " LIMIT 1", NullS);
+ if (!opt_silent)
+ fprintf(stdout, "\n %s", query);
+ rc= mysql_query(mysql, query);
+ myquery(rc);
+
+ field= 0;
+ }
+
+ result= mysql_use_result(mysql);
+ mytest(result);
+
+ if (!(row= mysql_fetch_row(result)) || !row[field])
+ {
+ fprintf(stdout, "\n *** ERROR: FAILED TO GET THE RESULT ***");
+ exit(1);
+ }
+ if (strcmp(row[field], exp_data))
+ {
+ fprintf(stdout, "\n obtained: `%s` (expected: `%s`)",
+ row[field], exp_data);
+ DIE_UNLESS(FALSE);
+ }
+ mysql_free_result(result);
+}
+
+
+/* Utility function to verify the field members */
+
+#define verify_prepare_field(result,no,name,org_name,type,table,\
+ org_table,db,length,def) \
+ do_verify_prepare_field((result),(no),(name),(org_name),(type), \
+ (table),(org_table),(db),(length),(def), \
+ __FILE__, __LINE__)
+
+static void do_verify_prepare_field(MYSQL_RES *result,
+ unsigned int no, const char *name,
+ const char *org_name,
+ enum enum_field_types type,
+ const char *table,
+ const char *org_table, const char *db,
+ unsigned long length, const char *def,
+ const char *file, int line)
+{
+ MYSQL_FIELD *field;
+ CHARSET_INFO *cs;
+ ulonglong expected_field_length;
+
+ if (!(field= mysql_fetch_field_direct(result, no)))
+ {
+ fprintf(stdout, "\n *** ERROR: FAILED TO GET THE RESULT ***");
+ exit(1);
+ }
+ cs= get_charset(field->charsetnr, 0);
+ DIE_UNLESS(cs);
+ if ((expected_field_length= length * cs->mbmaxlen) > UINT_MAX32)
+ expected_field_length= UINT_MAX32;
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n field[%d]:", no);
+ fprintf(stdout, "\n name :`%s`\t(expected: `%s`)", field->name, name);
+ fprintf(stdout, "\n org_name :`%s`\t(expected: `%s`)",
+ field->org_name, org_name);
+ fprintf(stdout, "\n type :`%d`\t(expected: `%d`)", field->type, type);
+ if (table)
+ fprintf(stdout, "\n table :`%s`\t(expected: `%s`)",
+ field->table, table);
+ if (org_table)
+ fprintf(stdout, "\n org_table:`%s`\t(expected: `%s`)",
+ field->org_table, org_table);
+ fprintf(stdout, "\n database :`%s`\t(expected: `%s`)", field->db, db);
+ fprintf(stdout, "\n length :`%lu`\t(expected: `%llu`)",
+ field->length, expected_field_length);
+ fprintf(stdout, "\n maxlength:`%ld`", field->max_length);
+ fprintf(stdout, "\n charsetnr:`%d`", field->charsetnr);
+ fprintf(stdout, "\n default :`%s`\t(expected: `%s`)",
+ field->def ? field->def : "(null)", def ? def: "(null)");
+ fprintf(stdout, "\n");
+ }
+ DIE_UNLESS(strcmp(field->name, name) == 0);
+ DIE_UNLESS(strcmp(field->org_name, org_name) == 0);
+ /*
+ XXX: silent column specification change works based on number of
+ bytes a column occupies. So CHAR -> VARCHAR upgrade is possible even
+ for CHAR(2) column if its character set is multibyte.
+ VARCHAR -> CHAR downgrade won't work for VARCHAR(3) as one would
+ expect.
+ */
+ if (cs->mbmaxlen == 1)
+ {
+ if (field->type != type)
+ {
+ fprintf(stderr,
+ "Expected field type: %d, got type: %d in file %s, line %d\n",
+ (int) type, (int) field->type, file, line);
+ DIE_UNLESS(field->type == type);
+ }
+ }
+ if (table)
+ DIE_UNLESS(strcmp(field->table, table) == 0);
+ if (org_table)
+ DIE_UNLESS(strcmp(field->org_table, org_table) == 0);
+ DIE_UNLESS(strcmp(field->db, db) == 0);
+ /*
+ Character set should be taken into account for multibyte encodings, such
+ as utf8. Field length is calculated as number of characters * maximum
+ number of bytes a character can occupy.
+ */
+ if (length && (field->length != expected_field_length))
+ {
+ fflush(stdout);
+ fprintf(stderr, "Expected field length: %llu, got length: %lu\n",
+ expected_field_length, field->length);
+ fflush(stderr);
+ DIE_UNLESS(field->length == expected_field_length);
+ }
+ if (def)
+ DIE_UNLESS(strcmp(field->def, def) == 0);
+}
+
+
+/* Utility function to verify the parameter count */
+
+static void verify_param_count(MYSQL_STMT *stmt, long exp_count)
+{
+ long param_count= mysql_stmt_param_count(stmt);
+ if (!opt_silent)
+ fprintf(stdout, "\n total parameters in stmt: `%ld` (expected: `%ld`)",
+ param_count, exp_count);
+ DIE_UNLESS(param_count == exp_count);
+}
+
+
+/* Utility function to verify the total affected rows */
+
+static void verify_st_affected_rows(MYSQL_STMT *stmt, ulonglong exp_count)
+{
+ ulonglong affected_rows= mysql_stmt_affected_rows(stmt);
+ if (!opt_silent)
+ fprintf(stdout, "\n total affected rows: `%ld` (expected: `%ld`)",
+ (long) affected_rows, (long) exp_count);
+ DIE_UNLESS(affected_rows == exp_count);
+}
+
+
+/* Utility function to verify the total affected rows */
+
+static void verify_affected_rows(ulonglong exp_count)
+{
+ ulonglong affected_rows= mysql_affected_rows(mysql);
+ if (!opt_silent)
+ fprintf(stdout, "\n total affected rows: `%ld` (expected: `%ld`)",
+ (long) affected_rows, (long) exp_count);
+ DIE_UNLESS(affected_rows == exp_count);
+}
+
+
+/* Utility function to verify the total fields count */
+
+static void verify_field_count(MYSQL_RES *result, uint exp_count)
+{
+ uint field_count= mysql_num_fields(result);
+ if (!opt_silent)
+ fprintf(stdout, "\n total fields in the result set: `%d` (expected: `%d`)",
+ field_count, exp_count);
+ DIE_UNLESS(field_count == exp_count);
+}
+
+
+/* Utility function to execute a query using prepare-execute */
+
+#ifndef EMBEDDED_LIBRARY
+static void execute_prepare_query(const char *query, ulonglong exp_count)
+{
+ MYSQL_STMT *stmt;
+ ulonglong affected_rows;
+ int rc;
+
+ stmt= mysql_simple_prepare(mysql, query);
+ check_stmt(stmt);
+
+ rc= mysql_stmt_execute(stmt);
+ myquery(rc);
+
+ affected_rows= mysql_stmt_affected_rows(stmt);
+ if (!opt_silent)
+ fprintf(stdout, "\n total affected rows: `%ld` (expected: `%ld`)",
+ (long) affected_rows, (long) exp_count);
+
+ DIE_UNLESS(affected_rows == exp_count);
+ mysql_stmt_close(stmt);
+}
+#endif
+
+/*
+Accepts arbitrary number of queries and runs them against the database.
+Used to fill tables for each test.
+*/
+
+void fill_tables(const char **query_list, unsigned query_count)
+{
+ int rc;
+ const char **query;
+ DBUG_ENTER("fill_tables");
+ for (query= query_list; query < query_list + query_count;
+ ++query)
+ {
+ rc= mysql_query(mysql, *query);
+ myquery(rc);
+ }
+ DBUG_VOID_RETURN;
+}
+
+/*
+All state of fetch from one statement: statement handle, out buffers,
+fetch position.
+See fetch_n for for the only use case.
+*/
+
+enum { MAX_COLUMN_LENGTH= 255 };
+
+typedef struct st_stmt_fetch
+{
+const char *query;
+unsigned stmt_no;
+MYSQL_STMT *handle;
+my_bool is_open;
+MYSQL_BIND *bind_array;
+char **out_data;
+unsigned long *out_data_length;
+unsigned column_count;
+unsigned row_count;
+} Stmt_fetch;
+
+
+/*
+Create statement handle, prepare it with statement, execute and allocate
+fetch buffers.
+*/
+
+void stmt_fetch_init(Stmt_fetch *fetch, unsigned stmt_no_arg,
+const char *query_arg)
+{
+ unsigned long type= CURSOR_TYPE_READ_ONLY;
+ int rc;
+ unsigned i;
+ MYSQL_RES *metadata;
+ DBUG_ENTER("stmt_fetch_init");
+
+ /* Save query and statement number for error messages */
+ fetch->stmt_no= stmt_no_arg;
+ fetch->query= query_arg;
+
+ fetch->handle= mysql_stmt_init(mysql);
+
+ rc= mysql_stmt_prepare(fetch->handle, fetch->query, strlen(fetch->query));
+ check_execute(fetch->handle, rc);
+
+ /*
+ The attribute is sent to server on execute and asks to open read-only
+ for result set
+ */
+ mysql_stmt_attr_set(fetch->handle, STMT_ATTR_CURSOR_TYPE,
+ (const void*) &type);
+
+ rc= mysql_stmt_execute(fetch->handle);
+ check_execute(fetch->handle, rc);
+
+ /* Find out total number of columns in result set */
+ metadata= mysql_stmt_result_metadata(fetch->handle);
+ fetch->column_count= mysql_num_fields(metadata);
+ mysql_free_result(metadata);
+
+ /*
+ Now allocate bind handles and buffers for output data:
+ calloc memory to reduce number of MYSQL_BIND members we need to
+ set up.
+ */
+
+ fetch->bind_array= (MYSQL_BIND *) calloc(1, sizeof(MYSQL_BIND) *
+ fetch->column_count);
+ fetch->out_data= (char**) calloc(1, sizeof(char*) * fetch->column_count);
+ fetch->out_data_length= (ulong*) calloc(1, sizeof(ulong) *
+ fetch->column_count);
+ for (i= 0; i < fetch->column_count; ++i)
+ {
+ fetch->out_data[i]= (char*) calloc(1, MAX_COLUMN_LENGTH);
+ fetch->bind_array[i].buffer_type= MYSQL_TYPE_STRING;
+ fetch->bind_array[i].buffer= fetch->out_data[i];
+ fetch->bind_array[i].buffer_length= MAX_COLUMN_LENGTH;
+ fetch->bind_array[i].length= fetch->out_data_length + i;
+ }
+
+ mysql_stmt_bind_result(fetch->handle, fetch->bind_array);
+
+ fetch->row_count= 0;
+ fetch->is_open= TRUE;
+
+ /* Ready for reading rows */
+ DBUG_VOID_RETURN;
+}
+
+
+/* Fetch and print one row from cursor */
+
+int stmt_fetch_fetch_row(Stmt_fetch *fetch)
+{
+ int rc;
+ unsigned i;
+ DBUG_ENTER("stmt_fetch_fetch_row");
+
+ if ((rc= mysql_stmt_fetch(fetch->handle)) == 0)
+ {
+ ++fetch->row_count;
+ if (!opt_silent)
+ printf("Stmt %d fetched row %d:\n", fetch->stmt_no, fetch->row_count);
+ for (i= 0; i < fetch->column_count; ++i)
+ {
+ fetch->out_data[i][fetch->out_data_length[i]]= '\0';
+ if (!opt_silent)
+ printf("column %d: %s\n", i+1, fetch->out_data[i]);
+ }
+ }
+ else
+ fetch->is_open= FALSE;
+ DBUG_RETURN(rc);
+}
+
+
+void stmt_fetch_close(Stmt_fetch *fetch)
+{
+ unsigned i;
+ DBUG_ENTER("stmt_fetch_close");
+
+ for (i= 0; i < fetch->column_count; ++i)
+ free(fetch->out_data[i]);
+ free(fetch->out_data);
+ free(fetch->out_data_length);
+ free(fetch->bind_array);
+ mysql_stmt_close(fetch->handle);
+ DBUG_VOID_RETURN;
+}
+
+/*
+For given array of queries, open query_count cursors and fetch
+from them in simultaneous manner.
+In case there was an error in one of the cursors, continue
+reading from the rest.
+*/
+
+enum fetch_type { USE_ROW_BY_ROW_FETCH= 0, USE_STORE_RESULT= 1 };
+
+my_bool fetch_n(const char **query_list, unsigned query_count,
+enum fetch_type fetch_type)
+{
+ unsigned open_statements= query_count;
+ int rc, error_count= 0;
+ Stmt_fetch *fetch_array= (Stmt_fetch*) calloc(1, sizeof(Stmt_fetch) *
+ query_count);
+ Stmt_fetch *fetch;
+ DBUG_ENTER("fetch_n");
+
+ for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
+ {
+ /* Init will exit(1) in case of error */
+ stmt_fetch_init(fetch, fetch - fetch_array,
+ query_list[fetch - fetch_array]);
+ }
+
+ if (fetch_type == USE_STORE_RESULT)
+ {
+ for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
+ {
+ rc= mysql_stmt_store_result(fetch->handle);
+ check_execute(fetch->handle, rc);
+ }
+ }
+
+ while (open_statements)
+ {
+ for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
+ {
+ if (fetch->is_open && (rc= stmt_fetch_fetch_row(fetch)))
+ {
+ open_statements--;
+ /*
+ We try to fetch from the rest of the statements in case of
+ error
+ */
+ if (rc != MYSQL_NO_DATA)
+ {
+ fprintf(stderr,
+ "Got error reading rows from statement %d,\n"
+ "query is: %s,\n"
+ "error message: %s", (int) (fetch - fetch_array),
+ fetch->query,
+ mysql_stmt_error(fetch->handle));
+ error_count++;
+ }
+ }
+ }
+ }
+ if (error_count)
+ fprintf(stderr, "Fetch FAILED");
+ else
+ {
+ unsigned total_row_count= 0;
+ for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
+ total_row_count+= fetch->row_count;
+ if (!opt_silent)
+ printf("Success, total rows fetched: %d\n", total_row_count);
+ }
+ for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
+ stmt_fetch_close(fetch);
+ free(fetch_array);
+ DBUG_RETURN(error_count != 0);
+}
+
+/* Separate thread query to test some cases */
+
+static my_bool thread_query(const char *query)
+{
+ MYSQL *l_mysql;
+ my_bool error;
+
+ error= 0;
+ if (!opt_silent)
+ fprintf(stdout, "\n in thread_query(%s)", query);
+ if (!(l_mysql= mysql_client_init(NULL)))
+ {
+ myerror("mysql_client_init() failed");
+ return 1;
+ }
+ if (!(mysql_real_connect(l_mysql, opt_host, opt_user,
+ opt_password, current_db, opt_port,
+ opt_unix_socket, 0)))
+ {
+ myerror("connection failed");
+ error= 1;
+ goto end;
+ }
+ l_mysql->reconnect= 1;
+ if (mysql_query(l_mysql, query))
+ {
+ fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql));
+ error= 1;
+ goto end;
+ }
+ mysql_commit(l_mysql);
+ end:
+ mysql_close(l_mysql);
+ return error;
+}
+
+
+/*
+ Read and parse arguments and MySQL options from my.cnf
+*/
+
+static const char *client_test_load_default_groups[]=
+{ "client", "client-server", "client-mariadb", 0 };
+static char **defaults_argv;
+
+static struct my_option client_test_long_options[] =
+{
+ {"basedir", 'b', "Basedir for tests.", (char**) &opt_basedir,
+ (char**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"count", 't', "Number of times test to be executed", &opt_count,
+ &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
+ {"database", 'D', "Database to use", &opt_db, &opt_db,
+ 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", (char**) &default_dbug_option,
+ (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
+ 0, 0, 0, 0, 0},
+ {"host", 'h', "Connect to host", &opt_host, &opt_host,
+ 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"password", 'p',
+ "Password to use when connecting to server. If password is not given it's asked from the tty.",
+ 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"port", 'P', "Port number to use for connection or 0 for default to, in "
+ "order of preference, my.cnf, $MYSQL_TCP_PORT, "
+#if MYSQL_PORT_DEFAULT == 0
+ "/etc/services, "
+#endif
+ "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
+ &opt_port, &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"server-arg", 'A', "Send embedded server this as a parameter.",
+ 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"show-tests", 'T', "Show all tests' names", 0, 0, 0, GET_NO_ARG, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
+ {"silent", 's', "Be more silent", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0,
+ 0},
+#ifdef HAVE_SMEM
+ {"shared-memory-base-name", 'm', "Base name of shared memory.",
+ &shared_memory_base_name, (uchar**)&shared_memory_base_name, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#endif
+ {"socket", 'S', "Socket file to use for connection",
+ &opt_unix_socket, &opt_unix_socket, 0, GET_STR,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"testcase", 'c',
+ "May disable some code when runs as mysql-test-run testcase.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+#ifndef DONT_ALLOW_USER_CHANGE
+ {"user", 'u', "User for login if not current user", &opt_user,
+ &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#endif
+ {"vardir", 'v', "Data dir for tests.", (char**) &opt_vardir,
+ (char**) &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"non-blocking-api", 'n',
+ "Use the non-blocking client API for communication.",
+ &non_blocking_api_enabled, &non_blocking_api_enabled, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"getopt-ll-test", 'g', "Option for testing bug in getopt library",
+ &opt_getopt_ll_test, &opt_getopt_ll_test, 0,
+ GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
+ {"plugin_dir", 0, "Directory for client-side plugins.",
+ &opt_plugin_dir, &opt_plugin_dir, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"default_auth", 0, "Default authentication client-side plugin to use.",
+ &opt_default_auth, &opt_default_auth, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+
+
+static void usage(void)
+{
+ /* show the usage string when the user asks for this */
+ putc('\n', stdout);
+ printf("%s Ver %s Distrib %s, for %s (%s)\n",
+ my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+ puts("By Monty, Venu, Kent and others\n");
+ printf("\
+Copyright (C) 2002-2004 MySQL AB\n\
+This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
+and you are welcome to modify and redistribute it under the GPL license\n");
+ printf("Usage: %s [OPTIONS] [TESTNAME1 TESTNAME2...]\n", my_progname);
+ my_print_help(client_test_long_options);
+ print_defaults("my", client_test_load_default_groups);
+ my_print_variables(client_test_long_options);
+}
+
+static struct my_tests_st *get_my_tests(); /* To be defined in main .c file */
+
+static struct my_tests_st *my_testlist= 0;
+
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : default_dbug_option);
+ break;
+ case 'c':
+ opt_testcase = 1;
+ break;
+ case 'p':
+ if (argument)
+ {
+ char *start=argument;
+ my_free(opt_password);
+ opt_password= my_strdup(argument, MYF(MY_FAE));
+ while (*argument) *argument++= 'x'; /* Destroy argument */
+ if (*start)
+ start[1]=0;
+ }
+ else
+ tty_password= 1;
+ break;
+ case 's':
+ if (argument == disabled_my_option)
+ opt_silent= 0;
+ else
+ opt_silent++;
+ break;
+ case 'A':
+ /*
+ When the embedded server is being tested, the test suite needs to be
+ able to pass command-line arguments to the embedded server so it can
+ locate the language files and data directory. The test suite
+ (mysql-test-run) never uses config files, just command-line options.
+ */
+ if (!embedded_server_arg_count)
+ {
+ embedded_server_arg_count= 1;
+ embedded_server_args[0]= (char*) "";
+ }
+ if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
+ !(embedded_server_args[embedded_server_arg_count++]=
+ my_strdup(argument, MYF(MY_FAE))))
+ {
+ DIE("Can't use server argument");
+ }
+ break;
+ case 'T':
+ {
+ struct my_tests_st *fptr;
+
+ printf("All possible test names:\n\n");
+ for (fptr= my_testlist; fptr->name; fptr++)
+ printf("%s\n", fptr->name);
+ exit(0);
+ break;
+ }
+ case '?':
+ case 'I': /* Info */
+ usage();
+ exit(0);
+ break;
+ }
+ return 0;
+}
+
+static void get_options(int *argc, char ***argv)
+{
+ int ho_error;
+
+ if ((ho_error= handle_options(argc, argv, client_test_long_options,
+ get_one_option)))
+ exit(ho_error);
+
+ if (tty_password)
+ opt_password= get_tty_password(NullS);
+ return;
+}
+
+/*
+ Print the test output on successful execution before exiting
+*/
+
+static void print_test_output()
+{
+ if (opt_silent < 3)
+ {
+ fprintf(stdout, "\n\n");
+ fprintf(stdout, "All '%d' tests were successful (in '%d' iterations)",
+ test_count-1, opt_count);
+ fprintf(stdout, "\n Total execution time: %g SECS", total_time);
+ if (opt_count > 1)
+ fprintf(stdout, " (Avg: %g SECS)", total_time/opt_count);
+
+ fprintf(stdout, "\n\n!!! SUCCESS !!!\n");
+ }
+}
+
+/***************************************************************************
+ main routine
+***************************************************************************/
+
+
+int main(int argc, char **argv)
+{
+ struct my_tests_st *fptr;
+ my_testlist= get_my_tests();
+
+ MY_INIT(argv[0]);
+
+ if (load_defaults("my", client_test_load_default_groups, &argc, &argv))
+ exit(1);
+
+ defaults_argv= argv;
+ get_options(&argc, &argv);
+
+ if (mysql_server_init(embedded_server_arg_count,
+ embedded_server_args,
+ (char**) embedded_server_groups))
+ DIE("Can't initialize MySQL server");
+
+ /* connect to server with no flags, default protocol, auto reconnect true */
+ mysql= client_connect(0, MYSQL_PROTOCOL_DEFAULT, 1);
+
+ total_time= 0;
+ for (iter_count= 1; iter_count <= opt_count; iter_count++)
+ {
+ /* Start of tests */
+ test_count= 1;
+ start_time= time((time_t *)0);
+ if (!argc)
+ {
+ for (fptr= my_testlist; fptr->name; fptr++)
+ (*fptr->function)();
+ }
+ else
+ {
+ for ( ; *argv ; argv++)
+ {
+ for (fptr= my_testlist; fptr->name; fptr++)
+ {
+ if (!strcmp(fptr->name, *argv))
+ {
+ (*fptr->function)();
+ break;
+ }
+ }
+ if (!fptr->name)
+ {
+ fprintf(stderr, "\n\nGiven test not found: '%s'\n", *argv);
+ fprintf(stderr, "See legal test names with %s -T\n\nAborting!\n",
+ my_progname);
+ client_disconnect(mysql, 1);
+ free_defaults(defaults_argv);
+ exit(1);
+ }
+ }
+ }
+
+ end_time= time((time_t *)0);
+ total_time+= difftime(end_time, start_time);
+
+ /* End of tests */
+ }
+
+ client_disconnect(mysql, 1); /* disconnect from server */
+
+ free_defaults(defaults_argv);
+ print_test_output();
+
+ while (embedded_server_arg_count > 1)
+ my_free(embedded_server_args[--embedded_server_arg_count]);
+
+ mysql_server_end();
+
+ my_end(0);
+
+ exit(0);
+}
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 73b49ec69f4..753df62abde 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2002, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008-2011 Monty Program Ab
+/* Copyright (c) 2002, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,407 +27,12 @@
*/
-#include <my_global.h>
-#include <my_sys.h>
-#include <mysql.h>
-#include <errmsg.h>
-#include <my_getopt.h>
-#include <m_string.h>
-#include <mysqld_error.h>
-#include <my_compare.h>
-#include <sql_common.h>
-#include <mysql/client_plugin.h>
-
-/*
- If non_blocking_api_enabled is true, we will re-define all the blocking
- API functions as wrappers that call the corresponding non-blocking API
- and use poll()/select() to wait for them to complete. This way we can get
- a good coverage testing of the non-blocking API as well.
-*/
-static my_bool non_blocking_api_enabled= 0;
-#if !defined(EMBEDDED_LIBRARY)
-#define WRAP_NONBLOCK_ENABLED non_blocking_api_enabled
-#include "nonblock-wrappers.h"
-#endif
-
-#define VER "2.1"
-#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
-#define MAX_KEY MAX_INDEXES
-#define MAX_SERVER_ARGS 64
-
-/* set default options */
-#ifdef NOT_USED
-static int opt_testcase = 0;
-#endif
-static char *opt_db= 0;
-static char *opt_user= 0;
-static char *opt_password= 0;
-static char *opt_host= 0;
-static char *opt_unix_socket= 0;
-#ifdef HAVE_SMEM
-static char *shared_memory_base_name= 0;
-#endif
-static unsigned int opt_port;
-static my_bool tty_password= 0, opt_silent= 0;
-
-static MYSQL *mysql= 0;
-static char current_db[]= "client_test_db";
-static unsigned int test_count= 0;
-static unsigned int opt_count= 0;
-static unsigned int iter_count= 0;
-static my_bool have_innodb= FALSE;
-static char *opt_plugin_dir= 0, *opt_default_auth= 0;
-
-static const char *opt_basedir= "./";
-static const char *opt_vardir= "mysql-test/var";
-
-static longlong opt_getopt_ll_test= 0;
-
-static int embedded_server_arg_count= 0;
-static char *embedded_server_args[MAX_SERVER_ARGS];
-
-static const char *embedded_server_groups[]= {
- "server",
- "embedded",
- "mysql_client_test_SERVER",
- NullS
-};
-
-static time_t start_time, end_time;
-static double total_time;
-
-const char *default_dbug_option= "d:t:o,/tmp/mysql_client_test.trace";
-
-struct my_tests_st
-{
- const char *name;
- void (*function)();
-};
-
-#define myheader(str) \
-DBUG_PRINT("test", ("name: %s", str)); \
-if (opt_silent < 2) \
-{ \
- fprintf(stdout, "\n\n#####################################\n"); \
- fprintf(stdout, "%u of (%u/%u): %s", test_count++, iter_count, \
- opt_count, str); \
- fprintf(stdout, " \n#####################################\n"); \
-}
-
-#define myheader_r(str) \
-DBUG_PRINT("test", ("name: %s", str)); \
-if (!opt_silent) \
-{ \
- fprintf(stdout, "\n\n#####################################\n"); \
- fprintf(stdout, "%s", str); \
- fprintf(stdout, " \n#####################################\n"); \
-}
-
-static void print_error(const char *msg);
-static void print_st_error(MYSQL_STMT *stmt, const char *msg);
-static void client_disconnect(MYSQL* mysql, my_bool drop_db);
-
-
-/*
- Abort unless given experssion is non-zero.
-
- SYNOPSIS
- DIE_UNLESS(expr)
-
- DESCRIPTION
- We can't use any kind of system assert as we need to
- preserve tested invariants in release builds as well.
-*/
-
-#define DIE_UNLESS(expr) \
- ((void) ((expr) ? 0 : (die(__FILE__, __LINE__, #expr), 0)))
-#define DIE_IF(expr) \
- ((void) ((expr) ? (die(__FILE__, __LINE__, #expr), 0) : 0))
-#define DIE(expr) \
- die(__FILE__, __LINE__, #expr)
-
-static void die(const char *file, int line, const char *expr)
-{
- fflush(stdout);
- fprintf(stderr, "%s:%d: check failed: '%s'\n", file, line, expr);
- fflush(stderr);
- exit(1);
-}
-
-
-#define myerror(msg) print_error(msg)
-#define mysterror(stmt, msg) print_st_error(stmt, msg)
-
-#define myquery(RES) \
-{ \
- int r= (RES); \
- if (r) \
- myerror(NULL); \
- DIE_UNLESS(r == 0); \
-}
-
-#define myquery_r(r) \
-{ \
-if (r) \
- myerror(NULL); \
-DIE_UNLESS(r != 0); \
-}
-
-#define check_execute(stmt, r) \
-{ \
-if (r) \
- mysterror(stmt, NULL); \
-DIE_UNLESS(r == 0);\
-}
-
-#define check_execute_r(stmt, r) \
-{ \
-if (r) \
- mysterror(stmt, NULL); \
-DIE_UNLESS(r != 0);\
-}
-
-#define check_stmt(stmt) \
-{ \
-if ( stmt == 0) \
- myerror(NULL); \
-DIE_UNLESS(stmt != 0); \
-}
-
-#define check_stmt_r(stmt) \
-{ \
-if (stmt == 0) \
- myerror(NULL);\
-DIE_UNLESS(stmt == 0);\
-}
-
-#define mytest(x) if (!(x)) {myerror(NULL);DIE_UNLESS(FALSE);}
-#define mytest_r(x) if ((x)) {myerror(NULL);DIE_UNLESS(FALSE);}
-
-
-/* A workaround for Sun Forte 5.6 on Solaris x86 */
-
-static int cmp_double(double *a, double *b)
-{
- return *a == *b;
-}
-
-
-/* Print the error message */
-
-static void print_error(const char *msg)
-{
- if (!opt_silent)
- {
- if (mysql && mysql_errno(mysql))
- {
- if (mysql->server_version)
- fprintf(stdout, "\n [MySQL-%s]", mysql->server_version);
- else
- fprintf(stdout, "\n [MySQL]");
- fprintf(stdout, "[%d] %s\n", mysql_errno(mysql), mysql_error(mysql));
- }
- else if (msg)
- fprintf(stderr, " [MySQL] %s\n", msg);
- }
-}
-
-
-static void print_st_error(MYSQL_STMT *stmt, const char *msg)
-{
- if (!opt_silent)
- {
- if (stmt && mysql_stmt_errno(stmt))
- {
- if (stmt->mysql && stmt->mysql->server_version)
- fprintf(stdout, "\n [MySQL-%s]", stmt->mysql->server_version);
- else
- fprintf(stdout, "\n [MySQL]");
-
- fprintf(stdout, "[%d] %s\n", mysql_stmt_errno(stmt),
- mysql_stmt_error(stmt));
- }
- else if (msg)
- fprintf(stderr, " [MySQL] %s\n", msg);
- }
-}
-
/*
- Enhanced version of mysql_client_init(), which may also set shared memory
- base on Windows.
+ The fw.c file includes all the mysql_client_test framework; this file
+ contains only the actual tests, plus the list of test functions to call.
*/
-static MYSQL *mysql_client_init(MYSQL* con)
-{
- MYSQL* res = mysql_init(con);
-#ifdef HAVE_SMEM
- if (res && shared_memory_base_name)
- mysql_options(res, MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name);
-#endif
- if (res && non_blocking_api_enabled)
- mysql_options(res, MYSQL_OPT_NONBLOCK, 0);
- if (opt_plugin_dir && *opt_plugin_dir)
- mysql_options(res, MYSQL_PLUGIN_DIR, opt_plugin_dir);
-
- if (opt_default_auth && *opt_default_auth)
- mysql_options(res, MYSQL_DEFAULT_AUTH, opt_default_auth);
- return res;
-}
-
-/*
- Disable direct calls of mysql_init, as it disregards shared memory base.
-*/
-#define mysql_init(A) Please use mysql_client_init instead of mysql_init
-
-
-/* Check if the connection has InnoDB tables */
-
-static my_bool check_have_innodb(MYSQL *conn)
-{
- MYSQL_RES *res;
- MYSQL_ROW row;
- int rc;
- my_bool result;
-
- rc= mysql_query(conn, "show variables like 'have_innodb'");
- myquery(rc);
- res= mysql_use_result(conn);
- DIE_UNLESS(res);
-
- row= mysql_fetch_row(res);
- DIE_UNLESS(row);
-
- result= strcmp(row[1], "YES") == 0;
- mysql_free_result(res);
- return result;
-}
-
-
-/*
- This is to be what mysql_query() is for mysql_real_query(), for
- mysql_simple_prepare(): a variant without the 'length' parameter.
-*/
-
-static MYSQL_STMT *STDCALL
-mysql_simple_prepare(MYSQL *mysql_arg, const char *query)
-{
- MYSQL_STMT *stmt= mysql_stmt_init(mysql_arg);
- if (stmt && mysql_stmt_prepare(stmt, query, (uint) strlen(query)))
- {
- mysql_stmt_close(stmt);
- return 0;
- }
- return stmt;
-}
-
-
-/**
- Connect to the server with options given by arguments to this application,
- stored in global variables opt_host, opt_user, opt_password, opt_db,
- opt_port and opt_unix_socket.
-
- @param flag[in] client_flag passed on to mysql_real_connect
- @param protocol[in] MYSQL_PROTOCOL_* to use for this connection
- @param auto_reconnect[in] set to 1 for auto reconnect
-
- @return pointer to initialized and connected MYSQL object
-*/
-static MYSQL* client_connect(ulong flag, uint protocol, my_bool auto_reconnect)
-{
- MYSQL* mysql;
- int rc;
- static char query[MAX_TEST_QUERY_LENGTH];
- myheader_r("client_connect");
-
- if (!opt_silent)
- fprintf(stdout, "\n Establishing a connection to '%s' ...",
- opt_host ? opt_host : "");
-
- if (!(mysql= mysql_client_init(NULL)))
- {
- opt_silent= 0;
- myerror("mysql_client_init() failed");
- exit(1);
- }
- /* enable local infile, in non-binary builds often disabled by default */
- mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0);
- mysql_options(mysql, MYSQL_OPT_PROTOCOL, &protocol);
- if (opt_plugin_dir && *opt_plugin_dir)
- mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
-
- if (opt_default_auth && *opt_default_auth)
- mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
-
- if (!(mysql_real_connect(mysql, opt_host, opt_user,
- opt_password, opt_db ? opt_db:"test", opt_port,
- opt_unix_socket, flag)))
- {
- opt_silent= 0;
- myerror("connection failed");
- mysql_close(mysql);
- fprintf(stdout, "\n Check the connection options using --help or -?\n");
- exit(1);
- }
- mysql->reconnect= auto_reconnect;
-
- if (!opt_silent)
- fprintf(stdout, "OK");
-
- /* set AUTOCOMMIT to ON*/
- mysql_autocommit(mysql, TRUE);
-
- if (!opt_silent)
- {
- fprintf(stdout, "\nConnected to MySQL server version: %s (%lu)\n",
- mysql_get_server_info(mysql),
- (ulong) mysql_get_server_version(mysql));
- fprintf(stdout, "\n Creating a test database '%s' ...", current_db);
- }
- strxmov(query, "CREATE DATABASE IF NOT EXISTS ", current_db, NullS);
-
- rc= mysql_query(mysql, query);
- myquery(rc);
-
- strxmov(query, "USE ", current_db, NullS);
- rc= mysql_query(mysql, query);
- myquery(rc);
- have_innodb= check_have_innodb(mysql);
-
- if (!opt_silent)
- fprintf(stdout, "OK\n");
-
- return mysql;
-}
-
-
-/* Close the connection */
-
-static void client_disconnect(MYSQL* mysql, my_bool drop_db)
-{
- static char query[MAX_TEST_QUERY_LENGTH];
-
- myheader_r("client_disconnect");
-
- if (mysql)
- {
- if (drop_db)
- {
- if (!opt_silent)
- fprintf(stdout, "\n dropping the test database '%s' ...", current_db);
- strxmov(query, "DROP DATABASE IF EXISTS ", current_db, NullS);
-
- mysql_query(mysql, query);
- if (!opt_silent)
- fprintf(stdout, "OK");
- }
-
- if (!opt_silent)
- fprintf(stdout, "\n closing the connection ...");
- mysql_close(mysql);
- if (!opt_silent)
- fprintf(stdout, "OK\n");
- }
-}
+#include "mysql_client_fw.c"
/* Query processing */
@@ -474,496 +79,6 @@ static void client_query()
}
-/* Print dashes */
-
-static void my_print_dashes(MYSQL_RES *result)
-{
- MYSQL_FIELD *field;
- unsigned int i, j;
-
- mysql_field_seek(result, 0);
- fputc('\t', stdout);
- fputc('+', stdout);
-
- for(i= 0; i< mysql_num_fields(result); i++)
- {
- field= mysql_fetch_field(result);
- for(j= 0; j < field->max_length+2; j++)
- fputc('-', stdout);
- fputc('+', stdout);
- }
- fputc('\n', stdout);
-}
-
-
-/* Print resultset metadata information */
-
-static void my_print_result_metadata(MYSQL_RES *result)
-{
- MYSQL_FIELD *field;
- unsigned int i, j;
- unsigned int field_count;
-
- mysql_field_seek(result, 0);
- if (!opt_silent)
- {
- fputc('\n', stdout);
- fputc('\n', stdout);
- }
-
- field_count= mysql_num_fields(result);
- for(i= 0; i< field_count; i++)
- {
- field= mysql_fetch_field(result);
- j= strlen(field->name);
- if (j < field->max_length)
- j= field->max_length;
- if (j < 4 && !IS_NOT_NULL(field->flags))
- j= 4;
- field->max_length= j;
- }
- if (!opt_silent)
- {
- my_print_dashes(result);
- fputc('\t', stdout);
- fputc('|', stdout);
- }
-
- mysql_field_seek(result, 0);
- for(i= 0; i< field_count; i++)
- {
- field= mysql_fetch_field(result);
- if (!opt_silent)
- fprintf(stdout, " %-*s |", (int) field->max_length, field->name);
- }
- if (!opt_silent)
- {
- fputc('\n', stdout);
- my_print_dashes(result);
- }
-}
-
-
-/* Process the result set */
-
-static int my_process_result_set(MYSQL_RES *result)
-{
- MYSQL_ROW row;
- MYSQL_FIELD *field;
- unsigned int i;
- unsigned int row_count= 0;
-
- if (!result)
- return 0;
-
- my_print_result_metadata(result);
-
- while ((row= mysql_fetch_row(result)) != NULL)
- {
- mysql_field_seek(result, 0);
- if (!opt_silent)
- {
- fputc('\t', stdout);
- fputc('|', stdout);
- }
-
- for(i= 0; i< mysql_num_fields(result); i++)
- {
- field= mysql_fetch_field(result);
- if (!opt_silent)
- {
- if (row[i] == NULL)
- fprintf(stdout, " %-*s |", (int) field->max_length, "NULL");
- else if (IS_NUM(field->type))
- fprintf(stdout, " %*s |", (int) field->max_length, row[i]);
- else
- fprintf(stdout, " %-*s |", (int) field->max_length, row[i]);
- }
- }
- if (!opt_silent)
- {
- fputc('\t', stdout);
- fputc('\n', stdout);
- }
- row_count++;
- }
- if (!opt_silent)
- {
- if (row_count)
- my_print_dashes(result);
-
- if (mysql_errno(mysql) != 0)
- fprintf(stderr, "\n\tmysql_fetch_row() failed\n");
- else
- fprintf(stdout, "\n\t%d %s returned\n", row_count,
- row_count == 1 ? "row" : "rows");
- }
- return row_count;
-}
-
-
-static int my_process_result(MYSQL *mysql_arg)
-{
- MYSQL_RES *result;
- int row_count;
-
- if (!(result= mysql_store_result(mysql_arg)))
- return 0;
-
- row_count= my_process_result_set(result);
-
- mysql_free_result(result);
- return row_count;
-}
-
-
-/* Process the statement result set */
-
-#define MAX_RES_FIELDS 50
-#define MAX_FIELD_DATA_SIZE 255
-
-static int my_process_stmt_result(MYSQL_STMT *stmt)
-{
- int field_count;
- int row_count= 0;
- MYSQL_BIND buffer[MAX_RES_FIELDS];
- MYSQL_FIELD *field;
- MYSQL_RES *result;
- char data[MAX_RES_FIELDS][MAX_FIELD_DATA_SIZE];
- ulong length[MAX_RES_FIELDS];
- my_bool is_null[MAX_RES_FIELDS];
- int rc, i;
-
- if (!(result= mysql_stmt_result_metadata(stmt))) /* No meta info */
- {
- while (!mysql_stmt_fetch(stmt))
- row_count++;
- return row_count;
- }
-
- field_count= MY_MIN(mysql_num_fields(result), MAX_RES_FIELDS);
-
- bzero((char*) buffer, sizeof(buffer));
- bzero((char*) length, sizeof(length));
- bzero((char*) is_null, sizeof(is_null));
-
- for(i= 0; i < field_count; i++)
- {
- buffer[i].buffer_type= MYSQL_TYPE_STRING;
- buffer[i].buffer_length= MAX_FIELD_DATA_SIZE;
- buffer[i].length= &length[i];
- buffer[i].buffer= (void *) data[i];
- buffer[i].is_null= &is_null[i];
- }
-
- rc= mysql_stmt_bind_result(stmt, buffer);
- check_execute(stmt, rc);
-
- rc= 1;
- mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*)&rc);
- rc= mysql_stmt_store_result(stmt);
- check_execute(stmt, rc);
- my_print_result_metadata(result);
-
- mysql_field_seek(result, 0);
- while ((rc= mysql_stmt_fetch(stmt)) == 0)
- {
- if (!opt_silent)
- {
- fputc('\t', stdout);
- fputc('|', stdout);
- }
- mysql_field_seek(result, 0);
- for (i= 0; i < field_count; i++)
- {
- field= mysql_fetch_field(result);
- if (!opt_silent)
- {
- if (is_null[i])
- fprintf(stdout, " %-*s |", (int) field->max_length, "NULL");
- else if (length[i] == 0)
- {
- data[i][0]= '\0'; /* unmodified buffer */
- fprintf(stdout, " %*s |", (int) field->max_length, data[i]);
- }
- else if (IS_NUM(field->type))
- fprintf(stdout, " %*s |", (int) field->max_length, data[i]);
- else
- fprintf(stdout, " %-*s |", (int) field->max_length, data[i]);
- }
- }
- if (!opt_silent)
- {
- fputc('\t', stdout);
- fputc('\n', stdout);
- }
- row_count++;
- }
- DIE_UNLESS(rc == MYSQL_NO_DATA);
- if (!opt_silent)
- {
- if (row_count)
- my_print_dashes(result);
- fprintf(stdout, "\n\t%d %s returned\n", row_count,
- row_count == 1 ? "row" : "rows");
- }
- mysql_free_result(result);
- return row_count;
-}
-
-
-/* Prepare statement, execute, and process result set for given query */
-
-int my_stmt_result(const char *buff)
-{
- MYSQL_STMT *stmt;
- int row_count;
- int rc;
-
- if (!opt_silent)
- fprintf(stdout, "\n\n %s", buff);
- stmt= mysql_simple_prepare(mysql, buff);
- check_stmt(stmt);
-
- rc= mysql_stmt_execute(stmt);
- check_execute(stmt, rc);
-
- row_count= my_process_stmt_result(stmt);
- mysql_stmt_close(stmt);
-
- return row_count;
-}
-
-/* Print the total number of warnings and the warnings themselves. */
-
-void my_process_warnings(MYSQL *conn, unsigned expected_warning_count)
-{
- MYSQL_RES *result;
- int rc;
-
- if (!opt_silent)
- fprintf(stdout, "\n total warnings: %u (expected: %u)\n",
- mysql_warning_count(conn), expected_warning_count);
-
- DIE_UNLESS(mysql_warning_count(mysql) == expected_warning_count);
-
- rc= mysql_query(conn, "SHOW WARNINGS");
- DIE_UNLESS(rc == 0);
-
- result= mysql_store_result(conn);
- mytest(result);
-
- rc= my_process_result_set(result);
- mysql_free_result(result);
-}
-
-
-/* Utility function to verify a particular column data */
-
-static void verify_col_data(const char *table, const char *col,
- const char *exp_data)
-{
- static char query[MAX_TEST_QUERY_LENGTH];
- MYSQL_RES *result;
- MYSQL_ROW row;
- int rc, field= 1;
-
- if (table && col)
- {
- strxmov(query, "SELECT ", col, " FROM ", table, " LIMIT 1", NullS);
- if (!opt_silent)
- fprintf(stdout, "\n %s", query);
- rc= mysql_query(mysql, query);
- myquery(rc);
-
- field= 0;
- }
-
- result= mysql_use_result(mysql);
- mytest(result);
-
- if (!(row= mysql_fetch_row(result)) || !row[field])
- {
- fprintf(stdout, "\n *** ERROR: FAILED TO GET THE RESULT ***");
- exit(1);
- }
- if (strcmp(row[field], exp_data))
- {
- fprintf(stdout, "\n obtained: `%s` (expected: `%s`)",
- row[field], exp_data);
- DIE_UNLESS(FALSE);
- }
- mysql_free_result(result);
-}
-
-
-/* Utility function to verify the field members */
-
-#define verify_prepare_field(result,no,name,org_name,type,table,\
- org_table,db,length,def) \
- do_verify_prepare_field((result),(no),(name),(org_name),(type), \
- (table),(org_table),(db),(length),(def), \
- __FILE__, __LINE__)
-
-static void do_verify_prepare_field(MYSQL_RES *result,
- unsigned int no, const char *name,
- const char *org_name,
- enum enum_field_types type,
- const char *table,
- const char *org_table, const char *db,
- unsigned long length, const char *def,
- const char *file, int line)
-{
- MYSQL_FIELD *field;
- CHARSET_INFO *cs;
- ulonglong expected_field_length;
-
- if (!(field= mysql_fetch_field_direct(result, no)))
- {
- fprintf(stdout, "\n *** ERROR: FAILED TO GET THE RESULT ***");
- exit(1);
- }
- cs= get_charset(field->charsetnr, 0);
- DIE_UNLESS(cs);
- if ((expected_field_length= length * cs->mbmaxlen) > UINT_MAX32)
- expected_field_length= UINT_MAX32;
- if (!opt_silent)
- {
- fprintf(stdout, "\n field[%d]:", no);
- fprintf(stdout, "\n name :`%s`\t(expected: `%s`)", field->name, name);
- fprintf(stdout, "\n org_name :`%s`\t(expected: `%s`)",
- field->org_name, org_name);
- fprintf(stdout, "\n type :`%d`\t(expected: `%d`)", field->type, type);
- if (table)
- fprintf(stdout, "\n table :`%s`\t(expected: `%s`)",
- field->table, table);
- if (org_table)
- fprintf(stdout, "\n org_table:`%s`\t(expected: `%s`)",
- field->org_table, org_table);
- fprintf(stdout, "\n database :`%s`\t(expected: `%s`)", field->db, db);
- fprintf(stdout, "\n length :`%lu`\t(expected: `%llu`)",
- field->length, expected_field_length);
- fprintf(stdout, "\n maxlength:`%ld`", field->max_length);
- fprintf(stdout, "\n charsetnr:`%d`", field->charsetnr);
- fprintf(stdout, "\n default :`%s`\t(expected: `%s`)",
- field->def ? field->def : "(null)", def ? def: "(null)");
- fprintf(stdout, "\n");
- }
- DIE_UNLESS(strcmp(field->name, name) == 0);
- DIE_UNLESS(strcmp(field->org_name, org_name) == 0);
- /*
- XXX: silent column specification change works based on number of
- bytes a column occupies. So CHAR -> VARCHAR upgrade is possible even
- for CHAR(2) column if its character set is multibyte.
- VARCHAR -> CHAR downgrade won't work for VARCHAR(3) as one would
- expect.
- */
- if (cs->mbmaxlen == 1)
- {
- if (field->type != type)
- {
- fprintf(stderr,
- "Expected field type: %d, got type: %d in file %s, line %d\n",
- (int) type, (int) field->type, file, line);
- DIE_UNLESS(field->type == type);
- }
- }
- if (table)
- DIE_UNLESS(strcmp(field->table, table) == 0);
- if (org_table)
- DIE_UNLESS(strcmp(field->org_table, org_table) == 0);
- DIE_UNLESS(strcmp(field->db, db) == 0);
- /*
- Character set should be taken into account for multibyte encodings, such
- as utf8. Field length is calculated as number of characters * maximum
- number of bytes a character can occupy.
- */
- if (length && (field->length != expected_field_length))
- {
- fflush(stdout);
- fprintf(stderr, "Expected field length: %llu, got length: %lu\n",
- expected_field_length, field->length);
- fflush(stderr);
- DIE_UNLESS(field->length == expected_field_length);
- }
- if (def)
- DIE_UNLESS(strcmp(field->def, def) == 0);
-}
-
-
-/* Utility function to verify the parameter count */
-
-static void verify_param_count(MYSQL_STMT *stmt, long exp_count)
-{
- long param_count= mysql_stmt_param_count(stmt);
- if (!opt_silent)
- fprintf(stdout, "\n total parameters in stmt: `%ld` (expected: `%ld`)",
- param_count, exp_count);
- DIE_UNLESS(param_count == exp_count);
-}
-
-
-/* Utility function to verify the total affected rows */
-
-static void verify_st_affected_rows(MYSQL_STMT *stmt, ulonglong exp_count)
-{
- ulonglong affected_rows= mysql_stmt_affected_rows(stmt);
- if (!opt_silent)
- fprintf(stdout, "\n total affected rows: `%ld` (expected: `%ld`)",
- (long) affected_rows, (long) exp_count);
- DIE_UNLESS(affected_rows == exp_count);
-}
-
-
-/* Utility function to verify the total affected rows */
-
-static void verify_affected_rows(ulonglong exp_count)
-{
- ulonglong affected_rows= mysql_affected_rows(mysql);
- if (!opt_silent)
- fprintf(stdout, "\n total affected rows: `%ld` (expected: `%ld`)",
- (long) affected_rows, (long) exp_count);
- DIE_UNLESS(affected_rows == exp_count);
-}
-
-
-/* Utility function to verify the total fields count */
-
-static void verify_field_count(MYSQL_RES *result, uint exp_count)
-{
- uint field_count= mysql_num_fields(result);
- if (!opt_silent)
- fprintf(stdout, "\n total fields in the result set: `%d` (expected: `%d`)",
- field_count, exp_count);
- DIE_UNLESS(field_count == exp_count);
-}
-
-
-/* Utility function to execute a query using prepare-execute */
-
-#ifndef EMBEDDED_LIBRARY
-static void execute_prepare_query(const char *query, ulonglong exp_count)
-{
- MYSQL_STMT *stmt;
- ulonglong affected_rows;
- int rc;
-
- stmt= mysql_simple_prepare(mysql, query);
- check_stmt(stmt);
-
- rc= mysql_stmt_execute(stmt);
- myquery(rc);
-
- affected_rows= mysql_stmt_affected_rows(stmt);
- if (!opt_silent)
- fprintf(stdout, "\n total affected rows: `%ld` (expected: `%ld`)",
- (long) affected_rows, (long) exp_count);
-
- DIE_UNLESS(affected_rows == exp_count);
- mysql_stmt_close(stmt);
-}
-#endif
-
/* Store result processing */
static void client_store_result()
@@ -1005,267 +120,6 @@ static void client_use_result()
}
-/*
- Accepts arbitrary number of queries and runs them against the database.
- Used to fill tables for each test.
-*/
-
-void fill_tables(const char **query_list, unsigned query_count)
-{
- int rc;
- const char **query;
- DBUG_ENTER("fill_tables");
- for (query= query_list; query < query_list + query_count;
- ++query)
- {
- rc= mysql_query(mysql, *query);
- myquery(rc);
- }
- DBUG_VOID_RETURN;
-}
-
-/*
- All state of fetch from one statement: statement handle, out buffers,
- fetch position.
- See fetch_n for for the only use case.
-*/
-
-enum { MAX_COLUMN_LENGTH= 255 };
-
-typedef struct st_stmt_fetch
-{
- const char *query;
- unsigned stmt_no;
- MYSQL_STMT *handle;
- my_bool is_open;
- MYSQL_BIND *bind_array;
- char **out_data;
- unsigned long *out_data_length;
- unsigned column_count;
- unsigned row_count;
-} Stmt_fetch;
-
-
-/*
- Create statement handle, prepare it with statement, execute and allocate
- fetch buffers.
-*/
-
-void stmt_fetch_init(Stmt_fetch *fetch, unsigned stmt_no_arg,
- const char *query_arg)
-{
- unsigned long type= CURSOR_TYPE_READ_ONLY;
- int rc;
- unsigned i;
- MYSQL_RES *metadata;
- DBUG_ENTER("stmt_fetch_init");
-
- /* Save query and statement number for error messages */
- fetch->stmt_no= stmt_no_arg;
- fetch->query= query_arg;
-
- fetch->handle= mysql_stmt_init(mysql);
-
- rc= mysql_stmt_prepare(fetch->handle, fetch->query, strlen(fetch->query));
- check_execute(fetch->handle, rc);
-
- /*
- The attribute is sent to server on execute and asks to open read-only
- for result set
- */
- mysql_stmt_attr_set(fetch->handle, STMT_ATTR_CURSOR_TYPE,
- (const void*) &type);
-
- rc= mysql_stmt_execute(fetch->handle);
- check_execute(fetch->handle, rc);
-
- /* Find out total number of columns in result set */
- metadata= mysql_stmt_result_metadata(fetch->handle);
- fetch->column_count= mysql_num_fields(metadata);
- mysql_free_result(metadata);
-
- /*
- Now allocate bind handles and buffers for output data:
- calloc memory to reduce number of MYSQL_BIND members we need to
- set up.
- */
-
- fetch->bind_array= (MYSQL_BIND *) calloc(1, sizeof(MYSQL_BIND) *
- fetch->column_count);
- fetch->out_data= (char**) calloc(1, sizeof(char*) * fetch->column_count);
- fetch->out_data_length= (ulong*) calloc(1, sizeof(ulong) *
- fetch->column_count);
- for (i= 0; i < fetch->column_count; ++i)
- {
- fetch->out_data[i]= (char*) calloc(1, MAX_COLUMN_LENGTH);
- fetch->bind_array[i].buffer_type= MYSQL_TYPE_STRING;
- fetch->bind_array[i].buffer= fetch->out_data[i];
- fetch->bind_array[i].buffer_length= MAX_COLUMN_LENGTH;
- fetch->bind_array[i].length= fetch->out_data_length + i;
- }
-
- mysql_stmt_bind_result(fetch->handle, fetch->bind_array);
-
- fetch->row_count= 0;
- fetch->is_open= TRUE;
-
- /* Ready for reading rows */
- DBUG_VOID_RETURN;
-}
-
-
-/* Fetch and print one row from cursor */
-
-int stmt_fetch_fetch_row(Stmt_fetch *fetch)
-{
- int rc;
- unsigned i;
- DBUG_ENTER("stmt_fetch_fetch_row");
-
- if ((rc= mysql_stmt_fetch(fetch->handle)) == 0)
- {
- ++fetch->row_count;
- if (!opt_silent)
- printf("Stmt %d fetched row %d:\n", fetch->stmt_no, fetch->row_count);
- for (i= 0; i < fetch->column_count; ++i)
- {
- fetch->out_data[i][fetch->out_data_length[i]]= '\0';
- if (!opt_silent)
- printf("column %d: %s\n", i+1, fetch->out_data[i]);
- }
- }
- else
- fetch->is_open= FALSE;
- DBUG_RETURN(rc);
-}
-
-
-void stmt_fetch_close(Stmt_fetch *fetch)
-{
- unsigned i;
- DBUG_ENTER("stmt_fetch_close");
-
- for (i= 0; i < fetch->column_count; ++i)
- free(fetch->out_data[i]);
- free(fetch->out_data);
- free(fetch->out_data_length);
- free(fetch->bind_array);
- mysql_stmt_close(fetch->handle);
- DBUG_VOID_RETURN;
-}
-
-/*
- For given array of queries, open query_count cursors and fetch
- from them in simultaneous manner.
- In case there was an error in one of the cursors, continue
- reading from the rest.
-*/
-
-enum fetch_type { USE_ROW_BY_ROW_FETCH= 0, USE_STORE_RESULT= 1 };
-
-my_bool fetch_n(const char **query_list, unsigned query_count,
- enum fetch_type fetch_type)
-{
- unsigned open_statements= query_count;
- int rc, error_count= 0;
- Stmt_fetch *fetch_array= (Stmt_fetch*) calloc(1, sizeof(Stmt_fetch) *
- query_count);
- Stmt_fetch *fetch;
- DBUG_ENTER("fetch_n");
-
- for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
- {
- /* Init will exit(1) in case of error */
- stmt_fetch_init(fetch, fetch - fetch_array,
- query_list[fetch - fetch_array]);
- }
-
- if (fetch_type == USE_STORE_RESULT)
- {
- for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
- {
- rc= mysql_stmt_store_result(fetch->handle);
- check_execute(fetch->handle, rc);
- }
- }
-
- while (open_statements)
- {
- for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
- {
- if (fetch->is_open && (rc= stmt_fetch_fetch_row(fetch)))
- {
- open_statements--;
- /*
- We try to fetch from the rest of the statements in case of
- error
- */
- if (rc != MYSQL_NO_DATA)
- {
- fprintf(stderr,
- "Got error reading rows from statement %d,\n"
- "query is: %s,\n"
- "error message: %s", (int) (fetch - fetch_array),
- fetch->query,
- mysql_stmt_error(fetch->handle));
- error_count++;
- }
- }
- }
- }
- if (error_count)
- fprintf(stderr, "Fetch FAILED");
- else
- {
- unsigned total_row_count= 0;
- for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
- total_row_count+= fetch->row_count;
- if (!opt_silent)
- printf("Success, total rows fetched: %d\n", total_row_count);
- }
- for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
- stmt_fetch_close(fetch);
- free(fetch_array);
- DBUG_RETURN(error_count != 0);
-}
-
-/* Separate thread query to test some cases */
-
-static my_bool thread_query(const char *query)
-{
- MYSQL *l_mysql;
- my_bool error;
-
- error= 0;
- if (!opt_silent)
- fprintf(stdout, "\n in thread_query(%s)", query);
- if (!(l_mysql= mysql_client_init(NULL)))
- {
- myerror("mysql_client_init() failed");
- return 1;
- }
- if (!(mysql_real_connect(l_mysql, opt_host, opt_user,
- opt_password, current_db, opt_port,
- opt_unix_socket, 0)))
- {
- myerror("connection failed");
- error= 1;
- goto end;
- }
- l_mysql->reconnect= 1;
- if (mysql_query(l_mysql, query))
- {
- fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql));
- error= 1;
- goto end;
- }
- mysql_commit(l_mysql);
-end:
- mysql_close(l_mysql);
- return error;
-}
-
-
/* Query processing */
static void test_debug_example()
@@ -1503,6 +357,7 @@ static void test_prepare_insert_update()
myquery(rc);
}
+
/* Test simple prepares of all DML statements */
static void test_prepare_simple()
@@ -2209,24 +1064,22 @@ static void test_wl4435_3()
puts("");
- /*
- The following types are not supported:
- - ENUM
- - SET
-
- The following types are supported but can not be used for
- OUT-parameters:
- - MEDIUMINT;
- - BIT(..);
-
- The problem is that those types are not supported for IN-parameters,
- and OUT-parameters should be bound as IN-parameters before execution
-
- The following types should not be used:
- - MYSQL_TYPE_YEAR (use MYSQL_TYPE_SHORT instead);
- - MYSQL_TYPE_TINY_BLOB, MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_LONG_BLOB
- (use MYSQL_TYPE_BLOB instead);
- */
+ // The following types are not supported:
+ // - ENUM
+ // - SET
+ //
+ // The following types are supported but can not be used for
+ // OUT-parameters:
+ // - MEDIUMINT;
+ // - BIT(..);
+ //
+ // The problem is that those types are not supported for IN-parameters,
+ // and OUT-parameters should be bound as IN-parameters before execution.
+ //
+ // The following types should not be used:
+ // - MYSQL_TYPE_YEAR (use MYSQL_TYPE_SHORT instead);
+ // - MYSQL_TYPE_TINY_BLOB, MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_LONG_BLOB
+ // (use MYSQL_TYPE_BLOB instead);
WL4435_TEST("TINYINT", "127",
MYSQL_TYPE_TINY, MYSQL_TYPE_TINY,
@@ -3456,6 +2309,7 @@ static void test_ps_query_cache()
if (!opt_silent)
fprintf(stdout, "OK");
+ break;
}
strmov(query, "select id1, value1 from t1 where id1= ? or "
@@ -7110,7 +5964,7 @@ static void test_subselect()
conversion using MYSQL_TIME structure
*/
-static void bind_date_conv(uint row_count, my_bool preserveFractions)
+static void test_bind_date_conv(uint row_count)
{
MYSQL_STMT *stmt= 0;
uint rc, i, count= row_count;
@@ -7120,10 +5974,6 @@ static void bind_date_conv(uint row_count, my_bool preserveFractions)
MYSQL_TIME tm[4];
ulong second_part;
uint year, month, day, hour, minute, sec;
- uint now_year= 1990, now_month= 3, now_day= 13;
-
- rc= mysql_query(mysql, "SET timestamp=UNIX_TIMESTAMP('1990-03-13')");
- myquery(rc);
stmt= mysql_simple_prepare(mysql, "INSERT INTO test_date VALUES(?, ?, ?, ?)");
check_stmt(stmt);
@@ -7220,33 +6070,19 @@ static void bind_date_conv(uint row_count, my_bool preserveFractions)
for (i= 0; i < array_elements(my_bind); i++)
{
if (!opt_silent)
- fprintf(stdout, "\ntime[%d]: %02d-%02d-%02d %02d:%02d:%02d.%06lu",
+ fprintf(stdout, "\ntime[%d]: %02d-%02d-%02d %02d:%02d:%02d.%02lu",
i, tm[i].year, tm[i].month, tm[i].day,
tm[i].hour, tm[i].minute, tm[i].second,
tm[i].second_part);
- DIE_UNLESS(tm[i].year == 0 || tm[i].year == year + count ||
- (tm[i].year == now_year &&
- my_bind[i].buffer_type == MYSQL_TYPE_TIME));
- DIE_UNLESS(tm[i].month == 0 || tm[i].month == month + count ||
- (tm[i].month == now_month &&
- my_bind[i].buffer_type == MYSQL_TYPE_TIME));
- DIE_UNLESS(tm[i].day == 0 || tm[i].day == day + count ||
- (tm[i].day == now_day &&
- my_bind[i].buffer_type == MYSQL_TYPE_TIME));
+ DIE_UNLESS(tm[i].year == 0 || tm[i].year == year+count);
+ DIE_UNLESS(tm[i].month == 0 || tm[i].month == month+count);
+ DIE_UNLESS(tm[i].day == 0 || tm[i].day == day+count);
DIE_UNLESS(tm[i].hour == 0 || tm[i].hour == hour+count);
DIE_UNLESS(tm[i].minute == 0 || tm[i].minute == minute+count);
DIE_UNLESS(tm[i].second == 0 || tm[i].second == sec+count);
- if (preserveFractions) {
- if (i == 3) { /* Dates dont have fractions */
- DIE_UNLESS(tm[i].second_part == 0);
- } else {
- DIE_UNLESS(tm[i].second_part == second_part+count);
- }
- } else {
- DIE_UNLESS((tm[i].second_part == 0)||
- tm[i].second_part == second_part+count);
- }
+ DIE_UNLESS(tm[i].second_part == 0 ||
+ tm[i].second_part == second_part+count);
}
}
rc= mysql_stmt_fetch(stmt);
@@ -7274,29 +6110,7 @@ static void test_date()
myquery(rc);
- bind_date_conv(5,FALSE);
-}
-
-
-/* Test DATE, TIME(6), DATETIME(6) and TS(6) with MYSQL_TIME conversion */
-
-static void test_date_frac()
-{
- int rc;
-
- myheader("test_date_frac");
-
- rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_date");
- myquery(rc);
-
- rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP(6), \
- c2 TIME(6), \
- c3 DATETIME(6), \
- c4 DATE)");
-
- myquery(rc);
-
- bind_date_conv(5,TRUE);
+ test_bind_date_conv(5);
}
@@ -7318,7 +6132,7 @@ static void test_date_date()
myquery(rc);
- bind_date_conv(3,FALSE);
+ test_bind_date_conv(3);
}
@@ -7340,7 +6154,7 @@ static void test_date_time()
myquery(rc);
- bind_date_conv(3, FALSE);
+ test_bind_date_conv(3);
}
@@ -7362,7 +6176,7 @@ static void test_date_ts()
myquery(rc);
- bind_date_conv(2, FALSE);
+ test_bind_date_conv(2);
}
@@ -7381,159 +6195,10 @@ static void test_date_dt()
" c2 datetime, c3 datetime, c4 date)");
myquery(rc);
- bind_date_conv(2, FALSE);
+ test_bind_date_conv(2);
}
-/*
- Test TIME/DATETIME parameters to cover the following methods:
- Item_param::val_int()
- Item_param::val_real()
- Item_param::val_decimal()
-*/
-static void test_temporal_param()
-{
-#define N_PARAMS 3
- MYSQL_STMT *stmt= 0;
- uint rc;
- ulong length[N_PARAMS], length2[N_PARAMS];
- MYSQL_BIND my_bind[N_PARAMS], my_bind2[N_PARAMS];
- my_bool is_null[N_PARAMS], is_null2[N_PARAMS];
- MYSQL_TIME tm;
- longlong bigint= 123;
- double real= 123;
- char dec[40];
-
- myheader("test_temporal_param");
-
- /* Initialize param/fetch buffers for data, null flags, lengths */
- memset(&my_bind, 0, sizeof(my_bind));
- memset(&my_bind2, 0, sizeof(my_bind2));
- memset(&length, 0, sizeof(length));
- memset(&length2, 0, sizeof(length2));
- memset(&is_null, 0, sizeof(is_null));
- memset(&is_null2, 0, sizeof(is_null2));
-
- /* Initialize the first input parameter */
- my_bind[0].buffer_type= MYSQL_TYPE_TIMESTAMP;
- my_bind[0].buffer= (void *) &tm;
- my_bind[0].is_null= &is_null[0];
- my_bind[0].length= &length[0];
- my_bind[0].buffer_length= sizeof(tm);
-
- /* Clone the second and the third input parameter */
- my_bind[2]= my_bind[1]= my_bind[0];
-
- /* Initialize fetch parameters */
- my_bind2[0].buffer_type= MYSQL_TYPE_LONGLONG;
- my_bind2[0].length= &length2[0];
- my_bind2[0].is_null= &is_null2[0];
- my_bind2[0].buffer_length= sizeof(bigint);
- my_bind2[0].buffer= (void *) &bigint;
-
- my_bind2[1].buffer_type= MYSQL_TYPE_DOUBLE;
- my_bind2[1].length= &length2[1];
- my_bind2[1].is_null= &is_null2[1];
- my_bind2[1].buffer_length= sizeof(real);
- my_bind2[1].buffer= (void *) &real;
-
- my_bind2[2].buffer_type= MYSQL_TYPE_STRING;
- my_bind2[2].length= &length2[2];
- my_bind2[2].is_null= &is_null2[2];
- my_bind2[2].buffer_length= sizeof(dec);
- my_bind2[2].buffer= (void *) &dec;
-
-
- /* Prepare and bind input and output parameters */
- stmt= mysql_simple_prepare(mysql, "SELECT CAST(? AS SIGNED), ?+0e0, ?+0.0");
- check_stmt(stmt);
- verify_param_count(stmt, N_PARAMS);
-
- rc= mysql_stmt_bind_param(stmt, my_bind);
- check_execute(stmt, rc);
-
- rc= mysql_stmt_bind_result(stmt, my_bind2);
- check_execute(stmt, rc);
-
- /* Initialize DATETIME value */
- tm.neg= 0;
- tm.time_type= MYSQL_TYPE_DATETIME;
- tm.year= 2001;
- tm.month= 10;
- tm.day= 20;
- tm.hour= 10;
- tm.minute= 10;
- tm.second= 59;
- tm.second_part= 500000;
-
- /* Execute and fetch */
- rc= mysql_stmt_execute(stmt);
- check_execute(stmt, rc);
-
- rc= mysql_stmt_store_result(stmt);
- check_execute(stmt, rc);
-
- rc= mysql_stmt_fetch(stmt);
- check_execute(stmt, rc);
-
- if (!opt_silent)
- printf("\n%lld %f '%s'\n", bigint, real, dec);
-
- /* Check values. */
- DIE_UNLESS(bigint == 20011020101059LL);
- DIE_UNLESS(real == 20011020101059.5);
- DIE_UNLESS(!strcmp(dec, "20011020101059.500000"));
-
- mysql_stmt_close(stmt);
-
- /* Re-initialize input parameters to TIME data type */
- my_bind[0].buffer_type= my_bind[1].buffer_type=
- my_bind[2].buffer_type= MYSQL_TYPE_TIME;
-
- /* Prepare and bind intput and output parameters */
- stmt= mysql_simple_prepare(mysql, "SELECT CAST(? AS SIGNED), ?+0e0, ?+0.0");
- check_stmt(stmt);
- verify_param_count(stmt, N_PARAMS);
-
- rc= mysql_stmt_bind_param(stmt, my_bind);
- check_execute(stmt, rc);
-
- rc= mysql_stmt_bind_result(stmt, my_bind2);
- check_execute(stmt, rc);
-
- /* Initialize TIME value */
- tm.neg= 0;
- tm.time_type= MYSQL_TYPE_TIME;
- tm.year= tm.month= tm.day= 0;
- tm.hour= 10;
- tm.minute= 10;
- tm.second= 59;
- tm.second_part= 500000;
-
- /* Execute and fetch */
- rc= mysql_stmt_execute(stmt);
- check_execute(stmt, rc);
-
- rc= mysql_stmt_store_result(stmt);
- check_execute(stmt, rc);
-
- rc= mysql_stmt_fetch(stmt);
- check_execute(stmt, rc);
-
- if (!opt_silent)
- printf("\n%lld %f '%s'\n", bigint, real, dec);
-
- /* Check returned values */
- DIE_UNLESS(bigint == 101059);
- DIE_UNLESS(real == 101059.5);
- DIE_UNLESS(!strcmp(dec, "101059.500000"));
-
- mysql_stmt_close(stmt);
-}
-
-
-
-
/* Misc tests to keep pure coverage happy */
static void test_pure_coverage()
@@ -8248,7 +6913,7 @@ static void test_field_misc()
/*
- Test SET feature with prepare stmts
+ Test SET OPTION feature with prepare stmts
bug #85 (reported by mark@mysql.com)
*/
@@ -9966,7 +8631,7 @@ static void test_ts()
char name;
char query[MAX_TEST_QUERY_LENGTH];
const char *queries [3]= {"SELECT a, b, c FROM test_ts WHERE %c=?",
- "SELECT a, b, c FROM test_ts WHERE %c=CAST(? AS TIME)", // XXX
+ "SELECT a, b, c FROM test_ts WHERE %c=CAST(? AS TIME)",
"SELECT a, b, c FROM test_ts WHERE %c=CAST(? AS DATE)"};
myheader("test_ts");
@@ -14361,6 +13026,49 @@ static void test_bug8880()
mysql_stmt_close(*stmt);
}
+/*
+ Test executing a query with prepared statements while query cache is active
+*/
+
+static void test_open_cursor_prepared_statement_query_cache()
+{
+ MYSQL_STMT *stmt;
+ int rc;
+ MYSQL_RES *result;
+
+ myheader("test_open_cursor_prepared_statement_query_cache");
+ if (! is_query_cache_available())
+ {
+ fprintf(stdout, "Skipping test_open_cursor_prepared_statement_query_cache: Query cache not available.\n");
+ return;
+ }
+
+ rc= mysql_query(mysql, "set global query_cache_size=1000000");
+ myquery(rc);
+
+ mysql_query(mysql, "drop table if exists t1");
+ mysql_query(mysql, "create table t1 (a int not null primary key, b int)");
+ rc= mysql_query(mysql, "insert into t1 values (1,1)");
+ myquery(rc); /* one check is enough */
+
+ /* Store query in query cache */
+ rc= mysql_query(mysql, "SELECT * FROM t1");
+ myquery(rc);
+ result= mysql_store_result(mysql);
+ mytest(result);
+ (void) my_process_result_set(result);
+ mysql_free_result(result);
+
+ /* Test using a cursor */
+ stmt= open_cursor("select a from t1");
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "set global query_cache_size=1000000");
+ myquery(rc);
+}
+
static void test_bug9159()
{
@@ -20087,128 +18795,6 @@ static void test_bug13001491()
}
-/*
- WL#5968: Implement START TRANSACTION READ (WRITE|ONLY);
- Check that the SERVER_STATUS_IN_TRANS_READONLY flag is set properly.
-*/
-static void test_wl5968()
-{
- int rc;
-
- myheader("test_wl5968");
-
- rc= mysql_query(mysql, "START TRANSACTION");
- myquery(rc);
- DIE_UNLESS(mysql->server_status & SERVER_STATUS_IN_TRANS);
- DIE_UNLESS(!(mysql->server_status & SERVER_STATUS_IN_TRANS_READONLY));
- rc= mysql_query(mysql, "COMMIT");
- myquery(rc);
- rc= mysql_query(mysql, "START TRANSACTION READ ONLY");
- myquery(rc);
- DIE_UNLESS(mysql->server_status & SERVER_STATUS_IN_TRANS);
- DIE_UNLESS(mysql->server_status & SERVER_STATUS_IN_TRANS_READONLY);
- rc= mysql_query(mysql, "COMMIT");
- myquery(rc);
- DIE_UNLESS(!(mysql->server_status & SERVER_STATUS_IN_TRANS));
- DIE_UNLESS(!(mysql->server_status & SERVER_STATUS_IN_TRANS_READONLY));
- rc= mysql_query(mysql, "START TRANSACTION");
- myquery(rc);
- DIE_UNLESS(mysql->server_status & SERVER_STATUS_IN_TRANS);
- DIE_UNLESS(!(mysql->server_status & SERVER_STATUS_IN_TRANS_READONLY));
- rc= mysql_query(mysql, "COMMIT");
- myquery(rc);
-}
-
-/*
- Read and parse arguments and MySQL options from my.cnf
-*/
-
-static const char *client_test_load_default_groups[]=
-{ "client", "client-server", "client-mariadb", 0 };
-static char **defaults_argv;
-
-static struct my_option client_test_long_options[] =
-{
- {"basedir", 'b', "Basedir for tests.", &opt_basedir,
- &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"count", 't', "Number of times test to be executed", &opt_count,
- &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
- {"database", 'D', "Database to use", &opt_db, &opt_db,
- 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"debug", '#', "Output debug log", &default_dbug_option,
- &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
- 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host", &opt_host, &opt_host,
- 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"password", 'p',
- "Password to use when connecting to server. If password is not given it's asked from the tty.",
- 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"port", 'P', "Port number to use for connection or 0 for default to, in "
- "order of preference, my.cnf, $MYSQL_TCP_PORT, "
-#if MYSQL_PORT_DEFAULT == 0
- "/etc/services, "
-#endif
- "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
- &opt_port, &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"server-arg", 'A', "Send embedded server this as a parameter.",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"show-tests", 'T', "Show all tests' names", 0, 0, 0, GET_NO_ARG, NO_ARG,
- 0, 0, 0, 0, 0, 0},
- {"silent", 's', "Be more silent", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0,
- 0},
-#ifdef HAVE_SMEM
- {"shared-memory-base-name", 'm', "Base name of shared memory.",
- &shared_memory_base_name, (uchar**)&shared_memory_base_name, 0,
- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#endif
- {"socket", 'S', "Socket file to use for connection",
- &opt_unix_socket, &opt_unix_socket, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"testcase", 'c',
- "May disable some code when runs as mysql-test-run testcase.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user", &opt_user,
- &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#endif
- {"vardir", 'v', "Data dir for tests.", &opt_vardir,
- &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"non-blocking-api", 'n',
- "Use the non-blocking client API for communication.",
- &non_blocking_api_enabled, &non_blocking_api_enabled, 0,
- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"getopt-ll-test", 'g', "Option for testing bug in getopt library",
- &opt_getopt_ll_test, &opt_getopt_ll_test, 0,
- GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
- {"plugin_dir", 0, "Directory for client-side plugins.",
- &opt_plugin_dir, &opt_plugin_dir, 0,
- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"default_auth", 0, "Default authentication client-side plugin to use.",
- &opt_default_auth, &opt_default_auth, 0,
- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
-};
-
-
-static void usage(void)
-{
- /* show the usage string when the user asks for this */
- putc('\n', stdout);
- printf("%s Ver %s Distrib %s, for %s (%s)\n",
- my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
- puts("By Monty, Venu, Kent and others\n");
- printf("\
-Copyright (C) 2002-2004 MySQL AB\n\
-This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
-and you are welcome to modify and redistribute it under the GPL license\n");
- printf("Usage: %s [OPTIONS] [TESTNAME1 TESTNAME2...]\n", my_progname);
- my_print_help(client_test_long_options);
- print_defaults("my", client_test_load_default_groups);
- my_print_variables(client_test_long_options);
-}
-
-
static struct my_tests_st my_tests[]= {
{ "disable_query_logs", disable_query_logs },
{ "test_view_sp_list_fields", test_view_sp_list_fields },
@@ -20277,8 +18863,6 @@ static struct my_tests_st my_tests[]= {
{ "test_store_result2", test_store_result2 },
{ "test_subselect", test_subselect },
{ "test_date", test_date },
- { "test_date_frac", test_date_frac },
- { "test_temporal_param", test_temporal_param },
{ "test_date_date", test_date_date },
{ "test_date_time", test_date_time },
{ "test_date_ts", test_date_ts },
@@ -20378,6 +18962,8 @@ static struct my_tests_st my_tests[]= {
{ "test_bug8378", test_bug8378 },
{ "test_bug8722", test_bug8722 },
{ "test_bug8880", test_bug8880 },
+ { "test_open_cursor_prepared_statement_query_cache",
+ test_open_cursor_prepared_statement_query_cache },
{ "test_bug9159", test_bug9159 },
{ "test_bug9520", test_bug9520 },
{ "test_bug9478", test_bug9478 },
@@ -20472,190 +19058,8 @@ static struct my_tests_st my_tests[]= {
{ "test_progress_reporting", test_progress_reporting },
{ "test_bug11754979", test_bug11754979 },
{ "test_bug13001491", test_bug13001491 },
- { "test_wl5968", test_wl5968 },
{ 0, 0 }
};
-static my_bool
-get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
- char *argument)
-{
- switch (optid) {
- case '#':
- DBUG_PUSH(argument ? argument : default_dbug_option);
- break;
- case 'c':
-#ifdef NOT_USED
- opt_testcase = 1;
-#endif
- break;
- case 'p':
- if (argument)
- {
- char *start=argument;
- my_free(opt_password);
- opt_password= my_strdup(argument, MYF(MY_FAE));
- while (*argument) *argument++= 'x'; /* Destroy argument */
- if (*start)
- start[1]=0;
- }
- else
- tty_password= 1;
- break;
- case 's':
- if (argument == disabled_my_option)
- opt_silent= 0;
- else
- opt_silent++;
- break;
- case 'A':
- /*
- When the embedded server is being tested, the test suite needs to be
- able to pass command-line arguments to the embedded server so it can
- locate the language files and data directory. The test suite
- (mysql-test-run) never uses config files, just command-line options.
- */
- if (!embedded_server_arg_count)
- {
- embedded_server_arg_count= 1;
- embedded_server_args[0]= (char*) "";
- }
- if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
- !(embedded_server_args[embedded_server_arg_count++]=
- my_strdup(argument, MYF(MY_FAE))))
- {
- DIE("Can't use server argument");
- }
- break;
- case 'T':
- {
- struct my_tests_st *fptr;
-
- printf("All possible test names:\n\n");
- for (fptr= my_tests; fptr->name; fptr++)
- printf("%s\n", fptr->name);
- exit(0);
- break;
- }
- case '?':
- case 'I': /* Info */
- usage();
- exit(0);
- break;
- }
- return 0;
-}
-
-static void get_options(int *argc, char ***argv)
-{
- int ho_error;
-
- if ((ho_error= handle_options(argc, argv, client_test_long_options,
- get_one_option)))
- exit(ho_error);
-
- if (tty_password)
- opt_password= get_tty_password(NullS);
- return;
-}
-
-/*
- Print the test output on successful execution before exiting
-*/
-
-static void print_test_output()
-{
- if (opt_silent < 3)
- {
- fprintf(stdout, "\n\n");
- fprintf(stdout, "All '%d' tests were successful (in '%d' iterations)",
- test_count-1, opt_count);
- fprintf(stdout, "\n Total execution time: %g SECS", total_time);
- if (opt_count > 1)
- fprintf(stdout, " (Avg: %g SECS)", total_time/opt_count);
-
- fprintf(stdout, "\n\n!!! SUCCESS !!!\n");
- }
-}
-
-/***************************************************************************
- main routine
-***************************************************************************/
-
-
-int main(int argc, char **argv)
-{
- struct my_tests_st *fptr;
-
- MY_INIT(argv[0]);
-
- if (load_defaults("my", client_test_load_default_groups, &argc, &argv))
- exit(1);
-
- defaults_argv= argv;
- get_options(&argc, &argv);
-
- if (mysql_server_init(embedded_server_arg_count,
- embedded_server_args,
- (char**) embedded_server_groups))
- DIE("Can't initialize MySQL server");
-
- /* connect to server with no flags, default protocol, auto reconnect true */
- mysql= client_connect(0, MYSQL_PROTOCOL_DEFAULT, 1);
-
- total_time= 0;
- for (iter_count= 1; iter_count <= opt_count; iter_count++)
- {
- /* Start of tests */
- test_count= 1;
- start_time= time((time_t *)0);
- if (!argc)
- {
- for (fptr= my_tests; fptr->name; fptr++)
- (*fptr->function)();
- }
- else
- {
- for ( ; *argv ; argv++)
- {
- for (fptr= my_tests; fptr->name; fptr++)
- {
- if (!strcmp(fptr->name, *argv))
- {
- (*fptr->function)();
- break;
- }
- }
- if (!fptr->name)
- {
- fprintf(stderr, "\n\nGiven test not found: '%s'\n", *argv);
- fprintf(stderr, "See legal test names with %s -T\n\nAborting!\n",
- my_progname);
- client_disconnect(mysql, 1);
- free_defaults(defaults_argv);
- exit(1);
- }
- }
- }
-
- end_time= time((time_t *)0);
- total_time+= difftime(end_time, start_time);
-
- /* End of tests */
- }
-
- client_disconnect(mysql, 1); /* disconnect from server */
-
- free_defaults(defaults_argv);
- print_test_output();
-
- while (embedded_server_arg_count > 1)
- my_free(embedded_server_args[--embedded_server_arg_count]);
-
- mysql_server_end();
-
- my_end(0);
-
- exit(0);
-}
+static struct my_tests_st *get_my_tests() { return my_tests; }
diff --git a/unittest/mysys/ma_dyncol-t.c b/unittest/mysys/ma_dyncol-t.c
index 11731ae81d4..4a9b687bc08 100644
--- a/unittest/mysys/ma_dyncol-t.c
+++ b/unittest/mysys/ma_dyncol-t.c
@@ -194,7 +194,7 @@ static CHARSET_INFO *charset_list[]=
#endif
#ifdef HAVE_CHARSET_utf8
&my_charset_utf8_general_ci,
-#ifdef HAVE_HAVE_UCA_COLLATIONS
+#ifdef HAVE_UCA_COLLATIONS
&my_charset_utf8_unicode_ci,
#endif
&my_charset_utf8_bin,
diff --git a/unittest/sql/CMakeLists.txt b/unittest/sql/CMakeLists.txt
new file mode 100644
index 00000000000..36b14e9a08a
--- /dev/null
+++ b/unittest/sql/CMakeLists.txt
@@ -0,0 +1,3 @@
+
+MY_ADD_TESTS(my_apc LINK_LIBRARIES mysys EXT cc)
+
diff --git a/unittest/sql/my_apc-t.cc b/unittest/sql/my_apc-t.cc
new file mode 100644
index 00000000000..05d6722ada4
--- /dev/null
+++ b/unittest/sql/my_apc-t.cc
@@ -0,0 +1,228 @@
+/*
+ Copyright (c) 2012, Monty Program Ab
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/*
+ This file does standalone APC system tests.
+*/
+#include <stdio.h>
+#include <my_global.h>
+#include <my_pthread.h>
+#include <my_sys.h>
+
+#include <tap.h>
+
+/*
+ A fake THD with enter_cond/exit_cond and some other members.
+*/
+PSI_stage_info stage_show_explain;
+class THD
+{
+ mysql_mutex_t* thd_mutex;
+public:
+ bool killed;
+
+ THD() : killed(FALSE) {}
+ inline const char* ENTER_COND(mysql_cond_t *cond, mysql_mutex_t* mutex,
+ PSI_stage_info*, PSI_stage_info*)
+ {
+ mysql_mutex_assert_owner(mutex);
+ thd_mutex= mutex;
+ return NULL;
+ }
+ inline void EXIT_COND(PSI_stage_info*)
+ {
+ mysql_mutex_unlock(thd_mutex);
+ }
+};
+
+#include "../sql/my_apc.h"
+
+#define MY_APC_STANDALONE 1
+#include "../sql/my_apc.cc"
+
+volatile bool started= FALSE;
+volatile bool service_should_exit= FALSE;
+volatile bool requestors_should_exit=FALSE;
+
+/* Counters for APC calls */
+int apcs_served= 0;
+int apcs_missed=0;
+int apcs_timed_out=0;
+mysql_mutex_t apc_counters_mutex;
+
+inline void increment_counter(int *var)
+{
+ mysql_mutex_lock(&apc_counters_mutex);
+ *var= *var+1;
+ mysql_mutex_unlock(&apc_counters_mutex);
+}
+
+volatile bool have_errors= false;
+
+Apc_target apc_target;
+mysql_mutex_t target_mutex;
+
+int int_rand(int size)
+{
+ return (int) (0.5 + ((double)rand() / RAND_MAX) * size);
+}
+
+/*
+ APC target thread (the one that will serve the APC requests). We will have
+ one target.
+*/
+void *test_apc_service_thread(void *ptr)
+{
+ my_thread_init();
+ mysql_mutex_init(0, &target_mutex, MY_MUTEX_INIT_FAST);
+ apc_target.init(&target_mutex);
+ apc_target.enable();
+ started= TRUE;
+ diag("test_apc_service_thread started");
+ while (!service_should_exit)
+ {
+ //apc_target.disable();
+ my_sleep(10000);
+ //apc_target.enable();
+ for (int i = 0; i < 10 && !service_should_exit; i++)
+ {
+ apc_target.process_apc_requests();
+ my_sleep(int_rand(30));
+ }
+ }
+ apc_target.disable();
+ apc_target.destroy();
+ mysql_mutex_destroy(&target_mutex);
+ my_thread_end();
+ pthread_exit(0);
+ return NULL;
+}
+
+
+/*
+ One APC request (to write 'value' into *where_to)
+*/
+class Apc_order : public Apc_target::Apc_call
+{
+public:
+ int value; // The value
+ int *where_to; // Where to write it
+ Apc_order(int a, int *b) : value(a), where_to(b) {}
+
+ void call_in_target_thread()
+ {
+ my_sleep(int_rand(1000));
+ *where_to = value;
+ increment_counter(&apcs_served);
+ }
+};
+
+
+/*
+ APC requestor thread. It makes APC requests, and checks if they were actually
+ executed.
+*/
+void *test_apc_requestor_thread(void *ptr)
+{
+ my_thread_init();
+ diag("test_apc_requestor_thread started");
+ THD my_thd;
+
+ while (!requestors_should_exit)
+ {
+ int dst_value= 0;
+ int src_value= int_rand(4*1000*100);
+ /* Create an APC to do "dst_value= src_value" assignment */
+ Apc_order apc_order(src_value, &dst_value);
+ bool timed_out;
+
+ mysql_mutex_lock(&target_mutex);
+ bool res= apc_target.make_apc_call(&my_thd, &apc_order, 60, &timed_out);
+ if (res)
+ {
+ if (timed_out)
+ increment_counter(&apcs_timed_out);
+ else
+ increment_counter(&apcs_missed);
+
+ if (dst_value != 0)
+ {
+ diag("APC was done even though return value says it wasnt!");
+ have_errors= true;
+ }
+ }
+ else
+ {
+ if (dst_value != src_value)
+ {
+ diag("APC was not done even though return value says it was!");
+ have_errors= true;
+ }
+ }
+ //my_sleep(300);
+ }
+ diag("test_apc_requestor_thread exiting");
+ my_thread_end();
+ return NULL;
+}
+
+/* Number of APC requestor threads */
+const int N_THREADS=23;
+
+
+int main(int args, char **argv)
+{
+ pthread_t service_thr;
+ pthread_t request_thr[N_THREADS];
+ int i;
+
+ my_thread_global_init();
+
+ mysql_mutex_init(0, &apc_counters_mutex, MY_MUTEX_INIT_FAST);
+
+ plan(1);
+ diag("Testing APC delivery and execution");
+
+ pthread_create(&service_thr, NULL, test_apc_service_thread, (void*)NULL);
+ while (!started)
+ my_sleep(1000);
+ for (i = 0; i < N_THREADS; i++)
+ pthread_create(&request_thr[i], NULL, test_apc_requestor_thread, (void*)NULL);
+
+ for (i = 0; i < 15; i++)
+ {
+ my_sleep(500*1000);
+ diag("%d APCs served %d missed", apcs_served, apcs_missed);
+ }
+ diag("Shutting down requestors");
+ requestors_should_exit= TRUE;
+ for (i = 0; i < N_THREADS; i++)
+ pthread_join(request_thr[i], NULL);
+
+ diag("Shutting down service");
+ service_should_exit= TRUE;
+ pthread_join(service_thr, NULL);
+
+ mysql_mutex_destroy(&apc_counters_mutex);
+
+ diag("Done");
+ my_thread_end();
+ my_thread_global_end();
+
+ ok1(!have_errors);
+ return exit_status();
+}
+
diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c
index 7e61cb8722e..6baef0417a8 100644
--- a/unittest/strings/strings-t.c
+++ b/unittest/strings/strings-t.c
@@ -87,7 +87,7 @@ static CHARSET_INFO *charset_list[]=
#endif
#ifdef HAVE_CHARSET_utf8
&my_charset_utf8_general_ci,
-#ifdef HAVE_HAVE_UCA_COLLATIONS
+#ifdef HAVE_UCA_COLLATIONS
&my_charset_utf8_unicode_ci,
#endif
&my_charset_utf8_bin,
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index 00c20d2d773..b0e64468a55 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -164,7 +164,7 @@ static void check_ssl_init()
static struct st_VioSSLFd *
new_VioSSLFd(const char *key_file, const char *cert_file,
const char *ca_file, const char *ca_path,
- const char *cipher, SSL_METHOD *method,
+ const char *cipher, my_bool is_client_method,
enum enum_ssl_init_error *error,
const char *crl_file, const char *crl_path)
{
@@ -188,7 +188,9 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
my_malloc(sizeof(struct st_VioSSLFd),MYF(0)))))
DBUG_RETURN(0);
- if (!(ssl_fd->ssl_context= SSL_CTX_new(method)))
+ if (!(ssl_fd->ssl_context= SSL_CTX_new(is_client_method ?
+ TLSv1_client_method() :
+ TLSv1_server_method())))
{
*error= SSL_INITERR_MEMFAIL;
DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
@@ -290,7 +292,7 @@ new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
verify= SSL_VERIFY_NONE;
if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file,
- ca_path, cipher, TLSv1_client_method(), error,
+ ca_path, cipher, TRUE, error,
crl_file, crl_path)))
{
return 0;
@@ -314,8 +316,7 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
struct st_VioSSLFd *ssl_fd;
int verify= SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE;
if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file,
- ca_path, cipher,
- (SSL_METHOD*) TLSv1_server_method(), error,
+ ca_path, cipher, FALSE, error,
crl_file, crl_path)))
{
return 0;
diff --git a/win/packaging/ca/CMakeLists.txt b/win/packaging/ca/CMakeLists.txt
index 940e9e3a7d1..0da1e5d67b1 100644
--- a/win/packaging/ca/CMakeLists.txt
+++ b/win/packaging/ca/CMakeLists.txt
@@ -33,7 +33,7 @@ IF(MSVC_VERSION EQUAL 1400)
ELSEIF(MSVC_VERSION EQUAL 1500)
SET(WIX35_MSVC_SUFFIX "_2008")
SET(WIX36_MSVC_SUFFIX "VS2008")
-ELSEIF(MSVC_VERSION EQUAL 1600)
+ELSEIF(MSVC_VERSION EQUAL 1600 OR MSVC_VERSION EQUAL 1700 )
SET(WIX35_MSVC_SUFFIX "_2010")
SET(WIX36_MSVC_SUFFIX "VS2010")
ELSE()