summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD-CMAKE11
-rw-r--r--CMakeLists.txt4
-rw-r--r--Docs/INSTALL-BINARY2
-rw-r--r--Docs/mysql.info7
-rw-r--r--INSTALL-SOURCE11
-rw-r--r--INSTALL-WIN-SOURCE3
-rw-r--r--KNOWN_BUGS.txt50
-rw-r--r--README8
-rw-r--r--VERSION2
-rw-r--r--client/get_password.c4
-rw-r--r--client/mysql.cc2
-rw-r--r--client/mysqldump.c60
-rw-r--r--client/mysqltest.cc50
-rw-r--r--cmake/build_configurations/mysql_release.cmake15
-rw-r--r--cmake/cpack_rpm.cmake1
-rw-r--r--cmake/os/WindowsCache.cmake3
-rw-r--r--cmake/readline.cmake2
-rw-r--r--config.h.cmake8
-rw-r--r--configure.cmake9
-rw-r--r--debian/additions/mariadb.cnf2
-rw-r--r--debian/additions/my.cnf2
-rw-r--r--debian/dist/Debian/control7
-rw-r--r--debian/dist/Debian/mariadb-server-5.5.postinst2
-rwxr-xr-xdebian/dist/Debian/rules23
-rw-r--r--debian/dist/Ubuntu/control7
-rw-r--r--debian/dist/Ubuntu/mariadb-server-5.5.postinst2
-rwxr-xr-xdebian/dist/Ubuntu/rules23
-rw-r--r--extra/resolveip.c4
-rw-r--r--include/atomic/nolock.h2
-rw-r--r--include/keycache.h3
-rw-r--r--include/m_string.h6
-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/violite.h6
-rw-r--r--libmysql/get_password.c4
-rw-r--r--mysql-test/README6
-rw-r--r--mysql-test/include/mtr_check.sql1
-rw-r--r--mysql-test/include/query_cache_partitions.inc126
-rw-r--r--mysql-test/lib/mtr_cases.pm15
-rwxr-xr-xmysql-test/mysql-test-run.pl21
-rw-r--r--mysql-test/r/bug12427262.result56
-rw-r--r--mysql-test/r/derived_opt.result24
-rw-r--r--mysql-test/r/derived_view.result4
-rw-r--r--mysql-test/r/explain.result16
-rw-r--r--mysql-test/r/func_group.result2
-rw-r--r--mysql-test/r/func_group_innodb.result26
-rw-r--r--mysql-test/r/func_in.result23
-rw-r--r--mysql-test/r/func_test.result41
-rw-r--r--mysql-test/r/group_min_max.result22
-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/join_outer.result4
-rw-r--r--mysql-test/r/join_outer_jcl6.result4
-rw-r--r--mysql-test/r/key.result4
-rw-r--r--mysql-test/r/limit_rows_examined.result2
-rw-r--r--mysql-test/r/mdev316.result22
-rw-r--r--mysql-test/r/mdev375.result14
-rw-r--r--mysql-test/r/myisam_mrr.result4
-rw-r--r--mysql-test/r/mysqld--help.result5
-rw-r--r--mysql-test/r/mysqldump.result45
-rw-r--r--mysql-test/r/mysqltest.result1
-rw-r--r--mysql-test/r/mysqltest_256.result1
-rw-r--r--mysql-test/r/negation_elimination.result4
-rw-r--r--mysql-test/r/partition.result12
-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/ps.result89
-rw-r--r--mysql-test/r/rpl_mysqldump_slave.result2
-rw-r--r--mysql-test/r/sp.result33
-rw-r--r--mysql-test/r/subselect.result307
-rw-r--r--mysql-test/r/subselect2.result12
-rw-r--r--mysql-test/r/subselect3.result2
-rw-r--r--mysql-test/r/subselect3_jcl6.result2
-rw-r--r--mysql-test/r/subselect4.result190
-rw-r--r--mysql-test/r/subselect_cache.result8
-rw-r--r--mysql-test/r/subselect_extra_no_semijoin.result4
-rw-r--r--mysql-test/r/subselect_innodb.result8
-rw-r--r--mysql-test/r/subselect_mat.result42
-rw-r--r--mysql-test/r/subselect_mat_cost.result2
-rw-r--r--mysql-test/r/subselect_mat_cost_bugs.result10
-rw-r--r--mysql-test/r/subselect_no_mat.result312
-rw-r--r--mysql-test/r/subselect_no_opts.result311
-rw-r--r--mysql-test/r/subselect_no_scache.result305
-rw-r--r--mysql-test/r/subselect_no_semijoin.result305
-rw-r--r--mysql-test/r/subselect_sj_mat.result18
-rw-r--r--mysql-test/r/union.result17
-rw-r--r--mysql-test/r/user_var.result7
-rw-r--r--mysql-test/r/view.result17
-rw-r--r--mysql-test/suite/binlog/r/binlog_drop_if_exists.result18
-rw-r--r--mysql-test/suite/binlog/r/binlog_grant.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_mdev342.result30
-rw-r--r--mysql-test/suite/binlog/t/binlog_drop_if_exists.test15
-rw-r--r--mysql-test/suite/binlog/t/binlog_grant.test19
-rw-r--r--mysql-test/suite/binlog/t/binlog_mdev342-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_mdev342.test66
-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/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/type_bit_iuds.result176
-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/innodb/r/innodb_bug12902967.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug14007649.result56
-rw-r--r--mysql-test/suite/innodb/t/innodb-blob.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-index.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-lock.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug12902967.test30
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug13635833.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14007649.test63
-rw-r--r--mysql-test/suite/mtr2/combinations5
-rw-r--r--mysql-test/suite/percona/disabled.def2
-rw-r--r--mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result41
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result19
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev359.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_report_port.result4
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test62
-rw-r--r--mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test60
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev359.test36
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test35
-rw-r--r--mysql-test/suite/rpl/t/rpl_report_port.test8
-rw-r--r--mysql-test/suite/sphinx/sphinx.result7
-rw-r--r--mysql-test/suite/sphinx/sphinx.test4
-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/disabled.def1
-rw-r--r--mysql-test/suite/sys_vars/r/all_vars.result1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test5
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result36
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test23
-rw-r--r--mysql-test/t/bug12427262.test51
-rw-r--r--mysql-test/t/func_group_innodb.test28
-rw-r--r--mysql-test/t/func_in.test29
-rw-r--r--mysql-test/t/func_test.test20
-rw-r--r--mysql-test/t/index_merge_innodb.test15
-rw-r--r--mysql-test/t/mdev316.test14
-rw-r--r--mysql-test/t/mdev375.test20
-rw-r--r--mysql-test/t/mysqldump.test27
-rw-r--r--mysql-test/t/mysqltest.test5
-rw-r--r--mysql-test/t/mysqltest_256.test17
-rw-r--r--mysql-test/t/partition.test13
-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.test75
-rw-r--r--mysql-test/t/select.test1
-rw-r--r--mysql-test/t/sp.test41
-rw-r--r--mysql-test/t/subselect.test165
-rw-r--r--mysql-test/t/subselect4.test42
-rw-r--r--mysql-test/t/union.test20
-rw-r--r--mysql-test/t/user_var.test11
-rw-r--r--mysql-test/t/view.test13
-rw-r--r--mysys/charset-def.c2
-rw-r--r--mysys/mf_keycache.c252
-rw-r--r--mysys/my_chsize.c7
-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/thr_mutex.c3
-rw-r--r--plugin/semisync/semisync_master.cc4
-rw-r--r--scripts/mysql_install_db.sh9
-rw-r--r--sql-common/my_time.c97
-rw-r--r--sql/field.cc4
-rw-r--r--sql/field.h11
-rw-r--r--sql/field_conv.cc4
-rw-r--r--sql/ha_partition.cc127
-rw-r--r--sql/ha_partition.h26
-rw-r--r--sql/handler.cc5
-rw-r--r--sql/handler.h42
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item.h12
-rw-r--r--sql/item_cmpfunc.cc70
-rw-r--r--sql/item_cmpfunc.h7
-rw-r--r--sql/item_func.cc1
-rw-r--r--sql/item_func.h6
-rw-r--r--sql/item_row.cc1
-rw-r--r--sql/item_strfunc.h26
-rw-r--r--sql/item_subselect.cc84
-rw-r--r--sql/item_subselect.h12
-rw-r--r--sql/item_sum.cc3
-rw-r--r--sql/log.cc60
-rw-r--r--sql/log.h11
-rw-r--r--sql/log_event.cc39
-rw-r--r--sql/log_event.h8
-rw-r--r--sql/log_event_old.cc2
-rw-r--r--sql/mysql_install_db.cc6
-rw-r--r--sql/mysqld.cc63
-rw-r--r--sql/opt_range.cc17
-rw-r--r--sql/opt_range.h2
-rw-r--r--sql/opt_subselect.cc47
-rw-r--r--sql/password.c1
-rw-r--r--sql/rpl_rli.cc4
-rw-r--r--sql/rpl_rli.h35
-rw-r--r--sql/rpl_utility.cc67
-rw-r--r--sql/rpl_utility.h20
-rw-r--r--sql/share/errmsg-utf8.txt3
-rw-r--r--sql/signal_handler.cc17
-rw-r--r--sql/slave.cc9
-rw-r--r--sql/spatial.cc4
-rw-r--r--sql/spatial.h2
-rw-r--r--sql/sql_base.cc33
-rw-r--r--sql/sql_cache.cc94
-rw-r--r--sql/sql_cache.h31
-rw-r--r--sql/sql_class.cc20
-rw-r--r--sql/sql_class.h21
-rw-r--r--sql/sql_delete.cc2
-rw-r--r--sql/sql_insert.cc4
-rw-r--r--sql/sql_lex.cc92
-rw-r--r--sql/sql_lex.h14
-rw-r--r--sql/sql_parse.cc47
-rw-r--r--sql/sql_profile.h2
-rw-r--r--sql/sql_repl.cc5
-rw-r--r--sql/sql_select.cc195
-rw-r--r--sql/sql_select.h3
-rw-r--r--sql/sql_show.cc2
-rw-r--r--sql/sql_table.cc108
-rw-r--r--sql/sql_update.cc2
-rw-r--r--sql/sql_yacc.yy4
-rw-r--r--sql/sys_vars.cc25
-rw-r--r--sql/table.cc37
-rw-r--r--sql/table.h2
-rw-r--r--sql/unireg.cc23
-rw-r--r--sql/unireg.h6
-rw-r--r--sql/wsrep_hton.cc2
-rw-r--r--sql/wsrep_mysqld.cc46
-rw-r--r--sql/wsrep_mysqld.h8
-rw-r--r--sql/wsrep_priv.h8
-rw-r--r--sql/wsrep_sst.cc16
-rw-r--r--sql/wsrep_utils.cc3
-rw-r--r--sql/wsrep_var.cc22
-rw-r--r--storage/blackhole/ha_blackhole.cc2
-rw-r--r--storage/example/mysql-test/mtr/suite.pm8
-rw-r--r--storage/innobase/btr/btr0cur.c2
-rw-r--r--storage/innobase/buf/buf0flu.c9
-rw-r--r--storage/innobase/dict/dict0load.c4
-rw-r--r--storage/innobase/fil/fil0fil.c2
-rw-r--r--storage/innobase/handler/ha_innodb.cc98
-rw-r--r--storage/innobase/handler/ha_innodb.h1
-rw-r--r--storage/innobase/include/srv0srv.h1
-rw-r--r--storage/innobase/lock/lock0lock.c15
-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/os/os0file.c23
-rw-r--r--storage/innobase/os/os0thread.c6
-rw-r--r--storage/innobase/rem/rem0rec.c5
-rw-r--r--storage/innobase/row/row0ins.c35
-rw-r--r--storage/innobase/row/row0upd.c70
-rw-r--r--storage/innobase/srv/srv0start.c16
-rw-r--r--storage/innobase/sync/sync0arr.c5
-rw-r--r--storage/maria/ha_maria.cc22
-rw-r--r--storage/maria/ha_maria.h7
-rw-r--r--storage/maria/ma_close.c31
-rw-r--r--storage/maria/ma_delete_table.c12
-rw-r--r--storage/maria/ma_info.c1
-rw-r--r--storage/maria/ma_open.c4
-rw-r--r--storage/maria/maria_chk.c3
-rw-r--r--storage/myisam/ha_myisam.cc22
-rw-r--r--storage/myisam/ha_myisam.h7
-rw-r--r--storage/myisam/mi_extra.c2
-rw-r--r--storage/myisam/mi_keycache.c2
-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.txt20
-rw-r--r--storage/xtradb/btr/btr0btr.c315
-rw-r--r--storage/xtradb/btr/btr0cur.c264
-rw-r--r--storage/xtradb/btr/btr0pcur.c89
-rw-r--r--storage/xtradb/btr/btr0sea.c8
-rw-r--r--storage/xtradb/buf/buf0buf.c81
-rw-r--r--storage/xtradb/buf/buf0flu.c19
-rw-r--r--storage/xtradb/buf/buf0lru.c465
-rw-r--r--storage/xtradb/dict/dict0boot.c221
-rw-r--r--storage/xtradb/dict/dict0dict.c42
-rw-r--r--storage/xtradb/dict/dict0load.c42
-rw-r--r--storage/xtradb/fil/fil0fil.c108
-rw-r--r--storage/xtradb/fsp/fsp0fsp.c413
-rw-r--r--storage/xtradb/handler/ha_innodb.cc402
-rw-r--r--storage/xtradb/handler/ha_innodb.h13
-rw-r--r--storage/xtradb/handler/handler0alter.cc21
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.c130
-rw-r--r--storage/xtradb/include/btr0btr.h58
-rw-r--r--storage/xtradb/include/btr0btr.ic2
-rw-r--r--storage/xtradb/include/btr0cur.h88
-rw-r--r--storage/xtradb/include/btr0cur.ic29
-rw-r--r--storage/xtradb/include/btr0pcur.h10
-rw-r--r--storage/xtradb/include/buf0buf.h52
-rw-r--r--storage/xtradb/include/buf0buf.ic21
-rw-r--r--storage/xtradb/include/buf0lru.h11
-rw-r--r--storage/xtradb/include/buf0types.h9
-rw-r--r--storage/xtradb/include/data0data.h23
-rw-r--r--storage/xtradb/include/data0data.ic53
-rw-r--r--storage/xtradb/include/db0err.h8
-rw-r--r--storage/xtradb/include/dict0boot.h20
-rw-r--r--storage/xtradb/include/dict0dict.h14
-rw-r--r--storage/xtradb/include/dict0dict.ic21
-rw-r--r--storage/xtradb/include/dict0mem.h10
-rw-r--r--storage/xtradb/include/fil0fil.h19
-rw-r--r--storage/xtradb/include/fsp0fsp.h40
-rw-r--r--storage/xtradb/include/log0log.h6
-rw-r--r--storage/xtradb/include/mem0mem.ic4
-rw-r--r--storage/xtradb/include/mtr0log.ic3
-rw-r--r--storage/xtradb/include/mtr0mtr.h13
-rw-r--r--storage/xtradb/include/mtr0mtr.ic11
-rw-r--r--storage/xtradb/include/page0page.h43
-rw-r--r--storage/xtradb/include/page0page.ic38
-rw-r--r--storage/xtradb/include/row0mysql.h8
-rw-r--r--storage/xtradb/include/row0sel.h7
-rw-r--r--storage/xtradb/include/srv0srv.h18
-rw-r--r--storage/xtradb/include/sync0rw.h18
-rw-r--r--storage/xtradb/include/sync0rw.ic8
-rw-r--r--storage/xtradb/include/sync0sync.h10
-rw-r--r--storage/xtradb/include/trx0purge.h4
-rw-r--r--storage/xtradb/include/trx0rec.ic7
-rw-r--r--storage/xtradb/include/trx0rseg.ic9
-rw-r--r--storage/xtradb/include/trx0sys.h6
-rw-r--r--storage/xtradb/include/trx0undo.h13
-rw-r--r--storage/xtradb/include/univ.i38
-rw-r--r--storage/xtradb/include/ut0mem.h31
-rw-r--r--storage/xtradb/include/ut0rnd.ic2
-rw-r--r--storage/xtradb/lock/lock0lock.c156
-rw-r--r--storage/xtradb/log/log0log.c175
-rw-r--r--storage/xtradb/mem/mem0pool.c6
-rw-r--r--storage/xtradb/mtr/mtr0mtr.c6
-rw-r--r--storage/xtradb/os/os0file.c122
-rw-r--r--storage/xtradb/os/os0proc.c3
-rw-r--r--storage/xtradb/os/os0thread.c6
-rw-r--r--storage/xtradb/page/page0cur.c23
-rw-r--r--storage/xtradb/page/page0page.c73
-rw-r--r--storage/xtradb/pars/pars0pars.c2
-rw-r--r--storage/xtradb/rem/rem0rec.c5
-rw-r--r--storage/xtradb/row/row0ins.c125
-rw-r--r--storage/xtradb/row/row0merge.c125
-rw-r--r--storage/xtradb/row/row0mysql.c156
-rw-r--r--storage/xtradb/row/row0row.c25
-rw-r--r--storage/xtradb/row/row0sel.c32
-rw-r--r--storage/xtradb/row/row0umod.c3
-rw-r--r--storage/xtradb/row/row0upd.c135
-rw-r--r--storage/xtradb/srv/srv0srv.c109
-rw-r--r--storage/xtradb/srv/srv0start.c29
-rw-r--r--storage/xtradb/sync/sync0rw.c10
-rw-r--r--storage/xtradb/sync/sync0sync.c16
-rw-r--r--storage/xtradb/trx/trx0purge.c5
-rw-r--r--storage/xtradb/trx/trx0rec.c42
-rw-r--r--storage/xtradb/trx/trx0sys.c62
-rw-r--r--storage/xtradb/trx/trx0trx.c2
-rw-r--r--storage/xtradb/trx/trx0undo.c43
-rw-r--r--storage/xtradb/ut/ut0mem.c82
-rw-r--r--storage/xtradb/ut/ut0ut.c8
-rw-r--r--support-files/mysql.spec.sh2
-rw-r--r--support-files/rpm/server.cnf9
-rw-r--r--support-files/wsrep.cnf.sh3
-rw-r--r--unittest/mysys/ma_dyncol-t.c2
-rw-r--r--unittest/strings/strings-t.c2
-rw-r--r--vio/viosocket.c2
789 files changed, 48523 insertions, 3191 deletions
diff --git a/BUILD-CMAKE b/BUILD-CMAKE
index 060d2481241..c95482cf619 100644
--- a/BUILD-CMAKE
+++ b/BUILD-CMAKE
@@ -1,6 +1,7 @@
Copyright (c) 2009, 2010 Sun Microsystems, Inc.
+Copyright (c) 2012 Monty Program Ab
-How to Build MySQL server with CMake
+How to Build MariaDB server with CMake
WHAT YOU NEED
---------------------------------------------------------------
@@ -11,7 +12,7 @@ HOW TO INSTALL:
Linux distributions:
shell> sudo apt-get install cmake
-The above works on do Debian/Ubuntu based distributions.On others, command
+The above works on Debian/Ubuntu based distributions. On others, the command
line needs to be modified to e.g "yum install" on Fedora or "zypper install"
on OpenSUSE.
@@ -20,8 +21,9 @@ shell> pfexec pkgadd install SUNWcmake
Windows and Mac OSX:
Download and install the latest distribution from
-http://www.cmake.org/cmake/resources/software.html.On Windows, download
-installer exe file and run it. On Mac, download the .dmg image and open it.
+http://www.cmake.org/cmake/resources/software.html
+On Windows, download installer exe file and run it. On MacOS, download
+the .dmg image and open it.
Other Unixes:
Precompiled packages for other Unix flavors (HPUX, AIX) are available from
@@ -243,3 +245,4 @@ later corrected, the cached result is still used. If you encounter this
situation, which should be a rare occation, you need either to remove the
offending entry from CMakeCache.txt (if test was for HAVE_FOO, remove lines
containing HAVE_FOO from CMakeCache.txt) or just remove the cache file.
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3db85a0b3e5..72fa8bca122 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -131,6 +131,10 @@ IF (NOT CPACK_GENERATOR)
ENDIF(WIN32)
ENDIF(NOT CPACK_GENERATOR)
+IF(DEB)
+ SET(INSTALL_LAYOUT "DEB")
+ENDIF(DEB)
+
INCLUDE(mysql_version)
INCLUDE(cpack_rpm)
INCLUDE(cpack_source_ignore_files)
diff --git a/Docs/INSTALL-BINARY b/Docs/INSTALL-BINARY
index 01ac65950a9..7ff33c7051e 100644
--- a/Docs/INSTALL-BINARY
+++ b/Docs/INSTALL-BINARY
@@ -31,7 +31,7 @@ also applies.
first.
If you run into problems and need to file a bug report,
- please report them to: http://bugs.launchpad.net/maria
+ please report them to: http://mariadb.org/jira
See the instructions in Section 1.6, "How to Report Bugs or Problems."
diff --git a/Docs/mysql.info b/Docs/mysql.info
index 3b9d298a684..95d97438993 100644
--- a/Docs/mysql.info
+++ b/Docs/mysql.info
@@ -1,10 +1,11 @@
MariaDB is in most aspects identical to MySQL.
Differences between MySQL and MariaDB can be found at:
-http://askmonty.org/wiki/index.php/MariaDB_versus_MySQL
+http://kb.askmonty.org/en/mariadb-versus-mysql-features/
+http://kb.askmonty.org/en/mariadb-versus-mysql-compatibility/
-The MariaDB references manual can be found at:
-http://askmonty.org/wiki/index.php/Manual
+The MariaDB manual can be found at:
+http://kb.askmonty.org/
The MySQL Reference Manual is available in various formats on
http://dev.mysql.com/doc; if you're interested in the DocBook XML
diff --git a/INSTALL-SOURCE b/INSTALL-SOURCE
index cfcc285cf67..b6f4fe546c7 100644
--- a/INSTALL-SOURCE
+++ b/INSTALL-SOURCE
@@ -1,3 +1,14 @@
+Installing and Upgrading MariaDB
+
+This file contains chapter two of the MySQL manual and describes how
+to obtain and install MySQL. The instructions below are generally
+applicable to both MySQL and MariaDB, but differ in some particulars
+(like, for example, the GPG signing key we use is different).
+
+Detailed, MariaDB-specific instructions are available at:
+http://kb.askmonty.org/en/getting-installing-and-upgrading-mariadb/
+
+- - - -
Chapter 2. Installing and Upgrading MySQL
diff --git a/INSTALL-WIN-SOURCE b/INSTALL-WIN-SOURCE
index 2e77959d69c..269bc2c3d1c 100644
--- a/INSTALL-WIN-SOURCE
+++ b/INSTALL-WIN-SOURCE
@@ -1,2 +1,3 @@
-Up-to-date instructions on MariaDB building on Windows can be found in http://kb.askmonty.org/en/building-mariadb-on-windows.
+Up-to-date instructions about building MariaDB on Windows can be found
+at: http://kb.askmonty.org/en/building-mariadb-on-windows
diff --git a/KNOWN_BUGS.txt b/KNOWN_BUGS.txt
index 38472fc978c..56c9102b0cd 100644
--- a/KNOWN_BUGS.txt
+++ b/KNOWN_BUGS.txt
@@ -1,35 +1,35 @@
-This file should contain all know fatal bugs in the Mariadb and the
-Maria storage engine for the last source or binary release. Minor
-bugs, extensions and feature request and bugs found since this release
-can be find in the MariaDB bugs database at:
-https://bugs.launchpad.net/maria and in the MySQL bugs databases at:
-http://bugs.mysql.com/ (category "Maria storage engine").
+This file should contain all known fatal bugs in Mariadb and the Aria
+storage engine for the last source or binary release. Minor bugs,
+extensions and feature requests, and bugs found since this release can
+be found in the MariaDB bugs database at: http://mariadb.org/jira and
+in the MySQL bugs databases at: http://bugs.mysql.com/ (category
+"Maria storage engine").
-There shouldn't normally be any bugs that affects normal operations in
-any MariaDB release. Still, there are always exceptions and edge cases
-and that's what this file is for.
+There should not normally be any bugs which affect normal operations
+in any MariaDB release. Still, there are always exceptions and edge
+cases and that is what this file is for.
If you have found a bug that is not listed here, please add it to
-http://bugs.launchpad.net/maria so that we can either fix it for next
-release or in the worst case add it here for others to know!
+http://mariadb.org/jira so we can either fix it for next release or in
+the worst case add it here for others to know!
+
IMPORTANT:
-If you have been using the Maria storage engine with
-MySQL-5.1-Maria-alpha build and upgrading to a newer MariaDB you MUST
-run maria_chk --recover on all your Maria tables. This is because we
-made an incompatible change of how transaction id is stored and old
-transaction id's must be reset!
+If you have been using the Maria (now Aria) storage engine with the
+MySQL-5.1-Maria-alpha build and are upgrading to a newer MariaDB you
+MUST run [m]aria_chk --recover on all your Aria tables. This is because
+we made an incompatible change with how the transaction id is stored
+and old transaction id's must be reset!
cd mysql-data-directory
-maria_chk --recover */*.MAI
+aria_chk --recover */*.MAI
-As the Maria storage engine is now in beta we will do our best to not
-introduce any incompatible changes in the data format for the Maria
-tables; If this would be ever be needed, we will, if possible, support
-both the old and the new version to make upgrades as easy as possible.
+Going forward, we will do our best to not introduce any incompatible
+changes in the data format for Aria tables. If this would be ever be
+needed, we will, if possible, support both the old and the new version
+to make upgrades as easy as possible.
-Note that for the MariaDB 5.1 release the Maria storage engine is
-classified as 'beta'; It should work, but use it with caution. Please
-report all bugs to https://bugs.launchpad.net/maria so that we can fix
-them!
+Note that for the MariaDB 5.1 release the Aria storage engine is
+classified as 'beta'; It should work, but use it with caution. Please
+report all bugs to http://mariadb.org/jira so we can fix them!
diff --git a/README b/README
index c6624cf43fa..7daeec0495f 100644
--- a/README
+++ b/README
@@ -13,9 +13,9 @@ see the Credits appendix. You can also do 'SHOW authors' to get a
list of active contributors.
A description of the MariaDB project and a manual can be found at:
-http://askmonty.org/wiki/index.php/MariaDB
-http://askmonty.org/wiki/index.php/MariaDB_versus_MySQL
-http://askmonty.org/wiki/index.php/Manual:Contents
+http://kb.askmonty.org/
+http://kb.askmonty.org/en/mariadb-versus-mysql-features/
+http://kb.askmonty.org/en/mariadb-versus-mysql-compatibility/
As MariaDB is a full replacement of MySQL, the MySQL manual at
http://dev.mysql.com/doc is generally applicable.
@@ -41,7 +41,7 @@ EXCEPTIONS-CLIENT file.
IMPORTANT:
Bug and/or error reports regarding MariaDB should be submitted at
-https://bugs.launchpad.net/maria
+http://mariadb.org/jira
Bugs in the MySQL code can also be submitted at http://bugs.mysql.com
diff --git a/VERSION b/VERSION
index 0f96ceb238d..6111f6d453f 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5
-MYSQL_VERSION_PATCH=24
+MYSQL_VERSION_PATCH=25
MYSQL_VERSION_EXTRA=
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 e74495dcf8d..d39e765a99a 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2916,7 +2916,7 @@ com_help(String *buffer __attribute__((unused)),
}
put_info("\nGeneral information about MariaDB can be found at\n"
- "http://askmonty.org/wiki/index.php/Manual:Contents\n", INFO_INFO);
+ "http://mariadb.org\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 6834d16bde7..3adbc897c50 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -86,6 +86,15 @@
/* Chars needed to store LONGLONG, excluding trailing '\0'. */
#define LONGLONG_LEN 20
+/* general_log or slow_log tables under mysql database */
+static inline my_bool general_log_or_slow_log_tables(const char *db,
+ const char *table)
+{
+ return (strcmp(db, "mysql") == 0) &&
+ ((strcmp(table, "general_log") == 0) ||
+ (strcmp(table, "slow_log") == 0));
+}
+
static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *option_value);
static ulong find_set(TYPELIB *lib, const char *x, uint length,
@@ -2503,6 +2512,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
"TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
FILE *sql_file= md_result_file;
int len;
+ my_bool is_log_table;
MYSQL_RES *result;
MYSQL_ROW row;
DBUG_ENTER("get_table_structure");
@@ -2587,9 +2597,12 @@ static uint get_table_structure(char *table, char *db, char *table_type,
/*
Even if the "table" is a view, we do a DROP TABLE here. The
view-specific code below fills in the DROP VIEW.
+ We will skip the DROP TABLE for general_log and slow_log, since
+ those stmts will fail, in case we apply dump by enabling logging.
*/
- fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
- opt_quoted_table);
+ if (!general_log_or_slow_log_tables(db, table))
+ fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
+ opt_quoted_table);
check_io(sql_file);
}
@@ -2701,12 +2714,25 @@ static uint get_table_structure(char *table, char *db, char *table_type,
row= mysql_fetch_row(result);
- fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" :
- "/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
- "/*!40101 SET character_set_client = utf8 */;\n"
- "%s;\n"
- "/*!40101 SET character_set_client = @saved_cs_client */;\n",
- row[1]);
+ is_log_table= general_log_or_slow_log_tables(db, table);
+ if (is_log_table)
+ row[1]+= 13; /* strlen("CREATE TABLE ")= 13 */
+ if (opt_compatible_mode & 3)
+ {
+ fprintf(sql_file,
+ is_log_table ? "CREATE TABLE IF NOT EXISTS %s;\n" : "%s;\n",
+ row[1]);
+ }
+ else
+ {
+ fprintf(sql_file,
+ "/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
+ "/*!40101 SET character_set_client = utf8 */;\n"
+ "%s%s;\n"
+ "/*!40101 SET character_set_client = @saved_cs_client */;\n",
+ is_log_table ? "CREATE TABLE IF NOT EXISTS " : "",
+ row[1]);
+ }
check_io(sql_file);
mysql_free_result(result);
@@ -4315,6 +4341,22 @@ static int dump_all_tables_in_db(char *database)
if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
+ if (strcmp(database, "mysql") == 0)
+ {
+ char table_type[NAME_LEN];
+ char ignore_flag;
+ uint num_fields;
+ num_fields= get_table_structure((char *) "general_log",
+ database, table_type, &ignore_flag);
+ if (num_fields == 0)
+ verbose_msg("-- Warning: get_table_structure() failed with some internal "
+ "error for 'general_log' table\n");
+ num_fields= get_table_structure((char *) "slow_log",
+ database, table_type, &ignore_flag);
+ if (num_fields == 0)
+ verbose_msg("-- Warning: get_table_structure() failed with some internal "
+ "error for 'slow_log' table\n");
+ }
if (lock_tables)
{
DYNAMIC_STRING query;
@@ -4773,7 +4815,7 @@ static int do_show_slave_status(MYSQL *mysql_con)
if (row[1])
fprintf(md_result_file, "MASTER_HOST='%s', ", row[1]);
if (row[3])
- fprintf(md_result_file, "MASTER_PORT='%s', ", row[3]);
+ fprintf(md_result_file, "MASTER_PORT=%s, ", row[3]);
}
fprintf(md_result_file,
"MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n", row[9], row[21]);
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index b93c9426deb..f204f359656 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -621,6 +621,8 @@ void free_all_replace(){
free_replace_column();
}
+void var_set_int(const char* name, int value);
+
class LogFile {
FILE* m_file;
@@ -1275,6 +1277,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 +1289,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);
@@ -5201,15 +5205,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;
@@ -5319,11 +5340,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;
}
@@ -9012,8 +9037,12 @@ int main(int argc, char **argv)
command->abort_on_error= (command->expected_errors.count == 0 &&
abort_on_error);
- /* delimiter needs to be executed so we can continue to parse */
- ok_to_do= cur_block->ok || command->type == Q_DELIMITER;
+ /*
+ some commmands need to be executed or at least parsed unconditionally,
+ because they change the grammar.
+ */
+ ok_to_do= cur_block->ok || command->type == Q_DELIMITER
+ || command->type == Q_PERL;
/*
Some commands need to be "done" the first time if they may get
re-iterated over in a true context. This can only happen if there's
@@ -9024,8 +9053,7 @@ int main(int argc, char **argv)
if (command->type == Q_SOURCE ||
command->type == Q_ERROR ||
command->type == Q_WRITE_FILE ||
- command->type == Q_APPEND_FILE ||
- command->type == Q_PERL)
+ command->type == Q_APPEND_FILE)
{
for (struct st_block *stb= cur_block-1; stb >= block_stack; stb--)
{
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 87fe47cac12..5b2596491ad 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -94,8 +94,19 @@ IF(FEATURE_SET)
ENDIF()
OPTION(ENABLED_LOCAL_INFILE "" ON)
-SET(WITH_SSL bundled CACHE STRING "")
-SET(WITH_ZLIB bundled CACHE STRING "")
+IF(RPM)
+ SET(WITH_SSL system CACHE STRING "")
+ SET(WITH_ZLIB system CACHE STRING "")
+ELSEIF(DEB)
+ SET(WITH_SSL system CACHE STRING "")
+ SET(WITH_ZLIB system CACHE STRING "")
+ SET(WITH_LIBWRAP ON)
+ SET(WITH_MAX ON)
+ SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
+ELSE()
+ SET(WITH_SSL bundled CACHE STRING "")
+ SET(WITH_ZLIB bundled CACHE STRING "")
+ENDIF()
IF(NOT COMPILATION_COMMENT)
SET(COMPILATION_COMMENT "MariaDB Server")
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/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 6191ceef378..1fb5fc920f6 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -151,7 +151,7 @@ IF(UNIX)
IF(CMAKE_REQUIRED_LIBRARIES)
LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES)
- ENDIF()
+ ENDIF()
LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT})
OPTION(WITH_LIBWRAP "Compile with tcp wrappers support" OFF)
@@ -202,6 +202,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)
@@ -261,6 +262,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)
@@ -326,6 +328,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)
@@ -554,6 +557,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/debian/additions/mariadb.cnf b/debian/additions/mariadb.cnf
index e3803c4aaeb..927e9d1ce88 100644
--- a/debian/additions/mariadb.cnf
+++ b/debian/additions/mariadb.cnf
@@ -3,7 +3,7 @@
[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
-#character-set-server = utf8
+#default-character-set = utf8
[mysqld]
#
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/dist/Debian/control b/debian/dist/Debian/control
index 562459618ec..7a324c93895 100644
--- a/debian/dist/Debian/control
+++ b/debian/dist/Debian/control
@@ -124,8 +124,9 @@ Provides: virtual-mysql-client, mysql-client,
mysql-client-4.1, mysql-client-5.1, mysql-client-5.5
Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
mariadb-client (<< ${source:Version}),
- mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
+ mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, mysql-client-5.5
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
+ mysql-client-5.5,
mariadb-client (<< ${source:Version}),
mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
Description: MariaDB database client binaries
@@ -185,10 +186,10 @@ Pre-Depends: mariadb-common, adduser (>= 3.40), debconf
Depends: mariadb-client-5.5 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10), mariadb-server-core-5.5 (>= ${binary:Version})
Provides: mariadb-server, mysql-server, virtual-mysql-server
Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
- mysql-server-4.1, mysql-server-5.0, mysql-server-5.1,
+ mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3
Replaces: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
- mysql-server-4.1, mysql-server-5.0, mysql-server-5.1,
+ mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
libmariadbclient16 (<< 5.3.4),
libmariadbclient-dev (<< 5.5.0)
diff --git a/debian/dist/Debian/mariadb-server-5.5.postinst b/debian/dist/Debian/mariadb-server-5.5.postinst
index e3f2df13b4b..2e15b121db9 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
diff --git a/debian/dist/Debian/rules b/debian/dist/Debian/rules
index 5cb22ae60d6..96ad527542d 100755
--- a/debian/dist/Debian/rules
+++ b/debian/dist/Debian/rules
@@ -70,30 +70,11 @@ endif
CXX=$${MYSQL_BUILD_CXX:-g++} \
CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wno-uninitialized"} \
cmake .. \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DINSTALL_SBINDIR=sbin \
- -DMYSQL_DATADIR=/var/lib/mysql \
- -DINSTALL_INCLUDEDIR=include/mysql \
- -DINSTALL_INFODIR=share/info \
- -DINSTALL_MANDIR=share/man \
- \
-DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \
+ -DBUILD_CONFIG=mysql_release \
-DCOMPILATION_COMMENT="mariadb.org binary distribution" \
-DSYSTEM_TYPE="debian-linux-gnu" \
- -DINSTALL_LAYOUT=DEB \
- \
- -DENABLED_LOCAL_INFILE=1 \
- -DWITH_FAST_MUTEXES=1 \
- \
- -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
- \
- -DEXTRA_CHARSETS=all \
- -DWITH_LIBWRAP=1 \
- -DWITH_SSL=system \
- -DWITH_ZLIB=system \
- -DWITH_EMBEDDED_SERVER=1 \
- -DHAVE_EMBEDDED_PRIVILEGE_CONTROL=ON \
- -DWITH_MAX=1'
+ -DDEB=debian'
touch $@
diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control
index 8594ee9616b..8a8a93c37aa 100644
--- a/debian/dist/Ubuntu/control
+++ b/debian/dist/Ubuntu/control
@@ -124,8 +124,9 @@ Provides: virtual-mysql-client, mysql-client,
mysql-client-4.1, mysql-client-5.1, mysql-client-5.5
Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
mariadb-client (<< ${source:Version}),
- mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
+ mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, mysql-client-5.5
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
+ mysql-client-5.5,
mariadb-client (<< ${source:Version}),
mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
Description: MariaDB database client binaries
@@ -179,10 +180,10 @@ Pre-Depends: mariadb-common, adduser (>= 3.40), debconf
Depends: mariadb-client-5.5 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10), mariadb-server-core-5.5 (>= ${binary:Version})
Provides: mariadb-server, mysql-server, virtual-mysql-server
Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
- mysql-server-4.1, mysql-server-5.0, mysql-server-5.1,
+ mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3
Replaces: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
- mysql-server-4.1, mysql-server-5.0, mysql-server-5.1,
+ mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
libmariadbclient16 (<< 5.3.4),
libmariadbclient-dev (<< 5.5.0)
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/dist/Ubuntu/rules b/debian/dist/Ubuntu/rules
index 592b2e4d7d1..bb413ad83cc 100755
--- a/debian/dist/Ubuntu/rules
+++ b/debian/dist/Ubuntu/rules
@@ -70,30 +70,11 @@ endif
CXX=$${MYSQL_BUILD_CXX:-g++} \
CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wno-uninitialized"} \
cmake .. \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DINSTALL_SBINDIR=sbin \
- -DMYSQL_DATADIR=/var/lib/mysql \
- -DINSTALL_INCLUDEDIR=include/mysql \
- -DINSTALL_INFODIR=share/info \
- -DINSTALL_MANDIR=share/man \
- \
-DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \
+ -DBUILD_CONFIG=mysql_release \
-DCOMPILATION_COMMENT="mariadb.org binary distribution" \
-DSYSTEM_TYPE="debian-linux-gnu" \
- -DINSTALL_LAYOUT=DEB \
- \
- -DENABLED_LOCAL_INFILE=1 \
- -DWITH_FAST_MUTEXES=1 \
- \
- -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
- \
- -DEXTRA_CHARSETS=all \
- -DWITH_LIBWRAP=1 \
- -DWITH_SSL=system \
- -DWITH_ZLIB=system \
- -DWITH_EMBEDDED_SERVER=1 \
- -DHAVE_EMBEDDED_PRIVILEGE_CONTROL=ON \
- -DWITH_MAX=1'
+ -DDEB=ubuntu'
touch $@
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/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/keycache.h b/include/keycache.h
index da6624725e7..8fa9bf1cd18 100644
--- a/include/keycache.h
+++ b/include/keycache.h
@@ -148,9 +148,10 @@ typedef struct st_key_cache
ulonglong param_partitions; /* number of the key cache partitions */
my_bool key_cache_inited; /* <=> key cache has been created */
my_bool can_be_used; /* usage of cache for read/write is allowed */
- my_bool in_init; /* Set to 1 in MySQL during init/resize */
+ my_bool in_init; /* set to 1 in MySQL during init/resize */
uint partitions; /* actual number of partitions */
size_t key_cache_mem_size; /* specified size of the cache memory */
+ pthread_mutex_t op_lock; /* to serialize operations like 'resize' */
} KEY_CACHE;
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_global.h b/include/my_global.h
index a5fa57dbfe3..09a3a0a6efd 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -229,11 +229,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 */
@@ -306,18 +301,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
@@ -823,18 +806,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 ce2ee6ce8ca..0ad3ebf0f30 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 21c85c633d6..404d5fb5258 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -200,28 +200,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
@@ -247,24 +232,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);
@@ -285,34 +258,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) ?\
@@ -352,7 +298,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()
@@ -541,12 +487,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/violite.h b/include/violite.h
index a026038bb0e..18df848d8b8 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
/*
* Vio Lite.
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/mysql-test/README b/mysql-test/README
index 0e147f83bd1..162551ad69c 100644
--- a/mysql-test/README
+++ b/mysql-test/README
@@ -69,10 +69,10 @@ extension. For example:
If you want to submit your test case you can send it
to maria-developers@lists.launchpad.com or attach it to a bug report on
-https://bugs.launchpad.net/maria/.
+http://mariadb.org/jira/.
If the test case is really big or if it contains 'not public' data,
then put your .test file and .result file(s) into a tar.gz archive,
add a README that explains the problem, ftp the archive to
-ftp://ftp.askmonty.org/private and send a mail to
-https://bugs.launchpad.net/maria/ about it.
+ftp://ftp.askmonty.org/private and submit a report to
+http://mariadb.org/jira about it.
diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql
index 82c0514b7cd..6c1a3513324 100644
--- a/mysql-test/include/mtr_check.sql
+++ b/mysql-test/include/mtr_check.sql
@@ -30,6 +30,7 @@ BEGIN
WHERE variable_name NOT IN ('timestamp', 'innodb_file_format_max')
AND variable_name not like "Last_IO_Err*"
AND variable_name != 'INNODB_IBUF_MAX_SIZE'
+ AND variable_name != 'INNODB_USE_NATIVE_AIO'
ORDER BY variable_name;
-- Dump all databases, there should be none
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/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 ebe7af3641d..a2802916fe4 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1518,7 +1518,7 @@ sub command_line_setup {
# We make the path absolute, as the server will do a chdir() before usage
unless ( $opt_vardir =~ m,^/, or
- (IS_WINDOWS and $opt_vardir =~ m,^[a-z]:/,i) )
+ (IS_WINDOWS and $opt_vardir =~ m,^[a-z]:[/\\],i) )
{
# Make absolute path, relative test dir
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
@@ -2717,6 +2717,7 @@ sub setup_vardir() {
# hm, what paths work for debs and for rpms ?
for (<$bindir/lib64/mysql/plugin/*.so>,
<$bindir/lib/mysql/plugin/*.so>,
+ <$bindir/lib/plugin/*.so>, # bintar
<$bindir/lib/plugin/*.dll>)
{
my $pname=basename($_);
@@ -3463,12 +3464,6 @@ sub mysql_install_db {
mtr_add_arg($args, "--lc-messages-dir=%s", $install_lang);
mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir);
- # On some old linux kernels, aio on tmpfs is not supported
- # Remove this if/when Bug #58421 fixes this in the server
- if ($^O eq "linux" && $opt_mem) {
- mtr_add_arg($args, "--loose-skip-innodb-use-native-aio");
- }
-
# InnoDB arguments that affect file location and sizes may
# need to be given to the bootstrap process as well as the
# server process.
@@ -4742,6 +4737,10 @@ sub extract_warning_lines ($$) {
qr|Access denied for user|,
qr|Aborted connection|,
qr|table.*is full|,
+ qr|Linux Native AIO|, # warning that aio does not work on /dev/shm
+ qr|Error: io_setup\(\) failed|,
+ qr|Warning: io_setup\(\) failed|,
+ qr|Warning: io_setup\(\) attempt|,
);
my $matched_lines= [];
@@ -5245,13 +5244,6 @@ sub mysqld_arguments ($$$) {
mtr_add_arg($args, "--user=root");
}
- # On some old linux kernels, aio on tmpfs is not supported
- # Remove this if/when Bug #58421 fixes this in the server
- if ($^O eq "linux" && $opt_mem)
- {
- mtr_add_arg($args, "--loose-skip-innodb-use-native-aio");
- }
-
if (!using_extern() and !$opt_user_args)
{
# Turn on logging to file
@@ -5292,6 +5284,7 @@ sub mysqld_arguments ($$$) {
}
elsif ($plugin = mtr_match_prefix($arg, "--plugin-load="))
{
+ next if $plugin =~ /=$/;
push @plugins, $plugin unless $seen{$plugin};
$seen{$plugin} = 1;
}
diff --git a/mysql-test/r/bug12427262.result b/mysql-test/r/bug12427262.result
new file mode 100644
index 00000000000..c541ba0f664
--- /dev/null
+++ b/mysql-test/r/bug12427262.result
@@ -0,0 +1,56 @@
+#
+# Bug#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE.
+#
+create database show_table_lw_db;
+use show_table_lw_db;
+create table t1 (c1 int);
+create table t2 (c1 int);
+create table t3 (c1 int);
+create table t4 (c1 int);
+create table t5 (c1 int);
+create table t6 (c1 int);
+create table t7 (c1 int);
+create table t8 (c1 int);
+create table t9 (c1 int);
+create table t10 (c1 int);
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
+like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
+into @count_read_before;
+show tables;
+Tables_in_show_table_lw_db
+t1
+t10
+t2
+t3
+t4
+t5
+t6
+t7
+t8
+t9
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
+like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
+into @count_read_after;
+select @count_read_after-@count_read_before;
+@count_read_after-@count_read_before
+0.000000000000000000000000000000
+show full tables;
+Tables_in_show_table_lw_db Table_type
+t1 BASE TABLE
+t10 BASE TABLE
+t2 BASE TABLE
+t3 BASE TABLE
+t4 BASE TABLE
+t5 BASE TABLE
+t6 BASE TABLE
+t7 BASE TABLE
+t8 BASE TABLE
+t9 BASE TABLE
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
+like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
+into @count_read_after;
+select @count_read_after-@count_read_before;
+@count_read_after-@count_read_before
+10.000000000000000000000000000000
+drop table t1;
+drop database show_table_lw_db;
diff --git a/mysql-test/r/derived_opt.result b/mysql-test/r/derived_opt.result
index c5376bee756..11216a32e61 100644
--- a/mysql-test/r/derived_opt.result
+++ b/mysql-test/r/derived_opt.result
@@ -161,24 +161,24 @@ prepare stmt1 from @stmt ;
execute stmt1 ;
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
-5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
execute stmt1 ;
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
-5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
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
-5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
deallocate prepare stmt1;
drop tables t1,t2;
set @@optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index 86b95e94a81..ba01db4a66f 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -1682,7 +1682,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and `test`.`t2`.`b`)
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0))
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;
@@ -1713,7 +1713,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t2`.`a`)) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and `test`.`t2`.`b`)
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t2`.`a`)) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0))
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;
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index a6fa21ad800..e081b56e6ce 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -225,10 +225,10 @@ INSERT INTO t2 VALUES (NULL), (0);
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><NULL>((select 1 from `test`.`t2` where (`test`.`t2`.`d` = NULL))) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual
+Note 1003 select (select 1 from `test`.`t2` where (`test`.`t2`.`d` = NULL)) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual
DROP TABLE t1, t2;
#
# Bug#30302: Tables that were optimized away are printed in the
@@ -260,7 +260,7 @@ FLUSH TABLES;
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND t.a);
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 NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
DROP TABLE t1, t2;
#
# Bug #48573: difference of index selection between rpm binary and
@@ -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 Using where
+2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
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 Using where
+2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
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 Using where
+2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
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 Using where
+2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
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 Using where
+2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests.
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index c38201f6d9f..3b47227a261 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1838,7 +1838,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 00baa5f990a..6485793d0e1 100644
--- a/mysql-test/r/func_group_innodb.result
+++ b/mysql-test/r/func_group_innodb.result
@@ -204,4 +204,30 @@ SELECT BIT_XOR(t1.b) FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
BIT_XOR(t1.b)
0
DROP TABLE t1, t2;
+#
+# Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
+# COUNT(*) LIMIT.
+#
+CREATE TABLE t1 (
+id BIGINT(20) ,
+member_id_to INT(11) ,
+r_date DATE ,
+PRIMARY KEY (id,r_date),
+KEY r_date_idx (r_date),
+KEY t1_idx01 (member_id_to)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(107924526,518491,'2011-05-01'),
+(107924527,518491,'2011-05-01'),
+(107924534,518491,'2011-06-21'),
+(107924535,518491,'2011-06-21'),
+(107924542,1601319,'2011-06-21'),
+(107924543,1601319,'2011-06-21'),
+(107924544,1601319,'2011-06-21'),
+(107924545,1601319,'2011-06-21');
+SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
+'2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
+member_id_to COUNT(*)
+518491 2
+DROP TABLE t1;
End of 5.5 tests
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 0a87f57726d..fc56660ac62 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -789,3 +789,26 @@ DROP TABLE t1;
# End of test BUG#13012483
#
End of 5.1 tests
+create table t1 (a bigint, b int);
+insert t1 values (1,1),(2,2),(3,3);
+select * from t1 where a in ('2.1');
+a b
+select * from t1 where b in ('2.1');
+a b
+select * from t1 where a='2.1';
+a b
+select * from t1 where b='2.1';
+a b
+select * from t1 where IF(1,a,a)='2.1';
+a b
+drop table t1;
+#
+# LP bug#992380 Crash when creating PS for a query with
+# subquery in WHERE (see also mysql bug#13012483)
+#
+CREATE TABLE t1 (a INT);
+PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
+EXECUTE s;
+1
+DROP TABLE t1;
+# End of 5.3 tests
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 81b7994af97..2c1c416472f 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -279,3 +279,44 @@ NULL
SELECT GREATEST(1.5E+2,1.3E+2,NULL) FROM DUAL;
GREATEST(1.5E+2,1.3E+2,NULL)
NULL
+create table t1 (a int);
+insert into t1 values (1), (100), (0), (NULL);
+select not a from t1;
+not a
+0
+0
+1
+NULL
+explain extended select not a from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00
+Warnings:
+Note 1003 select (`test`.`t1`.`a` = 0) AS `not a` from `test`.`t1`
+select * from t1 where not a;
+a
+0
+explain extended select * from t1 where not a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 0)
+select not (a+0) from t1;
+not (a+0)
+0
+0
+1
+NULL
+explain extended select not (a+0) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00
+Warnings:
+Note 1003 select (not((`test`.`t1`.`a` + 0))) AS `not (a+0)` from `test`.`t1`
+select * from t1 where not (a+0);
+a
+0
+explain extended select * from t1 where not (a+0);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not((`test`.`t1`.`a` + 0)))
+drop table t1;
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index c5c5f65df29..95caa6853b8 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2398,12 +2398,12 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
-2 SUBQUERY t1 index NULL a 10 NULL 1 Using index
+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
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 t1_outer index NULL a 10 NULL 15 Using index
-2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
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
@@ -2419,9 +2419,9 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2
ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2)
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 2 Using where; Using index
+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 range NULL a 5 NULL 8 Using index for group-by
+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
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
@@ -2756,8 +2756,8 @@ NULL
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 Using where; Using index
-x x x x x x x x x Using where; Using index
+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
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
MIN( a )
NULL
@@ -2828,8 +2828,8 @@ NULL
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 Using where; Using index
-x x x x x x x x x Using where; Using index
+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
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
MIN( a )
NULL
@@ -2907,8 +2907,8 @@ NULL
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 Using where; Using index
-x x x x x x x x x Using where; Using index
+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
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 e5025acc998..92bcb2e88f0 100644
--- a/mysql-test/r/index_merge_innodb.result
+++ b/mysql-test/r/index_merge_innodb.result
@@ -654,7 +654,7 @@ EXPLAIN SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index
-2 DEPENDENT SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index
+2 SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index
DROP TABLE t1,t2;
#
# BUG#56862/640419: Wrong result with sort_union index merge when one
@@ -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 b560c1e5176..bf151a872cf 100644
--- a/mysql-test/r/index_merge_myisam.result
+++ b/mysql-test/r/index_merge_myisam.result
@@ -1487,7 +1487,7 @@ EXPLAIN SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-2 DEPENDENT SUBQUERY t2 ref f2,f3 f2 5 const 1 Using where
+2 SUBQUERY t2 ref f2,f3 f2 5 const 1 Using where
DROP TABLE t1,t2;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index f16b38772a6..fd2a948847c 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1895,10 +1895,10 @@ EXPLAIN EXTENDED
SELECT t2.a FROM t1 LEFT JOIN t2 ON (6) IN (SELECT a FROM t3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
-1 PRIMARY t2 ALL NULL NULL NULL NULL 1 100.00 Using where
+1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where 1
+Note 1003 select NULL AS `a` from `test`.`t2` where 1
DROP TABLE t1,t2,t3;
#
# LP bug #817384 Wrong result with outer join + subquery in ON
diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result
index a4aaaf6085d..d891f5c49b2 100644
--- a/mysql-test/r/join_outer_jcl6.result
+++ b/mysql-test/r/join_outer_jcl6.result
@@ -1906,10 +1906,10 @@ EXPLAIN EXTENDED
SELECT t2.a FROM t1 LEFT JOIN t2 ON (6) IN (SELECT a FROM t3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
-1 PRIMARY t2 ALL NULL NULL NULL NULL 1 100.00 Using where
+1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where 1
+Note 1003 select NULL AS `a` from `test`.`t2` where 1
DROP TABLE t1,t2,t3;
#
# LP bug #817384 Wrong result with outer join + subquery in ON
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index 4035f61e36b..e215caadb1c 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -598,8 +598,8 @@ VALUES
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 t1_outer index NULL a 10 NULL 15 Using index
-2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
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/limit_rows_examined.result b/mysql-test/r/limit_rows_examined.result
index f4242f17a14..3a5212818ef 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 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 3
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/mdev316.result b/mysql-test/r/mdev316.result
new file mode 100644
index 00000000000..43082769872
--- /dev/null
+++ b/mysql-test/r/mdev316.result
@@ -0,0 +1,22 @@
+set names swe7;
+select '' in ('',convert(0,time));
+'' in ('',convert(0,time))
+1
+select case '' when '' then 1 when convert(0,time) then 2 end;
+case '' when '' then 1 when convert(0,time) then 2 end
+1
+select convert(0x0030 using ucs2) div 1, concat(convert(0x0030 using ucs2)) div 1;
+convert(0x0030 using ucs2) div 1 concat(convert(0x0030 using ucs2)) div 1
+0 0
+select cast(convert(0x0030 using ucs2) as double), cast(concat(convert(0x0030 using ucs2)) as double);
+cast(convert(0x0030 using ucs2) as double) cast(concat(convert(0x0030 using ucs2)) as double)
+0 0
+select cast(convert(0x0030 using ucs2) as decimal(5.2)), cast(concat(convert(0x0030 using ucs2)) as decimal(5.2));
+cast(convert(0x0030 using ucs2) as decimal(5.2)) cast(concat(convert(0x0030 using ucs2)) as decimal(5.2))
+0 0
+select cast(convert(_ucs2 0x0030 using latin1) as date), cast(concat(convert(_ucs2 0x0030 using latin1)) as date);
+cast(convert(_ucs2 0x0030 using latin1) as date) cast(concat(convert(_ucs2 0x0030 using latin1)) as date)
+NULL NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '0'
+Warning 1292 Incorrect datetime value: '0'
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/myisam_mrr.result b/mysql-test/r/myisam_mrr.result
index d4b25f25d40..03d212dbc04 100644
--- a/mysql-test/r/myisam_mrr.result
+++ b/mysql-test/r/myisam_mrr.result
@@ -349,10 +349,10 @@ WHERE t2.int_key IS NULL
GROUP BY t2.pk
);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 ref int_key int_key 5 const 1 100.00 Using index condition
Warnings:
-Note 1003 select min(1) AS `MIN(t1.pk)` from dual where exists(select `test`.`t2`.`pk` from `test`.`t2` where isnull(`test`.`t2`.`int_key`))
+Note 1003 select min(`test`.`t1`.`pk`) AS `MIN(t1.pk)` from `test`.`t1` where 0
DROP TABLE t1, t2;
#
# BUG#42048 Discrepancy between MyISAM and Maria's ICP implementation
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index fcadee7aced..ad55bfa3003 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -159,6 +159,10 @@ The following options may be given as the first argument:
Enable the event scheduler. Possible values are ON, OFF,
and DISABLED (keep the event scheduler completely
deactivated, it cannot be activated run-time)
+ --expensive-subquery-limit=#
+ The maximum number of rows a subquery may examine in
+ order to be executed during optimization and used for
+ constant optimization
--expire-logs-days=#
If non-zero, binary logs will be purged after
expire_logs_days days; possible purges happen at startup
@@ -885,6 +889,7 @@ delayed-queue-size 1000
div-precision-increment 4
engine-condition-pushdown FALSE
event-scheduler OFF
+expensive-subquery-limit 100
expire-logs-days 0
external-locking FALSE
extra-max-connections 1
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 8025f7a74b2..ff591c6cb69 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -5222,3 +5222,48 @@ DROP DATABASE b12809202_db;
# Delete all existing binary logs.
#
RESET MASTER;
+#
+# Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM
+#
+SET @old_log_output_state= @@global.log_output;
+SET @old_general_log_state= @@global.general_log;
+SET @old_slow_query_log_state= @@global.slow_query_log;
+call mtr.add_suppression("Failed to write to mysql.general_log");
+SET @@global.log_output="TABLE";
+SET @@global.general_log='OFF';
+SET @@global.slow_query_log='OFF';
+DROP DATABASE mysql;
+Warnings:
+Error 1146 Table 'mysql.proc' doesn't exist
+Error 1146 Table 'mysql.event' doesn't exist
+SHOW CREATE TABLE mysql.general_log;
+Table Create Table
+general_log CREATE TABLE `general_log` (
+ `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `user_host` mediumtext NOT NULL,
+ `thread_id` int(11) NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `command_type` varchar(64) NOT NULL,
+ `argument` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
+SHOW CREATE TABLE mysql.slow_log;
+Table Create Table
+slow_log CREATE TABLE `slow_log` (
+ `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `user_host` mediumtext NOT NULL,
+ `query_time` time(6) NOT NULL,
+ `lock_time` time(6) NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) NOT NULL,
+ `last_insert_id` int(11) NOT NULL,
+ `insert_id` int(11) NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `sql_text` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
+SET @@global.log_output= @old_log_output_state;
+SET @@global.slow_query_log= @old_slow_query_log_state;
+SET @@global.general_log= @old_general_log_state;
+#
+# End of 5.1 tests
+#
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 25345227d59..fdb3029059f 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -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/mysqltest_256.result b/mysql-test/r/mysqltest_256.result
new file mode 100644
index 00000000000..043c7208382
--- /dev/null
+++ b/mysql-test/r/mysqltest_256.result
@@ -0,0 +1 @@
+# Done
diff --git a/mysql-test/r/negation_elimination.result b/mysql-test/r/negation_elimination.result
index 5b09b0fc511..aea6518b676 100644
--- a/mysql-test/r/negation_elimination.result
+++ b/mysql-test/r/negation_elimination.result
@@ -321,7 +321,7 @@ select * from t1 where not(NULL or a);
a
explain select * from t1 where not(NULL and a);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL a 5 NULL 21 Using where; Using index
+1 SIMPLE t1 ref a a 5 const 1 Using index
select * from t1 where not(NULL and a);
a
0
@@ -502,5 +502,5 @@ explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 4 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or `test`.`t1`.`a`) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like '1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where (`test`.`t1`.`a` <> 0) having (`test`.`t1`.`a` <> 0)
+Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or (`test`.`t1`.`a` <> 0)) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like '1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where (`test`.`t1`.`a` <> 0) having (`test`.`t1`.`a` <> 0)
drop table t1;
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 1bc1ea31671..431c5dda116 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -2461,3 +2461,15 @@ SELECT 1 FROM t1 JOIN t1 AS t2 USING (a);
1
1
drop table t1;
+#
+# LP BUG#1001117 Crash on a simple select that uses a temptable view
+# MySQL Bug #12330344 Crash and/or valgrind errors in free_io_cache with join, view,
+# partitioned table
+#
+CREATE TABLE t1(a INT PRIMARY KEY) PARTITION BY LINEAR KEY (a);
+CREATE ALGORITHM=TEMPTABLE VIEW vtmp AS
+SELECT 1 FROM t1 AS t1_0 JOIN t1 ON t1_0.a LIKE (SELECT 1 FROM t1);
+SELECT * FROM vtmp;
+1
+DROP VIEW vtmp;
+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/ps.result b/mysql-test/r/ps.result
index 27131438d16..7629775b892 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -160,26 +160,26 @@ execute stmt1 ;
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
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
-5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
execute stmt1 ;
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
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
-5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
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
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
-5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
deallocate prepare stmt1;
set optimizer_switch=@tmp_optimizer_switch;
drop tables t1,t2;
@@ -255,15 +255,15 @@ deallocate prepare StMt1;
deallocate prepare Stmt1;
ERROR HY000: Unknown prepared statement handler (Stmt1) given to DEALLOCATE PREPARE
set names utf8;
-prepare `ü` from 'select 1234';
-execute `ü` ;
+prepare `ü` from 'select 1234';
+execute `ü` ;
1234
1234
set names latin1;
-execute `ü`;
+execute `ü`;
1234
1234
-deallocate prepare `ü`;
+deallocate prepare `ü`;
set names default;
create table t1 (a varchar(10)) charset=utf8;
insert into t1 (a) values ('yahoo');
@@ -3055,6 +3055,62 @@ DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests.
+#
+# LP bug#1001500 Crash on the second execution of the PS for
+# a query with degenerated conjunctive condition
+# (see also mysql bug#12582849)
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_nokey INTEGER,
+col_int_key INTEGER,
+col_varchar_key VARCHAR(1),
+col_varchar_nokey VARCHAR(1),
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_varchar_key, col_int_key)
+);
+INSERT INTO t1 (
+col_int_key, col_int_nokey,
+col_varchar_key, col_varchar_nokey
+) VALUES
+(4, 2, 'v', 'v'),
+(62, 150, 'v', 'v');
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_nokey INTEGER,
+col_int_key INTEGER,
+col_varchar_key VARCHAR(1),
+col_varchar_nokey VARCHAR(1),
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_varchar_key, col_int_key)
+);
+INSERT INTO t2 (
+col_int_key, col_int_nokey,
+col_varchar_key, col_varchar_nokey
+) VALUES
+(8, NULL, 'x', 'x'),
+(7, 8, 'd', 'd');
+PREPARE stmt FROM '
+SELECT
+ ( SELECT MAX( SQ1_alias2 .col_int_nokey ) AS SQ1_field1
+ FROM ( t2 AS SQ1_alias1 RIGHT JOIN t1 AS SQ1_alias2
+ ON ( SQ1_alias2.col_varchar_key = SQ1_alias1.col_varchar_nokey )
+ )
+ WHERE SQ1_alias2.pk < alias1.col_int_nokey OR alias1.pk
+ ) AS field1
+FROM ( t1 AS alias1 JOIN t2 AS alias2 ON alias2.pk )
+GROUP BY field1
+';
+EXECUTE stmt;
+field1
+150
+EXECUTE stmt;
+field1
+150
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
#
# WL#4435: Support OUT-parameters in prepared statements.
@@ -4044,3 +4100,4 @@ c1 c2 count(c3)
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/rpl_mysqldump_slave.result b/mysql-test/r/rpl_mysqldump_slave.result
index 76caab5fcfa..1b13ebb79c1 100644
--- a/mysql-test/r/rpl_mysqldump_slave.result
+++ b/mysql-test/r/rpl_mysqldump_slave.result
@@ -9,6 +9,6 @@ STOP SLAVE;
CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
START SLAVE;
STOP SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT='MASTER_MYPORT', MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT, MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
START SLAVE;
include/rpl_end.inc
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 05f9000bb33..414eeada0de 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -7849,3 +7849,36 @@ c1 c2 count(c3)
2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1
DROP PROCEDURE p1;
+#
+# LP bug#1002157 : testing stored function
+# bug#62125 result for null incorrectly yields 1292 warning.
+#
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+DROP FUNCTION IF EXISTS f3;
+DROP FUNCTION IF EXISTS f4;
+CREATE FUNCTION f1() RETURNS VARCHAR(1)
+BEGIN RETURN 'X'; END;/
+CREATE FUNCTION f2() RETURNS CHAR(1)
+BEGIN RETURN 'X'; END;/
+CREATE FUNCTION f3() RETURNS VARCHAR(1)
+BEGIN RETURN NULL; END;/
+CREATE FUNCTION f4() RETURNS CHAR(1)
+BEGIN RETURN NULL; END;/
+SELECT f1() IS NULL;
+f1() IS NULL
+0
+SELECT f2() IS NULL;
+f2() IS NULL
+0
+SELECT f3() IS NULL;
+f3() IS NULL
+1
+SELECT f4() IS NULL;
+f4() IS NULL
+1
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP FUNCTION f3;
+DROP FUNCTION f4;
+# End of 5.5 test
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 235d211840f..3ea6c0be398 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -51,12 +51,12 @@ ERROR 42S22: Reference 'a' not supported (forward reference in item list)
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from dual having (<expr_cache><1>((select 1)) = 1)
+Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -371,12 +371,12 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where; Using index
+1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
-2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where
+2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))
+Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
@@ -517,6 +517,7 @@ ERROR 21000: Subquery returns more than 1 row
show warnings;
Level Code Message
Error 1242 Subquery returns more than 1 row
+Error 1028 Sort aborted: Subquery returns more than 1 row
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
@@ -547,11 +548,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
-2 SUBQUERY t1 ref PRIMARY PRIMARY 3 const 2 100.00 Using index
-Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select 1 from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+ERROR 21000: Subquery returns more than 1 row
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
ERROR 21000: Subquery returns more than 1 row
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
@@ -907,7 +904,7 @@ a t1.a in (select t2.a from t2)
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
+2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
CREATE TABLE t3 (a int(11) default '0');
@@ -1608,25 +1605,25 @@ a3 1
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
@@ -1675,34 +1672,34 @@ select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= any (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2);
a
explain extended select * from t3 where NULL >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a);
a
@@ -1764,7 +1761,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION t1 system NULL NULL NULL NULL 1 100.00
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 'e' AS `s1` from dual where <nop>(<in_optimizer>('f',(<min>(select 'e' from dual union select 'e' from dual) < 'f')))
+Note 1003 select 'e' AS `s1` from dual where 1
drop table t1;
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
@@ -3099,8 +3096,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
-2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using where
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
@@ -3111,8 +3108,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
-2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
@@ -3163,7 +3160,7 @@ INSERT INTO t2 VALUES (1),(2),(3);
EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
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 t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
+2 SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
SELECT a, a IN (SELECT a FROM t1) FROM t2;
a a IN (SELECT a FROM t1)
1 1
@@ -3699,7 +3696,7 @@ ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
-2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
+2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
@@ -3726,9 +3723,9 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
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 t11 system NULL NULL NULL NULL 0 const row not found
-3 UNION t12 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 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
+3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
@@ -4198,8 +4195,8 @@ CREATE TABLE t1 (a int, b int, KEY (a));
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 0 Using where; Using index
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+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
DROP TABLE t1;
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -4580,7 +4577,7 @@ FROM t1
WHERE a = 230;
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 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
@@ -4626,7 +4623,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <nop>(<in_optimizer>(1,((select max(`test`.`t1`.`a1`) from `test`.`t1`) > 1)))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
1
1
@@ -5969,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 Using index
+2 SUBQUERY t1 ref a a 5 const 1
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
@@ -6130,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 Using index
+2 SUBQUERY t1 ref a a 5 const 1
DROP TABLE t1;
#
@@ -6542,7 +6539,7 @@ EXPLAIN
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 NULL
@@ -6550,7 +6547,7 @@ EXPLAIN
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
@@ -6589,5 +6586,225 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
f1 f2
drop table t1,t2;
+#
+# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
+# WHERE and UNION in HAVING
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_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 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
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
+min_a a
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
+min_a a
+drop table t1;
+#
+# LP BUG#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) );
+INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
+('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
+EXPLAIN
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a 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 HAVING
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
+field
+EXPLAIN
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
+1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
+1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+MAX( alias2.a )
+Arden-Arcade
+drop table t1;
+#
+# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
+# with semijoin+materialization, IN and = subqueries
+#
+CREATE TABLE t1 (a1 INT);
+INSERT INTO t1 VALUES (4),(6);
+CREATE TABLE t2 (b1 INT);
+INSERT INTO t2 VALUES (1),(7);
+EXPLAIN
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+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 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
+3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
+3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+a1
+drop table t1, t2;
+#
+# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
+# inner joins takes hundreds times longer
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (4),(5);
+CREATE TABLE t3 (c INT);
+INSERT INTO t3 VALUES (8),(3);
+set @@expensive_subquery_limit= 0;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 6
+Subquery_cache_miss 2
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 8
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 22
+set @@expensive_subquery_limit= default;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 0
+Subquery_cache_miss 0
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 16
+drop table t1, t2, t3;
+#
+# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0),(8);
+CREATE TABLE t2 (b INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+EXPLAIN
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * 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
+2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
+a
+drop table t1,t2;
+#
+# 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;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
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/subselect3.result b/mysql-test/r/subselect3.result
index 014ff5b5810..b33e7e113f2 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -1479,7 +1479,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not(<expr_cache><(select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9))>(<in_optimizer>((select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9)),(select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9)) in ( <materialize> (select `test`.`t3`.`b` from `test`.`t3` ), <primary_index_lookup>(9 in <temporary table> on distinct_key where ((9 = `<subquery3>`.`b`))))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1
SELECT * FROM t1
WHERE (
( SELECT a FROM t2 WHERE a = 9 ),
diff --git a/mysql-test/r/subselect3_jcl6.result b/mysql-test/r/subselect3_jcl6.result
index a62048db506..4660cd60603 100644
--- a/mysql-test/r/subselect3_jcl6.result
+++ b/mysql-test/r/subselect3_jcl6.result
@@ -1489,7 +1489,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not(<expr_cache><(select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9))>(<in_optimizer>((select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9)),(select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9)) in ( <materialize> (select `test`.`t3`.`b` from `test`.`t3` ), <primary_index_lookup>(9 in <temporary table> on distinct_key where ((9 = `<subquery3>`.`b`))))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1
SELECT * FROM t1
WHERE (
( SELECT a FROM t2 WHERE a = 9 ),
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 617d2e9e592..0f9912fc1f3 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -226,10 +226,10 @@ NULL
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 ;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><>((select 1 from `test`.`t2` where 0)) AS `RESULT` from dual
+Note 1003 select (select 1 from `test`.`t2` where 0) AS `RESULT` from dual
first equivalent variant
SELECT (SELECT 1 FROM t2 WHERE d = IFNULL(c,NULL)) AS RESULT FROM t1 GROUP BY c ;
RESULT
@@ -237,10 +237,10 @@ NULL
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = IFNULL(c,NULL)) AS RESULT FROM t1 GROUP BY c;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><>((select 1 from `test`.`t2` where 0)) AS `RESULT` from dual group by NULL
+Note 1003 select (select 1 from `test`.`t2` where 0) AS `RESULT` from dual group by NULL
second equivalent variant
SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 GROUP BY c ;
RESULT
@@ -248,10 +248,10 @@ NULL
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 GROUP BY c ;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><>((select 1 from `test`.`t2` where 0)) AS `RESULT` from dual group by NULL
+Note 1003 select (select 1 from `test`.`t2` where 0) AS `RESULT` from dual group by NULL
DROP TABLE t1,t2;
#
# BUG#45928 "Differing query results depending on MRR and
@@ -562,7 +562,7 @@ WHERE f3 = (
SELECT t1.f3 FROM t1
WHERE ( t1.f10 ) IN ( SELECT f11 FROM t2 GROUP BY f11 ));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ref f3 f3 5 const 0 Using where
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2
@@ -577,7 +577,7 @@ WHERE f3 = (
SELECT f3 FROM t1
WHERE ( f10, f10 ) IN ( SELECT f11, f11 FROM t2 GROUP BY f11 ));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ref f3 f3 5 const 0 Using where
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 8 func,func 1
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2
@@ -627,51 +627,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 +679,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 +687,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 +695,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 +703,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 +718,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 +770,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 +778,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 +786,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 +794,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 +813,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 +842,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 +904,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 +933,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
@@ -1220,6 +1220,13 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 SUBQUERY SQ1_t1 index NULL f4 5 NULL 2 Using index; Using temporary
3 SUBQUERY SQ1_t3 index f4 f4 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
+SELECT * FROM t1 WHERE
+(SELECT f2 FROM t2
+WHERE f4 <= ALL
+(SELECT max(SQ1_t1.f4)
+FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4
+GROUP BY SQ1_t1.f4));
+ERROR 21000: Subquery returns more than 1 row
drop table t1, t2, t3;
#
# BUG#52317: Assertion failing in Field_varstring::store()
@@ -1250,10 +1257,9 @@ FROM t2 JOIN t1 ON t1.f3
WHERE ('v') IN (SELECT f4 FROM t2)
GROUP BY f9;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 system NULL NULL NULL NULL 1
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(t2.f3),
(SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9
FROM t2 JOIN t1 ON t1.f3
@@ -1267,17 +1273,16 @@ FROM t2 JOIN t1 ON t1.f3
WHERE ('v') IN (SELECT f4 FROM t2)
ORDER BY f9;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 system NULL NULL NULL NULL 1
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(t2.f3),
(SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9
FROM t2 JOIN t1 ON t1.f3
WHERE ('v') IN (SELECT f4 FROM t2)
ORDER BY f9;
COUNT(t2.f3) f9
-0 2
+0 NULL
EXPLAIN
SELECT COUNT(t2.f3),
(SELECT t2.f1 FROM t1 limit 1) AS f9
@@ -1285,8 +1290,7 @@ FROM t2 JOIN t1
WHERE ('v') IN (SELECT f4 FROM t2)
GROUP BY f9;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 system NULL NULL NULL NULL 1
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(t2.f3),
@@ -1302,8 +1306,7 @@ FROM t2 JOIN t1
WHERE ('v') IN (SELECT f4 FROM t2)
ORDER BY f9;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 system NULL NULL NULL NULL 1
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(t2.f3),
@@ -1325,7 +1328,7 @@ EXPLAIN
SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
-2 SUBQUERY t1 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 (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1;
field1
NULL
@@ -1333,7 +1336,7 @@ EXPLAIN
SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
-2 SUBQUERY t1 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 (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1;
field1
NULL
@@ -1631,7 +1634,7 @@ SET SESSION optimizer_switch='in_to_exists=on,materialization=off';
EXPLAIN
SELECT * FROM t1 WHERE ( 6 ) NOT IN ( SELECT t2.f3 FROM t2 JOIN t3 ON t3.f10 = t2.f10);
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 t3 system NULL NULL NULL NULL 1
2 SUBQUERY t2 ref_or_null f10 f10 10 const,const 2 Using where; Using index
SELECT * FROM t1 WHERE ( 6 ) NOT IN ( SELECT t2.f3 FROM t2 JOIN t3 ON t3.f10 = t2.f10);
@@ -1852,8 +1855,8 @@ GROUP BY 1, 2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 system NULL NULL NULL NULL 1 Using temporary; Using filesort
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
-2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-3 MATERIALIZED t1 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
PREPARE st1 FROM "
SELECT t2.f1, (SELECT f2 FROM t1 WHERE (7) IN (SELECT f1 FROM t1))
FROM t2 JOIN t3 ON t3.f4 = t2.f4
@@ -2029,6 +2032,61 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where
2 SUBQUERY five ALL NULL NULL NULL NULL 5 Using where
drop table ten, t1, five;
+#
+# LP BUG#1008773 Wrong result (NULL instead of a value) with no matching rows, subquery in FROM and HAVING
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1);
+EXPLAIN
+SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 1
+SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1;
+MAX(a) bb
+NULL 1
+EXPLAIN
+SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY t2 system NULL NULL NULL NULL 1
+SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1;
+MAX(a) bb
+NULL 1
+EXPLAIN
+SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
+MAX(a) bb
+NULL 1
+EXPLAIN
+SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1;
+MAX(a) bb
+NULL NULL
+EXPLAIN
+SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
+SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1;
+MAX(a) bb
+NULL NULL
+EXPLAIN
+SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
+SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
+MAX(a) bb
+NULL NULL
+drop table t1, t2;
set optimizer_switch=@subselect4_tmp;
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
diff --git a/mysql-test/r/subselect_cache.result b/mysql-test/r/subselect_cache.result
index e38e8b42e9a..7bd10dc11a6 100644
--- a/mysql-test/r/subselect_cache.result
+++ b/mysql-test/r/subselect_cache.result
@@ -486,9 +486,9 @@ Handler_read_key 7
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
-Handler_read_rnd 10
+Handler_read_rnd 0
Handler_read_rnd_deleted 0
-Handler_read_rnd_next 42
+Handler_read_rnd_next 31
set optimizer_switch='subquery_cache=off';
flush status;
select a from t1 ORDER BY (select d from t2 where b=c);
@@ -514,9 +514,9 @@ Handler_read_key 0
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
-Handler_read_rnd 10
+Handler_read_rnd 0
Handler_read_rnd_deleted 0
-Handler_read_rnd_next 72
+Handler_read_rnd_next 61
set optimizer_switch='subquery_cache=on';
#single value subquery test (distinct ORDER BY)
flush status;
diff --git a/mysql-test/r/subselect_extra_no_semijoin.result b/mysql-test/r/subselect_extra_no_semijoin.result
index 773ee9898a4..ba001c71e3f 100644
--- a/mysql-test/r/subselect_extra_no_semijoin.result
+++ b/mysql-test/r/subselect_extra_no_semijoin.result
@@ -46,7 +46,7 @@ select * from t1
where id in (select id from t1 as x1 where (t1.cur_date is null));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
Note 1003 select 1 AS `id`,'2007-04-25 18:30:22' AS `cur_date` from dual where <expr_cache><1>(<in_optimizer>(1,<exists>(select `test`.`x1`.`id` from `test`.`t1` `x1` where 0)))
@@ -58,7 +58,7 @@ select * from t2
where id in (select id from t2 as x1 where (t2.cur_date is null));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
Note 1003 select 1 AS `id`,'2007-04-25' AS `cur_date` from dual where <expr_cache><1>(<in_optimizer>(1,<exists>(select `test`.`x1`.`id` from `test`.`t2` `x1` where 0)))
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index 5ee56b25fee..a0f05a26a46 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -332,8 +332,8 @@ FROM t2
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 t2 ALL NULL NULL NULL NULL 1
-3 SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using temporary
+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
SELECT *
FROM t1
WHERE t1.a = (
@@ -361,7 +361,7 @@ GROUP BY 1
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 1
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 SUBQUERY t3 ALL NULL NULL NULL NULL 1
SELECT MAX( f1 ) FROM t2
WHERE f2 >= (
@@ -386,7 +386,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 t1 ALL NULL NULL NULL NULL 1 Using temporary; Using filesort
+3 SUBQUERY internal_tmp_table ALL group_key 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 78472e99326..9bb26e8a6e0 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -1152,8 +1152,8 @@ create table t2 (b1 int);
insert into t1 values (5);
explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
-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 min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
min(a1)
NULL
@@ -1162,8 +1162,8 @@ set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='materialization=off,in_to_exists=on';
explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
-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 min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
min(a1)
NULL
@@ -1171,8 +1171,8 @@ set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='semijoin=off';
explain select min(a1) from t1 where 7 in (select b1 from t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
-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 min(a1) from t1 where 7 in (select b1 from t2);
min(a1)
NULL
@@ -1181,16 +1181,16 @@ set @@optimizer_switch='materialization=off,in_to_exists=on';
# with MariaDB and MWL#90, this particular case is solved:
explain select min(a1) from t1 where 7 in (select b1 from t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
-2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+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 min(a1) from t1 where 7 in (select b1 from t2);
min(a1)
NULL
# but when we go around MWL#90 code, the problem still shows up:
explain select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
-2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+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 min(a1) from t1 where 7 in (select b1 from t2) or 2> 4;
min(a1)
NULL
@@ -1932,7 +1932,7 @@ WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) 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 index NULL c 5 NULL 8 Using where; Using index
-2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
+2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index
2 MATERIALIZED s1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
SELECT a, c FROM t1, t2
@@ -1951,8 +1951,8 @@ WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) 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 index NULL c 5 NULL 8 Using where; Using index
-2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
-2 MATERIALIZED s1 hash_ALL NULL #hash#$hj 5 test.s2.d 8 Using where; Using join buffer (flat, BNLH join)
+2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index
+2 MATERIALIZED s1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
SELECT a, c FROM t1, t2
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
@@ -2166,7 +2166,7 @@ set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_
EXPLAIN
SELECT * FROM t2 WHERE (SELECT f3a FROM t3) NOT IN (SELECT f1a 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 FROM t3) NOT IN (SELECT f1a FROM t1);
@@ -2175,7 +2175,7 @@ EXPLAIN
SELECT (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-3 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1);
(SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1)
@@ -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);
@@ -2192,7 +2192,7 @@ EXPLAIN
SELECT (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 NULL NULL NULL NULL NULL NULL NULL No tables used
-3 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1);
(SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1)
@@ -2235,10 +2235,10 @@ NULL
EXPLAIN EXTENDED
SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 index NULL b 5 NULL 2 100.00 Using index
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1003 select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where <expr_cache><9>(<in_optimizer>(9,9 in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` ), <primary_index_lookup>(9 in <temporary table> on distinct_key where ((9 = `<subquery2>`.`a`))))))
+Note 1003 select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where 0
set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off';
SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2);
max_res
@@ -2246,10 +2246,10 @@ NULL
EXPLAIN EXTENDED
SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 index NULL b 5 NULL 2 100.00 Using index
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where <expr_cache><9>(<in_optimizer>(9,<exists>(select `test`.`t2`.`a` from `test`.`t2` where (9 = `test`.`t2`.`a`))))
+Note 1003 select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where 0
DROP TABLE t1,t2;
#
# LPBUG#825095: Wrong result with materialization and NOT IN with 2 expressions
diff --git a/mysql-test/r/subselect_mat_cost.result b/mysql-test/r/subselect_mat_cost.result
index 893209a07fc..081196a227b 100644
--- a/mysql-test/r/subselect_mat_cost.result
+++ b/mysql-test/r/subselect_mat_cost.result
@@ -496,7 +496,7 @@ from City
where City.population > 10000000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY City range Population Population 5 NULL 4 Using index condition; Rowid-ordered scan
-2 DEPENDENT SUBQUERY Country index_subquery CountryCapital CountryCapital 5 func 2 Using index; Using where
+2 SUBQUERY Country index_subquery CountryCapital CountryCapital 5 func 2 Using index; Using where
select Name, City.id in (select capital from Country where capital is not null) as is_capital
from City
where City.population > 10000000;
diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result
index ca4aa57417e..1d03f2e9fe6 100644
--- a/mysql-test/r/subselect_mat_cost_bugs.result
+++ b/mysql-test/r/subselect_mat_cost_bugs.result
@@ -124,7 +124,7 @@ FROM t3 RIGHT JOIN t1 ON t1.pk = t3.f1
WHERE t3.f3 OR ( 3 ) IN ( SELECT f2 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 NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT t1.*
FROM t3 RIGHT JOIN t1 ON t1.pk = t3.f1
WHERE t3.f3 OR ( 3 ) IN ( SELECT f2 FROM t2 );
@@ -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 t2 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+3 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 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);
@@ -209,8 +209,8 @@ WHERE t1.f1 AND alias2.f10
ORDER BY field1 ;
field1
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'f'
-Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
set optimizer_switch=@tmp_optimizer_switch;
drop table t1,t2;
#
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index b08148f8057..8ce097787f1 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -58,12 +58,12 @@ ERROR 42S22: Reference 'a' not supported (forward reference in item list)
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from dual having (<expr_cache><1>((select 1)) = 1)
+Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -378,12 +378,12 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where; Using index
+1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
-2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where
+2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))
+Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
@@ -524,6 +524,7 @@ ERROR 21000: Subquery returns more than 1 row
show warnings;
Level Code Message
Error 1242 Subquery returns more than 1 row
+Error 1028 Sort aborted: Subquery returns more than 1 row
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
@@ -554,11 +555,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
-2 SUBQUERY t1 ref PRIMARY PRIMARY 3 const 2 100.00 Using index
-Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select 1 from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+ERROR 21000: Subquery returns more than 1 row
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
ERROR 21000: Subquery returns more than 1 row
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
@@ -914,7 +911,7 @@ a t1.a in (select t2.a from t2)
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
+2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
CREATE TABLE t3 (a int(11) default '0');
@@ -1615,25 +1612,25 @@ a3 1
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
@@ -1682,34 +1679,34 @@ select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= any (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2);
a
explain extended select * from t3 where NULL >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a);
a
@@ -1771,7 +1768,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION t1 system NULL NULL NULL NULL 1 100.00
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 'e' AS `s1` from dual where <nop>(<in_optimizer>('f',(<min>(select 'e' from dual union select 'e' from dual) < 'f')))
+Note 1003 select 'e' AS `s1` from dual where 1
drop table t1;
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
@@ -3105,8 +3102,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
-2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using where
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
@@ -3117,8 +3114,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
-2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
@@ -3169,7 +3166,7 @@ INSERT INTO t2 VALUES (1),(2),(3);
EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
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 t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
+2 SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
SELECT a, a IN (SELECT a FROM t1) FROM t2;
a a IN (SELECT a FROM t1)
1 1
@@ -3703,7 +3700,7 @@ ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
-2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
+2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
@@ -3730,9 +3727,9 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
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 t11 system NULL NULL NULL NULL 0 const row not found
-3 UNION t12 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 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
+3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
@@ -4202,8 +4199,8 @@ CREATE TABLE t1 (a int, b int, KEY (a));
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 0 Using where; Using index
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+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
DROP TABLE t1;
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -4531,13 +4528,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a` having (1 = <ref_null_helper>(min(`test`.`t1`.`a`))))))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = <ref_null_helper>(min(`test`.`t1`.`a`))))))
+Note 1003 select 1 AS `1` from `test`.`t1` where 0
SET join_cache_level=@save_join_cache_level;
DROP TABLE t1;
#
@@ -4582,7 +4579,7 @@ FROM t1
WHERE a = 230;
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 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
@@ -4628,7 +4625,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <nop>(<in_optimizer>(1,((select max(`test`.`t1`.`a1`) from `test`.`t1`) > 1)))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
1
1
@@ -5970,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 Using index
+2 SUBQUERY t1 ref a a 5 const 1
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
@@ -6129,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 Using index
+2 SUBQUERY t1 ref a a 5 const 1
DROP TABLE t1;
#
@@ -6541,7 +6538,7 @@ EXPLAIN
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 NULL
@@ -6549,7 +6546,7 @@ EXPLAIN
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
@@ -6588,6 +6585,225 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
f1 f2
drop table t1,t2;
+#
+# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
+# WHERE and UNION in HAVING
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_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 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
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
+min_a a
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
+min_a a
+drop table t1;
+#
+# LP BUG#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) );
+INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
+('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
+EXPLAIN
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a 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 HAVING
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
+field
+EXPLAIN
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
+1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
+1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+MAX( alias2.a )
+Arden-Arcade
+drop table t1;
+#
+# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
+# with semijoin+materialization, IN and = subqueries
+#
+CREATE TABLE t1 (a1 INT);
+INSERT INTO t1 VALUES (4),(6);
+CREATE TABLE t2 (b1 INT);
+INSERT INTO t2 VALUES (1),(7);
+EXPLAIN
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+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 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where; Start temporary; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 End temporary; Using join buffer (flat, BNL join)
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+a1
+drop table t1, t2;
+#
+# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
+# inner joins takes hundreds times longer
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (4),(5);
+CREATE TABLE t3 (c INT);
+INSERT INTO t3 VALUES (8),(3);
+set @@expensive_subquery_limit= 0;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 6
+Subquery_cache_miss 2
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 8
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 22
+set @@expensive_subquery_limit= default;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 0
+Subquery_cache_miss 0
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 16
+drop table t1, t2, t3;
+#
+# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0),(8);
+CREATE TABLE t2 (b INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+EXPLAIN
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
+a
+drop table t1,t2;
+#
+# 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;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set optimizer_switch=default;
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 36d03d8db77..466d8c8fd06 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -54,7 +54,7 @@ ERROR 42S22: Reference 'a' not supported (forward reference in item list)
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
@@ -374,12 +374,12 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where; Using index
+1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
-2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where
+2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))
+Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
@@ -520,6 +520,7 @@ ERROR 21000: Subquery returns more than 1 row
show warnings;
Level Code Message
Error 1242 Subquery returns more than 1 row
+Error 1028 Sort aborted: Subquery returns more than 1 row
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
@@ -550,11 +551,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
-2 SUBQUERY t1 ref PRIMARY PRIMARY 3 const 2 100.00 Using index
-Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select 1 from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+ERROR 21000: Subquery returns more than 1 row
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
ERROR 21000: Subquery returns more than 1 row
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
@@ -910,7 +907,7 @@ a t1.a in (select t2.a from t2)
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
+2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
CREATE TABLE t3 (a int(11) default '0');
@@ -1611,25 +1608,25 @@ a3 1
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
@@ -1678,34 +1675,34 @@ select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= any (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2);
a
explain extended select * from t3 where NULL >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a);
a
@@ -1767,7 +1764,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION t1 system NULL NULL NULL NULL 1 100.00
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 'e' AS `s1` from dual where <nop>(<in_optimizer>('f',(<min>(select 'e' from dual union select 'e' from dual) < 'f')))
+Note 1003 select 'e' AS `s1` from dual where 1
drop table t1;
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
@@ -3101,8 +3098,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
-2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using where
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
@@ -3113,8 +3110,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
-2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
@@ -3165,7 +3162,7 @@ INSERT INTO t2 VALUES (1),(2),(3);
EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
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 t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
+2 SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
SELECT a, a IN (SELECT a FROM t1) FROM t2;
a a IN (SELECT a FROM t1)
1 1
@@ -3699,7 +3696,7 @@ ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
-2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
+2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
@@ -3726,9 +3723,9 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
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 t11 system NULL NULL NULL NULL 0 const row not found
-3 UNION t12 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 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
+3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
@@ -4198,8 +4195,8 @@ CREATE TABLE t1 (a int, b int, KEY (a));
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 0 Using where; Using index
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+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
DROP TABLE t1;
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -4527,13 +4524,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a` having (1 = <ref_null_helper>(min(`test`.`t1`.`a`)))))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = <ref_null_helper>(min(`test`.`t1`.`a`)))))
+Note 1003 select 1 AS `1` from `test`.`t1` where 0
SET join_cache_level=@save_join_cache_level;
DROP TABLE t1;
#
@@ -4578,7 +4575,7 @@ FROM t1
WHERE a = 230;
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 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
@@ -4624,7 +4621,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <nop>(<in_optimizer>(1,((select max(`test`.`t1`.`a1`) from `test`.`t1`) > 1)))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
1
1
@@ -5966,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 Using index
+2 SUBQUERY t1 ref a a 5 const 1
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
@@ -6125,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 Using index
+2 SUBQUERY t1 ref a a 5 const 1
DROP TABLE t1;
#
@@ -6537,7 +6534,7 @@ EXPLAIN
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 NULL
@@ -6545,7 +6542,7 @@ EXPLAIN
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
@@ -6584,6 +6581,226 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
f1 f2
drop table t1,t2;
+#
+# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
+# WHERE and UNION in HAVING
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_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 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
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
+min_a a
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
+min_a a
+drop table t1;
+#
+# LP BUG#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) );
+INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
+('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
+EXPLAIN
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a 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 HAVING
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
+field
+EXPLAIN
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
+1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
+1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+MAX( alias2.a )
+Arden-Arcade
+drop table t1;
+#
+# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
+# with semijoin+materialization, IN and = subqueries
+#
+CREATE TABLE t1 (a1 INT);
+INSERT INTO t1 VALUES (4),(6);
+CREATE TABLE t2 (b1 INT);
+INSERT INTO t2 VALUES (1),(7);
+EXPLAIN
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+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 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
+3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
+3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+a1
+drop table t1, t2;
+#
+# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
+# inner joins takes hundreds times longer
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (4),(5);
+CREATE TABLE t3 (c INT);
+INSERT INTO t3 VALUES (8),(3);
+set @@expensive_subquery_limit= 0;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 6
+Subquery_cache_miss 2
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 8
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 22
+set @@expensive_subquery_limit= default;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 0
+Subquery_cache_miss 0
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 16
+drop table t1, t2, t3;
+#
+# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0),(8);
+CREATE TABLE t2 (b INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+EXPLAIN
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * 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
+2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
+a
+drop table t1,t2;
+#
+# 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;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
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 7fcacfda470..1fde0d08d7e 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -57,7 +57,7 @@ ERROR 42S22: Reference 'a' not supported (forward reference in item list)
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
@@ -377,12 +377,12 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where; Using index
+1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
-2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where
+2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))
+Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
@@ -523,6 +523,7 @@ ERROR 21000: Subquery returns more than 1 row
show warnings;
Level Code Message
Error 1242 Subquery returns more than 1 row
+Error 1028 Sort aborted: Subquery returns more than 1 row
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
@@ -553,11 +554,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
-2 SUBQUERY t1 ref PRIMARY PRIMARY 3 const 2 100.00 Using index
-Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select 1 from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+ERROR 21000: Subquery returns more than 1 row
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
ERROR 21000: Subquery returns more than 1 row
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
@@ -913,7 +910,7 @@ a t1.a in (select t2.a from t2)
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
+2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
CREATE TABLE t3 (a int(11) default '0');
@@ -1614,25 +1611,25 @@ a3 1
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
@@ -1681,34 +1678,34 @@ select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= any (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2);
a
explain extended select * from t3 where NULL >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a);
a
@@ -1770,7 +1767,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION t1 system NULL NULL NULL NULL 1 100.00
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 'e' AS `s1` from dual where <nop>(<in_optimizer>('f',(<min>(select 'e' from dual union select 'e' from dual) < 'f')))
+Note 1003 select 'e' AS `s1` from dual where 1
drop table t1;
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
@@ -3105,8 +3102,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
-2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using where
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
@@ -3117,8 +3114,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
-2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
@@ -3169,7 +3166,7 @@ INSERT INTO t2 VALUES (1),(2),(3);
EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
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 t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
+2 SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
SELECT a, a IN (SELECT a FROM t1) FROM t2;
a a IN (SELECT a FROM t1)
1 1
@@ -3705,7 +3702,7 @@ ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
-2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
+2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
@@ -3732,9 +3729,9 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
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 t11 system NULL NULL NULL NULL 0 const row not found
-3 UNION t12 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 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
+3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
@@ -4204,8 +4201,8 @@ CREATE TABLE t1 (a int, b int, KEY (a));
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 0 Using where; Using index
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+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
DROP TABLE t1;
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -4586,7 +4583,7 @@ FROM t1
WHERE a = 230;
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 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
@@ -4632,7 +4629,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <nop>(<in_optimizer>(1,((select max(`test`.`t1`.`a1`) from `test`.`t1`) > 1)))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
1
1
@@ -5975,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 Using index
+2 SUBQUERY t1 ref a a 5 const 1
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
@@ -6136,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 Using index
+2 SUBQUERY t1 ref a a 5 const 1
DROP TABLE t1;
#
@@ -6548,7 +6545,7 @@ EXPLAIN
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 NULL
@@ -6556,7 +6553,7 @@ EXPLAIN
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
@@ -6595,6 +6592,226 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
f1 f2
drop table t1,t2;
+#
+# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
+# WHERE and UNION in HAVING
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_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 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
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
+min_a a
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
+min_a a
+drop table t1;
+#
+# LP BUG#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) );
+INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
+('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
+EXPLAIN
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a 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 HAVING
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
+field
+EXPLAIN
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
+1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
+1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+MAX( alias2.a )
+Arden-Arcade
+drop table t1;
+#
+# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
+# with semijoin+materialization, IN and = subqueries
+#
+CREATE TABLE t1 (a1 INT);
+INSERT INTO t1 VALUES (4),(6);
+CREATE TABLE t2 (b1 INT);
+INSERT INTO t2 VALUES (1),(7);
+EXPLAIN
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+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 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
+3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
+3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+a1
+drop table t1, t2;
+#
+# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
+# inner joins takes hundreds times longer
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (4),(5);
+CREATE TABLE t3 (c INT);
+INSERT INTO t3 VALUES (8),(3);
+set @@expensive_subquery_limit= 0;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 0
+Subquery_cache_miss 0
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 58
+set @@expensive_subquery_limit= default;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 0
+Subquery_cache_miss 0
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 16
+drop table t1, t2, t3;
+#
+# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0),(8);
+CREATE TABLE t2 (b INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+EXPLAIN
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * 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
+2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
+a
+drop table t1,t2;
+#
+# 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;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set optimizer_switch=default;
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 405261c9ec6..ba50b8522eb 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -54,12 +54,12 @@ ERROR 42S22: Reference 'a' not supported (forward reference in item list)
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from dual having (<expr_cache><1>((select 1)) = 1)
+Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -374,12 +374,12 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where; Using index
+1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
-2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where
+2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))
+Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
@@ -520,6 +520,7 @@ ERROR 21000: Subquery returns more than 1 row
show warnings;
Level Code Message
Error 1242 Subquery returns more than 1 row
+Error 1028 Sort aborted: Subquery returns more than 1 row
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
@@ -550,11 +551,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
-2 SUBQUERY t1 ref PRIMARY PRIMARY 3 const 2 100.00 Using index
-Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select 1 from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+ERROR 21000: Subquery returns more than 1 row
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
ERROR 21000: Subquery returns more than 1 row
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
@@ -1678,34 +1675,34 @@ select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= any (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2);
a
explain extended select * from t3 where NULL >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a);
a
@@ -1767,7 +1764,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION t1 system NULL NULL NULL NULL 1 100.00
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 'e' AS `s1` from dual where <nop>(<in_optimizer>('f',(<min>(select 'e' from dual union select 'e' from dual) < 'f')))
+Note 1003 select 'e' AS `s1` from dual where 1
drop table t1;
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
@@ -3101,8 +3098,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
-2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using where
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
@@ -3113,8 +3110,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
-1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
-2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
@@ -3699,7 +3696,7 @@ ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
-2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
+2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
@@ -3726,9 +3723,9 @@ from t1' at line 1
explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
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 t11 system NULL NULL NULL NULL 0 const row not found
-3 UNION t12 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 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
+3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
@@ -4198,8 +4195,8 @@ CREATE TABLE t1 (a int, b int, KEY (a));
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 0 Using where; Using index
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+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
DROP TABLE t1;
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -4525,15 +4522,15 @@ SET join_cache_level=0;
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
-2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,1 in ( <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery2>`.`min(a)`))))))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
-2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,1 in ( <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery2>`.`min(a)`))))))
+Note 1003 select 1 AS `1` from `test`.`t1` where 0
SET join_cache_level=@save_join_cache_level;
DROP TABLE t1;
#
@@ -4578,7 +4575,7 @@ FROM t1
WHERE a = 230;
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 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
@@ -4624,7 +4621,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where <nop>(<in_optimizer>(1,((select max(`test`.`t1`.`a1`) from `test`.`t1`) > 1)))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
1
1
@@ -5966,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 Using index
+2 SUBQUERY t1 ref a a 5 const 1
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
@@ -6125,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 Using index
+2 SUBQUERY t1 ref a a 5 const 1
DROP TABLE t1;
#
@@ -6537,7 +6534,7 @@ EXPLAIN
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 NULL
@@ -6545,7 +6542,7 @@ EXPLAIN
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
@@ -6584,6 +6581,226 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
f1 f2
drop table t1,t2;
+#
+# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
+# WHERE and UNION in HAVING
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_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 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
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
+min_a a
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
+min_a a
+drop table t1;
+#
+# LP BUG#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) );
+INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
+('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
+EXPLAIN
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a 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 HAVING
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
+field
+EXPLAIN
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
+1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
+1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+MAX( alias2.a )
+Arden-Arcade
+drop table t1;
+#
+# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
+# with semijoin+materialization, IN and = subqueries
+#
+CREATE TABLE t1 (a1 INT);
+INSERT INTO t1 VALUES (4),(6);
+CREATE TABLE t2 (b1 INT);
+INSERT INTO t2 VALUES (1),(7);
+EXPLAIN
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+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 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
+3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
+3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+a1
+drop table t1, t2;
+#
+# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
+# inner joins takes hundreds times longer
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (4),(5);
+CREATE TABLE t3 (c INT);
+INSERT INTO t3 VALUES (8),(3);
+set @@expensive_subquery_limit= 0;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 6
+Subquery_cache_miss 2
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 8
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 22
+set @@expensive_subquery_limit= default;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 0
+Subquery_cache_miss 0
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 16
+drop table t1, t2, t3;
+#
+# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0),(8);
+CREATE TABLE t2 (b INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+EXPLAIN
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * 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
+2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
+a
+drop table t1,t2;
+#
+# 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;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set @optimizer_switch_for_subselect_test=null;
diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result
index e3f73d3993b..f8598a3864d 100644
--- a/mysql-test/r/subselect_sj_mat.result
+++ b/mysql-test/r/subselect_sj_mat.result
@@ -1197,8 +1197,8 @@ set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='materialization=off,in_to_exists=on';
explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
-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 min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
min(a1)
NULL
@@ -1206,8 +1206,8 @@ set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='semijoin=off';
explain select min(a1) from t1 where 7 in (select b1 from t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
-2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+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 min(a1) from t1 where 7 in (select b1 from t2);
min(a1)
NULL
@@ -1223,8 +1223,8 @@ NULL
# but when we go around MWL#90 code, the problem still shows up:
explain select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
-2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+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 min(a1) from t1 where 7 in (select b1 from t2) or 2> 4;
min(a1)
NULL
@@ -1971,7 +1971,7 @@ 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 index c c 5 NULL 8 Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1
-2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
+2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index
2 MATERIALIZED s1 ALL c NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
SELECT a, c FROM t1, t2
@@ -1991,8 +1991,8 @@ 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 index c c 5 NULL 8 Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1
-2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
-2 MATERIALIZED s1 hash_ALL c #hash#$hj 10 const,test.s2.d 8 Using where; Using join buffer (flat, BNLH join)
+2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index
+2 MATERIALIZED s1 hash_ALL c #hash#$hj 5 const 8 Using where; Using join buffer (flat, BNLH join)
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
SELECT a, c FROM t1, t2
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 1ac688787c6..75255d558c4 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1845,3 +1845,20 @@ dev
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
dev
1
+#
+# LP bug#1010729: Unexpected syntax error from UNION
+# (bug #54382) with single-table join nest
+#
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+CREATE TABLE t3 (c int);
+SELECT a FROM t1 UNION SELECT b FROM t2 JOIN (t3) ON ( t2.b = t3.c );
+a
+DROP TABLE t1, t2, t3;
+CREATE TABLE t1 (pk int NOT NULL);
+CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL);
+SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk)
+UNION
+SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk);
+pk
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index accb88b7f15..e98dda46061 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -454,6 +454,13 @@ SELECT (@v:=a) <> (@v:=1) FROM t1;
(@v:=a) <> (@v:=1)
1
DROP TABLE t1;
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2);
+SELECT DISTINCT @a:=MIN(t1.a) FROM t1, t1 AS t2
+GROUP BY @b:=(SELECT COUNT(*) > t2.a);
+@a:=MIN(t1.a)
+1
+DROP TABLE t1;
End of 5.1 tests
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1));
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index ae4c61a1dc7..b50f6b81206 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -4324,13 +4324,13 @@ MM
ZZ
ZZ
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'VV'
+Warning 1292 Truncated incorrect DOUBLE value: 'VV'
EXPLAIN EXTENDED
SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'VV'
+Warning 1292 Truncated incorrect DOUBLE value: 'VV'
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 'JJ')
DROP VIEW v1;
DROP TABLE t1;
@@ -4674,6 +4674,19 @@ 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
+#
+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;
# -----------------------------------------------------------------
# -- End of 5.3 tests.
# -----------------------------------------------------------------
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 0c398bed440..f39b682d2de 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;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE 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_grant.result b/mysql-test/suite/binlog/r/binlog_grant.result
index 1c0e73f8842..09a3d709929 100644
--- a/mysql-test/suite/binlog/r/binlog_grant.result
+++ b/mysql-test/suite/binlog/r/binlog_grant.result
@@ -22,3 +22,7 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo
**** Clean up ****
set global binlog_format = @saved_binlog_format;
drop user mysqltest_1@localhost;
+GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
+SHOW MASTER LOGS;
+SHOW BINARY LOGS;
+DROP USER 'mysqltest_1'@'localhost';
diff --git a/mysql-test/suite/binlog/r/binlog_mdev342.result b/mysql-test/suite/binlog/r/binlog_mdev342.result
new file mode 100644
index 00000000000..0e1d8f8ac78
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_mdev342.result
@@ -0,0 +1,30 @@
+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;
+SET DEBUG_SYNC= "binlog_open_before_update_index SIGNAL con1_ready WAIT_FOR con1_cont";
+SET SESSION debug_dbug="+d,crash_create_critical_before_update_index";
+INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
+SET DEBUG_SYNC= "ha_commit_trans_after_prepare SIGNAL con2_ready";
+INSERT INTO t1 VALUES (2, NULL);
+SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
+SET DEBUG_SYNC= "now SIGNAL con1_cont";
+Got one of the listed errors
+SELECT a FROM t1 ORDER BY a;
+a
+1
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+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)
+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=<binlog_start>
+DROP TABLE t1;
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_grant.test b/mysql-test/suite/binlog/t/binlog_grant.test
index 9d9c6031b5a..f0367b3aa79 100644
--- a/mysql-test/suite/binlog/t/binlog_grant.test
+++ b/mysql-test/suite/binlog/t/binlog_grant.test
@@ -54,3 +54,22 @@ disconnect root;
connection default;
set global binlog_format = @saved_binlog_format;
drop user mysqltest_1@localhost;
+
+
+# Testing if REPLICATION CLIENT privilege is enough to execute
+# SHOW MASTER LOGS and SHOW BINARY.
+GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
+--connect(rpl,localhost,mysqltest_1,,)
+
+--connection rpl
+# We are only interested if the following commands succeed and not on
+# their output.
+--disable_result_log
+SHOW MASTER LOGS;
+SHOW BINARY LOGS;
+--enable_result_log
+
+# clean up
+--disconnect rpl
+connection default;
+DROP USER 'mysqltest_1'@'localhost';
diff --git a/mysql-test/suite/binlog/t/binlog_mdev342-master.opt b/mysql-test/suite/binlog/t/binlog_mdev342-master.opt
new file mode 100644
index 00000000000..425fda95086
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_mdev342-master.opt
@@ -0,0 +1 @@
+--skip-stack-trace --skip-core-file
diff --git a/mysql-test/suite/binlog/t/binlog_mdev342.test b/mysql-test/suite/binlog/t/binlog_mdev342.test
new file mode 100644
index 00000000000..02310b87a76
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_mdev342.test
@@ -0,0 +1,66 @@
+--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;
+
+# One connection does an insert that causes a binlog rotate.
+# The rotate is paused after writing new file but before updating index.
+connect(con1,localhost,root,,);
+SET DEBUG_SYNC= "binlog_open_before_update_index SIGNAL con1_ready WAIT_FOR con1_cont";
+SET SESSION debug_dbug="+d,crash_create_critical_before_update_index";
+send INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
+
+# Another connection creates a prepared transaction.
+# After the transaction is prepared, it will hang waiting for LOCK_log.
+connect(con2,localhost,root,,);
+SET DEBUG_SYNC= "ha_commit_trans_after_prepare SIGNAL con2_ready";
+send INSERT INTO t1 VALUES (2, NULL);
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
+
+# Now crash the server in con1, with old binlog closed, new binlog not yet in
+# index, and one transaction in prepared-but-not-committed state.
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait-binlog_mdev342.test
+EOF
+# If con1 manages to race ahead and crash, we can see the crash already in the
+# SET DEBUG_SYNC statement, so need --error here also.
+--error 0,2006,2013
+SET DEBUG_SYNC= "now SIGNAL con1_cont";
+connection con1;
+--error 2006,2013
+reap;
+
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart-binlog_mdev342.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;
+
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000001
+--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/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/type_bit_iuds.result b/mysql-test/suite/engines/iuds/r/type_bit_iuds.result
index 763b3003b9d..e01c7d78680 100644
--- a/mysql-test/suite/engines/iuds/r/type_bit_iuds.result
+++ b/mysql-test/suite/engines/iuds/r/type_bit_iuds.result
@@ -49,7 +49,7 @@ SELECT CONCAT(BIN(c1),BIN(c2),BIN(c3)) FROM t2;
CONCAT(BIN(c1),BIN(c2),BIN(c3))
000
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0));
@@ -854,7 +854,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
000
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1));
@@ -1704,7 +1704,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111
111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2));
@@ -2619,7 +2619,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111
111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4));
@@ -3692,7 +3692,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111
111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8));
@@ -5211,7 +5211,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16));
@@ -7252,7 +7252,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32));
@@ -10392,7 +10392,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64));
@@ -11224,7 +11224,7 @@ SELECT CONCAT(BIN(c1),BIN(c2),BIN(c3)) FROM t2;
CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0));
@@ -12029,7 +12029,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1));
@@ -12879,7 +12879,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111
111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2));
@@ -13794,7 +13794,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111
111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4));
@@ -14867,7 +14867,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111
111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8));
@@ -16386,7 +16386,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16));
@@ -18427,7 +18427,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32));
@@ -21567,7 +21567,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64));
@@ -22405,7 +22405,7 @@ SELECT CONCAT(BIN(c1),BIN(c2),BIN(c3)) FROM t2;
CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0));
@@ -23216,7 +23216,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1));
@@ -24066,7 +24066,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111
111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2));
@@ -24981,7 +24981,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111
111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4));
@@ -26054,7 +26054,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111
111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8));
@@ -27573,7 +27573,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16));
@@ -29614,7 +29614,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32));
@@ -32754,7 +32754,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64));
@@ -33592,7 +33592,7 @@ SELECT CONCAT(BIN(c1),BIN(c2),BIN(c3)) FROM t2;
CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0));
@@ -34403,7 +34403,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1));
@@ -35259,7 +35259,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111
111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2));
@@ -36174,7 +36174,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111
111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4));
@@ -37247,7 +37247,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111
111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8));
@@ -38766,7 +38766,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16));
@@ -40807,7 +40807,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32));
@@ -43947,7 +43947,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64));
@@ -44785,7 +44785,7 @@ SELECT CONCAT(BIN(c1),BIN(c2),BIN(c3)) FROM t2;
CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0));
@@ -45596,7 +45596,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1));
@@ -46452,7 +46452,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111
111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2));
@@ -47373,7 +47373,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111
111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4));
@@ -48452,7 +48452,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111
111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8));
@@ -49971,7 +49971,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16));
@@ -52012,7 +52012,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32));
@@ -55152,7 +55152,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64));
@@ -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');
@@ -55992,7 +55992,7 @@ SELECT CONCAT(BIN(c1),BIN(c2),BIN(c3)) FROM t2;
CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0));
@@ -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;
@@ -56805,7 +56805,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -57663,7 +57663,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111
111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -58586,7 +58586,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111
111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -59667,7 +59667,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111
111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -61194,7 +61194,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -63237,7 +63237,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -66379,7 +66379,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(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');
@@ -67216,7 +67216,7 @@ SELECT CONCAT(BIN(c1),BIN(c2),BIN(c3)) FROM t2;
CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0));
@@ -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;
@@ -68026,7 +68026,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -68881,7 +68881,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111
111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -69801,7 +69801,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111
111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -70879,7 +70879,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111
111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -72403,7 +72403,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -74449,7 +74449,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -77588,7 +77588,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(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');
@@ -78425,7 +78425,7 @@ SELECT CONCAT(BIN(c1),BIN(c2),BIN(c3)) FROM t2;
CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0));
@@ -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;
@@ -79235,7 +79235,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111
111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -80090,7 +80090,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111
111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -81010,7 +81010,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111
111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -82088,7 +82088,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111
111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -83612,7 +83612,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -85658,7 +85658,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(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;
@@ -88803,7 +88803,7 @@ CONCAT(BIN(c1),BIN(c2),BIN(c3))
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
CREATE TABLE t3 (c1 BIT(65));
-ERROR 42000: Display width out of range for column 'c1' (max = 64)
+ERROR 42000: Display width out of range for 'c1' (max = 64)
CREATE TABLE t4(i INT, b BIT NOT NULL);
ALTER TABLE t4 ADD PRIMARY KEY (i);
CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(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/innodb/r/innodb_bug12902967.result b/mysql-test/suite/innodb/r/innodb_bug12902967.result
new file mode 100644
index 00000000000..da1d94d69f5
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug12902967.result
@@ -0,0 +1,6 @@
+create table t1 (f1 integer primary key) engine innodb;
+alter table t1 add constraint c1 foreign key (f1) references t1(f1);
+ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
+InnoDB: has or is referenced in foreign key constraints
+InnoDB: which are not compatible with the new table definition.
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug14007649.result b/mysql-test/suite/innodb/r/innodb_bug14007649.result
new file mode 100644
index 00000000000..50de5868be4
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug14007649.result
@@ -0,0 +1,56 @@
+create table t1 (
+rowid int,
+f1 int,
+f2 int,
+key i1 (f1, f2),
+key i2 (f2)) engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `rowid` int(11) DEFAULT NULL,
+ `f1` int(11) DEFAULT NULL,
+ `f2` int(11) DEFAULT NULL,
+ KEY `i1` (`f1`,`f2`),
+ KEY `i2` (`f2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
+start transaction with consistent snapshot;
+start transaction;
+update t1 set f2 = 4 where f1 = 1 and f2 is null;
+(b) Number of rows updated:
+select row_count();
+row_count()
+1
+insert into t1 values (3, 1, null);
+(b) After update and insert query.
+select rowid, f1, f2 from t1;
+rowid f1 f2
+1 1 10
+2 1 4
+3 1 NULL
+commit;
+(a) Before the update statement is executed.
+select rowid, f1, f2 from t1;
+rowid f1 f2
+1 1 10
+2 1 NULL
+SET SESSION debug_dbug="+d,bug14007649";
+update t1 set f2 = 6 where f1 = 1 and f2 is null;
+(a) Number of rows updated:
+select row_count();
+row_count()
+1
+(a) After the update statement is executed.
+select rowid, f1, f2 from t1;
+rowid f1 f2
+1 1 10
+2 1 NULL
+3 1 6
+commit;
+"The trx with consistent snapshot ended."
+select rowid, f1, f2 from t1;
+rowid f1 f2
+1 1 10
+2 1 4
+3 1 6
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/innodb-blob.test b/mysql-test/suite/innodb/t/innodb-blob.test
index c81d4a8acf1..0c3e4366c94 100644
--- a/mysql-test/suite/innodb/t/innodb-blob.test
+++ b/mysql-test/suite/innodb/t/innodb-blob.test
@@ -4,11 +4,6 @@
--source include/have_innodb.inc
-if (`select plugin_auth_version <= "1.1.8-24.1" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB 1.1.8-24.1 or earlier
-}
-
# DEBUG_SYNC must be compiled in.
--source include/have_debug_sync.inc
diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test
index 46a2e210c6a..cea9055b873 100644
--- a/mysql-test/suite/innodb/t/innodb-index.test
+++ b/mysql-test/suite/innodb/t/innodb-index.test
@@ -1,10 +1,5 @@
-- source include/have_innodb.inc
-if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB 1.0.17-13.0 or earlier
-}
-
let $MYSQLD_DATADIR= `select @@datadir`;
let $per_table=`select @@innodb_file_per_table`;
diff --git a/mysql-test/suite/innodb/t/innodb-lock.test b/mysql-test/suite/innodb/t/innodb-lock.test
index 97ae56f933b..e3026ac505b 100644
--- a/mysql-test/suite/innodb/t/innodb-lock.test
+++ b/mysql-test/suite/innodb/t/innodb-lock.test
@@ -1,10 +1,5 @@
--source include/have_innodb.inc
-if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB 1.0.17-13.0 or earlier
-}
-
#
# Check and select innodb lock type
#
diff --git a/mysql-test/suite/innodb/t/innodb_bug12902967.test b/mysql-test/suite/innodb/t/innodb_bug12902967.test
new file mode 100644
index 00000000000..1183c4ceff6
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug12902967.test
@@ -0,0 +1,30 @@
+# Bug 12902967: Creating self referencing fk on same index unhandled,
+# confusing error
+#
+# Creating a self referencing foreign key on the same
+# column/index is an unhandled exception, it should throw a sensible
+# error but instead implies that your data dictionary may now be out
+# of sync:
+
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+
+let error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err;
+--source include/restart_mysqld.inc
+
+create table t1 (f1 integer primary key) engine innodb;
+
+# The below statement should produce error message in error log.
+# This error message should mention problem with foreign keys
+# rather than with data dictionary.
+--replace_regex /'\.\/test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_ERROR_ON_RENAME
+alter table t1 add constraint c1 foreign key (f1) references t1(f1);
+--source include/restart_mysqld.inc
+perl;
+$file = $ENV{error_log};
+open (FILE, '<', $file) or die "can't open(< $file): $!\n";
+print ((grep { /^InnoDB:/ and not /aio/i } <FILE>)[-2..-1]);
+EOF
+
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/innodb_bug13635833.test b/mysql-test/suite/innodb/t/innodb_bug13635833.test
index 4bab6d09f89..47185b9d526 100644
--- a/mysql-test/suite/innodb/t/innodb_bug13635833.test
+++ b/mysql-test/suite/innodb/t/innodb_bug13635833.test
@@ -2,11 +2,6 @@
--source include/have_debug_sync.inc
--source include/not_embedded.inc
-if (`select plugin_auth_version <= "1.1.8-24.1" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB 1.1.8-24.1 or earlier
-}
-
SET DEBUG_SYNC='reset';
# Save the initial number of concurrent sessions
diff --git a/mysql-test/suite/innodb/t/innodb_bug14007649.test b/mysql-test/suite/innodb/t/innodb_bug14007649.test
new file mode 100644
index 00000000000..5f613cad6f1
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug14007649.test
@@ -0,0 +1,63 @@
+--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'`)
+{
+ --skip Not fixed in XtraDB 1.1.8-26.0 or earlier
+}
+
+create table t1 (
+ rowid int,
+ f1 int,
+ f2 int,
+ key i1 (f1, f2),
+ key i2 (f2)) engine=innodb;
+
+show create table t1;
+insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+
+connection a;
+start transaction with consistent snapshot;
+
+connection b;
+start transaction;
+update t1 set f2 = 4 where f1 = 1 and f2 is null;
+
+-- echo (b) Number of rows updated:
+select row_count();
+
+insert into t1 values (3, 1, null);
+
+-- echo (b) After update and insert query.
+select rowid, f1, f2 from t1;
+
+commit;
+
+connection a;
+
+-- echo (a) Before the update statement is executed.
+select rowid, f1, f2 from t1;
+
+SET SESSION debug_dbug="+d,bug14007649";
+update t1 set f2 = 6 where f1 = 1 and f2 is null;
+
+-- echo (a) Number of rows updated:
+select row_count();
+
+-- echo (a) After the update statement is executed.
+select rowid, f1, f2 from t1;
+
+commit;
+
+--echo "The trx with consistent snapshot ended."
+
+select rowid, f1, f2 from t1;
+
+connection default;
+disconnect a;
+disconnect b;
+
+drop table t1;
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/percona/disabled.def b/mysql-test/suite/percona/disabled.def
index eb9df7f4118..cd3fd72cc54 100644
--- a/mysql-test/suite/percona/disabled.def
+++ b/mysql-test/suite/percona/disabled.def
@@ -1,3 +1,5 @@
+percona_sync_flush: removed from XtraDB-26.0
+
percona_suppress_log_warning_1592: Feature not merged into MariaDB
percona_log_slow_slave_statements: Feature not merged into MariaDB
percona_log_slow_slave_statements-and-use_global_long_query_time: Feature not merged into MariaDB
diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result b/mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result
new file mode 100644
index 00000000000..198ecfb6724
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result
@@ -0,0 +1,41 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
+create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam;
+create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb;
+ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
+create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb;
+set @@binlog_format=statement;
+*** autoincrement field is not the first in PK warning must be there: ***
+insert into tm set b=null, a=1;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
+show warnings;
+Level Code Message
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
+*** no warning when autoincrement is the first in PK
+insert into ti set b=null, a=1;
+show warnings;
+Level Code Message
+create function multi_part_pk_with_autoinc (arg int)
+returns int
+begin
+insert into tm set b=null, a=arg;
+return arg;
+end//
+select multi_part_pk_with_autoinc (3);
+multi_part_pk_with_autoinc (3)
+3
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
+*** autoincrement field is not the first in PK warning must be there: ***
+show warnings;
+Level Code Message
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
+set @@binlog_format=mixed;
+insert into tm set b=null, a=2;
+drop table tm, ti;
+drop function multi_part_pk_with_autoinc;
+include/rpl_end.inc
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 c88dcee9dbc..fcd03ea74b8 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,4 +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.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 TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
+INSERT INTO test.t_slave VALUES(NULL, ROUND(RAND() * 1000), @c);
+SET INSERT_ID=2;
+SET @c=2;
+SET @@rand_seed1=10000000, @@rand_seed2=1000000;
+INSERT INTO t5 VALUES (NULL, ROUND(RAND() * 1000), @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;
+drop table test.t5;
+drop table test.t1;
+drop table test.t_slave;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_mdev359.result b/mysql-test/suite/rpl/r/rpl_mdev359.result
new file mode 100644
index 00000000000..f4382f672e4
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mdev359.result
@@ -0,0 +1,13 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master';
+SET GLOBAL rpl_semi_sync_master_enabled = ON;
+SET DEBUG_SYNC = "rpl_semisync_master_commit_trx_before_lock SIGNAL m1_ready WAIT_FOR m1_cont";
+INSERT INTO t1 SELECT * FROM t1;
+SET DEBUG_SYNC= "now WAIT_FOR m1_ready";
+SET GLOBAL rpl_semi_sync_master_enabled = OFF;
+SET DEBUG_SYNC= "now SIGNAL m1_cont";
+DROP TABLE t1;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result b/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result
new file mode 100644
index 00000000000..b69deb17c4c
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result
@@ -0,0 +1,13 @@
+include/master-slave.inc
+[connection master]
+[connection slave]
+SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
+SHOW BINLOG EVENTS;
+[connection slave1]
+SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
+FLUSH LOGS;
+SET DEBUG_SYNC= 'now SIGNAL end';
+SET DEBUG_SYNC= 'RESET';
+[connection slave]
+SET DEBUG_SYNC= 'RESET';
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_report_port.result b/mysql-test/suite/rpl/r/rpl_report_port.result
index d9887f41ff9..6a9ac341780 100644
--- a/mysql-test/suite/rpl/r/rpl_report_port.result
+++ b/mysql-test/suite/rpl/r/rpl_report_port.result
@@ -3,8 +3,8 @@ include/master-slave.inc
include/rpl_restart_server.inc [server_number=2 parameters: --report-port=9000]
include/start_slave.inc
[Slave restarted with the report-port set to some value]
-include/assert.inc [The value shown for the slave's port number is 9000 which is the value set for report-port.]
-include/rpl_restart_server.inc [server_number=2 parameters: --report-port=]
+include/assert.inc [The value shown for the slave's port number is user specified port number which is the value set for report-port.]
+include/rpl_restart_server.inc [server_number=2]
include/start_slave.inc
[Slave restarted with the report-port set to the value of slave's port number]
include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.]
diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test b/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test
new file mode 100644
index 00000000000..6996e1c73c7
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test
@@ -0,0 +1,62 @@
+# Test of auto-increment.
+#
+# BUG#11754117-45670
+# Multipart primary key with the autoincrement part not first in it
+# is replication unsafe.
+#
+
+source include/master-slave.inc;
+source include/have_binlog_format_mixed.inc;
+source include/have_innodb.inc;
+
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
+
+--connection master
+create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam;
+--error ER_WRONG_AUTO_KEY
+create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb;
+create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb;
+
+set @@binlog_format=statement;
+--echo *** autoincrement field is not the first in PK warning must be there: ***
+insert into tm set b=null, a=1;
+show warnings;
+--echo *** no warning when autoincrement is the first in PK
+insert into ti set b=null, a=1;
+show warnings;
+
+delimiter //;
+create function multi_part_pk_with_autoinc (arg int)
+returns int
+begin
+ insert into tm set b=null, a=arg;
+ return arg;
+end//
+delimiter ;//
+
+select multi_part_pk_with_autoinc (3);
+--echo *** autoincrement field is not the first in PK warning must be there: ***
+show warnings;
+
+set @@binlog_format=mixed;
+insert into tm set b=null, a=2;
+
+sync_slave_with_master;
+
+if (`select count(*) <> 3 from tm`)
+{
+ --echo Wrong result from SELECT on the slave side.
+ select * from tm;
+ --die
+}
+
+# cleanup
+
+--connection master
+
+drop table tm, ti;
+drop function multi_part_pk_with_autoinc;
+
+sync_slave_with_master;
+
+--source include/rpl_end.inc
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 13c66f9f64b..b62a6e96437 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
@@ -206,4 +206,64 @@ SELECT * FROM t3;
connection master;
echo [on master];
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+
+--sync_slave_with_master
+
+#
+# BUG#11754117 - 45670: INTVAR_EVENTS FOR FILTERED-OUT QUERY_LOG_EVENTS ARE EXECUTED
+# Int-, Rand- and User- var events accompaning a filtered out Query-log-event should
+# be filtered as well.
+#
+connection master;
+CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b INT, 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);
+CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
+ INSERT INTO test.t_slave VALUES(NULL, ROUND(RAND() * 1000), @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
+SELECT b into @b FROM test.t5;
+--let $b_master=`select @b`
+UPDATE test.t1 SET a=2; # to run trigger on slave
+
+--sync_slave_with_master
+
+# The proof:
+SELECT a AS 'ONE' into @a FROM test.t_slave;
+SELECT c AS 'NULL' into @c FROM test.t_slave;
+
+let $count= 1;
+let $table= test.t_slave;
+source include/wait_until_rows_count.inc;
+
+if (`SELECT @a != 2 and @c != NULL`)
+{
+ SELECT * FROM test.t_slave;
+ --die Intvar or user var from replication events unexpetedly escaped out to screw a following query applying context.
+}
+
+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.
+}
+
+# cleanup BUG#11754117
+connection master;
+drop table test.t5;
+drop table test.t1;
+
+--sync_slave_with_master
+drop table test.t_slave;
+
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mdev359.test b/mysql-test/suite/rpl/t/rpl_mdev359.test
new file mode 100644
index 00000000000..ef4e41f5291
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mdev359.test
@@ -0,0 +1,36 @@
+--source include/have_semisync_plugin.inc
+--source include/not_embedded.inc
+--source include/have_debug_sync.inc
+--source include/have_binlog_format_mixed_or_statement.inc
+--source include/master-slave.inc
+
+# MDEV-359: There was a server crash when the code first checks if semisync
+# is enabled without lock, then if so takes the lock and tests again.
+# If semisync was disabled in-between the first and the second test, an
+# assert was incorrectly made that referenced a NULL pointer.
+#
+# This tests uses debug_sync to pause one thread at the critical point in
+# the code, disable the semisync, and then continue the paused thread.
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master';
+SET GLOBAL rpl_semi_sync_master_enabled = ON;
+--connection master1
+SET DEBUG_SYNC = "rpl_semisync_master_commit_trx_before_lock SIGNAL m1_ready WAIT_FOR m1_cont";
+--send
+INSERT INTO t1 SELECT * FROM t1;
+--connection master
+SET DEBUG_SYNC= "now WAIT_FOR m1_ready";
+SET GLOBAL rpl_semi_sync_master_enabled = OFF;
+SET DEBUG_SYNC= "now SIGNAL m1_cont";
+--connection master1
+--reap
+
+connection master;
+DROP TABLE t1;
+
+disable_warnings;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+enable_warnings;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test
new file mode 100644
index 00000000000..16d986268c9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test
@@ -0,0 +1,35 @@
+# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER
+#
+# The function mysql_show_binlog_events has a local stack variable
+# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however
+# this variable goes out of scope and is destroyed before clean
+# thd->current_linfo.
+#
+# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure
+# that with the fix local variable linfo is valid along all
+# mysql_show_binlog_events function scope.
+#
+--source include/have_debug_sync.inc
+--source include/master-slave.inc
+
+--echo [connection slave]
+--connection slave
+SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
+--send SHOW BINLOG EVENTS
+
+--connection slave1
+--echo [connection slave1]
+SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
+FLUSH LOGS;
+SET DEBUG_SYNC= 'now SIGNAL end';
+SET DEBUG_SYNC= 'RESET';
+
+--echo [connection slave]
+--connection slave
+--disable_result_log
+--reap
+--enable_result_log
+SET DEBUG_SYNC= 'RESET';
+
+--connection master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_report_port.test b/mysql-test/suite/rpl/t/rpl_report_port.test
index 379f9aed946..12c34ce01b1 100644
--- a/mysql-test/suite/rpl/t/rpl_report_port.test
+++ b/mysql-test/suite/rpl/t/rpl_report_port.test
@@ -38,21 +38,23 @@ connection master;
# 9000 is the value of the port we should get.
--let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1)
---let assert_text= The value shown for the slave's port number is 9000 which is the value set for report-port.
+--let assert_text= The value shown for the slave's port number is user specified port number which is the value set for report-port.
--let assert_cond= $report_port = "9000"
--source include/assert.inc
-
# Start the server with the report-port being passed with no value. So on SHOW SLAVE HOSTS
# on the master the value of slave's port should be the actual value of the slave port.
+connection master;
--let $rpl_server_number= 2
---let $rpl_server_parameters= --report-port=
+--let $rpl_server_parameters=
--source include/rpl_restart_server.inc
connection slave;
--source include/start_slave.inc
+connection master;
+sync_slave_with_master;
--echo [Slave restarted with the report-port set to the value of slave's port number]
connection master;
diff --git a/mysql-test/suite/sphinx/sphinx.result b/mysql-test/suite/sphinx/sphinx.result
index 50f1f513e31..a671028bbe2 100644
--- a/mysql-test/suite/sphinx/sphinx.result
+++ b/mysql-test/suite/sphinx/sphinx.result
@@ -46,14 +46,17 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE ts ref q q 257 const 3 Using where with pushed condition
SET optimizer_switch=@save_optimizer_switch;
drop table ts;
-show status like "sphinx_%";
+show status like "sphinx_error%";
Variable_name Value
sphinx_error_commits 0
sphinx_error_group_commits 0
sphinx_error_snapshot_file
sphinx_error_snapshot_position 0
-sphinx_time 0
+show status like "sphinx_total%";
+Variable_name Value
sphinx_total 2
sphinx_total_found 2
+show status like "sphinx_word%";
+Variable_name Value
sphinx_word_count 0
sphinx_words
diff --git a/mysql-test/suite/sphinx/sphinx.test b/mysql-test/suite/sphinx/sphinx.test
index bc5daec8fe5..648eec07f63 100644
--- a/mysql-test/suite/sphinx/sphinx.test
+++ b/mysql-test/suite/sphinx/sphinx.test
@@ -26,4 +26,6 @@ explain select * from ts where q=';groupby=attr:gid';
SET optimizer_switch=@save_optimizer_switch;
drop table ts;
-show status like "sphinx_%";
+show status like "sphinx_error%";
+show status like "sphinx_total%";
+show status like "sphinx_word%";
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/disabled.def b/mysql-test/suite/sys_vars/disabled.def
index 319a6d970aa..1ae495e4863 100644
--- a/mysql-test/suite/sys_vars/disabled.def
+++ b/mysql-test/suite/sys_vars/disabled.def
@@ -11,4 +11,5 @@
##############################################################################
innodb_trx_rseg_n_slots_debug_basic: variable innodb_trx_rseg_n_slots_debug is removed in MariaDB
+innodb_flush_checkpoint_debug_basic: removed from XtraDB-26.0
diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result
index 1bd4e394f6a..692545ae0fb 100644
--- a/mysql-test/suite/sys_vars/r/all_vars.result
+++ b/mysql-test/suite/sys_vars/r/all_vars.result
@@ -10,5 +10,6 @@ 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/t/innodb_trx_rseg_n_slots_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test
index 11c6dd7820b..d17917de8e9 100644
--- a/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test
@@ -1,11 +1,6 @@
--source include/have_innodb.inc
--source include/have_debug.inc
-if (`select plugin_auth_version <= "1.1.8-24.1" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not supported by XtraDB 1.1.8-24.1 or earlier
-}
-
SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug;
SELECT @start_global_value;
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index c27b36089c6..17b38b7d7af 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -146,6 +146,42 @@ table_schema table_name column_name column_type extra
test t2 a int(11)
test t2 b int(11) VIRTUAL
DROP TABLE t1,t2;
+create table t1 (
+a int not null, b char(2) not null,
+c enum('Y','N') as (case when b = 'aa' then 'Y' else 'N' end) persistent
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` char(2) NOT NULL,
+ `c` enum('Y','N') AS (case when b = 'aa' then 'Y' else 'N' end) PERSISTENT
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1(a,b) values (1,'bb'), (2,'aa'), (3,'cc');
+select * from t1;
+a b c
+1 bb N
+2 aa Y
+3 cc N
+create table t2 (
+a int, b int,
+c set("y","n")
+as (if(a=0,if(b=0,('n,n'),('n,y')),if(b=0,('y,n'),('y,y')))) persistent
+);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` set('y','n') AS (if(a=0,if(b=0,('n,n'),('n,y')),if(b=0,('y,n'),('y,y')))) PERSISTENT
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t2(a,b) values (7,0), (2,3), (0,1);
+select * from t2;
+a b c
+7 0 y,n
+2 3 y
+0 1 y,n
+drop table t1,t2;
create table t1 (a int, b int);
insert into t1 values (3, 30), (4, 20), (1, 20);
create table t2 (c int, d int, v int as (d+1), index idx(c));
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
index 6f576f61513..01404046cde 100644
--- a/mysql-test/suite/vcol/t/vcol_misc.test
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -156,6 +156,29 @@ SELECT table_schema, table_name, column_name, column_type, extra
DROP TABLE t1,t2;
#
+# Bug mdev-354: virtual columns of ENUM and SET types
+#
+
+create table t1 (
+ a int not null, b char(2) not null,
+ c enum('Y','N') as (case when b = 'aa' then 'Y' else 'N' end) persistent
+);
+show create table t1;
+insert into t1(a,b) values (1,'bb'), (2,'aa'), (3,'cc');
+select * from t1;
+
+create table t2 (
+ a int, b int,
+ c set("y","n")
+ as (if(a=0,if(b=0,('n,n'),('n,y')),if(b=0,('y,n'),('y,y')))) persistent
+);
+show create table t2;
+insert into t2(a,b) values (7,0), (2,3), (0,1);
+select * from t2;
+
+drop table t1,t2;
+
+#
# SELECT that uses a virtual column and executed with BKA
#
diff --git a/mysql-test/t/bug12427262.test b/mysql-test/t/bug12427262.test
new file mode 100644
index 00000000000..aca37a651c4
--- /dev/null
+++ b/mysql-test/t/bug12427262.test
@@ -0,0 +1,51 @@
+--echo #
+--echo # Bug#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE.
+--echo #
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+--disable_warnings
+create database show_table_lw_db;
+use show_table_lw_db;
+create table t1 (c1 int);
+create table t2 (c1 int);
+create table t3 (c1 int);
+create table t4 (c1 int);
+create table t5 (c1 int);
+create table t6 (c1 int);
+create table t7 (c1 int);
+create table t8 (c1 int);
+create table t9 (c1 int);
+create table t10 (c1 int);
+--enable_warnings
+
+# Query PS to know initial read count for frm file.
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
+like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
+into @count_read_before;
+
+show tables;
+
+# Query PS to know read count for frm file after above query. It should
+# not be changed as FRM file will not be opened for above query.
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
+like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
+into @count_read_after;
+
+select @count_read_after-@count_read_before;
+
+show full tables;
+
+# Query PS to know read count for frm file after above query. COUNT_READ
+# will be incremented by 1 as FRM file will be opened for above query.
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
+like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
+into @count_read_after;
+
+select @count_read_after-@count_read_before;
+
+--disable_warnings
+drop table t1;
+drop database show_table_lw_db;
+--enable_warnings
diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test
index ccf7aff6e6e..bfe91f1f587 100644
--- a/mysql-test/t/func_group_innodb.test
+++ b/mysql-test/t/func_group_innodb.test
@@ -144,5 +144,33 @@ SELECT BIT_XOR(t1.b) FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
DROP TABLE t1, t2;
+--echo #
+--echo # Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
+--echo # COUNT(*) LIMIT.
+--echo #
+
+CREATE TABLE t1 (
+id BIGINT(20) ,
+member_id_to INT(11) ,
+r_date DATE ,
+PRIMARY KEY (id,r_date),
+KEY r_date_idx (r_date),
+KEY t1_idx01 (member_id_to)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(107924526,518491,'2011-05-01'),
+(107924527,518491,'2011-05-01'),
+(107924534,518491,'2011-06-21'),
+(107924535,518491,'2011-06-21'),
+(107924542,1601319,'2011-06-21'),
+(107924543,1601319,'2011-06-21'),
+(107924544,1601319,'2011-06-21'),
+(107924545,1601319,'2011-06-21');
+
+SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
+ '2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
+
+DROP TABLE t1;
--echo End of 5.5 tests
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 97bd628e2f9..1e695142d90 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -577,3 +577,32 @@ DROP TABLE t1;
--echo #
--echo End of 5.1 tests
+#
+# lp:817966 int_column IN (string_constant)
+#
+# rather illogically, when BIGINT field is compared to a string,
+# the string is converted to an integer, not to a double.
+# When some other integer field (not BIGINT) is compared to a string,
+# or when the BIGINT is not a field, but an expression, both
+# operands are compared as doubles. The latter behavior is correct,
+# according to the manual.
+#
+create table t1 (a bigint, b int);
+insert t1 values (1,1),(2,2),(3,3);
+select * from t1 where a in ('2.1');
+select * from t1 where b in ('2.1');
+select * from t1 where a='2.1';
+select * from t1 where b='2.1';
+select * from t1 where IF(1,a,a)='2.1';
+drop table t1;
+--echo #
+--echo # LP bug#992380 Crash when creating PS for a query with
+--echo # subquery in WHERE (see also mysql bug#13012483)
+--echo #
+CREATE TABLE t1 (a INT);
+PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
+EXECUTE s;
+
+DROP TABLE t1;
+
+--echo # End of 5.3 tests
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index f697e0b477a..6a99b975e81 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -160,3 +160,23 @@ SELECT LEAST(1.1,1.2,NULL,1.0) FROM DUAL;
SELECT GREATEST(1.5E+2,1.3E+2,NULL) FROM DUAL;
# End of 4.1 tests
+
+#
+# test of replacing NOT <field>
+#
+create table t1 (a int);
+insert into t1 values (1), (100), (0), (NULL);
+
+select not a from t1;
+explain extended select not a from t1;
+
+select * from t1 where not a;
+explain extended select * from t1 where not a;
+
+select not (a+0) from t1;
+explain extended select not (a+0) from t1;
+
+select * from t1 where not (a+0);
+explain extended select * from t1 where not (a+0);
+
+drop table t1;
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/mdev316.test b/mysql-test/t/mdev316.test
new file mode 100644
index 00000000000..5843b06a60e
--- /dev/null
+++ b/mysql-test/t/mdev316.test
@@ -0,0 +1,14 @@
+#
+# MDEV-316 lp:1009085 Assertion failed: warn_item, file item_cmpfunc.cc, line 3613
+#
+set names swe7;
+select '' in ('',convert(0,time));
+select case '' when '' then 1 when convert(0,time) then 2 end;
+
+#
+# Excessive optimization of Item_func_conv_charset:
+#
+select convert(0x0030 using ucs2) div 1, concat(convert(0x0030 using ucs2)) div 1;
+select cast(convert(0x0030 using ucs2) as double), cast(concat(convert(0x0030 using ucs2)) as double);
+select cast(convert(0x0030 using ucs2) as decimal(5.2)), cast(concat(convert(0x0030 using ucs2)) as decimal(5.2));
+select cast(convert(_ucs2 0x0030 using latin1) as date), cast(concat(convert(_ucs2 0x0030 using latin1)) as date);
diff --git a/mysql-test/t/mdev375.test b/mysql-test/t/mdev375.test
new file mode 100644
index 00000000000..547d57aa587
--- /dev/null
+++ b/mysql-test/t/mdev375.test
@@ -0,0 +1,20 @@
+#
+# MDEV-375 Server crashes in THD::print_aborted_warning with log_warnings > 3
+#
+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/mysqldump.test b/mysql-test/t/mysqldump.test
index 920dbe76d1b..eaa2e7a8840 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -2413,3 +2413,30 @@ RESET MASTER;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
+
+--echo #
+--echo # Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM
+--echo #
+SET @old_log_output_state= @@global.log_output;
+SET @old_general_log_state= @@global.general_log;
+SET @old_slow_query_log_state= @@global.slow_query_log;
+
+call mtr.add_suppression("Failed to write to mysql.general_log");
+--exec $MYSQL_DUMP -uroot --all-databases > $MYSQLTEST_VARDIR/tmp/bug45740.sql
+# Make log_output as table and disabling general_log and slow_log
+SET @@global.log_output="TABLE";
+SET @@global.general_log='OFF';
+SET @@global.slow_query_log='OFF';
+DROP DATABASE mysql;
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug45740.sql
+SHOW CREATE TABLE mysql.general_log;
+SHOW CREATE TABLE mysql.slow_log;
+--remove_file $MYSQLTEST_VARDIR/tmp/bug45740.sql
+
+SET @@global.log_output= @old_log_output_state;
+SET @@global.slow_query_log= @old_slow_query_log_state;
+SET @@global.general_log= @old_general_log_state;
+
+--echo #
+--echo # End of 5.1 tests
+--echo #
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/mysqltest_256.test b/mysql-test/t/mysqltest_256.test
new file mode 100644
index 00000000000..fd9447cd2d8
--- /dev/null
+++ b/mysql-test/t/mysqltest_256.test
@@ -0,0 +1,17 @@
+#
+# MDEV-256 lp:995501 - mysqltest attempts to parse Perl code inside a block
+# with false condition, gets confused and throws wrong errors
+#
+
+let $run = 0;
+if ($run)
+{
+ --perl
+ foreach (1)
+ {
+ print "In perl\n";
+ }
+ EOF
+ SELECT 1;
+}
+--echo # Done
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index d6d49c59255..08c028c8224 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -2463,3 +2463,16 @@ INSERT INTO t1 VALUES (6,8,10);
SELECT 1 FROM t1 JOIN t1 AS t2 USING (a);
drop table t1;
+
+--echo #
+--echo # LP BUG#1001117 Crash on a simple select that uses a temptable view
+--echo # MySQL Bug #12330344 Crash and/or valgrind errors in free_io_cache with join, view,
+--echo # partitioned table
+--echo #
+
+CREATE TABLE t1(a INT PRIMARY KEY) PARTITION BY LINEAR KEY (a);
+CREATE ALGORITHM=TEMPTABLE VIEW vtmp AS
+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;
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 eed45597855..d955b46469c 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -279,11 +279,11 @@ deallocate prepare Stmt1;
# also check that statement names are in right charset.
set names utf8;
-prepare `ü` from 'select 1234';
-execute `ü` ;
+prepare `ü` from 'select 1234';
+execute `ü` ;
set names latin1;
-execute `ü`;
-deallocate prepare `ü`;
+execute `ü`;
+deallocate prepare `ü`;
set names default;
@@ -3124,6 +3124,71 @@ DROP TABLE t1;
--echo
--echo End of 5.1 tests.
+--echo #
+--echo # LP bug#1001500 Crash on the second execution of the PS for
+--echo # a query with degenerated conjunctive condition
+--echo # (see also mysql bug#12582849)
+--echo #
+
+CREATE TABLE t1 (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_nokey INTEGER,
+ col_int_key INTEGER,
+
+ col_varchar_key VARCHAR(1),
+ col_varchar_nokey VARCHAR(1),
+
+ PRIMARY KEY (pk),
+ KEY (col_int_key),
+ KEY (col_varchar_key, col_int_key)
+);
+
+INSERT INTO t1 (
+ col_int_key, col_int_nokey,
+ col_varchar_key, col_varchar_nokey
+) VALUES
+(4, 2, 'v', 'v'),
+(62, 150, 'v', 'v');
+
+CREATE TABLE t2 (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_nokey INTEGER,
+ col_int_key INTEGER,
+
+ col_varchar_key VARCHAR(1),
+ col_varchar_nokey VARCHAR(1),
+
+ PRIMARY KEY (pk),
+ KEY (col_int_key),
+ KEY (col_varchar_key, col_int_key)
+);
+
+INSERT INTO t2 (
+ col_int_key, col_int_nokey,
+ col_varchar_key, col_varchar_nokey
+) VALUES
+(8, NULL, 'x', 'x'),
+(7, 8, 'd', 'd');
+
+PREPARE stmt FROM '
+SELECT
+ ( SELECT MAX( SQ1_alias2 .col_int_nokey ) AS SQ1_field1
+ FROM ( t2 AS SQ1_alias1 RIGHT JOIN t1 AS SQ1_alias2
+ ON ( SQ1_alias2.col_varchar_key = SQ1_alias1.col_varchar_nokey )
+ )
+ WHERE SQ1_alias2.pk < alias1.col_int_nokey OR alias1.pk
+ ) AS field1
+FROM ( t1 AS alias1 JOIN t2 AS alias2 ON alias2.pk )
+GROUP BY field1
+';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+DROP TABLE t1, t2;
+
###########################################################################
--echo
@@ -3596,3 +3661,5 @@ GROUP BY c1, c2;
EXECUTE s1;
DEALLOCATE PREPARE s1;
+
+--echo # End of 5.3 tests
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 3a85ca3a3a9..618d6eb3ed4 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -4461,3 +4461,4 @@ SELECT * FROM t1, t2 WHERE a=3 AND a=b;
drop table t1,t2;
--echo End of 5.3 tests
+
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 5d92fea0bf1..08421040109 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9145,3 +9145,44 @@ CALL p1(2);
CALL p1(1);
DROP PROCEDURE p1;
+
+--echo #
+--echo # LP bug#1002157 : testing stored function
+--echo # bug#62125 result for null incorrectly yields 1292 warning.
+--echo #
+
+--disable_warnings
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+DROP FUNCTION IF EXISTS f3;
+DROP FUNCTION IF EXISTS f4;
+--enable_warnings
+
+delimiter /;
+
+CREATE FUNCTION f1() RETURNS VARCHAR(1)
+BEGIN RETURN 'X'; END;/
+
+CREATE FUNCTION f2() RETURNS CHAR(1)
+BEGIN RETURN 'X'; END;/
+
+CREATE FUNCTION f3() RETURNS VARCHAR(1)
+BEGIN RETURN NULL; END;/
+
+CREATE FUNCTION f4() RETURNS CHAR(1)
+BEGIN RETURN NULL; END;/
+
+delimiter ;/
+
+SELECT f1() IS NULL;
+SELECT f2() IS NULL;
+SELECT f3() IS NULL;
+SELECT f4() IS NULL;
+
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP FUNCTION f3;
+DROP FUNCTION f4;
+
+--echo # End of 5.5 test
+
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index b02b1d4a4a0..786e328aa72 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -304,6 +304,7 @@ SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT *
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
+-- error ER_SUBQUERY_NO_1_ROW
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
-- error ER_SUBQUERY_NO_1_ROW
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
@@ -5556,5 +5557,169 @@ SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELE
drop table t1,t2;
+--echo #
+--echo # LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
+--echo # WHERE and UNION in HAVING
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
+
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
+
+drop table t1;
+
+--echo #
+--echo # LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+--echo # precomputed and thus not part of optimization
+--echo #
+
+CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
+INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
+('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
+
+EXPLAIN
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
+
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
+
+EXPLAIN
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+
+drop table t1;
+
+--echo #
+--echo # MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
+--echo # with semijoin+materialization, IN and = subqueries
+--echo #
+
+CREATE TABLE t1 (a1 INT);
+INSERT INTO t1 VALUES (4),(6);
+CREATE TABLE t2 (b1 INT);
+INSERT INTO t2 VALUES (1),(7);
+
+EXPLAIN
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+
+drop table t1, t2;
+
+--echo #
+--echo # MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
+--echo # inner joins takes hundreds times longer
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (4),(5);
+
+CREATE TABLE t3 (c INT);
+INSERT INTO t3 VALUES (8),(3);
+
+set @@expensive_subquery_limit= 0;
+
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+
+flush status;
+
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+
+show status like "subquery_cache%";
+show status like '%Handler_read%';
+
+set @@expensive_subquery_limit= default;
+
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+
+flush status;
+
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+
+show status like "subquery_cache%";
+show status like '%Handler_read%';
+
+drop table t1, t2, t3;
+
+--echo #
+--echo # MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0),(8);
+
+CREATE TABLE t2 (b INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+
+EXPLAIN
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
+
+drop table t1,t2;
+
+
+--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 # return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index e6ff625d3fe..b53967e35e5 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -977,6 +977,14 @@ SELECT * FROM t1 WHERE
FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4
GROUP BY SQ1_t1.f4));
+--error ER_SUBQUERY_NO_1_ROW
+SELECT * FROM t1 WHERE
+(SELECT f2 FROM t2
+ WHERE f4 <= ALL
+ (SELECT max(SQ1_t1.f4)
+ FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4
+ GROUP BY SQ1_t1.f4));
+
drop table t1, t2, t3;
--echo #
@@ -1663,6 +1671,40 @@ explain select * from t1 where 33 in (select b from five) or c > 11;
drop table ten, t1, five;
+--echo #
+--echo # LP BUG#1008773 Wrong result (NULL instead of a value) with no matching rows, subquery in FROM and HAVING
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1);
+
+EXPLAIN
+SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1;
+SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1;
+
+EXPLAIN
+SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1;
+SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1;
+
+EXPLAIN
+SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
+SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
+
+
+EXPLAIN
+SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1;
+SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1;
+
+EXPLAIN
+SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1;
+SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1;
+
+EXPLAIN
+SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
+SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
+
+drop table t1, t2;
set optimizer_switch=@subselect4_tmp;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 9c03f93028c..94860ceec2d 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1237,3 +1237,23 @@ SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIM
SELECT(SELECT 1 AS a ORDER BY a) AS dev;
SELECT(SELECT 1 AS a LIMIT 1) AS dev;
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
+
+--echo #
+--echo # LP bug#1010729: Unexpected syntax error from UNION
+--echo # (bug #54382) with single-table join nest
+--echo #
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+CREATE TABLE t3 (c int);
+SELECT a FROM t1 UNION SELECT b FROM t2 JOIN (t3) ON ( t2.b = t3.c );
+
+DROP TABLE t1, t2, t3;
+
+CREATE TABLE t1 (pk int NOT NULL);
+CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL);
+SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk)
+UNION
+SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk);
+
+DROP TABLE t1,t2;
+
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index fa23d118634..f509a1ad0f2 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -363,6 +363,17 @@ SELECT (@v:=a) <> (@v:=1) FROM t1;
DROP TABLE t1;
+#
+# LP BUG#1001506 Crash on a query with GROUP BY and user variables
+# MySQL Bug #11764372 57197: EVEN MORE USER VARIABLE CRASHING FUN
+#
+
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2);
+SELECT DISTINCT @a:=MIN(t1.a) FROM t1, t1 AS t2
+GROUP BY @b:=(SELECT COUNT(*) > t2.a);
+DROP TABLE t1;
+
--echo End of 5.1 tests
#
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 0585073a6f5..17026e45724 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4613,6 +4613,19 @@ 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 #
+
+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;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------
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/mf_keycache.c b/mysys/mf_keycache.c
index e4488318ffd..30f269454c2 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -5821,31 +5821,31 @@ static KEY_CACHE_FUNCS partitioned_key_cache_funcs =
******************************************************************************/
+static
+int repartition_key_cache_internal(KEY_CACHE *keycache,
+ uint key_cache_block_size, size_t use_mem,
+ uint division_limit, uint age_threshold,
+ uint partitions, my_bool use_op_lock);
/*
- Initialize a key cache
+ Initialize a key cache : internal
SYNOPSIS
- init_key_cache()
+ init_key_cache_internal()
keycache pointer to the key cache to be initialized
key_cache_block_size size of blocks to keep cached data
use_mem total memory to use for cache buffers/structures
division_limit division limit (may be zero)
age_threshold age threshold (may be zero)
partitions number of partitions in the key cache
+ use_op_lock if TRUE use keycache->op_lock, otherwise - ignore it
DESCRIPTION
- The function creates a control block structure for a key cache and
- places the pointer to this block in the structure keycache.
- If the value of the parameter 'partitions' is 0 then a simple key cache
- is created. Otherwise a partitioned key cache with the specified number
- of partitions is created.
- The parameter key_cache_block_size specifies the size of the blocks in
- the key cache to be created. The parameters division_limit and
- age_threshold determine the initial values of those characteristics of
- the key cache that are used for midpoint insertion strategy. The parameter
- use_mem specifies the total amount of memory to be allocated for the
- key cache buffers and for all auxiliary structures.
+ The function performs the actions required from init_key_cache().
+ It has an additional parameter: use_op_lock. When the parameter
+ is TRUE than the function initializes keycache->op_lock if needed,
+ then locks it, and unlocks it before the return. Otherwise the actions
+ with the lock are omitted.
RETURN VALUE
total number of blocks in key cache partitions, if successful,
@@ -5854,19 +5854,22 @@ static KEY_CACHE_FUNCS partitioned_key_cache_funcs =
NOTES
if keycache->key_cache_inited != 0 we assume that the memory
for the control block of the key cache has been already allocated.
-
- It's assumed that no two threads call this function simultaneously
- referring to the same key cache handle.
*/
-int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
- size_t use_mem, uint division_limit,
- uint age_threshold, uint partitions)
+static
+int init_key_cache_internal(KEY_CACHE *keycache, uint key_cache_block_size,
+ size_t use_mem, uint division_limit,
+ uint age_threshold, uint partitions,
+ my_bool use_op_lock)
{
void *keycache_cb;
int blocks;
if (keycache->key_cache_inited)
+ {
+ if (use_op_lock)
+ pthread_mutex_lock(&keycache->op_lock);
keycache_cb= keycache->keycache_cb;
+ }
else
{
if (partitions == 0)
@@ -5887,8 +5890,17 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
keycache->key_cache_type= PARTITIONED_KEY_CACHE;
keycache->interface_funcs= &partitioned_key_cache_funcs;
}
+ /*
+ Initialize op_lock if it's not initialized before.
+ The mutex may have been initialized before if we are being called
+ from repartition_key_cache_internal().
+ */
+ if (use_op_lock)
+ pthread_mutex_init(&keycache->op_lock, MY_MUTEX_INIT_FAST);
keycache->keycache_cb= keycache_cb;
keycache->key_cache_inited= 1;
+ if (use_op_lock)
+ pthread_mutex_lock(&keycache->op_lock);
}
if (partitions != 0)
@@ -5909,11 +5921,58 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
((SIMPLE_KEY_CACHE_CB *) keycache_cb)->key_cache_mem_size;
if (blocks > 0)
keycache->can_be_used= 1;
+ if (use_op_lock)
+ pthread_mutex_unlock(&keycache->op_lock);
return blocks;
}
/*
+ Initialize a key cache
+
+ SYNOPSIS
+ init_key_cache()
+ keycache pointer to the key cache to be initialized
+ key_cache_block_size size of blocks to keep cached data
+ use_mem total memory to use for cache buffers/structures
+ division_limit division limit (may be zero)
+ age_threshold age threshold (may be zero)
+ partitions number of partitions in the key cache
+
+ DESCRIPTION
+ The function creates a control block structure for a key cache and
+ places the pointer to this block in the structure keycache.
+ If the value of the parameter 'partitions' is 0 then a simple key cache
+ is created. Otherwise a partitioned key cache with the specified number
+ of partitions is created.
+ The parameter key_cache_block_size specifies the size of the blocks in
+ the key cache to be created. The parameters division_limit and
+ age_threshold determine the initial values of those characteristics of
+ the key cache that are used for midpoint insertion strategy. The parameter
+ use_mem specifies the total amount of memory to be allocated for the
+ key cache buffers and for all auxiliary structures.
+ The function calls init_key_cache_internal() to perform all these actions
+ with the last parameter set to TRUE.
+
+ RETURN VALUE
+ total number of blocks in key cache partitions, if successful,
+ <= 0 - otherwise.
+
+ NOTES
+ It's assumed that no two threads call this function simultaneously
+ referring to the same key cache handle.
+*/
+
+int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
+ size_t use_mem, uint division_limit,
+ uint age_threshold, uint partitions)
+{
+ return init_key_cache_internal(keycache, key_cache_block_size, use_mem,
+ division_limit, age_threshold, partitions, 1);
+}
+
+
+/*
Resize a key cache
SYNOPSIS
@@ -5953,11 +6012,13 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
int blocks= -1;
if (keycache->key_cache_inited)
{
+ pthread_mutex_lock(&keycache->op_lock);
if ((uint) keycache->param_partitions != keycache->partitions && use_mem)
- blocks= repartition_key_cache(keycache,
- key_cache_block_size, use_mem,
- division_limit, age_threshold,
- (uint) keycache->param_partitions);
+ blocks= repartition_key_cache_internal(keycache,
+ key_cache_block_size, use_mem,
+ division_limit, age_threshold,
+ (uint) keycache->param_partitions,
+ 0);
else
{
blocks= keycache->interface_funcs->resize(keycache->keycache_cb,
@@ -5976,6 +6037,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
((SIMPLE_KEY_CACHE_CB *)(keycache->keycache_cb))->key_cache_mem_size;
keycache->can_be_used= (blocks >= 0);
+ pthread_mutex_unlock(&keycache->op_lock);
}
return blocks;
}
@@ -6009,33 +6071,37 @@ void change_key_cache_param(KEY_CACHE *keycache, uint division_limit,
{
if (keycache->key_cache_inited)
{
-
+ pthread_mutex_lock(&keycache->op_lock);
keycache->interface_funcs->change_param(keycache->keycache_cb,
division_limit,
- age_threshold);
+ age_threshold);
+ pthread_mutex_unlock(&keycache->op_lock);
}
}
/*
- Destroy a key cache
+ Destroy a key cache : internal
SYNOPSIS
- end_key_cache()
+ end_key_cache_internal()
keycache pointer to the key cache to be destroyed
cleanup <=> complete free
+ use_op_lock if TRUE use keycache->op_lock, otherwise - ignore it
DESCRIPTION
- The function frees the memory allocated for the cache blocks and
- auxiliary structures used by the key cache keycache. If the value
- of the parameter cleanup is TRUE then all resources used by the key
- cache are to be freed.
+ The function performs the actions required from end_key_cache().
+ It has an additional parameter: use_op_lock. When the parameter
+ is TRUE than the function destroys keycache->op_lock if cleanup is true.
+ Otherwise the action with the lock is omitted.
RETURN VALUE
none
*/
-void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
+static
+void end_key_cache_internal(KEY_CACHE *keycache, my_bool cleanup,
+ my_bool use_op_lock)
{
if (keycache->key_cache_inited)
{
@@ -6047,6 +6113,12 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
my_free(keycache->keycache_cb);
keycache->keycache_cb= 0;
}
+ /*
+ We do not destroy op_lock if we are going to reuse the same key cache.
+ This happens if we are called from repartition_key_cache_internal().
+ */
+ if (use_op_lock)
+ pthread_mutex_destroy(&keycache->op_lock);
keycache->key_cache_inited= 0;
}
keycache->can_be_used= 0;
@@ -6055,6 +6127,32 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
/*
+ Destroy a key cache
+
+ SYNOPSIS
+ end_key_cache()
+ keycache pointer to the key cache to be destroyed
+ cleanup <=> complete free
+
+ DESCRIPTION
+ The function frees the memory allocated for the cache blocks and
+ auxiliary structures used by the key cache keycache. If the value
+ of the parameter cleanup is TRUE then all resources used by the key
+ cache are to be freed.
+ The function calls end_key_cache_internal() to perform all these actions
+ with the last parameter set to TRUE.
+
+ RETURN VALUE
+ none
+*/
+
+void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
+{
+ end_key_cache_internal(keycache, cleanup, 1);
+}
+
+
+/*
Read a block of data from a key cache into a buffer
SYNOPSIS
@@ -6098,7 +6196,7 @@ uchar *key_cache_read(KEY_CACHE *keycache,
uchar *buff, uint length,
uint block_length, int return_buffer)
{
- if (keycache->key_cache_inited && keycache->can_be_used)
+ if (keycache->can_be_used)
return keycache->interface_funcs->read(keycache->keycache_cb,
file, filepos, level,
buff, length,
@@ -6150,7 +6248,7 @@ int key_cache_insert(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
uchar *buff, uint length)
{
- if (keycache->key_cache_inited && keycache->can_be_used)
+ if (keycache->can_be_used)
return keycache->interface_funcs->insert(keycache->keycache_cb,
file, filepos, level,
buff, length);
@@ -6205,7 +6303,7 @@ int key_cache_write(KEY_CACHE *keycache,
uchar *buff, uint length,
uint block_length, int force_write)
{
- if (keycache->key_cache_inited && keycache->can_be_used)
+ if (keycache->can_be_used)
return keycache->interface_funcs->write(keycache->keycache_cb,
file, file_extra,
filepos, level,
@@ -6257,7 +6355,7 @@ int flush_key_blocks(KEY_CACHE *keycache,
int file, void *file_extra,
enum flush_type type)
{
- if (keycache->key_cache_inited)
+ if (keycache->can_be_used)
return keycache->interface_funcs->flush(keycache->keycache_cb,
file, file_extra, type);
return 0;
@@ -6289,13 +6387,15 @@ int reset_key_cache_counters(const char *name __attribute__((unused)),
KEY_CACHE *keycache,
void *unused __attribute__((unused)))
{
+ int rc= 0;
if (keycache->key_cache_inited)
{
-
- return keycache->interface_funcs->reset_counters(name,
- keycache->keycache_cb);
+ pthread_mutex_lock(&keycache->op_lock);
+ rc= keycache->interface_funcs->reset_counters(name,
+ keycache->keycache_cb);
+ pthread_mutex_unlock(&keycache->op_lock);
}
- return 0;
+ return rc;
}
@@ -6325,11 +6425,63 @@ void get_key_cache_statistics(KEY_CACHE *keycache, uint partition_no,
{
if (keycache->key_cache_inited)
{
+ pthread_mutex_lock(&keycache->op_lock);
keycache->interface_funcs->get_stats(keycache->keycache_cb,
partition_no, key_cache_stats);
+ pthread_mutex_unlock(&keycache->op_lock);
}
}
+
+/*
+ Repartition a key cache : internal
+
+ SYNOPSIS
+ repartition_key_cache_internal()
+ keycache pointer to the key cache to be repartitioned
+ key_cache_block_size size of blocks to keep cached data
+ use_mem total memory to use for the new key cache
+ division_limit new division limit (if not zero)
+ age_threshold new age threshold (if not zero)
+ partitions new number of partitions in the key cache
+ use_op_lock if TRUE use keycache->op_lock, otherwise - ignore it
+
+ DESCRIPTION
+ The function performs the actions required from repartition_key_cache().
+ It has an additional parameter: use_op_lock. When the parameter
+ is TRUE then the function locks keycache->op_lock at start and
+ unlocks it before the return. Otherwise the actions with the lock
+ are omitted.
+
+ RETURN VALUE
+ number of blocks in the key cache, if successful,
+ 0 - otherwise.
+*/
+
+static
+int repartition_key_cache_internal(KEY_CACHE *keycache,
+ uint key_cache_block_size, size_t use_mem,
+ uint division_limit, uint age_threshold,
+ uint partitions, my_bool use_op_lock)
+{
+ uint blocks= -1;
+ if (keycache->key_cache_inited)
+ {
+ if (use_op_lock)
+ pthread_mutex_lock(&keycache->op_lock);
+ keycache->interface_funcs->resize(keycache->keycache_cb,
+ key_cache_block_size, 0,
+ division_limit, age_threshold);
+ end_key_cache_internal(keycache, 1, 0);
+ blocks= init_key_cache_internal(keycache, key_cache_block_size, use_mem,
+ division_limit, age_threshold, partitions,
+ 0);
+ if (use_op_lock)
+ pthread_mutex_unlock(&keycache->op_lock);
+ }
+ return blocks;
+}
+
/*
Repartition a key cache
@@ -6353,16 +6505,14 @@ void get_key_cache_statistics(KEY_CACHE *keycache, uint partition_no,
that are used for midpoint insertion strategy. The parameter use_mem
specifies the total amount of memory to be allocated for the new key
cache buffers and for all auxiliary structures.
+ The function calls repartition_key_cache_internal() to perform all these
+ actions with the last parameter set to TRUE.
RETURN VALUE
number of blocks in the key cache, if successful,
0 - otherwise.
NOTES
- The function does not block the calls and executions of other functions
- from the key cache interface. However it assumes that the calls of
- resize_key_cache itself are serialized.
-
Currently the function is called when the value of the variable
key_cache_partitions is being reset for the key cache keycache.
*/
@@ -6371,16 +6521,8 @@ int repartition_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
size_t use_mem, uint division_limit,
uint age_threshold, uint partitions)
{
- uint blocks= -1;
- if (keycache->key_cache_inited)
- {
- keycache->interface_funcs->resize(keycache->keycache_cb,
- key_cache_block_size, 0,
- division_limit, age_threshold);
- end_key_cache(keycache, 1);
- blocks= init_key_cache(keycache, key_cache_block_size, use_mem,
- division_limit, age_threshold, partitions);
- }
- return blocks;
+ return repartition_key_cache_internal(keycache, key_cache_block_size, use_mem,
+ division_limit, age_threshold,
+ partitions, 1);
}
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_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/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/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc
index 9e857f83d39..8573c4dcbde 100644
--- a/plugin/semisync/semisync_master.cc
+++ b/plugin/semisync/semisync_master.cc
@@ -608,6 +608,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
set_timespec(start_ts, 0);
+ DEBUG_SYNC(current_thd, "rpl_semisync_master_commit_trx_before_lock");
/* Acquire the mutex. */
lock();
@@ -738,15 +739,16 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
}
}
- l_end:
/*
At this point, the binlog file and position of this transaction
must have been removed from ActiveTranx.
*/
assert(thd_killed(NULL) ||
+ !getMasterEnabled() ||
!active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name,
trx_wait_binlog_pos));
+ l_end:
/* Update the status counter. */
if (is_on())
rpl_semi_sync_master_yes_transactions++;
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 1dd6b787c43..0ed94d0ffa3 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -484,7 +484,8 @@ then
echo "databases and anonymous user created by default. This is"
echo "strongly recommended for production servers."
echo
- echo "See the MariaDB knowledge or the MySQL manual for more instructions."
+ echo "See the MariaDB Knowledgebase at http://kb.askmonty.org or the"
+ echo "MySQL manual for more instructions."
if test "$in_rpm" -eq 0
then
@@ -499,13 +500,13 @@ then
echo
echo "Please report any problems with the $scriptdir/mysqlbug script!"
echo
- echo "The latest information about MariaDB is available at http://www.askmonty.org/."
+ echo "The latest information about MariaDB is available at http://mariadb.org/."
echo "You can find additional information about the MySQL part at:"
echo "http://dev.mysql.com"
echo "Support MariaDB development by buying support/new features from"
- echo "Monty Program Ab. You can contact us about this at sales@askmonty.org".
+ echo "Monty Program Ab. You can contact us about this at sales@montyprogram.com".
echo "Alternatively consider joining our community based development effort:"
- echo "http://askmonty.org/wiki/index.php/MariaDB#How_can_I_participate_in_the_development_of_MariaDB"
+ echo "http://kb.askmonty.org/en/contributing-to-the-mariadb-project/"
echo
fi
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 6affd5c0ecf..df75bb49c89 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -1041,6 +1041,27 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type)
/*
+ Helper function for datetime formatting.
+ Format number as string, left-padded with 0.
+
+ The reason to use own formatting rather than sprintf() is performance - in a
+ datetime benchmark it helped to reduced the datetime formatting overhead
+ from ~30% down to ~4%.
+*/
+
+static char* fmt_number(uint val, char *out, uint digits)
+{
+ uint i;
+ for(i= 0; i < digits; i++)
+ {
+ out[digits-i-1]= '0' + val%10;
+ val/=10;
+ }
+ return out + digits;
+}
+
+
+/*
Functions to convert time/date/datetime value to a string,
using default format.
This functions don't check that given MYSQL_TIME structure members are
@@ -1053,42 +1074,84 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type)
int my_time_to_str(const MYSQL_TIME *l_time, char *to, uint digits)
{
- ulong day= (l_time->year || l_time->month) ? 0 : l_time->day;
+ uint day= (l_time->year || l_time->month) ? 0 : l_time->day;
+ uint hour= day * 24 + l_time->hour;
+ char*pos= to;
if (digits == AUTO_SEC_PART_DIGITS)
digits= l_time->second_part ? TIME_SECOND_PART_DIGITS : 0;
DBUG_ASSERT(digits <= TIME_SECOND_PART_DIGITS);
- return sprintf(to,
- digits ? "%s%02lu:%02u:%02u.%0*lu"
- : "%s%02lu:%02u:%02u",
- (l_time->neg ? "-" : ""),
- day * 24L + l_time->hour, l_time->minute, l_time->second,
- digits, (ulong)sec_part_shift(l_time->second_part, digits));
+ if(l_time->neg)
+ *pos++= '-';
+
+ if(hour > 99)
+ /* Need more than 2 digits for hours in string representation. */
+ pos= longlong10_to_str((longlong)hour, pos, 10);
+ else
+ pos= fmt_number(hour, pos, 2);
+
+ *pos++= ':';
+ pos= fmt_number(l_time->minute, pos, 2);
+ *pos++= ':';
+ pos= fmt_number(l_time->second, pos, 2);
+
+ if (digits)
+ {
+ *pos++= '.';
+ pos= fmt_number((uint)sec_part_shift(l_time->second_part, digits),
+ pos, digits);
+ }
+
+ *pos= 0;
+ return (int) (pos-to);
}
+
int my_date_to_str(const MYSQL_TIME *l_time, char *to)
{
- return sprintf(to, "%04u-%02u-%02u",
- l_time->year,
- l_time->month,
- l_time->day);
+ char *pos=to;
+ pos= fmt_number(l_time->year, pos, 4);
+ *pos++='-';
+ pos= fmt_number(l_time->month, pos, 2);
+ *pos++='-';
+ pos= fmt_number(l_time->day, pos, 2);
+ *pos= 0;
+ return (int)(pos - to);
}
+
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to, uint digits)
{
+ char *pos= to;
+
if (digits == AUTO_SEC_PART_DIGITS)
digits= l_time->second_part ? TIME_SECOND_PART_DIGITS : 0;
DBUG_ASSERT(digits <= TIME_SECOND_PART_DIGITS);
- return sprintf(to,
- digits ? "%04u-%02u-%02u %02u:%02u:%02u.%0*lu"
- : "%04u-%02u-%02u %02u:%02u:%02u",
- l_time->year, l_time->month, l_time->day,
- l_time->hour, l_time->minute, l_time->second,
- digits, (ulong)sec_part_shift(l_time->second_part, digits));
+ pos= fmt_number(l_time->year, pos, 4);
+ *pos++='-';
+ pos= fmt_number(l_time->month, pos, 2);
+ *pos++='-';
+ pos= fmt_number(l_time->day, pos, 2);
+ *pos++=' ';
+ pos= fmt_number(l_time->hour, pos, 2);
+ *pos++= ':';
+ pos= fmt_number(l_time->minute, pos, 2);
+ *pos++= ':';
+ pos= fmt_number(l_time->second, pos, 2);
+
+ if (digits)
+ {
+ *pos++='.';
+ pos= fmt_number((uint) sec_part_shift(l_time->second_part, digits), pos,
+ digits);
+ }
+
+ *pos= 0;
+ return (int)(pos - to);
}
diff --git a/sql/field.cc b/sql/field.cc
index 6e1851d89d1..2084c661602 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1,6 +1,6 @@
/*
- 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, 2011, 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
diff --git a/sql/field.h b/sql/field.h
index c86c0975117..f22bab0409d 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1,7 +1,7 @@
#ifndef FIELD_INCLUDED
#define FIELD_INCLUDED
-/* 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, 2011, 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
@@ -63,6 +63,9 @@ enum Derivation
#define my_charset_numeric my_charset_latin1
#define MY_REPERTOIRE_NUMERIC MY_REPERTOIRE_ASCII
+/* The length of the header part for each virtual column in the .frm file */
+#define FRM_VCOL_HEADER_SIZE(b) (3 + test(b))
+
struct ha_field_option_struct;
struct st_cache_field;
@@ -2244,6 +2247,10 @@ public:
{
return (flags & (BINCMP_FLAG | BINARY_FLAG)) != 0;
}
+ uint virtual_col_expr_maxlen()
+ {
+ return 255 - FRM_VCOL_HEADER_SIZE(interval != NULL);
+ }
private:
const String empty_set_string;
};
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 20da18a129c..6685b334d06 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -1,5 +1,7 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2000, 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
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index b4181fc6d7f..78adbeff623 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
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index aa9179f9f69..0f922394ec5 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -544,22 +544,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 8b3573eb23e..cb220783e33 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -507,10 +507,6 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
"Assigning value %d.", plugin->plugin->name, idx);
hton->db_type= (enum legacy_db_type) idx;
}
- installed_htons[hton->db_type]= hton;
- tmp= hton->savepoint_offset;
- hton->savepoint_offset= savepoint_alloc_size;
- savepoint_alloc_size+= tmp;
/*
In case a plugin is uninstalled and re-installed later, it should
@@ -1301,6 +1297,7 @@ int ha_commit_trans(THD *thd, bool all)
need_prepare_ordered|= (ht->prepare_ordered != NULL);
need_commit_ordered|= (ht->commit_ordered != NULL);
}
+ DEBUG_SYNC(thd, "ha_commit_trans_after_prepare");
DBUG_EXECUTE_IF("crash_commit_after_prepare", DBUG_SUICIDE(););
#ifdef WITH_WSREP
diff --git a/sql/handler.h b/sql/handler.h
index a2277f8df90..47593845ad6 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1694,6 +1694,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
@@ -2527,6 +2529,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
diff --git a/sql/item.cc b/sql/item.cc
index 3af415fe5c2..3031e90c9b2 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1265,7 +1265,7 @@ err:
bool Item::get_seconds(ulonglong *sec, ulong *sec_part)
{
- if (result_type() == INT_RESULT)
+ if (decimals == 0)
{ // optimize for an important special case
longlong val= val_int();
bool neg= val < 0 && !unsigned_flag;
diff --git a/sql/item.h b/sql/item.h
index a9c1153d236..f7f3edda384 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1395,21 +1395,21 @@ public:
{
return cmp_context == IMPOSSIBLE_RESULT || item->cmp_context == cmp_context;
}
- /*
+ /**
Test whether an expression is expensive to compute. Used during
optimization to avoid computing expensive expressions during this
phase. Also used to force temp tables when sorting on expensive
functions.
- TODO:
+ @todo
Normally we should have a method:
cost Item::execution_cost(),
where 'cost' is either 'double' or some structure of various cost
parameters.
- NOTE
- This function is now used to prevent evaluation of materialized IN
- subquery predicates before it is allowed. grep for
- DontEvaluateMaterializedSubqueryTooEarly to see the uses.
+ @note
+ This function is now used to prevent evaluation of expensive subquery
+ predicates during the optimization phase. It also prevents evaluation
+ of predicates that are not computable at this moment.
*/
virtual bool is_expensive()
{
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 5f1a863d8fd..2a0ca19a4e9 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1504,6 +1504,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref)
}
if (args[1]->maybe_null)
maybe_null=1;
+ with_subselect= 1;
with_sum_func= with_sum_func || args[1]->with_sum_func;
with_field= with_field || args[1]->with_field;
used_tables_cache|= args[1]->used_tables();
@@ -3032,6 +3033,11 @@ void Item_func_case::fix_length_and_dec()
nagg++;
if (!(found_types= collect_cmp_types(agg, nagg)))
return;
+
+ Item *date_arg= 0;
+ if (found_types & (1 << TIME_RESULT))
+ date_arg= find_date_time_item(args, arg_count, 0);
+
if (found_types & (1 << STRING_RESULT))
{
/*
@@ -3071,16 +3077,12 @@ void Item_func_case::fix_length_and_dec()
change_item_tree_if_needed(thd, &args[nagg * 2], agg[nagg + 1]);
}
- Item *date_arg= 0;
for (i= 0; i <= (uint)TIME_RESULT; i++)
{
if (found_types & (1 << i) && !cmp_items[i])
{
DBUG_ASSERT((Item_result)i != ROW_RESULT);
- if ((Item_result)i == TIME_RESULT)
- date_arg= find_date_time_item(args, arg_count, 0);
-
if (!(cmp_items[i]=
cmp_item::get_comparator((Item_result)i, date_arg,
cmp_collation.collation)))
@@ -4051,15 +4053,15 @@ void Item_func_in::fix_length_and_dec()
}
else
{
+ if (found_types & (1 << TIME_RESULT))
+ date_arg= find_date_time_item(args, arg_count, 0);
+ if (found_types & (1 << STRING_RESULT) &&
+ agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
+ return;
for (i= 0; i <= (uint) TIME_RESULT; i++)
{
if (found_types & (1 << i) && !cmp_items[i])
{
- if ((Item_result)i == STRING_RESULT &&
- agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
- return;
- if ((Item_result)i == TIME_RESULT)
- date_arg= find_date_time_item(args, arg_count, 0);
if (!cmp_items[i] && !(cmp_items[i]=
cmp_item::get_comparator((Item_result)i, date_arg,
cmp_collation.collation)))
@@ -4255,6 +4257,22 @@ Item_cond::fix_fields(THD *thd, Item **ref)
if (abort_on_null)
item->top_level_item();
+ /*
+ replace degraded condition:
+ was: <field>
+ become: <field> = 1
+ */
+ if (item->type() == FIELD_ITEM)
+ {
+ Query_arena backup, *arena;
+ Item *new_item;
+ arena= thd->activate_stmt_arena_if_needed(&backup);
+ if ((new_item= new Item_func_ne(item, new Item_int(0, 1))))
+ li.replace(item= new_item);
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
+ }
+
// item can be substituted in fix_fields
if ((!item->fixed &&
item->fix_fields(thd, li.ref())) ||
@@ -4939,6 +4957,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref)
return TRUE; /* purecov: inspected */
with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func;
with_field= args[0]->with_field || args[1]->with_field;
+ with_subselect|= args[0]->with_subselect | args[1]->with_subselect;
max_length= 1;
decimals= 0;
@@ -5308,6 +5327,28 @@ Item *Item_func_not::neg_transformer(THD *thd) /* NOT(x) -> x */
}
+bool Item_func_not::fix_fields(THD *thd, Item **ref)
+{
+ if (args[0]->type() == FIELD_ITEM)
+ {
+ /* replace "NOT <field>" with "<filed> == 0" */
+ Query_arena backup, *arena;
+ Item *new_item;
+ bool rc= TRUE;
+ arena= thd->activate_stmt_arena_if_needed(&backup);
+ if ((new_item= new Item_func_eq(args[0], new Item_int(0, 1))))
+ {
+ new_item->name= name;
+ rc= (*ref= new_item)->fix_fields(thd, ref);
+ }
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
+ return rc;
+ }
+ return Item_func::fix_fields(thd, ref);
+}
+
+
Item *Item_bool_rowready_func2::neg_transformer(THD *thd)
{
Item *item= negated_item();
@@ -5540,7 +5581,15 @@ void Item_equal::add_const(Item *c, Item *f)
else
{
Item_func_eq *func= new Item_func_eq(c, const_item);
- func->set_cmp_func();
+ if (func->set_cmp_func())
+ {
+ /*
+ Setting a comparison function fails when trying to compare
+ incompatible charsets. Charset compatibility is checked earlier,
+ except for constant subqueries where we may do it here.
+ */
+ return;
+ }
func->quick_fix_field();
cond_false= !func->val_int();
}
@@ -5730,6 +5779,7 @@ bool Item_equal::fix_fields(THD *thd, Item **ref)
used_tables_cache|= item->used_tables();
tmp_table_map= item->not_null_tables();
not_null_tables_cache|= tmp_table_map;
+ DBUG_ASSERT(!item->with_sum_func && !item->with_subselect);
if (item->maybe_null)
maybe_null= 1;
if (!item->get_item_equal())
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index de62bc49930..34d1a0bd0ae 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -371,9 +371,9 @@ public:
Item_bool_func2(Item *a,Item *b)
:Item_int_func(a,b), cmp(tmp_arg, tmp_arg+1), abort_on_null(FALSE) {}
void fix_length_and_dec();
- void set_cmp_func()
+ int set_cmp_func()
{
- cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, TRUE);
+ return cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, TRUE);
}
optimize_type select_optimize() const { return OPTIMIZE_OP; }
virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; }
@@ -442,6 +442,7 @@ public:
enum Functype functype() const { return NOT_FUNC; }
const char *func_name() const { return "not"; }
Item *neg_transformer(THD *thd);
+ bool fix_fields(THD *, Item **);
virtual void print(String *str, enum_query_type query_type);
};
@@ -508,6 +509,8 @@ public:
longlong val_int();
enum Functype functype() const { return NOT_ALL_FUNC; }
const char *func_name() const { return "<not>"; }
+ bool fix_fields(THD *thd, Item **ref)
+ {return Item_func::fix_fields(thd, ref);}
virtual void print(String *str, enum_query_type query_type);
void set_sum_test(Item_sum_hybrid *item) { test_sum_item= item; };
void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; };
diff --git a/sql/item_func.cc b/sql/item_func.cc
index b9bab372500..4691ee10e49 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3350,6 +3350,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
func->maybe_null=1;
func->with_sum_func= func->with_sum_func || item->with_sum_func;
func->with_field= func->with_field || item->with_field;
+ func->with_subselect|= item->with_subselect;
used_tables_cache|=item->used_tables();
const_item_cache&=item->const_item();
f_args.arg_type[i]=item->result_type();
diff --git a/sql/item_func.h b/sql/item_func.h
index f91107c5445..cb9c1929d7d 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1941,6 +1941,11 @@ public:
return str;
}
+ void update_null_value()
+ {
+ execute();
+ }
+
virtual bool change_context_processor(uchar *cntx)
{ context= (Name_resolution_context *)cntx; return FALSE; }
@@ -1955,6 +1960,7 @@ public:
{
return sp_result_field;
}
+
bool check_vcol_func_processor(uchar *int_arg)
{
return trace_unsupported_by_check_vcol_func_processor(func_name());
diff --git a/sql/item_row.cc b/sql/item_row.cc
index 530a40c55dc..2c4a628075e 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -95,6 +95,7 @@ bool Item_row::fix_fields(THD *thd, Item **ref)
maybe_null|= item->maybe_null;
with_sum_func= with_sum_func || item->with_sum_func;
with_field= with_field || item->with_field;
+ with_subselect|= item->with_subselect;
}
fixed= 1;
return FALSE;
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index ad854b02765..9ed2627a518 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -829,7 +829,7 @@ public:
{
DBUG_ASSERT(args[0]->fixed);
conv_charset= cs;
- if (cache_if_const && args[0]->const_item() && !args[0]->with_subselect)
+ if (cache_if_const && args[0]->const_item() && !args[0]->is_expensive())
{
uint errors= 0;
String tmp, *str= args[0]->val_str(&tmp);
@@ -854,6 +854,30 @@ public:
}
}
String *val_str(String *);
+ longlong val_int()
+ {
+ if (args[0]->result_type() == STRING_RESULT)
+ return Item_str_func::val_int();
+ return args[0]->val_int();
+ }
+ double val_real()
+ {
+ if (args[0]->result_type() == STRING_RESULT)
+ return Item_str_func::val_real();
+ return args[0]->val_real();
+ }
+ my_decimal *val_decimal(my_decimal *d)
+ {
+ if (args[0]->result_type() == STRING_RESULT)
+ return Item_str_func::val_decimal(d);
+ return args[0]->val_decimal(d);
+ }
+ bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+ {
+ if (args[0]->result_type() == STRING_RESULT)
+ return Item_str_func::get_date(ltime, fuzzydate);
+ return args[0]->get_date(ltime, fuzzydate);
+ }
void fix_length_and_dec();
const char *func_name() const { return "convert"; }
virtual void print(String *str, enum_query_type query_type);
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 5458a2fb968..49d232d31be 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2002, 2011, Oracle and/or its affiliates.
- Copyright (c) 2010, 2011, Monty Program Ab
+/* Copyright (c) 2002, 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
@@ -287,7 +287,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)
@@ -523,6 +523,48 @@ void Item_subselect::recalc_used_tables(st_select_lex *new_parent,
*/
}
+
+/**
+ Determine if a subquery is expensive to execute during query optimization.
+
+ @details The cost of execution of a subquery is estimated based on an
+ estimate of the number of rows the subquery will access during execution.
+ This measure is used instead of JOIN::read_time, because it is considered
+ to be much more reliable than the cost estimate.
+
+ @return true if the subquery is expensive
+ @return false otherwise
+*/
+bool Item_subselect::is_expensive()
+{
+ double examined_rows= 0;
+
+ for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select())
+ {
+ JOIN *cur_join= sl->join;
+ if (!cur_join)
+ continue;
+
+ /* If a subquery is not optimized we cannot estimate its cost. */
+ if (!cur_join->join_tab)
+ return true;
+
+ if (sl->first_inner_unit())
+ {
+ /*
+ Subqueries that contain subqueries are considered expensive.
+ @todo: accumulate the cost of subqueries.
+ */
+ return true;
+ }
+
+ examined_rows+= cur_join->get_examined_rows();
+ }
+
+ return (examined_rows > thd->variables.expensive_subquery_limit);
+}
+
+
bool Item_subselect::walk(Item_processor processor, bool walk_subquery,
uchar *argument)
{
@@ -904,6 +946,15 @@ void Item_maxmin_subselect::print(String *str, enum_query_type query_type)
void Item_maxmin_subselect::no_rows_in_result()
{
+ /*
+ Subquery predicates outside of the SELECT list must be evaluated in order
+ to possibly filter the special result row generated for implicit grouping
+ if the subquery is in the HAVING clause.
+ If the predicate is constant, we need its actual value in the only result
+ row for queries with implicit grouping.
+ */
+ if (parsing_place != SELECT_LIST || const_item())
+ return;
value= Item_cache::get_cache(new Item_null());
null_value= 0;
was_values= 0;
@@ -913,6 +964,15 @@ void Item_maxmin_subselect::no_rows_in_result()
void Item_singlerow_subselect::no_rows_in_result()
{
+ /*
+ Subquery predicates outside of the SELECT list must be evaluated in order
+ to possibly filter the special result row generated for implicit grouping
+ if the subquery is in the HAVING clause.
+ If the predicate is constant, we need its actual value in the only result
+ row for queries with implicit grouping.
+ */
+ if (parsing_place != SELECT_LIST || const_item())
+ return;
value= Item_cache::get_cache(new Item_null());
reset();
make_const();
@@ -1375,6 +1435,15 @@ Item* Item_exists_subselect::expr_cache_insert_transformer(uchar *thd_arg)
void Item_exists_subselect::no_rows_in_result()
{
+ /*
+ Subquery predicates outside of the SELECT list must be evaluated in order
+ to possibly filter the special result row generated for implicit grouping
+ if the subquery is in the HAVING clause.
+ If the predicate is constant, we need its actual value in the only result
+ row for queries with implicit grouping.
+ */
+ if (parsing_place != SELECT_LIST || const_item())
+ return;
value= 0;
null_value= 0;
make_const();
@@ -2719,6 +2788,15 @@ void Item_allany_subselect::print(String *str, enum_query_type query_type)
void Item_allany_subselect::no_rows_in_result()
{
+ /*
+ Subquery predicates outside of the SELECT list must be evaluated in order
+ to possibly filter the special result row generated for implicit grouping
+ if the subquery is in the HAVING clause.
+ If the predicate is constant, we need its actual value in the only result
+ row for queries with implicit grouping.
+ */
+ if (parsing_place != SELECT_LIST || const_item())
+ return;
value= 0;
null_value= 0;
was_null= 0;
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 0e0f61aedd9..05c4528490f 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -159,8 +159,8 @@ public:
null_value= 1;
}
/**
- Set the subquery result to the default value for the predicate when the
- subquery is known to produce an empty result.
+ Set the subquery result to a default value consistent with the semantics of
+ the result row produced for queries with implicit grouping.
*/
void no_rows_in_result()= 0;
virtual bool select_transformer(JOIN *join);
@@ -209,7 +209,7 @@ public:
*/
bool is_evaluated() const;
bool is_uncacheable() const;
- bool is_expensive() { return TRUE; }
+ bool is_expensive();
/*
Used by max/min subquery to initialize value presence registration
@@ -235,7 +235,7 @@ public:
@retval TRUE if the predicate is expensive
@retval FALSE otherwise
*/
- bool is_expensive_processor(uchar *arg) { return TRUE; }
+ bool is_expensive_processor(uchar *arg) { return is_expensive(); }
/**
Get the SELECT_LEX structure associated with this Item.
@@ -581,6 +581,10 @@ public:
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ bool const_item() const
+ {
+ return Item_subselect::const_item() && left_expr->const_item();
+ }
void update_used_tables();
bool setup_mat_engine();
bool init_left_expr_cache();
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index afe4f34bd05..0b21ba92558 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1135,6 +1135,7 @@ Item_sum_num::fix_fields(THD *thd, Item **ref)
if (args[i]->fix_fields(thd, args + i) || args[i]->check_cols(1))
return TRUE;
set_if_bigger(decimals, args[i]->decimals);
+ with_subselect|= args[i]->with_subselect;
}
result_field=0;
max_length=float_length(decimals);
@@ -1165,6 +1166,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
(item= args[0])->check_cols(1))
return TRUE;
decimals=item->decimals;
+ with_subselect= args[0]->with_subselect;
switch (hybrid_type= item->result_type()) {
case INT_RESULT:
@@ -3319,6 +3321,7 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
args[i]->fix_fields(thd, args + i)) ||
args[i]->check_cols(1))
return TRUE;
+ with_subselect|= args[i]->with_subselect;
}
/* skip charset aggregation for order columns */
diff --git a/sql/log.cc b/sql/log.cc
index 2ef6463aa81..3547877bad8 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2628,9 +2628,10 @@ void MYSQL_LOG::init_pthread_objects()
SYNOPSIS
close()
- exiting Bitmask. For the slow and general logs the only used bit is
- LOG_CLOSE_TO_BE_OPENED. This is used if we intend to call
- open at once after close.
+ exiting Bitmask. LOG_CLOSE_TO_BE_OPENED is used if we intend to call
+ open at once after close. LOG_CLOSE_DELAYED_CLOSE is used for
+ binlog rotation, to delay actual close of the old file until
+ we have successfully created the new file.
NOTES
One can do an open on the object at once after doing a close.
@@ -2651,7 +2652,8 @@ void MYSQL_LOG::close(uint exiting)
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
}
- if (mysql_file_close(log_file.file, MYF(MY_WME)) && ! write_error)
+ if (!(exiting & LOG_CLOSE_DELAYED_CLOSE) &&
+ mysql_file_close(log_file.file, MYF(MY_WME)) && ! write_error)
{
write_error= 1;
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
@@ -3353,6 +3355,10 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
if (write_file_name_to_index_file)
{
#ifdef HAVE_REPLICATION
+#ifdef ENABLED_DEBUG_SYNC
+ if (current_thd)
+ DEBUG_SYNC(current_thd, "binlog_open_before_update_index");
+#endif
DBUG_EXECUTE_IF("crash_create_critical_before_update_index", DBUG_SUICIDE(););
#endif
@@ -4461,6 +4467,10 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
{
int error= 0, close_on_error= FALSE;
char new_name[FN_REFLEN], *new_name_ptr, *old_name, *file_to_open;
+ uint close_flag;
+ bool delay_close= false;
+ File old_file;
+ LINT_INIT(old_file);
DBUG_ENTER("MYSQL_BIN_LOG::new_file_impl");
if (!is_open())
@@ -4544,7 +4554,20 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
}
old_name=name;
name=0; // Don't free name
- close(LOG_CLOSE_TO_BE_OPENED | LOG_CLOSE_INDEX);
+ close_flag= LOG_CLOSE_TO_BE_OPENED | LOG_CLOSE_INDEX;
+ if (!is_relay_log)
+ {
+ /*
+ We need to keep the old binlog file open (and marked as in-use) until
+ the new one is fully created and synced to disk and index. Otherwise we
+ leave a window where if we crash, there is no binlog file marked as
+ crashed for server restart to detect the need for recovery.
+ */
+ old_file= log_file.file;
+ close_flag|= LOG_CLOSE_DELAYED_CLOSE;
+ delay_close= true;
+ }
+ close(close_flag);
if (log_type == LOG_BIN && checksum_alg_reset != BINLOG_CHECKSUM_ALG_UNDEF)
{
DBUG_ASSERT(!is_relay_log);
@@ -4587,6 +4610,12 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
end:
+ if (delay_close)
+ {
+ clear_inuse_flag_when_closing(old_file);
+ mysql_file_close(old_file, MYF(MY_WME));
+ }
+
if (error && close_on_error /* rotate or reopen failed */)
{
/*
@@ -6493,6 +6522,8 @@ int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd,
- LOG_CLOSE_TO_BE_OPENED : if we intend to call open
at once after close.
- LOG_CLOSE_STOP_EVENT : write a 'stop' event to the log
+ - LOG_CLOSE_DELAYED_CLOSE : do not yet close the file and clear the
+ LOG_EVENT_BINLOG_IN_USE_F flag
@note
One can do an open on the object at once after doing a close.
@@ -6522,12 +6553,11 @@ void MYSQL_BIN_LOG::close(uint exiting)
#endif /* HAVE_REPLICATION */
/* don't pwrite in a file opened with O_APPEND - it doesn't work */
- if (log_file.type == WRITE_CACHE && log_type == LOG_BIN)
+ if (log_file.type == WRITE_CACHE && log_type == LOG_BIN
+ && !(exiting & LOG_CLOSE_DELAYED_CLOSE))
{
- my_off_t offset= BIN_LOG_HEADER_SIZE + FLAGS_OFFSET;
my_off_t org_position= mysql_file_tell(log_file.file, MYF(0));
- uchar flags= 0; // clearing LOG_EVENT_BINLOG_IN_USE_F
- mysql_file_pwrite(log_file.file, &flags, 1, offset, MYF(0));
+ clear_inuse_flag_when_closing(log_file.file);
/*
Restore position so that anything we have in the IO_cache is written
to the correct position.
@@ -6562,6 +6592,18 @@ void MYSQL_BIN_LOG::close(uint exiting)
}
+/*
+ Clear the LOG_EVENT_BINLOG_IN_USE_F; this marks the binlog file as cleanly
+ closed and not needing crash recovery.
+*/
+void MYSQL_BIN_LOG::clear_inuse_flag_when_closing(File file)
+{
+ my_off_t offset= BIN_LOG_HEADER_SIZE + FLAGS_OFFSET;
+ uchar flags= 0; // clearing LOG_EVENT_BINLOG_IN_USE_F
+ mysql_file_pwrite(file, &flags, 1, offset, MYF(0));
+}
+
+
void MYSQL_BIN_LOG::set_max_size(ulong max_size_arg)
{
/*
diff --git a/sql/log.h b/sql/log.h
index 2bc4d0e49d7..55782952d21 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -202,6 +202,7 @@ extern TC_LOG_DUMMY tc_log_dummy;
#define LOG_CLOSE_INDEX 1
#define LOG_CLOSE_TO_BE_OPENED 2
#define LOG_CLOSE_STOP_EVENT 4
+#define LOG_CLOSE_DELAYED_CLOSE 8
/*
Maximum unique log filename extension.
@@ -222,6 +223,11 @@ class Relay_log_info;
extern PSI_mutex_key key_LOG_INFO_lock;
#endif
+/*
+ Note that we destroy the lock mutex in the desctructor here.
+ This means that object instances cannot be destroyed/go out of scope,
+ until we have reset thd->current_linfo to NULL;
+ */
typedef struct st_log_info
{
char log_file_name[FN_REFLEN];
@@ -477,8 +483,8 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
void mark_xids_active(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;
@@ -666,6 +672,7 @@ public:
bool need_mutex);
bool reset_logs(THD* thd);
void close(uint exiting);
+ void clear_inuse_flag_when_closing(File file);
// iterating through the log index file
int find_log_pos(LOG_INFO* linfo, const char* log_name,
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 95ac3fc278c..a679249ae24 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1,5 +1,6 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2000, 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
@@ -5843,11 +5844,12 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
#endif
+#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
+
/*
Intvar_log_event::do_apply_event()
*/
-#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
{
/*
@@ -5856,6 +5858,9 @@ int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
*/
const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
+ if (rli->deferred_events_collecting)
+ return rli->deferred_events->add(this);
+
switch (type) {
case LAST_INSERT_ID_EVENT:
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 1;
@@ -5962,6 +5967,9 @@ int Rand_log_event::do_apply_event(Relay_log_info const *rli)
*/
const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
+ if (rli->deferred_events_collecting)
+ return rli->deferred_events->add(this);
+
thd->rand.seed1= (ulong) seed1;
thd->rand.seed2= (ulong) seed2;
return 0;
@@ -5988,6 +5996,29 @@ Rand_log_event::do_shall_skip(Relay_log_info *rli)
return continue_group(rli);
}
+/**
+ Exec deferred Int-, Rand- and User- var events prefixing
+ a Query-log-event event.
+
+ @param thd THD handle
+
+ @return false on success, true if a failure in an event applying occurred.
+*/
+bool slave_execute_deferred_events(THD *thd)
+{
+ bool res= false;
+ Relay_log_info *rli= thd->rli_slave;
+
+ DBUG_ASSERT(rli && (!rli->deferred_events_collecting || rli->deferred_events));
+
+ if (!rli->deferred_events_collecting || rli->deferred_events->is_empty())
+ return res;
+
+ res= rli->deferred_events->execute(rli);
+
+ return res;
+}
+
#endif /* !MYSQL_CLIENT */
@@ -6426,6 +6457,10 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
{
Item *it= 0;
CHARSET_INFO *charset;
+
+ if (rli->deferred_events_collecting)
+ return rli->deferred_events->add(this);
+
if (!(charset= get_charset(charset_number, MYF(MY_WME))))
return 1;
LEX_STRING user_var_name;
diff --git a/sql/log_event.h b/sql/log_event.h
index 78dccb3cac1..cccab93e0d5 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -4258,6 +4258,14 @@ private:
const char* log_ident;
uint ident_len;
};
+
+/**
+ 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
int append_query_string(THD *thd, CHARSET_INFO *csinfo,
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 040b35d28f1..8f2c515e11c 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007, 2010, Oracle and/or its affiliates.
+/* Copyright (c) 2007, 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
diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc
index 364dca9120a..6e2c6ec07f3 100644
--- a/sql/mysql_install_db.cc
+++ b/sql/mysql_install_db.cc
@@ -119,8 +119,8 @@ static void die(const char *fmt, ...)
fprintf(stderr,
"http://kb.askmonty.org/v/installation-issues-on-windows contains some help\n"
"for solving the most common problems. If this doesn't help you, please\n"
- "leave a comment in the knowledge base or file a bug report at\n"
- "https://bugs.launchpad.net/maria");
+ "leave a comment in the Knowledgebase or file a bug report at\n"
+ "http://mariadb.org/jira");
}
fflush(stderr);
va_end(args);
@@ -247,7 +247,7 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size)
"\"\"%s\" --no-defaults --bootstrap"
" \"--language=%s\\share\\english\""
" --basedir=. --datadir=. --default-storage-engine=myisam"
- " --max_allowed_packet=9M --loose-skip-innodb --loose-skip-pbxt"
+ " --max_allowed_packet=9M --loose-skip-innodb"
" --net-buffer-length=16k\"", mysqld_path, basedir);
return cmdline;
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index eaaff295ae0..dfdf1c41c0f 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -110,7 +110,7 @@ ulong wsrep_running_threads = 0; // # of currently running wsrep threads
/* 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
@@ -694,6 +694,7 @@ mysql_cond_t COND_wsrep_rollback;
wsrep_aborting_thd_t wsrep_aborting_thd= NULL;
mysql_mutex_t LOCK_wsrep_replaying;
mysql_cond_t COND_wsrep_replaying;
+mysql_mutex_t LOCK_wsrep_slave_threads;
int wsrep_replaying= 0;
static void wsrep_close_threads(THD* thd);
#endif
@@ -768,7 +769,8 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
#ifdef WITH_WSREP
PSI_mutex_key key_LOCK_wsrep_rollback, key_LOCK_wsrep_thd,
key_LOCK_wsrep_replaying, key_LOCK_wsrep_ready, key_LOCK_wsrep_sst,
- key_LOCK_wsrep_sst_thread, key_LOCK_wsrep_sst_init;
+ key_LOCK_wsrep_sst_thread, key_LOCK_wsrep_sst_init,
+ key_LOCK_wsrep_slave_threads;
#endif
PSI_mutex_key key_RELAYLOG_LOCK_index;
@@ -846,6 +848,7 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_wsrep_rollback, "LOCK_wsrep_rollback", PSI_FLAG_GLOBAL},
{ &key_LOCK_wsrep_thd, "THD::LOCK_wsrep_thd", 0},
{ &key_LOCK_wsrep_replaying, "LOCK_wsrep_replaying", PSI_FLAG_GLOBAL},
+ { &key_LOCK_wsrep_slave_threads, "LOCK_wsrep_slave_threads", PSI_FLAG_GLOBAL},
#endif
{ &key_PARTITION_LOCK_auto_inc, "HA_DATA_PARTITION::LOCK_auto_inc", 0}
};
@@ -2047,6 +2050,7 @@ static void clean_up_mutexes()
(void) mysql_cond_destroy(&COND_wsrep_rollback);
(void) mysql_mutex_destroy(&LOCK_wsrep_replaying);
(void) mysql_cond_destroy(&COND_wsrep_replaying);
+ (void) mysql_mutex_destroy(&LOCK_wsrep_slave_threads);
#endif
mysql_mutex_destroy(&LOCK_server_started);
mysql_cond_destroy(&COND_server_started);
@@ -3051,11 +3055,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,
@@ -3542,14 +3544,23 @@ static int init_common_variables()
return 1;
#ifdef HAVE_TZNAME
- {
- struct tm tm_tmp;
- localtime_r(&server_start_time,&tm_tmp);
- strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
- sizeof(system_time_zone)-1);
+ struct tm tm_tmp;
+ localtime_r(&server_start_time,&tm_tmp);
+ const char *tz_name= tzname[tm_tmp.tm_isdst != 0 ? 1 : 0];
+#ifdef _WIN32
+ /*
+ Time zone name may be localized and contain non-ASCII characters,
+ Convert from ANSI encoding to UTF8.
+ */
+ wchar_t wtz_name[sizeof(system_time_zone)];
+ mbstowcs(wtz_name, tz_name, sizeof(system_time_zone)-1);
+ WideCharToMultiByte(CP_UTF8,0, wtz_name, -1, system_time_zone,
+ sizeof(system_time_zone) - 1, NULL, NULL);
+#else
+ strmake(system_time_zone, tz_name, sizeof(system_time_zone)-1);
+#endif /* _WIN32 */
+#endif /* HAVE_TZNAME */
- }
-#endif
/*
We set SYSTEM time zone as reasonable default and
also for failure of my_tz_init() and bootstrap mode.
@@ -4065,6 +4076,8 @@ static int init_thread_environment()
mysql_mutex_init(key_LOCK_wsrep_replaying,
&LOCK_wsrep_replaying, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_wsrep_replaying, &COND_wsrep_replaying, NULL);
+ mysql_mutex_init(key_LOCK_wsrep_slave_threads,
+ &LOCK_wsrep_slave_threads, MY_MUTEX_INIT_FAST);
#endif
return 0;
}
@@ -5002,9 +5015,7 @@ void wsrep_close_client_connections(my_bool wait_to_end)
void wsrep_close_applier(THD *thd)
{
- if (wsrep_debug)
- WSREP_INFO("closing applier %ld", thd->thread_id);
-
+ WSREP_DEBUG("closing applier %ld", thd->thread_id);
wsrep_close_thread(thd);
}
@@ -5021,10 +5032,30 @@ static void wsrep_close_threads(THD *thd)
/* We skip slave threads & scheduler on this first loop through. */
if (tmp->wsrep_applier && tmp != thd)
{
- if (wsrep_debug)
- WSREP_INFO("closing wsrep thread %ld", tmp->thread_id);
+ WSREP_DEBUG("closing wsrep thread %ld", tmp->thread_id);
wsrep_close_thread (tmp);
+ }
+ }
+ mysql_mutex_unlock(&LOCK_thread_count);
+}
+
+void wsrep_close_applier_threads(int count)
+{
+ THD *tmp;
+ mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
+
+ I_List_iterator<THD> it(threads);
+ while ((tmp=it++) && count)
+ {
+ DBUG_PRINT("quit",("Informing thread %ld that it's time to die",
+ tmp->thread_id));
+ /* We skip slave threads & scheduler on this first loop through. */
+ if (tmp->wsrep_applier)
+ {
+ WSREP_DEBUG("closing wsrep applier thread %ld", tmp->thread_id);
+ tmp->wsrep_applier_closing= TRUE;
+ count--;
}
}
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 0390ac1101e..da328063e56 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2008,7 +2008,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
if (reuse_handler)
{
DBUG_PRINT("info", ("Reusing handler 0x%lx", (long) file));
- if (init() || reset())
+ if (init())
{
DBUG_RETURN(1);
}
@@ -2043,7 +2043,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 +2090,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:
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 545e9e3c7b8..efb45f96345 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -990,7 +990,7 @@ class SQL_SELECT :public Sql_alloc {
key_map quick_keys; // Possible quick keys
key_map needed_reg; // Possible quick keys after prev tables.
table_map const_tables,read_tables;
- bool free_cond;
+ bool free_cond; /* Currently not used and always FALSE */
SQL_SELECT();
~SQL_SELECT();
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index a5a68d0d306..8d1cbeba5f4 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -4894,7 +4894,43 @@ static void remove_subq_pushed_predicates(JOIN *join, Item **where)
bool JOIN::optimize_unflattened_subqueries()
{
- return select_lex->optimize_unflattened_subqueries();
+ return select_lex->optimize_unflattened_subqueries(false);
+}
+
+/**
+ Optimize all constant subqueries of a query that were not flattened into
+ a semijoin.
+
+ @details
+ Similar to other constant conditions, constant subqueries can be used in
+ various constant optimizations. Having optimized constant subqueries before
+ these constant optimizations, makes it possible to estimate if a subquery
+ is "cheap" enough to be executed during the optimization phase.
+
+ Constant subqueries can be optimized and evaluated independent of the outer
+ query, therefore if const_only = true, this method can be called early in
+ the optimization phase of the outer query.
+
+ @return Operation status
+ @retval FALSE success.
+ @retval TRUE error occurred.
+*/
+
+bool JOIN::optimize_constant_subqueries()
+{
+ ulonglong save_options= select_lex->options;
+ bool res;
+ /*
+ Constant subqueries may be executed during the optimization phase.
+ In EXPLAIN mode the optimizer doesn't initialize many of the data structures
+ needed for execution. In order to make it possible to execute subqueries
+ during optimization, constant subqueries must be optimized for execution,
+ not for EXPLAIN.
+ */
+ select_lex->options&= ~SELECT_DESCRIBE;
+ res= select_lex->optimize_unflattened_subqueries(true);
+ select_lex->options= save_options;
+ return res;
}
@@ -5295,7 +5331,14 @@ bool JOIN::choose_subquery_plan(table_map join_tables)
by the IN predicate.
*/
outer_join= unit->outer_select() ? unit->outer_select()->join : NULL;
- if (outer_join && outer_join->table_count > 0)
+ /*
+ Get the cost of the outer join if:
+ (1) It has at least one table, and
+ (2) It has been already optimized (if there is no join_tab, then the
+ outer join has not been optimized yet).
+ */
+ if (outer_join && outer_join->table_count > 0 && // (1)
+ outer_join->join_tab) // (2)
{
/*
TODO:
diff --git a/sql/password.c b/sql/password.c
index 1a12a81f7c6..947620ddf7a 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+ 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
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 940fc201bae..252b4f3f5b9 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -52,8 +52,8 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
until_log_pos(0), retried_trans(0),
tables_to_lock(0), tables_to_lock_count(0),
- last_event_start_time(0), m_flags(0), row_stmt_start_timestamp(0),
- long_find_row_note_printed(false),
+ last_event_start_time(0), deferred_events(NULL),m_flags(0),
+ row_stmt_start_timestamp(0), long_find_row_note_printed(false),
m_annotate_event(0)
{
DBUG_ENTER("Relay_log_info::Relay_log_info");
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index 958002561bc..b989283deb4 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -389,6 +389,41 @@ public:
*/
time_t last_event_start_time;
+ /*
+ A container to hold on Intvar-, Rand-, Uservar- log-events in case
+ the slave is configured with table filtering rules.
+ The withhold events are executed when their parent Query destiny is
+ determined for execution as well.
+ */
+ Deferred_log_events *deferred_events;
+
+ /*
+ State of the container: true stands for IRU events gathering,
+ false does for execution, either deferred or direct.
+ */
+ bool deferred_events_collecting;
+
+ /*
+ Returns true if the argument event resides in the containter;
+ more specifically, the checking is done against the last added event.
+ */
+ bool is_deferred_event(Log_event * ev)
+ {
+ return deferred_events_collecting ? deferred_events->is_last(ev) : false;
+ };
+ /* The general cleanup that slave applier may need at the end of query. */
+ inline void cleanup_after_query()
+ {
+ if (deferred_events)
+ deferred_events->rewind();
+ };
+ /* The general cleanup that slave applier may need at the end of session. */
+ void cleanup_after_session()
+ {
+ if (deferred_events)
+ delete deferred_events;
+ };
+
/**
Helper function to do after statement completion.
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 71fa5c8909c..388a6c9f9bb 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -19,6 +19,7 @@
#ifndef MYSQL_CLIENT
#include "unireg.h" // REQUIRED by later includes
#include "rpl_rli.h"
+#include "log_event.h"
#include "sql_select.h"
/**
@@ -1057,6 +1058,7 @@ table_def::~table_def()
#endif
}
+
/**
@param even_buf point to the buffer containing serialized event
@param event_len length of the event accounting possible checksum alg
@@ -1112,3 +1114,68 @@ 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)
+{
+ my_init_dynamic_array(&array, sizeof(Log_event *), 32, 16);
+}
+
+Deferred_log_events::~Deferred_log_events()
+{
+ delete_dynamic(&array);
+}
+
+int Deferred_log_events::add(Log_event *ev)
+{
+ last_added= ev;
+ insert_dynamic(&array, (uchar*) &ev);
+ return 0;
+}
+
+bool Deferred_log_events::is_empty()
+{
+ return array.elements == 0;
+}
+
+bool Deferred_log_events::execute(Relay_log_info *rli)
+{
+ bool res= false;
+
+ DBUG_ASSERT(rli->deferred_events_collecting);
+
+ rli->deferred_events_collecting= false;
+ for (uint i= 0; !res && i < array.elements; i++)
+ {
+ Log_event *ev= (* (Log_event **)
+ dynamic_array_ptr(&array, i));
+ res= ev->apply_event(rli);
+ }
+ rli->deferred_events_collecting= true;
+ return res;
+}
+
+void Deferred_log_events::rewind()
+{
+ /*
+ Reset preceeding Query log event events which execution was
+ deferred because of slave side filtering.
+ */
+ if (!is_empty())
+ {
+ for (uint i= 0; i < array.elements; i++)
+ {
+ Log_event *ev= *(Log_event **) dynamic_array_ptr(&array, i);
+ delete ev;
+ }
+ if (array.elements > array.max_element)
+ freeze_size(&array);
+ reset_dynamic(&array);
+ }
+ last_added= NULL;
+}
+
+#endif
+
diff --git a/sql/rpl_utility.h b/sql/rpl_utility.h
index 1f5577d8b8b..9046891e27f 100644
--- a/sql/rpl_utility.h
+++ b/sql/rpl_utility.h
@@ -29,7 +29,7 @@
#include "mysql_com.h"
class Relay_log_info;
-
+class Log_event;
/**
A table definition from the master.
@@ -262,6 +262,24 @@ CPP_UNNAMED_NS_START
};
CPP_UNNAMED_NS_END
+
+class Deferred_log_events
+{
+private:
+ DYNAMIC_ARRAY array;
+ Log_event *last_added;
+
+public:
+ Deferred_log_events(Relay_log_info *rli);
+ ~Deferred_log_events();
+ /* 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);
+ void rewind();
+ bool is_last(Log_event *ev) { return ev == last_added; };
+};
+
#endif
// NB. number of printed bit values is limited to sizeof(buf) - 1
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 140220dfa9c..923e8e73bc7 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -6501,6 +6501,9 @@ ER_TABLE_IN_FK_CHECK
ER_UNUSED_1
eng "You should never see it"
+ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST
+ eng "INSERT into autoincrement field which is not the first part in the composed primary key is unsafe."
+
#
# End of 5.5 error messages.
#
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 94a485cbe29..2b387012f85 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2797,7 +2797,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
/* fall through */
default:
DBUG_PRINT("info", ("Deleting the event after it has been executed"));
- delete ev;
+ if (!rli->is_deferred_event(ev))
+ delete ev;
break;
}
@@ -3461,6 +3462,12 @@ pthread_handler_t handle_slave_sql(void *arg)
goto err_during_init;
}
thd->init_for_queries();
+ thd->rli_slave= rli;
+ if ((rli->deferred_events_collecting= rpl_filter->is_on()))
+ {
+ rli->deferred_events= new Deferred_log_events(rli);
+ }
+
thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables
/*
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 1616f93241d..e82eec26fdb 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2002, 2011, Oracle and/or its affiliates.
- Copyright (c) 2011, Monty Program Ab
+ Copyright (c) 2002, 2012, Oracle and/or its affiliates.
+ 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
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_base.cc b/sql/sql_base.cc
index be30e085b05..96cb4d8a045 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -223,6 +223,7 @@ static bool
has_write_table_with_auto_increment(TABLE_LIST *tables);
static bool
has_write_table_with_auto_increment_and_select(TABLE_LIST *tables);
+static bool has_write_table_auto_increment_not_first_in_pk(TABLE_LIST *tables);
uint cached_open_tables(void)
{
@@ -5781,6 +5782,12 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables &&
has_write_table_with_auto_increment_and_select(tables))
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_WRITE_AUTOINC_SELECT);
+ /* Todo: merge all has_write_table_auto_inc with decide_logging_format */
+ if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables)
+ {
+ if (has_write_table_auto_increment_not_first_in_pk(tables))
+ thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_AUTOINC_NOT_FIRST);
+ }
/*
INSERT...ON DUPLICATE KEY UPDATE on a table with more than one unique keys
@@ -9554,6 +9561,32 @@ has_write_table_with_auto_increment_and_select(TABLE_LIST *tables)
return(has_select && has_auto_increment_tables);
}
+/*
+ Tells if there is a table whose auto_increment column is a part
+ of a compound primary key while is not the first column in
+ the table definition.
+
+ @param tables Table list
+
+ @return true if the table exists, fais if does not.
+*/
+
+static bool
+has_write_table_auto_increment_not_first_in_pk(TABLE_LIST *tables)
+{
+ for (TABLE_LIST *table= tables; table; table= table->next_global)
+ {
+ /* we must do preliminary checks as table->table may be NULL */
+ if (!table->placeholder() &&
+ table->table->found_next_number_field &&
+ (table->lock_type >= TL_WRITE_ALLOW_WRITE)
+ && table->table->s->next_number_keypart != 0)
+ return 1;
+ }
+
+ return 0;
+}
+
/*
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 96814562757..7edd28446a2 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1533,7 +1533,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"));
@@ -3203,6 +3203,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
@@ -3213,24 +3214,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];
@@ -3243,9 +3244,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
@@ -3264,42 +3265,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);
@@ -3310,12 +3286,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)
{
@@ -3326,7 +3304,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)
{
@@ -3335,6 +3313,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);
}
@@ -3353,7 +3333,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",
@@ -3361,8 +3342,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)
@@ -3412,7 +3395,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
@@ -3425,6 +3409,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
@@ -3478,7 +3463,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;
@@ -3951,6 +3938,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 &&
@@ -3963,18 +3953,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 5fb809c4da3..99d54e437d2 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008-2012 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
@@ -710,7 +710,7 @@ extern "C" bool wsrep_thd_is_wsrep_on(THD *thd)
extern "C" bool wsrep_consistency_check(void *thd)
{
- return ((THD*)thd)->wsrep_consistency_check;
+ return ((THD*)thd)->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING;
}
extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode)
@@ -864,7 +864,7 @@ THD::THD()
#endif
:Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION,
/* statement id */ 0),
- rli_fake(0),
+ rli_fake(0), rli_slave(NULL),
in_sub_stmt(0), log_all_errors(0),
binlog_unsafe_warning_flags(0),
binlog_table_maps(0),
@@ -890,6 +890,7 @@ THD::THD()
spcont(NULL),
#ifdef WITH_WSREP
wsrep_applier(is_applier),
+ wsrep_applier_closing(FALSE),
wsrep_client_thread(0),
#endif
m_parser_state(NULL),
@@ -1003,7 +1004,7 @@ THD::THD()
wsrep_retry_query = NULL;
wsrep_retry_query_len = 0;
wsrep_retry_command = COM_CONNECT;
- wsrep_consistency_check = false;
+ wsrep_consistency_check = NO_CONSISTENCY_CHECK;
#endif
/* Call to init() below requires fully initialized Open_tables_state. */
reset_open_tables_state(this);
@@ -1356,7 +1357,7 @@ void THD::init(void)
wsrep_rli= NULL;
wsrep_PA_safe= true;
wsrep_seqno_changed= false;
- wsrep_consistency_check = false;
+ wsrep_consistency_check = NO_CONSISTENCY_CHECK;
#endif
if (variables.sql_log_bin)
variables.option_bits|= OPTION_BIN_LOG;
@@ -1593,6 +1594,8 @@ THD::~THD()
}
mysql_audit_free_thd(this);
+ if (rli_slave)
+ rli_slave->cleanup_after_session();
#endif
free_root(&main_mem_root, MYF(0));
@@ -1979,6 +1982,11 @@ void THD::cleanup_after_query()
//wsrep_trx_seqno = 0;
#endif /* WITH_WSREP */
+#ifndef EMBEDDED_LIBRARY
+ if (rli_slave)
+ rli_slave->cleanup_after_query();
+#endif
+
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 1dc38539670..844f56fac6f 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1,6 +1,6 @@
/*
- 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
@@ -45,6 +45,11 @@
REPLAYING,
RETRY_AUTOCOMMIT,
};
+ enum wsrep_consistency_check_mode {
+ NO_CONSISTENCY_CHECK,
+ CONSISTENCY_CHECK_DECLARED,
+ CONSISTENCY_CHECK_RUNNING,
+ };
#endif
#ifdef USE_PRAGMA_INTERFACE
@@ -517,6 +522,7 @@ typedef struct system_variables
ulonglong group_concat_max_len;
ha_rows select_limit;
ha_rows max_join_size;
+ ha_rows expensive_subquery_limit;
ulong auto_increment_increment, auto_increment_offset;
ulong lock_wait_timeout;
ulong join_cache_level;
@@ -1590,6 +1596,8 @@ public:
/* Used to execute base64 coded binlog events in MySQL server */
Relay_log_info* rli_fake;
+ /* Slave applier execution context */
+ Relay_log_info* rli_slave;
void reset_for_next_command(bool calculate_userstat);
/*
@@ -2368,6 +2376,7 @@ public:
#ifdef WITH_WSREP
const bool wsrep_applier; /* dedicated slave applier thread */
+ bool wsrep_applier_closing; /* applier marked to close */
bool wsrep_client_thread; /* to identify client threads*/
enum wsrep_exec_mode wsrep_exec_mode;
query_id_t wsrep_last_query_id;
@@ -2389,7 +2398,8 @@ public:
char* wsrep_retry_query;
size_t wsrep_retry_query_len;
enum enum_server_command wsrep_retry_command;
- bool wsrep_consistency_check;
+ enum wsrep_consistency_check_mode
+ wsrep_consistency_check;
#endif /* WITH_WSREP */
/**
Internal parser state.
@@ -3106,7 +3116,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);
@@ -3603,7 +3613,8 @@ public:
if (copy_field) /* Fix for Intel compiler */
{
delete [] copy_field;
- save_copy_field= copy_field= 0;
+ save_copy_field= copy_field= NULL;
+ save_copy_field_end= copy_field_end= NULL;
}
}
};
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index bde7a082f42..0afd8c2ac3c 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -120,7 +120,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
}
/* Apply the IN=>EXISTS transformation to all subqueries and optimize them. */
- if (select_lex->optimize_unflattened_subqueries())
+ if (select_lex->optimize_unflattened_subqueries(false))
DBUG_RETURN(TRUE);
const_cond= (!conds || conds->const_item());
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index a4eb1e8996f..230384d0a43 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -2785,9 +2785,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)
@@ -2797,7 +2794,6 @@ pthread_handler_t handle_delayed_insert(void *arg)
error));
}
#endif
-#endif
if (error == ETIMEDOUT || error == ETIME)
thd->killed= KILL_CONNECTION;
}
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 3ffdb1384c1..6efb36c2d7d 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -68,7 +68,8 @@ Query_tables_list::binlog_stmt_unsafe_errcode[BINLOG_STMT_UNSAFE_COUNT] =
ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT,
ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC,
ER_BINLOG_UNSAFE_UPDATE_IGNORE,
- ER_BINLOG_UNSAFE_INSERT_TWO_KEYS
+ ER_BINLOG_UNSAFE_INSERT_TWO_KEYS,
+ ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST
};
@@ -1556,7 +1557,7 @@ int lex_one_token(void *arg, void *yythd)
if (version == 99997 && thd->wsrep_exec_mode == LOCAL_STATE)
{
WSREP_DEBUG("consistency check: %s", thd->query());
- thd->wsrep_consistency_check= TRUE;
+ thd->wsrep_consistency_check= CONSISTENCY_CHECK_DECLARED;
lip->yySkipn(5);
lip->set_echo(TRUE);
state=MY_LEX_START;
@@ -3417,7 +3418,23 @@ bool st_select_lex::add_index_hint (THD *thd, char *str, uint length)
}
-bool st_select_lex::optimize_unflattened_subqueries()
+/**
+ Optimize all subqueries that have not been flattened into semi-joins.
+
+ @details
+ This functionality is a method of SELECT_LEX instead of JOIN because
+ SQL statements as DELETE/UPDATE do not have a corresponding JOIN object.
+
+ @see JOIN::optimize_unflattened_subqueries
+
+ @param const_only Restrict subquery optimization to constant subqueries
+
+ @return Operation status
+ @retval FALSE success.
+ @retval TRUE error occurred.
+*/
+
+bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
{
for (SELECT_LEX_UNIT *un= first_inner_unit(); un; un= un->next_unit())
{
@@ -3427,12 +3444,19 @@ bool st_select_lex::optimize_unflattened_subqueries()
{
if (subquery_predicate->substype() == Item_subselect::IN_SUBS)
{
- Item_in_subselect *in_subs=(Item_in_subselect*)subquery_predicate;
+ Item_in_subselect *in_subs= (Item_in_subselect*) subquery_predicate;
if (in_subs->is_jtbm_merged)
continue;
}
+ if (const_only && !subquery_predicate->const_item())
+ {
+ /* Skip non-constant subqueries if the caller asked so. */
+ continue;
+ }
+
bool empty_union_result= true;
+ bool is_correlated_unit= false;
/*
If the subquery is a UNION, optimize all the subqueries in the UNION. If
there is no UNION, then the loop will execute once for the subquery.
@@ -3457,6 +3481,8 @@ bool st_select_lex::optimize_unflattened_subqueries()
inner_join->select_options|= SELECT_DESCRIBE;
}
res= inner_join->optimize();
+ sl->update_correlated_cache();
+ is_correlated_unit|= sl->is_correlated;
inner_join->select_options= save_options;
un->thd->lex->current_select= save_select;
if (empty_union_result)
@@ -3472,6 +3498,9 @@ bool st_select_lex::optimize_unflattened_subqueries()
}
if (empty_union_result)
subquery_predicate->no_rows_in_result();
+ if (!is_correlated_unit)
+ un->uncacheable&= ~UNCACHEABLE_DEPENDENT;
+ subquery_predicate->is_correlated= is_correlated_unit;
}
}
return FALSE;
@@ -3841,6 +3870,61 @@ void SELECT_LEX::update_used_tables()
/**
+ @brief
+ Update is_correlated cache for this select
+
+ @details
+*/
+
+void st_select_lex::update_correlated_cache()
+{
+ TABLE_LIST *tl;
+ List_iterator<TABLE_LIST> ti(leaf_tables);
+
+ is_correlated= false;
+
+ while ((tl= ti++))
+ {
+ if (tl->on_expr)
+ is_correlated|= test(tl->on_expr->used_tables() & OUTER_REF_TABLE_BIT);
+ for (TABLE_LIST *embedding= tl->embedding ; embedding ;
+ embedding= embedding->embedding)
+ {
+ if (embedding->on_expr)
+ is_correlated|= test(embedding->on_expr->used_tables() &
+ OUTER_REF_TABLE_BIT);
+ }
+ }
+
+ if (join->conds)
+ is_correlated|= test(join->conds->used_tables() & OUTER_REF_TABLE_BIT);
+
+ if (join->having)
+ is_correlated|= test(join->having->used_tables() & OUTER_REF_TABLE_BIT);
+
+ if (join->tmp_having)
+ is_correlated|= test(join->tmp_having->used_tables() & OUTER_REF_TABLE_BIT);
+
+ Item *item;
+ List_iterator_fast<Item> it(join->fields_list);
+ while ((item= it++))
+ is_correlated|= test(item->used_tables() & OUTER_REF_TABLE_BIT);
+
+ for (ORDER *order= group_list.first; order; order= order->next)
+ is_correlated|= test((*order->item)->used_tables() & OUTER_REF_TABLE_BIT);
+
+ if (!master_unit()->is_union())
+ {
+ for (ORDER *order= order_list.first; order; order= order->next)
+ is_correlated|= test((*order->item)->used_tables() & OUTER_REF_TABLE_BIT);
+ }
+
+ if (!is_correlated)
+ uncacheable&= ~UNCACHEABLE_DEPENDENT;
+}
+
+
+/**
Set the EXPLAIN type for this subquery.
*/
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 7da0cc48298..2f3214646de 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -997,12 +997,7 @@ public:
void clear_index_hints(void) { index_hints= NULL; }
bool is_part_of_union() { return master_unit()->is_union(); }
- /*
- Optimize all subqueries that have not been flattened into semi-joins.
- This functionality is a method of SELECT_LEX instead of JOIN because
- some SQL statements as DELETE do not have a corresponding JOIN object.
- */
- bool optimize_unflattened_subqueries();
+ bool optimize_unflattened_subqueries(bool const_only);
/* Set the EXPLAIN type for this subquery. */
void set_explain_type();
bool handle_derived(LEX *lex, uint phases);
@@ -1023,6 +1018,7 @@ public:
void mark_as_belong_to_derived(TABLE_LIST *derived);
void increase_derived_records(ha_rows records);
void update_used_tables();
+ void update_correlated_cache();
void mark_const_derived(bool empty);
bool save_leaf_tables(THD *thd);
@@ -1433,6 +1429,12 @@ public:
*/
BINLOG_STMT_UNSAFE_INSERT_TWO_KEYS,
+ /**
+ INSERT into auto-inc field which is not the first part of composed
+ primary key.
+ */
+ BINLOG_STMT_UNSAFE_AUTOINC_NOT_FIRST,
+
/* The last element of this enumeration type. */
BINLOG_STMT_UNSAFE_COUNT
};
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index cce1aaf05d4..0ca412be17d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2401,6 +2401,11 @@ mysql_execute_command(THD *thd)
}
DBUG_RETURN(0);
}
+ /*
+ Execute deferred events first
+ */
+ if (slave_execute_deferred_events(thd))
+ DBUG_RETURN(-1);
}
else
{
@@ -2447,12 +2452,33 @@ mysql_execute_command(THD *thd)
* allow SET and SHOW queries
*/
if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready &&
- lex->sql_command != SQLCOM_SET_OPTION &&
- !is_show_query(lex->sql_command))
- {
+ lex->sql_command != SQLCOM_SET_OPTION &&
+ !is_show_query(lex->sql_command))
+ {
+#if DIRTY_HACK
+ /* Dirty hack for lp:1002714 - trying to recognize mysqldump connection
+ * and allow it to continue. Actuall mysqldump_magic_str may be longer
+ * and is obviously version dependent and may be issued by any client
+ * connection after which connection becomes non-replicating. */
+ static char const mysqldump_magic_str[]=
+"SELECT LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL";
+ static const size_t mysqldump_magic_str_len= sizeof(mysqldump_magic_str) -1;
+ if (SQLCOM_SELECT != lex->sql_command ||
+ thd->query_length() < mysqldump_magic_str_len ||
+ strncmp(thd->query(), mysqldump_magic_str, mysqldump_magic_str_len))
+ {
+#endif /* DIRTY_HACK */
my_error(ER_UNKNOWN_COM_ERROR, MYF(0),
"WSREP has not yet prepared node for application use");
goto error;
+#if DIRTY_HACK
+ }
+ else
+ {
+ /* mysqldump connection, allow all further queries to pass */
+ thd->variables.wsrep_on= FALSE;
+ }
+#endif /* DIRTY_HACK */
}
}
#endif /* WITH_WSREP */
@@ -3074,7 +3100,7 @@ end_with_restore_list:
goto error;
#else
{
- if (check_global_access(thd, SUPER_ACL))
+ if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
goto error;
res = show_binlogs(thd);
break;
@@ -3348,8 +3374,9 @@ end_with_restore_list:
break;
#ifdef WITH_WSREP
if (lex->sql_command == SQLCOM_INSERT_SELECT &&
- thd->wsrep_consistency_check)
+ thd->wsrep_consistency_check == CONSISTENCY_CHECK_DECLARED)
{
+ thd->wsrep_consistency_check = CONSISTENCY_CHECK_RUNNING;
WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL);
}
@@ -4978,7 +5005,7 @@ finish:
close_thread_tables(thd);
#ifdef WITH_WSREP
WSREP_TO_ISOLATION_END
- thd->wsrep_consistency_check= FALSE;
+ thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK;
#endif /* WITH_WSREP */
thd_proc_info(thd, 0);
@@ -6669,6 +6696,7 @@ TABLE_LIST *st_select_lex::end_nested_join(THD *thd)
embedded->embedding= embedding;
join_list->push_front(embedded);
ptr= embedded;
+ embedded->lifted= 1;
}
else if (nested_join->join_list.elements == 0)
{
@@ -8408,11 +8436,16 @@ int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal)
THD *bf_thd = (THD *) bf_thd_ptr;
DBUG_ENTER("wsrep_abort_thd");
- if (WSREP(bf_thd) && victim_thd)
+ if ( (WSREP(bf_thd) ||
+ (WSREP_ON && bf_thd->wsrep_exec_mode == TOTAL_ORDER)) && victim_thd)
{
WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", (bf_thd) ?
(long long)bf_thd->real_id : 0, (long long)victim_thd->real_id);
ha_wsrep_abort_transaction(bf_thd, victim_thd, signal);
+ }
+ else
+ {
+ WSREP_DEBUG("wsrep_abort_thd not effective: %p %p", bf_thd, victim_thd);
}
DBUG_RETURN(1);
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_repl.cc b/sql/sql_repl.cc
index 816ae57c828..a85e0f2a997 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1897,6 +1897,8 @@ 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;
+ LOG_INFO linfo;
+
DBUG_ENTER("mysql_show_binlog_events");
Log_event::init_show_field_list(&field_list);
@@ -1939,7 +1941,6 @@ bool mysql_show_binlog_events(THD* thd)
char search_file_name[FN_REFLEN], *name;
const char *log_file_name = lex_mi->log_file_name;
mysql_mutex_t *log_lock = binary_log->get_log_lock();
- LOG_INFO linfo;
Log_event* ev;
unit->set_limit(thd->lex->current_select);
@@ -2036,6 +2037,8 @@ bool mysql_show_binlog_events(THD* thd)
mysql_mutex_unlock(log_lock);
}
+ // Check that linfo is still on the function scope.
+ DEBUG_SYNC(thd, "after_show_binlog_events");
ret= FALSE;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 223e5c44fcf..0ed351b720c 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2010 Oracle and/or its affiliates.
- 2009-2011 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
@@ -271,6 +271,8 @@ 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);
/**
This handles SELECT with and without UNION.
@@ -987,7 +989,10 @@ JOIN::optimize()
}
eval_select_list_used_tables();
-
+
+ if (optimize_constant_subqueries())
+ DBUG_RETURN(1);
+
table_count= select_lex->leaf_tables.elements;
if (setup_ftfuncs(select_lex)) /* should be after having->fix_fields */
@@ -1274,6 +1279,12 @@ JOIN::optimize()
{
conds= substitute_for_best_equal_field(NO_PARTICULAR_TAB, conds,
cond_equal, map2table);
+ if (thd->is_error())
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from substitute_for_best_equal"));
+ DBUG_RETURN(1);
+ }
conds->update_used_tables();
DBUG_EXECUTE("where",
print_where(conds,
@@ -1294,6 +1305,12 @@ JOIN::optimize()
*tab->on_expr_ref,
tab->cond_equal,
map2table);
+ if (thd->is_error())
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from substitute_for_best_equal"));
+ DBUG_RETURN(1);
+ }
(*tab->on_expr_ref)->update_used_tables();
}
}
@@ -6615,6 +6632,32 @@ void JOIN::get_prefix_cost_and_fanout(uint n_tables,
/**
+ Estimate the number of rows that query execution will read.
+
+ @todo This is a very pessimistic upper bound. Use join selectivity
+ when available to produce a more realistic number.
+*/
+
+double JOIN::get_examined_rows()
+{
+ ha_rows examined_rows;
+ double prev_fanout= 1;
+ JOIN_TAB *tab= first_breadth_first_tab(this);
+ JOIN_TAB *prev_tab= tab;
+
+ examined_rows= tab->get_examined_rows();
+
+ while ((tab= next_breadth_first_tab(this, tab)))
+ {
+ prev_fanout *= prev_tab->records_read;
+ examined_rows+= tab->get_examined_rows() * prev_fanout;
+ prev_tab= tab;
+ }
+ return examined_rows;
+}
+
+
+/**
Find a good, possibly optimal, query execution plan (QEP) by a possibly
exhaustive search.
@@ -8061,36 +8104,15 @@ JOIN::make_simple_join(JOIN *parent, TABLE *temp_table)
row_limit= unit->select_limit_cnt;
do_send_rows= row_limit ? 1 : 0;
- join_tab->use_join_cache= FALSE;
- join_tab->cache=0; /* No caching */
+ bzero(join_tab, sizeof(JOIN_TAB));
join_tab->table=temp_table;
- join_tab->cache_select= 0;
- join_tab->select=0;
- join_tab->select_cond= 0; // Avoid valgrind warning
join_tab->set_select_cond(NULL, __LINE__);
- join_tab->quick=0;
join_tab->type= JT_ALL; /* Map through all records */
join_tab->keys.init();
join_tab->keys.set_all(); /* test everything in quick */
- join_tab->info=0;
- join_tab->on_expr_ref=0;
- join_tab->last_inner= 0;
- join_tab->first_unmatched= 0;
join_tab->ref.key = -1;
- join_tab->not_used_in_distinct=0;
join_tab->read_first_record= join_init_read_record;
- join_tab->preread_init_done= FALSE;
join_tab->join= this;
- join_tab->ref.key_parts= 0;
- join_tab->keep_current_rowid= FALSE;
- join_tab->flush_weedout_table= join_tab->check_weed_out_table= NULL;
- join_tab->do_firstmatch= NULL;
- join_tab->loosescan_match_tab= NULL;
- join_tab->emb_sj_nest= NULL;
- join_tab->pre_idx_push_select_cond= NULL;
- join_tab->bush_root_tab= NULL;
- join_tab->bush_children= NULL;
- join_tab->last_leaf_in_bush= FALSE;
bzero((char*) &join_tab->read_record,sizeof(join_tab->read_record));
temp_table->status=0;
temp_table->null_row=0;
@@ -10288,6 +10310,51 @@ double JOIN_TAB::scan_time()
return res;
}
+
+/**
+ Estimate the number of rows that a an access method will read from a table.
+
+ @todo: why not use JOIN_TAB::found_records
+*/
+
+ha_rows JOIN_TAB::get_examined_rows()
+{
+ ha_rows examined_rows;
+
+ if (select && select->quick)
+ examined_rows= select->quick->records;
+ else if (type == JT_NEXT || type == JT_ALL ||
+ type == JT_HASH || type ==JT_HASH_NEXT)
+ {
+ if (limit)
+ {
+ /*
+ @todo This estimate is wrong, a LIMIT query may examine much more rows
+ than the LIMIT itself.
+ */
+ examined_rows= limit;
+ }
+ else
+ {
+ if (table->is_filled_at_execution())
+ examined_rows= records;
+ else
+ {
+ /*
+ handler->info(HA_STATUS_VARIABLE) has been called in
+ make_join_statistics()
+ */
+ examined_rows= table->file->stats.records;
+ }
+ }
+ }
+ else
+ examined_rows= (ha_rows) records_read;
+
+ return examined_rows;
+}
+
+
/**
Initialize the join_tab before reading.
Currently only derived table/view materialization is done here.
@@ -10591,6 +10658,22 @@ void JOIN::cleanup(bool full)
tmp_join->tmp_table_param.save_copy_field= 0;
}
tmp_table_param.cleanup();
+
+ if (!join_tab)
+ {
+ List_iterator<TABLE_LIST> li(*join_list);
+ TABLE_LIST *table_ref;
+ while ((table_ref= li++))
+ {
+ if (table_ref->table &&
+ table_ref->jtbm_subselect &&
+ table_ref->jtbm_subselect->is_jtbm_const_tab)
+ {
+ free_tmp_table(thd, table_ref->table);
+ table_ref->table= NULL;
+ }
+ }
+ }
}
DBUG_VOID_RETURN;
}
@@ -11267,9 +11350,9 @@ static bool check_simple_equality(Item *left_item, Item *right_item,
if (!item)
{
Item_func_eq *eq_item;
- if ((eq_item= new Item_func_eq(orig_left_item, orig_right_item)))
+ if (!(eq_item= new Item_func_eq(orig_left_item, orig_right_item)) ||
+ eq_item->set_cmp_func())
return FALSE;
- eq_item->set_cmp_func();
eq_item->quick_fix_field();
item= eq_item;
}
@@ -11362,9 +11445,9 @@ static bool check_row_equality(THD *thd, Item *left_row, Item_row *right_row,
if (!is_converted)
{
Item_func_eq *eq_item;
- if (!(eq_item= new Item_func_eq(left_item, right_item)))
+ if (!(eq_item= new Item_func_eq(left_item, right_item)) ||
+ eq_item->set_cmp_func())
return FALSE;
- eq_item->set_cmp_func();
eq_item->quick_fix_field();
eq_list->push_back(eq_item);
}
@@ -12050,9 +12133,8 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
eq_item= new Item_func_eq(field_item->real_item(), head_item);
- if (!eq_item)
+ if (!eq_item || eq_item->set_cmp_func())
return 0;
- eq_item->set_cmp_func();
eq_item->quick_fix_field();
}
current_sjm= field_sjm;
@@ -12139,7 +12221,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
Item_equal::get_first() for details.
@return
- The transformed condition
+ The transformed condition, or NULL in case of error
*/
static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
@@ -18594,8 +18676,6 @@ check_reverse_order:
join_read_first:join_read_last;
tab->type=JT_NEXT; // Read with index_first(), index_next()
- if (table->covering_keys.is_set(best_key) && ! table->key_read)
- table->enable_keyread();
if (tab->pre_idx_push_select_cond)
{
tab->set_cond(tab->pre_idx_push_select_cond);
@@ -18606,6 +18686,7 @@ check_reverse_order:
orig_cond= 0;
orig_cond_saved= false;
}
+
table->file->ha_index_or_rnd_end();
if (tab->join->select_options & SELECT_DESCRIBE)
{
@@ -18613,6 +18694,7 @@ check_reverse_order:
tab->ref.key_parts= 0;
if (select_limit < table->file->stats.records)
tab->limit= select_limit;
+ table->disable_keyread();
}
}
else if (tab->type != JT_ALL)
@@ -20214,6 +20296,8 @@ copy_fields(TMP_TABLE_PARAM *param)
Copy_field *ptr=param->copy_field;
Copy_field *end=param->copy_field_end;
+ DBUG_ASSERT((ptr != NULL && end >= ptr) || (ptr == NULL && end == NULL));
+
for (; ptr != end; ptr++)
(*ptr->do_copy)(ptr);
@@ -21354,10 +21438,17 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
}
else
{
- TABLE_LIST *real_table= table->pos_in_table_list;
- item_list.push_back(new Item_string(real_table->alias,
- strlen(real_table->alias),
- cs));
+ 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));
}
/* "partitions" column */
if (join->thd->lex->describe & DESCRIBE_PARTITIONS)
@@ -21515,32 +21606,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
}
else
{
- ha_rows examined_rows;
- if (tab->select && tab->select->quick)
- examined_rows= tab->select->quick->records;
- else if (tab->type == JT_NEXT || tab->type == JT_ALL || is_hj)
- {
- if (tab->limit)
- examined_rows= tab->limit;
- else
- {
- if (tab->table->is_filled_at_execution())
- {
- examined_rows= tab->records;
- }
- else
- {
- /*
- handler->info(HA_STATUS_VARIABLE) has been called in
- make_join_statistics()
- */
- examined_rows= tab->table->file->stats.records;
- }
- }
- }
- else
- examined_rows=(ha_rows)tab->records_read;
-
+ ha_rows examined_rows= tab->get_examined_rows();
+
item_list.push_back(new Item_int((longlong) (ulonglong) examined_rows,
MY_INT64_NUM_DECIMAL_DIGITS));
diff --git a/sql/sql_select.h b/sql/sql_select.h
index c4553148cc6..0ed976ac36a 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -512,6 +512,7 @@ typedef struct st_join_table {
return (is_hash_join_key_no(key) ? hj_key : table->key_info+key);
}
double scan_time();
+ ha_rows get_examined_rows();
bool preread_init();
bool is_sjm_nest() { return test(bush_children); }
@@ -1281,6 +1282,7 @@ public:
bool alloc_func_list();
bool flatten_subqueries();
bool optimize_unflattened_subqueries();
+ bool optimize_constant_subqueries();
bool make_sum_func_list(List<Item> &all_fields, List<Item> &send_fields,
bool before_group_by, bool recompute= FALSE);
@@ -1380,6 +1382,7 @@ public:
void get_prefix_cost_and_fanout(uint n_tables,
double *read_time_arg,
double *record_count_arg);
+ double get_examined_rows();
/* defined in opt_subselect.cc */
bool transform_max_min_subquery();
/* True if this JOIN is a subquery under an IN predicate. */
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 82647df6756..5eb8c8da039 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2009, 2011, Monty Program Ab
+ 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
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index ef05a472ab7..04cf6a479ec 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -238,10 +238,17 @@ uint explain_filename(THD* thd,
{
part_name_len= tmp_p - part_name - 1;
subpart_name= tmp_p + 3;
+ tmp_p+= 3;
+ }
+ else if ((tmp_p[1] == 'Q' || tmp_p[1] == 'q') &&
+ (tmp_p[2] == 'L' || tmp_p[2] == 'l') &&
+ tmp_p[3] == '-')
+ {
+ name_type= TEMP;
+ tmp_p+= 4; /* sql- prefix found */
}
else
res= 2;
- tmp_p+= 3;
break;
case 'T':
case 't':
@@ -1937,6 +1944,49 @@ 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)
+{
+ const char *query= thd->query();
+ const char *query_end= query + thd->query_length();
+ const uchar *const state_map= thd->charset()->state_map;
+
+ for (; query < query_end; query++)
+ {
+ if (state_map[*query] == MY_LEX_SKIP)
+ continue;
+ if (comment_pos-- == 0)
+ break;
+ }
+ if (query > query_end - 3 /* comment can't be shorter than 4 */ ||
+ state_map[*query] != MY_LEX_LONG_COMMENT || query[1] != '*')
+ return 0;
+
+ *comment_start= query;
+
+ for (query+= 3; query < query_end; query++)
+ {
+ if (query[-1] == '*' && query[0] == '/')
+ return query - *comment_start + 1;
+ }
+ return 0;
+}
+
+
+/**
Execute the drop of a normal or temporary table.
@param thd Thread handler
@@ -2011,11 +2061,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)
@@ -6935,21 +6994,47 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
(void) quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP);
}
else if (mysql_rename_table(new_db_type, new_db, tmp_name, new_db,
- new_alias, FN_FROM_IS_TMP) ||
- ((new_name != table_name || new_db != db) && // we also do rename
- (need_copy_table != ALTER_TABLE_METADATA_ONLY ||
- mysql_rename_table(save_old_db_type, db, table_name, new_db,
- new_alias, NO_FRM_RENAME)) &&
- Table_triggers_list::change_table_name(thd, db, alias, table_name,
- new_db, new_alias)))
+ new_alias, FN_FROM_IS_TMP))
{
/* Try to get everything back. */
- error=1;
- (void) quick_rm_table(new_db_type,new_db,new_alias, 0);
+ error= 1;
(void) quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP);
(void) mysql_rename_table(old_db_type, db, old_name, db, alias,
FN_FROM_IS_TMP);
}
+ else if (new_name != table_name || new_db != db)
+ {
+ if (need_copy_table == ALTER_TABLE_METADATA_ONLY &&
+ mysql_rename_table(save_old_db_type, db, table_name, new_db,
+ new_alias, NO_FRM_RENAME))
+ {
+ /* Try to get everything back. */
+ error= 1;
+ (void) quick_rm_table(new_db_type, new_db, new_alias, 0);
+ (void) mysql_rename_table(old_db_type, db, old_name, db, alias,
+ FN_FROM_IS_TMP);
+ }
+ else if (Table_triggers_list::change_table_name(thd, db, alias,
+ table_name, new_db,
+ new_alias))
+ {
+ /* Try to get everything back. */
+ error= 1;
+ (void) quick_rm_table(new_db_type, new_db, new_alias, 0);
+ (void) mysql_rename_table(old_db_type, db, old_name, db,
+ alias, FN_FROM_IS_TMP);
+ /*
+ If we were performing "fast"/in-place ALTER TABLE we also need
+ to restore old name of table in storage engine as a separate
+ step, as the above rename affects .FRM only.
+ */
+ if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
+ {
+ (void) mysql_rename_table(save_old_db_type, new_db, new_alias,
+ db, table_name, NO_FRM_RENAME);
+ }
+ }
+ }
if (! error)
(void) quick_rm_table(old_db_type, db, old_name, FN_IS_TMP);
@@ -7369,7 +7454,10 @@ err:
thd_progress_next_stage(thd);
if (error > 0)
+ {
+ /* We are going to drop the temporary table */
to->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
+ }
if (errpos >= 3 && to->file->ha_end_bulk_insert() && error <= 0)
{
to->file->print_error(my_errno,MYF(0));
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 53abf1bbe15..2a24f6d2bdf 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -368,7 +368,7 @@ int mysql_update(THD *thd,
}
/* Apply the IN=>EXISTS transformation to all subqueries and optimize them. */
- if (select_lex->optimize_unflattened_subqueries())
+ if (select_lex->optimize_unflattened_subqueries(false))
DBUG_RETURN(TRUE);
if (select_lex->inner_refs_list.elements &&
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index e968dd12ca0..4e3629080be 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -9823,7 +9823,9 @@ table_factor:
lex->nest_level--;
}
else if (($3->select_lex &&
- $3->select_lex->master_unit()->is_union()) || $5)
+ $3->select_lex->master_unit()->is_union() &&
+ ($3->select_lex->master_unit()->first_select() ==
+ $3->select_lex || !$3->lifted)) || $5)
{
/* simple nested joins cannot have aliases or unions */
my_parse_error(ER(ER_SYNTAX_ERROR));
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 49fc526a16f..b7e5feaa8a2 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2246,7 +2246,7 @@ static char *system_time_zone_ptr;
static Sys_var_charptr Sys_system_time_zone(
"system_time_zone", "The server system time zone",
READ_ONLY GLOBAL_VAR(system_time_zone_ptr), NO_CMD_LINE,
- IN_FS_CHARSET, DEFAULT(system_time_zone));
+ IN_SYSTEM_CHARSET, DEFAULT(system_time_zone));
static Sys_var_ulong Sys_table_def_size(
"table_definition_cache",
@@ -3603,12 +3603,13 @@ static Sys_var_charptr Sys_wsrep_cluster_name(
ON_CHECK(wsrep_cluster_name_check),
ON_UPDATE(wsrep_cluster_name_update));
+static PolyLock_mutex PLock_wsrep_slave_threads(&LOCK_wsrep_slave_threads);
static Sys_var_charptr Sys_wsrep_cluster_address (
"wsrep_cluster_address", "Address to initially connect to cluster",
GLOBAL_VAR(wsrep_cluster_address),
CMD_LINE(REQUIRED_ARG, OPT_WSREP_CLUSTER_ADDRESS),
IN_FS_CHARSET, DEFAULT(wsrep_cluster_address),
- NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ &PLock_wsrep_slave_threads, NOT_IN_BINLOG,
ON_CHECK(wsrep_cluster_address_check),
ON_UPDATE(wsrep_cluster_address_update));
@@ -3637,7 +3638,10 @@ static Sys_var_charptr Sys_wsrep_node_incoming_address(
static Sys_var_ulong Sys_wsrep_slave_threads(
"wsrep_slave_threads", "Number of slave appliers to launch",
GLOBAL_VAR(wsrep_slave_threads), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1, 512), DEFAULT(1), BLOCK_SIZE(1));
+ VALID_RANGE(1, 512), DEFAULT(1), BLOCK_SIZE(1),
+ &PLock_wsrep_slave_threads, NOT_IN_BINLOG,
+ ON_CHECK(wsrep_slave_threads_check),
+ ON_UPDATE(wsrep_slave_threads_update));
static Sys_var_charptr Sys_wsrep_dbug_option(
"wsrep_dbug_option", "DBUG options to provider library",
@@ -3674,7 +3678,7 @@ static Sys_var_mybool Sys_wsrep_drupal_282555_workaround(
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_charptr sys_wsrep_sst_method(
- "wsrep_sst_method", "Snapshot transfer method",
+ "wsrep_sst_method", "State snapshot transfer method",
GLOBAL_VAR(wsrep_sst_method),CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(wsrep_sst_method), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_sst_method_check),
@@ -3704,6 +3708,12 @@ static Sys_var_charptr Sys_wsrep_sst_donor(
ON_CHECK(wsrep_sst_donor_check),
ON_UPDATE(wsrep_sst_donor_update));
+static Sys_var_mybool Sys_wsrep_sst_donor_rejects_queries(
+ "wsrep_sst_donor_rejects_queries", "Reject client queries "
+ "when donating state snapshot transfer",
+ GLOBAL_VAR(wsrep_sst_donor_rejects_queries),
+ CMD_LINE(OPT_ARG), DEFAULT(FALSE));
+
static Sys_var_mybool Sys_wsrep_on (
"wsrep_on", "To enable wsrep replication ",
SESSION_VAR(wsrep_on),
@@ -3971,4 +3981,9 @@ static Sys_var_ulong Sys_debug_binlog_fsync_sleep(
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
#endif
-
+static Sys_var_harows Sys_expensive_subquery_limit(
+ "expensive_subquery_limit",
+ "The maximum number of rows a subquery may examine in order to be "
+ "executed during optimization and used for constant optimization",
+ SESSION_VAR(expensive_subquery_limit), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, HA_POS_ERROR), DEFAULT(100), BLOCK_SIZE(1));
diff --git a/sql/table.cc b/sql/table.cc
index 40304dc6fdc..b8161093e9a 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1439,25 +1439,33 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
/*
Get virtual column data stored in the .frm file as follows:
- byte 1 = 1 (always 1 to allow for future extensions)
+ byte 1 = 1 | 2
byte 2 = sql_type
byte 3 = flags (as of now, 0 - no flags, 1 - field is physically stored)
- byte 4-... = virtual column expression (text data)
+ [byte 4] = optional interval_id for sql_type (only if byte 1 == 2)
+ next byte ... = virtual column expression (text data)
*/
vcol_info= new Virtual_column_info();
- if ((uint)vcol_screen_pos[0] != 1)
+ bool opt_interval_id= (uint)vcol_screen_pos[0] == 2;
+ field_type= (enum_field_types) (uchar) vcol_screen_pos[1];
+ if (opt_interval_id)
+ interval_nr= (uint)vcol_screen_pos[3];
+ else if ((uint)vcol_screen_pos[0] != 1)
{
error= 4;
goto err;
}
- field_type= (enum_field_types) (uchar) vcol_screen_pos[1];
fld_stored_in_db= (bool) (uint) vcol_screen_pos[2];
- vcol_expr_length= vcol_info_length-(uint)FRM_VCOL_HEADER_SIZE;
+ vcol_expr_length= vcol_info_length -
+ (uint)(FRM_VCOL_HEADER_SIZE(opt_interval_id));
if (!(vcol_info->expr_str.str=
(char *)memdup_root(&share->mem_root,
- vcol_screen_pos+(uint)FRM_VCOL_HEADER_SIZE,
+ vcol_screen_pos +
+ (uint) FRM_VCOL_HEADER_SIZE(opt_interval_id),
vcol_expr_length)))
goto err;
+ if (opt_interval_id)
+ interval_nr= (uint) vcol_screen_pos[3];
vcol_info->expr_str.length= vcol_expr_length;
vcol_screen_pos+= vcol_info_length;
share->vfields++;
@@ -4536,7 +4544,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)
{
@@ -5985,7 +6000,13 @@ void TABLE::use_index(int key_to_save)
bool TABLE::is_filled_at_execution()
{
- return test(pos_in_table_list->jtbm_subselect ||
+ /*
+ pos_in_table_list == NULL for internal temporary tables because they
+ do not have a corresponding table reference. Such tables are filled
+ during execution.
+ */
+ return test(!pos_in_table_list ||
+ pos_in_table_list->jtbm_subselect ||
pos_in_table_list->is_active_sjm());
}
diff --git a/sql/table.h b/sql/table.h
index f3f9d5ac036..87affe984fc 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1800,6 +1800,8 @@ struct TABLE_LIST
struct st_nested_join *nested_join; /* if the element is a nested join */
TABLE_LIST *embedding; /* nested join containing the table */
List<TABLE_LIST> *join_list;/* join list the table belongs to */
+ bool lifted; /* set to true when the table is moved to
+ the upper level at the parsing stage */
bool cacheable_table; /* stop PS caching */
/* used in multi-upd/views privilege check */
bool table_in_first_from_clause;
diff --git a/sql/unireg.cc b/sql/unireg.cc
index c9b0f91d9f7..edcfe9eb934 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -726,18 +726,19 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
}
if (field->vcol_info)
{
+ uint col_expr_maxlen= field->virtual_col_expr_maxlen();
tmp_len=
system_charset_info->cset->charpos(system_charset_info,
field->vcol_info->expr_str.str,
field->vcol_info->expr_str.str +
field->vcol_info->expr_str.length,
- VIRTUAL_COLUMN_EXPRESSION_MAXLEN);
+ col_expr_maxlen);
if (tmp_len < field->vcol_info->expr_str.length)
{
my_error(ER_WRONG_STRING_LENGTH, MYF(0),
field->vcol_info->expr_str.str,"VIRTUAL COLUMN EXPRESSION",
- (uint) VIRTUAL_COLUMN_EXPRESSION_MAXLEN);
+ col_expr_maxlen);
DBUG_RETURN(1);
}
/*
@@ -746,7 +747,7 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
expressions saved in the frm file for virtual columns.
*/
vcol_info_length+= field->vcol_info->expr_str.length+
- (uint)FRM_VCOL_HEADER_SIZE;
+ FRM_VCOL_HEADER_SIZE(field->interval!=NULL);
}
totlength+= field->length;
@@ -949,8 +950,9 @@ static bool pack_fields(File file, List<Create_field> &create_fields,
the additional data saved for the virtual field
*/
buff[12]= cur_vcol_expr_len= field->vcol_info->expr_str.length +
- (uint)FRM_VCOL_HEADER_SIZE;
- vcol_info_length+= cur_vcol_expr_len+(uint)FRM_VCOL_HEADER_SIZE;
+ FRM_VCOL_HEADER_SIZE(field->interval!=NULL);
+ vcol_info_length+= cur_vcol_expr_len +
+ FRM_VCOL_HEADER_SIZE(field->interval!=NULL);
buff[13]= (uchar) MYSQL_TYPE_VIRTUAL;
}
int2store(buff+15, field->comment.length);
@@ -1055,17 +1057,20 @@ static bool pack_fields(File file, List<Create_field> &create_fields,
{
/*
Pack each virtual field as follows:
- byte 1 = 1 (always 1 to allow for future extensions)
+ byte 1 = interval_id == 0 ? 1 : 2
byte 2 = sql_type
byte 3 = flags (as of now, 0 - no flags, 1 - field is physically stored)
- byte 4-... = virtual column expression (text data)
+ [byte 4] = possible interval_id for sql_type
+ next byte ... = virtual column expression (text data)
*/
if (field->vcol_info && field->vcol_info->expr_str.length)
{
- buff[0]= (uchar)1;
+ buff[0]= (uchar)(1 + test(field->interval_id));
buff[1]= (uchar) field->sql_type;
buff[2]= (uchar) field->stored_in_db;
- if (my_write(file, buff, 3, MYF_RW))
+ if (field->interval_id)
+ buff[3]= (uchar) field->interval_id;
+ if (my_write(file, buff, 3 + test(field->interval_id), MYF_RW))
DBUG_RETURN(1);
if (my_write(file,
(uchar*) field->vcol_info->expr_str.str,
diff --git a/sql/unireg.h b/sql/unireg.h
index f8317a89c8c..da510bb4e6d 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -161,12 +161,6 @@ typedef struct st_ha_create_information HA_CREATE_INFO;
#define DEFAULT_KEY_CACHE_NAME "default"
-/* The length of the header part for each virtual column in the .frm file */
-#define FRM_VCOL_HEADER_SIZE 3
-
-/* Maximum length of the defining expression for a virtual columns */
-#define VIRTUAL_COLUMN_EXPRESSION_MAXLEN 255 - FRM_VCOL_HEADER_SIZE
-
/* Include prototypes for unireg */
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index 49b3ea5c0bf..219e0e8a244 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -216,7 +216,7 @@ wsrep_run_wsrep_commit(
if (thd->wsrep_exec_mode != LOCAL_STATE) {
DBUG_RETURN(WSREP_TRX_OK);
}
- if (thd->wsrep_consistency_check) {
+ if (thd->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING) {
WSREP_DEBUG("commit for consistency check: %s", thd->query());
DBUG_RETURN(WSREP_TRX_OK);
}
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 0bf0c2294d3..a5d7134a201 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -326,15 +326,27 @@ out:
local_status.set(new_status, view);
}
+void wsrep_ready_set (my_bool x)
+{
+ WSREP_DEBUG("Setting wsrep_ready to %d", x);
+ if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort();
+ if (wsrep_ready != x)
+ {
+ wsrep_ready= x;
+ mysql_cond_signal (&COND_wsrep_ready);
+ }
+ mysql_mutex_unlock (&LOCK_wsrep_ready);
+}
+
// Wait until wsrep has reached ready state
void wsrep_ready_wait ()
{
if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort();
while (!wsrep_ready)
- {
- WSREP_INFO("Waiting to reach ready state");
- mysql_cond_wait (&COND_wsrep_ready, &LOCK_wsrep_ready);
- }
+ {
+ WSREP_INFO("Waiting to reach ready state");
+ mysql_cond_wait (&COND_wsrep_ready, &LOCK_wsrep_ready);
+ }
WSREP_INFO("ready state reached");
mysql_mutex_unlock (&LOCK_wsrep_ready);
}
@@ -1127,17 +1139,17 @@ void wsrep_to_isolation_end(THD *thd) {
}
}
-#define WSREP_MDL_LOG(severity, msg, req, gra) \
- WSREP_##severity( \
- "%s\n" \
- "request: (%lu \tseqno %lld \tmode %d \tQstate \t%d cmd %d %d \t%s)\n" \
- "granted: (%lu \tseqno %lld \tmode %d \tQstate \t%d cmd %d %d \t%s)", \
- msg, \
- req->thread_id, (long long)req->wsrep_trx_seqno, \
- req->wsrep_exec_mode, req->wsrep_query_state, \
- req->command, req->lex->sql_command, req->query(), \
- gra->thread_id, (long long)gra->wsrep_trx_seqno, \
- gra->wsrep_exec_mode, gra->wsrep_query_state, \
+#define WSREP_MDL_LOG(severity, msg, req, gra) \
+ WSREP_##severity( \
+ "%s\n" \
+ "request: (%lu \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)\n" \
+ "granted: (%lu \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)", \
+ msg, \
+ req->thread_id, (long long)req->wsrep_trx_seqno, \
+ req->wsrep_exec_mode, req->wsrep_query_state, req->wsrep_conflict_state, \
+ req->command, req->lex->sql_command, req->query(), \
+ gra->thread_id, (long long)gra->wsrep_trx_seqno, \
+ gra->wsrep_exec_mode, gra->wsrep_query_state, gra->wsrep_conflict_state, \
gra->command, gra->lex->sql_command, gra->query());
bool
@@ -1154,7 +1166,7 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
request_thd->wsrep_exec_mode == REPL_RECV)
{
mysql_mutex_unlock(&request_thd->LOCK_wsrep_thd);
- WSREP_MDL_LOG(DEBUG, "MDL conflict", request_thd, granted_thd);
+ WSREP_MDL_LOG(DEBUG, "MDL conflict ", request_thd, granted_thd);
mysql_mutex_lock(&granted_thd->LOCK_wsrep_thd);
if (granted_thd->wsrep_exec_mode == TOTAL_ORDER ||
@@ -1183,7 +1195,7 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd);
wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1);
return FALSE;
- }
+ }
else
{
WSREP_MDL_LOG(DEBUG, "MDL conflict-> BF abort", request_thd, granted_thd);
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index ebea44c9151..968281a2c98 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -50,6 +50,7 @@ extern const char* wsrep_sst_method;
extern const char* wsrep_sst_receive_address;
extern char* wsrep_sst_auth;
extern const char* wsrep_sst_donor;
+extern my_bool wsrep_sst_donor_rejects_queries;
extern const char* wsrep_start_position;
extern long long wsrep_max_ws_size;
extern long wsrep_max_ws_rows;
@@ -129,6 +130,8 @@ extern void wsrep_sst_auth_init INIT_ARGS;
extern bool wsrep_sst_donor_check CHECK_ARGS;
extern bool wsrep_sst_donor_update UPDATE_ARGS;
+extern bool wsrep_slave_threads_check CHECK_ARGS;
+extern bool wsrep_slave_threads_update UPDATE_ARGS;
extern bool wsrep_init_first(); // initialize wsrep before storage
// engines (true) or after (false)
@@ -142,7 +145,8 @@ extern void wsrep_init_startup(bool first);
extern void wsrep_close_client_connections(my_bool wait_to_end);
extern void wsrep_close_applier(THD *thd);
-extern void wsrep_wait_appliers_close(THD *thd);
+extern void wsrep_wait_appliers_close(THD *thd);
+extern void wsrep_close_applier_threads(int count);
extern void wsrep_create_appliers(long threads = wsrep_slave_threads);
extern void wsrep_create_rollbacker();
extern void wsrep_kill_mysql(THD *thd);
@@ -250,6 +254,7 @@ extern long long wsrep_max_ws_size;
extern long wsrep_max_ws_rows;
extern int wsrep_to_isolation;
extern my_bool wsrep_certify_nonPK;
+extern mysql_mutex_t LOCK_wsrep_slave_threads;
extern PSI_mutex_key key_LOCK_wsrep_ready;
extern PSI_mutex_key key_COND_wsrep_ready;
@@ -263,6 +268,7 @@ extern PSI_mutex_key key_LOCK_wsrep_rollback;
extern PSI_cond_key key_COND_wsrep_rollback;
extern PSI_mutex_key key_LOCK_wsrep_replaying;
extern PSI_cond_key key_COND_wsrep_replaying;
+extern PSI_mutex_key key_LOCK_wsrep_slave_threads;
struct TABLE_LIST;
int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
diff --git a/sql/wsrep_priv.h b/sql/wsrep_priv.h
index 4db8abf68de..32d0cebfd33 100644
--- a/sql/wsrep_priv.h
+++ b/sql/wsrep_priv.h
@@ -26,6 +26,8 @@
#include <pthread.h>
#include <cstdio>
+extern void wsrep_ready_set (my_bool x);
+
extern ssize_t wsrep_sst_prepare (void** msg);
extern int wsrep_sst_donate_cb (void* app_ctx,
void* recv_ctx,
@@ -38,8 +40,8 @@ extern int wsrep_sst_donate_cb (void* app_ctx,
extern size_t default_ip (char* buf, size_t buf_len);
extern size_t default_address(char* buf, size_t buf_len);
-extern wsrep_uuid_t local_uuid;
-extern wsrep_seqno_t local_seqno;
+extern wsrep_uuid_t local_uuid;
+extern wsrep_seqno_t local_seqno;
/*! SST thread signals init thread about sst completion */
extern void wsrep_sst_complete(wsrep_uuid_t* uuid, wsrep_seqno_t seqno, bool);
@@ -212,7 +214,7 @@ class thd
public:
- thd();
+ thd(my_bool wsrep_on);
~thd();
THD* const ptr;
};
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 37779c4b96d..df39db3caa4 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -39,6 +39,8 @@ const char* wsrep_sst_donor = "";
// container for real auth string
static const char* sst_auth_real = NULL;
+my_bool wsrep_sst_donor_rejects_queries = FALSE;
+
static const char *sst_methods[] = {
"mysqldump",
"rsync",
@@ -597,6 +599,13 @@ static int sst_run_shell (const char* cmd_str, int max_tries)
return -ret;
}
+static void sst_reject_queries(my_bool close_conn)
+{
+ wsrep_ready_set (FALSE); // this will be resotred when donor becomes synced
+ WSREP_INFO("Rejecting client queries for the duration of SST.");
+ if (TRUE == close_conn) wsrep_close_client_connections(FALSE);
+}
+
static int sst_mysqldump_check_addr (const char* user, const char* pswd,
const char* host, const char* port)
{
@@ -654,6 +663,8 @@ static int sst_donate_mysqldump (const char* addr,
size_t cmd_len= 1024;
char cmd_str[cmd_len];
+ if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(TRUE);
+
snprintf (cmd_str, cmd_len,
"wsrep_sst_mysqldump '%s' '%s' '%s' '%s' '%u' '%s' '%lld' '%d'",
user, pswd, host, port, mysqld_port, uuid_str, (long long)seqno,
@@ -781,7 +792,8 @@ static void* sst_donor_thread (void* a)
wsrep_uuid_t ret_uuid= WSREP_UUID_UNDEFINED;
wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED; // seqno of complete SST
- wsp::thd thd;
+ wsp::thd thd(FALSE); // we turn off wsrep_on for this THD so that it can
+ // operate with wsrep_ready == OFF
wsp::process proc(arg->cmd, "r");
err= proc.error();
@@ -880,6 +892,8 @@ static int sst_donate_other (const char* method,
return (ret < 0 ? ret : -EMSGSIZE);
}
+ if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(FALSE);
+
pthread_t tmp;
sst_thread_arg arg(cmd_str);
mysql_mutex_lock (&arg.lock);
diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc
index a6d7dcdbfc8..00919b3163e 100644
--- a/sql/wsrep_utils.cc
+++ b/sql/wsrep_utils.cc
@@ -289,13 +289,14 @@ process::wait ()
return err_;
}
-thd::thd () : init(), ptr(new THD)
+thd::thd (my_bool won) : init(), ptr(new THD)
{
if (ptr)
{
ptr->thread_stack= (char*) &ptr;
ptr->store_globals();
ptr->variables.option_bits&= ~OPTION_BIN_LOG; // disable binlog
+ ptr->variables.wsrep_on = won;
ptr->security_ctx->master_access= ~(ulong)0;
lex_start(ptr);
}
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index 66f0f05c006..fb5c3b339cd 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -35,6 +35,7 @@ const char* wsrep_node_name = glob_hostname;
static char node_address[256] = { 0, };
const char* wsrep_node_address = node_address;
ulong wsrep_OSU_method_options;
+static int wsrep_thread_change = 0;
int wsrep_init_vars()
{
@@ -419,6 +420,27 @@ void wsrep_node_address_init (const char* value)
wsrep_node_address = (value) ? my_strdup(value, MYF(0)) : NULL;
}
+bool wsrep_slave_threads_check (sys_var *self, THD* thd, set_var* var)
+{
+ mysql_mutex_lock(&LOCK_wsrep_slave_threads);
+ wsrep_thread_change = var->value->val_int() - wsrep_slave_threads;
+ mysql_mutex_unlock(&LOCK_wsrep_slave_threads);
+
+ return 0;
+}
+
+bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type)
+{
+ if (wsrep_thread_change > 0)
+ {
+ wsrep_create_appliers(wsrep_thread_change);
+ }
+ else if (wsrep_thread_change < 0)
+ {
+ wsrep_close_applier_threads(-wsrep_thread_change);
+ }
+ return false;
+}
/*
* Status variables stuff below
*/
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 6c8eba08afb..812623314bf 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2005, 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
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/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
index e227e47b52f..9c61e0cf763 100644
--- a/storage/innobase/btr/btr0cur.c
+++ b/storage/innobase/btr/btr0cur.c
@@ -3463,6 +3463,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/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
index 6e8e8fdda5a..7cd09d6675e 100644
--- a/storage/innobase/buf/buf0flu.c
+++ b/storage/innobase/buf/buf0flu.c
@@ -1750,8 +1750,6 @@ buf_flush_batch(
}
#endif /* UNIV_DEBUG */
- srv_buf_pool_flushed += count;
-
return(count);
}
@@ -1778,13 +1776,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/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
index 44a0ec5b338..22f0d4456d5 100644
--- a/storage/innobase/dict/dict0load.c
+++ b/storage/innobase/dict/dict0load.c
@@ -177,7 +177,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);
@@ -214,7 +214,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/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index 2390333b393..0a467d40345 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -1908,7 +1908,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);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index a0b4ec43dad..0b3ea633829 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -4279,6 +4279,31 @@ 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) {
+ DBUG_ASSERT(new_handler->prebuilt != NULL);
+ DBUG_ASSERT(new_handler->user_thd == user_thd);
+ DBUG_ASSERT(new_handler->prebuilt->trx == prebuilt->trx);
+
+ 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
{
@@ -6940,13 +6965,15 @@ wsrep_append_foreign_key(
/*===========================*/
trx_t* trx, /*!< in: trx */
dict_foreign_t* foreign, /*!< in: foreign key constraint */
- const rec_t* clust_rec, /*!<in: clustered index record */
- dict_index_t* clust_index, /*!<in: clustered index */
+ const rec_t* rec, /*!<in: clustered index record */
+ dict_index_t* index, /*!<in: clustered index */
+ ibool referenced, /*!<in: is check for referenced table */
ibool shared) /*!<in: is shared access */
{
THD* thd = (THD*)trx->mysql_thd;
ulint rcode = DB_SUCCESS;
char cache_key[512] = {'\0'};
+ int cache_key_len;
if (!wsrep_on(trx->mysql_thd) ||
wsrep_thd_exec_mode(thd) != LOCAL_STATE)
@@ -6955,39 +6982,55 @@ wsrep_append_foreign_key(
byte key[WSREP_MAX_SUPPORTED_KEY_LENGTH+1];
ulint len = WSREP_MAX_SUPPORTED_KEY_LENGTH;
- key[0] = '\0';
+ dict_index_t *idx_target = (referenced) ?
+ foreign->referenced_index : foreign->foreign_index;
+ dict_index_t *idx = (referenced) ?
+ UT_LIST_GET_FIRST(foreign->referenced_table->indexes) :
+ UT_LIST_GET_FIRST(foreign->foreign_table->indexes);
+ int i = 0;
+ while (idx != NULL && idx != idx_target) {
+ idx = UT_LIST_GET_NEXT(indexes, idx);
+ i++;
+ }
+ ut_a(idx);
+ key[0] = (char)i;
+
rcode = wsrep_rec_get_primary_key(
- &key[1], &len, clust_rec, clust_index,
+ &key[1], &len, rec, index,
wsrep_protocol_version > 1);
if (rcode != DB_SUCCESS) {
WSREP_ERROR("FK key set failed: %lu", rcode);
return rcode;
}
+ strncpy(cache_key,
+ (wsrep_protocol_version > 1) ?
+ ((referenced) ?
+ foreign->referenced_table->name :
+ foreign->foreign_table->name) :
+ foreign->foreign_table->name, 512);
+ cache_key_len = strlen(cache_key);
#ifdef WSREP_DEBUG_PRINT
- ulint i;
- fprintf(stderr, "FK parent key, table: %s shared: %d len: %lu ",
- foreign->referenced_table_name, (int)shared, len+1);
- for (i=0; i<len+1; i++) {
- fprintf(stderr, " %hhX, ", key[i]);
+ ulint j;
+ fprintf(stderr, "FK parent key, table: %s %s len: %lu ",
+ cache_key, (shared) ? "shared" : "exclusive", len+1);
+ for (j=0; j<len+1; j++) {
+ fprintf(stderr, " %hhX, ", key[j]);
}
fprintf(stderr, "\n");
#endif
- strncpy(cache_key, (wsrep_protocol_version > 1) ?
- foreign->referenced_table->name :
- foreign->foreign_table->name, 512);
char *p = strchr(cache_key, '/');
if (p) {
*p = '\0';
} else {
- WSREP_WARN("unexpected foreign key table %s",
- foreign->foreign_table->name);
+ WSREP_WARN("unexpected foreign key table %s %s",
+ foreign->referenced_table->name, foreign->foreign_table->name);
}
wsrep_key_part_t wkey_part[3];
wsrep_key_t wkey = {wkey_part, 3};
if (!wsrep_prepare_key_for_innodb(
(const uchar*)cache_key,
- strlen(foreign->foreign_table->name) + 1,
+ cache_key_len + 1,
(const uchar*)key, len+1,
wkey_part,
&wkey.key_parts_len)) {
@@ -7066,6 +7109,23 @@ wsrep_append_key(
}
DBUG_RETURN(0);
}
+
+ibool
+wsrep_is_cascding_foreign_key_parent(
+ dict_table_t* table, /*!< in: InnoDB table */
+ dict_index_t* index /*!< in: InnoDB index */
+) {
+ // return referenced_by_foreign_key();
+ dict_foreign_t* fk = dict_table_get_referenced_constraint(table, index);
+ if (fk &&
+ (fk->type & DICT_FOREIGN_ON_UPDATE_CASCADE ||
+ fk->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)
+ ) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
int
ha_innobase::wsrep_append_keys(
/*==================*/
@@ -7134,7 +7194,9 @@ ha_innobase::wsrep_append_keys(
keyval0[0] = (char)i;
keyval1[0] = (char)i;
- if (key_info->flags & HA_NOSAME) {
+ if (key_info->flags & HA_NOSAME ||
+ referenced_by_foreign_key()) {
+
len = wsrep_store_key_val_for_row(
table, i, key0, key_info->key_length,
record0, &is_null);
@@ -9280,7 +9342,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);
@@ -9421,7 +9483,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 = "";
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 8b3b63bd9fb..8f211d6e38c 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -137,6 +137,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/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 90accf471a2..10e4544c85a 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -266,6 +266,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 mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
index 99a2cdc9b73..b24bd05e0b3 100644
--- a/storage/innobase/lock/lock0lock.c
+++ b/storage/innobase/lock/lock0lock.c
@@ -2106,8 +2106,9 @@ lock_rec_lock_fast(
ut_ad(mode - (LOCK_MODE_MASK & mode) == LOCK_GAP
|| mode - (LOCK_MODE_MASK & mode) == 0
#ifdef WITH_WSREP
- || mode - (LOCK_MODE_MASK & mode) == WSREP_BF
- || mode - (LOCK_MODE_MASK & mode) - LOCK_REC_NOT_GAP == WSREP_BF
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == 0
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_GAP
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_REC_NOT_GAP
#endif /* WITH_WSREP */
|| mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP);
@@ -2191,8 +2192,9 @@ lock_rec_lock_slow(
ut_ad(mode - (LOCK_MODE_MASK & mode) == LOCK_GAP
|| mode - (LOCK_MODE_MASK & mode) == 0
#ifdef WITH_WSREP
- || mode - (LOCK_MODE_MASK & mode) == WSREP_BF
- || mode - (LOCK_MODE_MASK & mode) - LOCK_REC_NOT_GAP == WSREP_BF
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == 0
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_GAP
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_REC_NOT_GAP
#endif /* WITH_WSREP */
|| mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP);
@@ -2266,8 +2268,9 @@ lock_rec_lock(
ut_ad(mode - (LOCK_MODE_MASK & mode) == LOCK_GAP
|| mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP
#ifdef WITH_WSREP
- || mode - (LOCK_MODE_MASK & mode) == WSREP_BF
- || mode - (LOCK_MODE_MASK & mode) - LOCK_REC_NOT_GAP == WSREP_BF
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == 0
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_GAP
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_REC_NOT_GAP
#endif /* WITH_WSREP */
|| mode - (LOCK_MODE_MASK & mode) == 0);
#ifdef WITH_WSREP
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/os/os0file.c b/storage/innobase/os/os0file.c
index cc8dff3b621..6ba27d1af9c 100644
--- a/storage/innobase/os/os0file.c
+++ b/storage/innobase/os/os0file.c
@@ -3382,12 +3382,23 @@ os_aio_array_create(
if (!os_aio_linux_create_io_ctx(n/n_segments,
&array->aio_ctx[i])) {
/* If something bad happened during aio setup
- we should call it a day and return right away.
- We don't care about any leaks because a failure
- to initialize the io subsystem means that the
- server (or atleast the innodb storage engine)
- is not going to startup. */
- return(NULL);
+ we disable linux native aio.
+ The disadvantage will be a small memory leak
+ at shutdown but that's ok compared to a crash
+ or a not working server.
+ This frequently happens when running the test suite
+ with many threads on a system with low fs.aio-max-nr!
+ */
+
+ fprintf(stderr,
+ " InnoDB: Warning: Linux Native AIO disabled "
+ "because os_aio_linux_create_io_ctx() "
+ "failed. To get rid of this warning you can "
+ "try increasing system "
+ "fs.aio-max-nr to 1048576 or larger or "
+ "setting innodb_use_native_aio = 0 in my.cnf\n");
+ srv_use_native_aio = FALSE;
+ goto skip_native_aio;
}
}
diff --git a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c
index 12b6805d98e..b19b5378fcd 100644
--- a/storage/innobase/os/os0thread.c
+++ b/storage/innobase/os/os0thread.c
@@ -136,8 +136,10 @@ os_thread_create(
if (thread_id) {
*thread_id = win_thread_id;
}
-
- return(thread);
+ if (thread) {
+ CloseHandle(thread);
+ }
+ return((os_thread_t)win_thread_id);
#else
int ret;
os_thread_t pthread;
diff --git a/storage/innobase/rem/rem0rec.c b/storage/innobase/rem/rem0rec.c
index 15618a3fa02..0cee1ffb3c8 100644
--- a/storage/innobase/rem/rem0rec.c
+++ b/storage/innobase/rem/rem0rec.c
@@ -1803,7 +1803,10 @@ wsrep_rec_get_primary_key(
ut_ad(rec);
key_parts = dict_index_get_n_unique_in_tree(index);
- for (i = 0; i < key_parts; i++) {
+ for (i = 0;
+ i < key_parts && (index->type & DICT_CLUSTERED || i < key_parts - 1);
+ i++) {
+
dict_field_t* field = dict_index_get_nth_field(index, i);
const dict_col_t* col = dict_field_get_col(field);
diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
index a829e6990b2..d7823c140bf 100644
--- a/storage/innobase/row/row0ins.c
+++ b/storage/innobase/row/row0ins.c
@@ -761,7 +761,8 @@ ulint wsrep_append_foreign_key(trx_t *trx,
dict_foreign_t* foreign,
const rec_t* clust_rec,
dict_index_t* clust_index,
- ibool shared);
+ ibool referenced,
+ ibool shared);
#endif /* WITH_WSREP */
/*********************************************************************//**
@@ -1086,7 +1087,7 @@ row_ins_foreign_check_on_constraint(
foreign,
clust_rec,
clust_index,
- FALSE);
+ FALSE, FALSE);
}
#endif /* WITH_WSREP */
if (foreign->foreign_table->n_foreign_key_checks_running == 0) {
@@ -1422,12 +1423,22 @@ run_again:
if (check_ref) {
err = DB_SUCCESS;
#ifdef WITH_WSREP
- err = wsrep_append_foreign_key(
- thr_get_trx(thr),
- foreign,
- rec,
- check_index,
- TRUE);
+ if (thr->fk_cascade_depth == 0) {
+ err = wsrep_append_foreign_key(
+ thr_get_trx(thr),
+ foreign,
+ rec,
+ check_index,
+ check_ref, TRUE);
+ } else {
+ fprintf(stderr, "WSREP: skipping FK key append\n");
+ err = wsrep_append_foreign_key(
+ thr_get_trx(thr),
+ foreign,
+ rec,
+ check_index,
+ TRUE, TRUE);
+ }
#endif /* WITH_WSREP */
goto end_scan;
} else if (foreign->type != 0) {
@@ -1458,6 +1469,14 @@ run_again:
goto end_scan;
}
+#ifdef WITH_WSREP_REMOVED
+ err = wsrep_append_foreign_key(
+ thr_get_trx(thr),
+ foreign,
+ rec,
+ check_index,
+ FALSE);
+#endif /* WITH_WSREP */
/* row_ins_foreign_check_on_constraint
may have repositioned pcur on a
different block */
diff --git a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c
index 4f5096a162b..8469d688c5c 100644
--- a/storage/innobase/row/row0upd.c
+++ b/storage/innobase/row/row0upd.c
@@ -170,6 +170,46 @@ func_exit:
return(is_referenced);
}
+#ifdef WITH_WSREP
+ulint wsrep_append_foreign_key(trx_t *trx,
+ dict_foreign_t* foreign,
+ const rec_t* clust_rec,
+ dict_index_t* clust_index,
+ ibool referenced,
+ ibool shared);
+
+static
+void
+wsrep_append_fk_reference(
+/*=================================*/
+ upd_node_t* node, /*!< in: row update node */
+ dict_table_t* table, /*!< in: table in question */
+ dict_index_t* index, /*!< in: index of the cursor */
+ que_thr_t* thr, /*!< in: query thread */
+ const rec_t* rec
+) {
+ dict_foreign_t *foreign = UT_LIST_GET_FIRST(table->foreign_list);
+
+ while (foreign) {
+ if (foreign->foreign_index == index
+ && node->is_delete)
+ {
+ if (DB_SUCCESS != wsrep_append_foreign_key(
+ thr_get_trx(thr),
+ foreign,
+ rec,
+ index,
+ TRUE, TRUE)
+ ) {
+ fprintf(stderr,
+ "WSREP: FK key append failed\n");
+ }
+ }
+ foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
+ }
+}
+#endif /* WITH_WSREP */
+
/*********************************************************************//**
Checks if possible foreign key constraints hold after a delete of the record
under pcur.
@@ -283,7 +323,6 @@ row_upd_check_references_constraints(
}
err = DB_SUCCESS;
-
func_exit:
if (got_s_lock) {
row_mysql_unfreeze_data_dictionary(trx);
@@ -1646,6 +1685,12 @@ row_upd_sec_index_entry(
node, &pcur, index->table,
index, offsets, thr, &mtr);
}
+#ifdef WITH_WSREP
+ if (err == DB_SUCCESS && !referenced) {
+ wsrep_append_fk_reference(node, index->table,
+ index, thr, rec);
+ }
+#endif /* WITH_WSREP */
}
break;
}
@@ -1887,6 +1932,12 @@ err_exit:
goto err_exit;
}
}
+#ifdef WITH_WSREP
+ if (!referenced) {
+ wsrep_append_fk_reference(node, index->table,
+ index, thr, rec);
+ }
+#endif /* WITH_WSREP */
}
mtr_commit(mtr);
@@ -2089,6 +2140,9 @@ row_upd_del_mark_clust_rec(
btr_pcur_t* pcur;
btr_cur_t* btr_cur;
ulint err;
+#ifdef WITH_WSREP
+ rec_t* rec;
+#endif /* WITH_WSREP */
ut_ad(node);
ut_ad(dict_index_is_clust(index));
@@ -2105,15 +2159,29 @@ row_upd_del_mark_clust_rec(
/* Mark the clustered index record deleted; we do not have to check
locks, because we assume that we have an x-lock on the record */
+#ifdef WITH_WSREP
+ rec = btr_cur_get_rec(btr_cur);
+#endif /* WITH_WSREP */
+
err = btr_cur_del_mark_set_clust_rec(
BTR_NO_LOCKING_FLAG, btr_cur_get_block(btr_cur),
+#ifdef WITH_WSREP
+ rec, index, offsets, TRUE, thr, mtr);
+#else
btr_cur_get_rec(btr_cur), index, offsets, TRUE, thr, mtr);
+#endif /* WITH_WSREP */
if (err == DB_SUCCESS && referenced) {
/* NOTE that the following call loses the position of pcur ! */
err = row_upd_check_references_constraints(
node, pcur, index->table, index, offsets, thr, mtr);
}
+#ifdef WITH_WSREP
+ if (err == DB_SUCCESS && !referenced) {
+ wsrep_append_fk_reference(node, index->table,
+ index, thr, rec);
+ }
+#endif /* WITH_WSREP */
mtr_commit(mtr);
diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
index 343e41fe376..86669a50895 100644
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
@@ -1364,10 +1364,18 @@ innobase_start_or_create_for_mysql(void)
}
# endif /* __WIN__ */
- os_aio_init(io_limit,
- srv_n_read_io_threads,
- srv_n_write_io_threads,
- SRV_MAX_N_PENDING_SYNC_IOS);
+ if (!os_aio_init(io_limit,
+ srv_n_read_io_threads,
+ srv_n_write_io_threads,
+ SRV_MAX_N_PENDING_SYNC_IOS)) {
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Fatal error: cannot initialize AIO"
+ " sub-system\n");
+
+ return(DB_ERROR);
+ }
fil_init(srv_file_per_table ? 50000 : 5000,
srv_max_n_open_files);
diff --git a/storage/innobase/sync/sync0arr.c b/storage/innobase/sync/sync0arr.c
index 30caddccced..c6cbfc94dca 100644
--- a/storage/innobase/sync/sync0arr.c
+++ b/storage/innobase/sync/sync0arr.c
@@ -928,6 +928,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/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 2b67f29f9f8..e763b7e7a37 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -1008,6 +1008,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 35c98cc52d7..545daca12fe 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_close.c b/storage/maria/ma_close.c
index 973adf2b91e..c355f1f1def 100644
--- a/storage/maria/ma_close.c
+++ b/storage/maria/ma_close.c
@@ -195,20 +195,27 @@ int maria_close(register MARIA_HA *info)
if (share->state_history)
{
- MARIA_STATE_HISTORY_CLOSED *history;
- /*
- Here we ignore the unlikely case that we don't have memory to
- store the state. In the worst case what happens is that any transaction
- that tries to access this table will get a wrong status information.
- */
- if ((history= (MARIA_STATE_HISTORY_CLOSED *)
- my_malloc(sizeof(*history), MYF(MY_WME))))
+ if (share->state_history->trid) /* If not visible for all */
{
- history->create_rename_lsn= share->state.create_rename_lsn;
- history->state_history= share->state_history;
- if (my_hash_insert(&maria_stored_state, (uchar*) history))
- my_free(history);
+ MARIA_STATE_HISTORY_CLOSED *history;
+ DBUG_PRINT("info", ("Storing state history"));
+ /*
+ Here we ignore the unlikely case that we don't have memory
+ to store the state. In the worst case what happens is that
+ any transaction that tries to access this table will get a
+ wrong status information.
+ */
+ if ((history= (MARIA_STATE_HISTORY_CLOSED *)
+ my_malloc(sizeof(*history), MYF(MY_WME))))
+ {
+ history->create_rename_lsn= share->state.create_rename_lsn;
+ history->state_history= share->state_history;
+ if (my_hash_insert(&maria_stored_state, (uchar*) history))
+ my_free(history);
+ }
}
+ else
+ my_free(share->state_history);
/* Marker for concurrent checkpoint */
share->state_history= 0;
}
diff --git a/storage/maria/ma_delete_table.c b/storage/maria/ma_delete_table.c
index 9e91638fa27..09d5cde5ad0 100644
--- a/storage/maria/ma_delete_table.c
+++ b/storage/maria/ma_delete_table.c
@@ -38,14 +38,8 @@ int maria_delete_table(const char *name)
/** @todo LOCK take X-lock on table */
/*
We need to know if this table is transactional.
- When built with RAID support, we also need to determine if this table
- makes use of the raid feature. If yes, we need to remove all raid
- chunks. This is done with my_raid_delete(). Unfortunately it is
- necessary to open the table just to check this. We use
- 'open_for_repair' to be able to open even a crashed table. If even
- this open fails, we assume no raid configuration for this table
- and try to remove the normal data file only. This may however
- leave the raid chunks behind.
+ Unfortunately it is necessary to open the table just to check this. We use
+ 'open_for_repair' to be able to open even a crashed table.
*/
if (!(info= maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR)))
{
@@ -56,6 +50,8 @@ int maria_delete_table(const char *name)
sync_dir= (info->s->now_transactional && !info->s->temporary &&
!maria_in_recovery) ?
MY_SYNC_DIR : 0;
+ /* Remove history for table */
+ _ma_reset_state(info);
maria_close(info);
}
diff --git a/storage/maria/ma_info.c b/storage/maria/ma_info.c
index 97b5b8b7f7b..341ea147785 100644
--- a/storage/maria/ma_info.c
+++ b/storage/maria/ma_info.c
@@ -42,6 +42,7 @@ int maria_status(MARIA_HA *info, register MARIA_INFO *x, uint flag)
MY_STAT state;
MARIA_SHARE *share= info->s;
DBUG_ENTER("maria_status");
+ DBUG_PRINT("info", ("records: %lld", info->state->records));
x->recpos= info->cur_row.lastpos;
if (flag == HA_STATUS_POS)
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index a526c0d4276..5f90f61c786 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -866,6 +866,9 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
_ma_remove_not_visible_states(history->state_history, 0, 0);
history->state_history= 0;
(void) my_hash_delete(&maria_stored_state, (uchar*) history);
+ DBUG_PRINT("info", ("Reading state history. trid: %lu records: %lld",
+ (ulong) share->state_history->trid,
+ share->state_history->state.records));
}
else
{
@@ -988,6 +991,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
mysql_mutex_unlock(&THR_LOCK_maria);
m_info->open_flags= open_flags;
+ DBUG_PRINT("exit", ("table: %p name: %s",m_info, name));
DBUG_RETURN(m_info);
err:
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/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 4fbd94a1a3b..73e0fadd530 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 579ef061af4..79324f64370 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_keycache.c b/storage/myisam/mi_keycache.c
index a2422b71bbf..b45f0efa2f7 100644
--- a/storage/myisam/mi_keycache.c
+++ b/storage/myisam/mi_keycache.c
@@ -76,6 +76,7 @@ int mi_assign_to_key_cache(MI_INFO *info,
in the old key cache.
*/
+ pthread_mutex_lock(&share->key_cache->op_lock);
if (flush_key_blocks(share->key_cache, share->kfile, &share->dirty_part_map,
FLUSH_RELEASE))
{
@@ -83,6 +84,7 @@ int mi_assign_to_key_cache(MI_INFO *info,
mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); /* Mark that table must be checked */
}
+ pthread_mutex_unlock(&share->key_cache->op_lock);
/*
Flush the new key cache for this file. This is needed to ensure
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 e6bece5b7ff..47a3abb78d2 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -1652,6 +1652,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..ecd2d46dad3 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)
diff --git a/storage/xtradb/btr/btr0btr.c b/storage/xtradb/btr/btr0btr.c
index 433b062bcec..1fa6df44f7c 100644
--- a/storage/xtradb/btr/btr0btr.c
+++ b/storage/xtradb/btr/btr0btr.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -42,6 +42,28 @@ Created 6/2/1994 Heikki Tuuri
#include "ibuf0ibuf.h"
#include "trx0trx.h"
+/**************************************************************//**
+Report that an index page is corrupted. */
+UNIV_INTERN
+void
+btr_corruption_report(
+/*==================*/
+ const buf_block_t* block, /*!< in: corrupted block */
+ const dict_index_t* index) /*!< in: index tree */
+{
+ fprintf(stderr, "InnoDB: flag mismatch in space %u page %u"
+ " index %s of table %s\n",
+ (unsigned) buf_block_get_space(block),
+ (unsigned) buf_block_get_page_no(block),
+ index->name, index->table_name);
+ if (block->page.zip.data) {
+ buf_page_print(block->page.zip.data,
+ buf_block_get_zip_size(block),
+ BUF_PAGE_PRINT_NO_CRASH);
+ }
+ buf_page_print(buf_block_get_frame(block), 0, 0);
+}
+
#ifdef UNIV_BLOB_DEBUG
# include "srv0srv.h"
# include "ut0rbt.h"
@@ -664,6 +686,12 @@ btr_root_fseg_validate(
{
ulint offset = mach_read_from_2(seg_header + FSEG_HDR_OFFSET);
+ if (UNIV_UNLIKELY(srv_pass_corrupt_table)) {
+ return (mach_read_from_4(seg_header + FSEG_HDR_SPACE) == space)
+ && (offset >= FIL_PAGE_DATA)
+ && (offset <= UNIV_PAGE_SIZE - FIL_PAGE_DATA_END);
+ }
+
ut_a(mach_read_from_4(seg_header + FSEG_HDR_SPACE) == space);
ut_a(offset >= FIL_PAGE_DATA);
ut_a(offset <= UNIV_PAGE_SIZE - FIL_PAGE_DATA_END);
@@ -698,12 +726,22 @@ btr_root_block_get(
}
ut_a(block);
- ut_a((ibool)!!page_is_comp(buf_block_get_frame(block))
- == dict_table_is_comp(index->table));
+ btr_assert_not_corrupted(block, index);
#ifdef UNIV_BTR_DEBUG
if (!dict_index_is_ibuf(index)) {
const page_t* root = buf_block_get_frame(block);
+ if (UNIV_UNLIKELY(srv_pass_corrupt_table)) {
+ if (!btr_root_fseg_validate(FIL_PAGE_DATA
+ + PAGE_BTR_SEG_LEAF
+ + root, space))
+ return(NULL);
+ if (!btr_root_fseg_validate(FIL_PAGE_DATA
+ + PAGE_BTR_SEG_TOP
+ + root, space))
+ return(NULL);
+ return(block);
+ }
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
+ root, space));
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
@@ -912,28 +950,31 @@ btr_page_alloc_for_ibuf(
/**************************************************************//**
Allocates a new file page to be used in an index tree. NOTE: we assume
that the caller has made the reservation for free extents!
-@return new allocated block, x-latched; NULL if out of space */
-UNIV_INTERN
+@retval NULL if no page could be allocated
+@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
+(init_mtr == mtr, or the page was not previously freed in mtr)
+@retval block (not allocated or initialized) otherwise */
+static __attribute__((nonnull, warn_unused_result))
buf_block_t*
-btr_page_alloc(
-/*===========*/
+btr_page_alloc_low(
+/*===============*/
dict_index_t* index, /*!< in: index */
ulint hint_page_no, /*!< in: hint of a good page */
byte file_direction, /*!< in: direction where a possible
page split is made */
ulint level, /*!< in: level where the page is placed
in the tree */
- mtr_t* mtr) /*!< in: mtr */
+ mtr_t* mtr, /*!< in/out: mini-transaction
+ for the allocation */
+ mtr_t* init_mtr) /*!< in/out: mtr or another
+ mini-transaction in which the
+ page should be initialized.
+ If init_mtr!=mtr, but the page
+ is already X-latched in mtr, do
+ not initialize the page. */
{
fseg_header_t* seg_header;
page_t* root;
- buf_block_t* new_block;
- ulint new_page_no;
-
- if (dict_index_is_ibuf(index)) {
-
- return(btr_page_alloc_for_ibuf(index, mtr));
- }
root = btr_root_get(index, mtr);
@@ -947,45 +988,81 @@ btr_page_alloc(
reservation for free extents, and thus we know that a page can
be allocated: */
- new_page_no = fseg_alloc_free_page_general(seg_header, hint_page_no,
- file_direction, TRUE, mtr);
- if (new_page_no == FIL_NULL) {
+ return(fseg_alloc_free_page_general(
+ seg_header, hint_page_no, file_direction,
+ TRUE, mtr, init_mtr));
+}
- return(NULL);
+/**************************************************************//**
+Allocates a new file page to be used in an index tree. NOTE: we assume
+that the caller has made the reservation for free extents!
+@retval NULL if no page could be allocated
+@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
+(init_mtr == mtr, or the page was not previously freed in mtr)
+@retval block (not allocated or initialized) otherwise */
+UNIV_INTERN
+buf_block_t*
+btr_page_alloc(
+/*===========*/
+ dict_index_t* index, /*!< in: index */
+ ulint hint_page_no, /*!< in: hint of a good page */
+ byte file_direction, /*!< in: direction where a possible
+ page split is made */
+ ulint level, /*!< in: level where the page is placed
+ in the tree */
+ mtr_t* mtr, /*!< in/out: mini-transaction
+ for the allocation */
+ mtr_t* init_mtr) /*!< in/out: mini-transaction
+ for x-latching and initializing
+ the page */
+{
+ buf_block_t* new_block;
+
+ if (dict_index_is_ibuf(index)) {
+
+ return(btr_page_alloc_for_ibuf(index, mtr));
}
- new_block = buf_page_get(dict_index_get_space(index),
- dict_table_zip_size(index->table),
- new_page_no, RW_X_LATCH, mtr);
- buf_block_dbg_add_level(new_block, SYNC_TREE_NODE_NEW);
+ new_block = btr_page_alloc_low(
+ index, hint_page_no, file_direction, level, mtr, init_mtr);
+
+ if (new_block) {
+ buf_block_dbg_add_level(new_block, SYNC_TREE_NODE_NEW);
+ }
return(new_block);
}
/**************************************************************//**
Gets the number of pages in a B-tree.
-@return number of pages */
+@return number of pages, or ULINT_UNDEFINED if the index is unavailable */
UNIV_INTERN
ulint
btr_get_size(
/*=========*/
dict_index_t* index, /*!< in: index */
- ulint flag) /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */
+ ulint flag, /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */
+ mtr_t* mtr) /*!< in/out: mini-transaction where index
+ is s-latched */
{
fseg_header_t* seg_header;
page_t* root;
ulint n;
ulint dummy;
- mtr_t mtr;
- mtr_start(&mtr);
+ ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
+ MTR_MEMO_S_LOCK));
- mtr_s_lock(dict_index_get_lock(index), &mtr);
+ if (index->page == FIL_NULL
+ || index->to_be_dropped
+ || *index->name == TEMP_INDEX_PREFIX) {
+ return(ULINT_UNDEFINED);
+ }
- root = btr_root_get(index, &mtr);
+ root = btr_root_get(index, mtr);
if (srv_pass_corrupt_table && !root) {
- mtr_commit(&mtr);
+ mtr_commit(mtr);
return(0);
}
ut_a(root);
@@ -993,22 +1070,20 @@ btr_get_size(
if (flag == BTR_N_LEAF_PAGES) {
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
- fseg_n_reserved_pages(seg_header, &n, &mtr);
+ fseg_n_reserved_pages(seg_header, &n, mtr);
} else if (flag == BTR_TOTAL_SIZE) {
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_TOP;
- n = fseg_n_reserved_pages(seg_header, &dummy, &mtr);
+ n = fseg_n_reserved_pages(seg_header, &dummy, mtr);
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
- n += fseg_n_reserved_pages(seg_header, &dummy, &mtr);
+ n += fseg_n_reserved_pages(seg_header, &dummy, mtr);
} else {
ut_error;
}
- mtr_commit(&mtr);
-
return(n);
}
@@ -1090,10 +1165,10 @@ btr_page_free(
buf_block_t* block, /*!< in: block to be freed, x-latched */
mtr_t* mtr) /*!< in: mtr */
{
- ulint level;
-
- level = btr_page_get_level(buf_block_get_frame(block), mtr);
+ const page_t* page = buf_block_get_frame(block);
+ ulint level = btr_page_get_level(page, mtr);
+ ut_ad(fil_page_get_type(block->frame) == FIL_PAGE_INDEX);
btr_page_free_low(index, block, level, mtr);
}
@@ -1207,9 +1282,11 @@ btr_page_get_father_node_ptr_func(
!= page_no)) {
rec_t* print_rec;
fputs("InnoDB: Dump of the child page:\n", stderr);
- buf_page_print(page_align(user_rec), 0);
+ buf_page_print(page_align(user_rec), 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: Dump of the parent page:\n", stderr);
- buf_page_print(page_align(node_ptr), 0);
+ buf_page_print(page_align(node_ptr), 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: Corruption of an index tree: table ", stderr);
ut_print_name(stderr, NULL, TRUE, index->table_name);
@@ -1333,16 +1410,12 @@ btr_create(
/* Allocate then the next page to the segment: it will be the
tree root page */
- page_no = fseg_alloc_free_page(buf_block_get_frame(
- ibuf_hdr_block)
- + IBUF_HEADER
- + IBUF_TREE_SEG_HEADER,
- IBUF_TREE_ROOT_PAGE_NO,
- FSP_UP, mtr);
- ut_ad(page_no == IBUF_TREE_ROOT_PAGE_NO);
-
- block = buf_page_get(space, zip_size, page_no,
- RW_X_LATCH, mtr);
+ block = fseg_alloc_free_page(
+ buf_block_get_frame(ibuf_hdr_block)
+ + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
+ IBUF_TREE_ROOT_PAGE_NO,
+ FSP_UP, mtr);
+ ut_ad(buf_block_get_page_no(block) == IBUF_TREE_ROOT_PAGE_NO);
} else {
#ifdef UNIV_BLOB_DEBUG
if ((type & DICT_CLUSTERED) && !index->blobs) {
@@ -1562,7 +1635,7 @@ btr_page_reorganize_low(
ibool success = FALSE;
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
- ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
+ btr_assert_not_corrupted(block, index);
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
@@ -1664,8 +1737,8 @@ btr_page_reorganize_low(
if (UNIV_UNLIKELY(data_size1 != data_size2)
|| UNIV_UNLIKELY(max_ins_size1 != max_ins_size2)) {
- buf_page_print(page, 0);
- buf_page_print(temp_page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(temp_page, 0, BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"InnoDB: Error: page old data size %lu"
" new data size %lu\n"
@@ -1676,6 +1749,7 @@ btr_page_reorganize_low(
(unsigned long) data_size1, (unsigned long) data_size2,
(unsigned long) max_ins_size1,
(unsigned long) max_ins_size2);
+ ut_ad(0);
} else {
success = TRUE;
}
@@ -1839,7 +1913,7 @@ btr_root_raise_and_insert(
level = btr_page_get_level(root, mtr);
- new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, mtr);
+ new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, mtr, mtr);
new_page = buf_block_get_frame(new_block);
new_page_zip = buf_block_get_page_zip(new_block);
ut_a(!new_page_zip == !root_page_zip);
@@ -2575,7 +2649,7 @@ func_start:
/* 2. Allocate a new page to the index */
new_block = btr_page_alloc(cursor->index, hint_page_no, direction,
- btr_page_get_level(page, mtr), mtr);
+ btr_page_get_level(page, mtr), mtr, mtr);
new_page = buf_block_get_frame(new_block);
new_page_zip = buf_block_get_page_zip(new_block);
btr_page_create(new_block, new_page_zip, cursor->index,
@@ -3025,15 +3099,16 @@ btr_node_ptr_delete(
ut_a(err == DB_SUCCESS);
if (!compressed) {
- btr_cur_compress_if_useful(&cursor, mtr);
+ btr_cur_compress_if_useful(&cursor, FALSE, mtr);
}
}
/*************************************************************//**
If page is the only on its level, this function moves its records to the
-father page, thus reducing the tree height. */
+father page, thus reducing the tree height.
+@return father block */
static
-void
+buf_block_t*
btr_lift_page_up(
/*=============*/
dict_index_t* index, /*!< in: index tree */
@@ -3150,6 +3225,8 @@ btr_lift_page_up(
}
ut_ad(page_validate(father_page, index));
ut_ad(btr_check_node_ptr(index, father_block, mtr));
+
+ return(father_block);
}
/*************************************************************//**
@@ -3166,11 +3243,13 @@ UNIV_INTERN
ibool
btr_compress(
/*=========*/
- btr_cur_t* cursor, /*!< in: cursor on the page to merge or lift;
- the page must not be empty: in record delete
- use btr_discard_page if the page would become
- empty */
- mtr_t* mtr) /*!< in: mtr */
+ btr_cur_t* cursor, /*!< in/out: cursor on the page to merge
+ or lift; the page must not be empty:
+ when deleting records, use btr_discard_page()
+ if the page would become empty */
+ ibool adjust, /*!< in: TRUE if should adjust the
+ cursor position even if compression occurs */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
dict_index_t* index;
ulint space;
@@ -3188,13 +3267,15 @@ btr_compress(
ulint* offsets;
ulint data_size;
ulint n_recs;
+ ulint nth_rec = 0; /* remove bogus warning */
ulint max_ins_size;
ulint max_ins_size_reorg;
block = btr_cur_get_block(cursor);
page = btr_cur_get_page(cursor);
index = btr_cur_get_index(cursor);
- ut_a((ibool) !!page_is_comp(page) == dict_table_is_comp(index->table));
+
+ btr_assert_not_corrupted(block, index);
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
@@ -3214,6 +3295,10 @@ btr_compress(
offsets = btr_page_get_father_block(NULL, heap, index, block, mtr,
&father_cursor);
+ if (adjust) {
+ nth_rec = page_rec_get_n_recs_before(btr_cur_get_rec(cursor));
+ }
+
/* Decide the page to which we try to merge and which will inherit
the locks */
@@ -3240,9 +3325,9 @@ btr_compress(
} else {
/* The page is the only one on the level, lift the records
to the father */
- btr_lift_page_up(index, block, mtr);
- mem_heap_free(heap);
- return(TRUE);
+
+ merge_block = btr_lift_page_up(index, block, mtr);
+ goto func_exit;
}
n_recs = page_get_n_recs(page);
@@ -3324,6 +3409,10 @@ err_exit:
btr_node_ptr_delete(index, block, mtr);
lock_update_merge_left(merge_block, orig_pred, block);
+
+ if (adjust) {
+ nth_rec += page_rec_get_n_recs_before(orig_pred);
+ }
} else {
rec_t* orig_succ;
#ifdef UNIV_BTR_DEBUG
@@ -3388,7 +3477,6 @@ err_exit:
}
btr_blob_dbg_remove(page, index, "btr_compress");
- mem_heap_free(heap);
if (!dict_index_is_clust(index) && page_is_leaf(merge_page)) {
/* Update the free bits of the B-tree page in the
@@ -3440,6 +3528,16 @@ err_exit:
btr_page_free(index, block, mtr);
ut_ad(btr_check_node_ptr(index, merge_block, mtr));
+func_exit:
+ mem_heap_free(heap);
+
+ if (adjust) {
+ btr_cur_position(
+ index,
+ page_rec_get_nth(merge_block->frame, nth_rec),
+ merge_block, cursor);
+ }
+
return(TRUE);
}
@@ -3876,7 +3974,7 @@ btr_index_rec_validate(
(ulong) rec_get_n_fields_old(rec), (ulong) n);
if (dump_on_error) {
- buf_page_print(page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: corrupt record ", stderr);
rec_print_old(stderr, rec);
@@ -3914,7 +4012,8 @@ btr_index_rec_validate(
(ulong) i, (ulong) len, (ulong) fixed_size);
if (dump_on_error) {
- buf_page_print(page, 0);
+ buf_page_print(page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: corrupt record ", stderr);
rec_print_new(stderr, rec, offsets);
@@ -4124,8 +4223,8 @@ loop:
btr_validate_report2(index, level, block, right_block);
fputs("InnoDB: broken FIL_PAGE_NEXT"
" or FIL_PAGE_PREV links\n", stderr);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH);
ret = FALSE;
}
@@ -4134,8 +4233,8 @@ loop:
!= page_is_comp(page))) {
btr_validate_report2(index, level, block, right_block);
fputs("InnoDB: 'compact' flag mismatch\n", stderr);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH);
ret = FALSE;
@@ -4158,8 +4257,8 @@ loop:
fputs("InnoDB: records in wrong order"
" on adjacent pages\n", stderr);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: record ", stderr);
rec = page_rec_get_prev(page_get_supremum_rec(page));
@@ -4208,8 +4307,8 @@ loop:
fputs("InnoDB: node pointer to the page is wrong\n",
stderr);
- buf_page_print(father_page, 0);
- buf_page_print(page, 0);
+ buf_page_print(father_page, 0, BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: node ptr ", stderr);
rec_print(stderr, node_ptr, index);
@@ -4241,8 +4340,10 @@ loop:
btr_validate_report1(index, level, block);
- buf_page_print(father_page, 0);
- buf_page_print(page, 0);
+ buf_page_print(father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: Error: node ptrs differ"
" on levels > 0\n"
@@ -4287,9 +4388,15 @@ loop:
btr_validate_report1(index, level,
block);
- buf_page_print(father_page, 0);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(
+ father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ right_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
}
} else {
page_t* right_father_page
@@ -4307,10 +4414,18 @@ loop:
btr_validate_report1(index, level,
block);
- buf_page_print(father_page, 0);
- buf_page_print(right_father_page, 0);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(
+ father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ right_father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ right_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
}
if (page_get_page_no(right_father_page)
@@ -4324,10 +4439,18 @@ loop:
btr_validate_report1(index, level,
block);
- buf_page_print(father_page, 0);
- buf_page_print(right_father_page, 0);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(
+ father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ right_father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ right_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
}
}
}
@@ -4372,6 +4495,12 @@ btr_validate_index(
mtr_x_lock(dict_index_get_lock(index), &mtr);
root = btr_root_get(index, &mtr);
+
+ if (UNIV_UNLIKELY(srv_pass_corrupt_table && !root)) {
+ mtr_commit(&mtr);
+ return(FALSE);
+ }
+
n = btr_page_get_level(root, &mtr);
for (i = 0; i <= n && !trx_is_interrupted(trx); i++) {
diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c
index 43313474071..e093dabebf1 100644
--- a/storage/xtradb/btr/btr0cur.c
+++ b/storage/xtradb/btr/btr0cur.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -18,8 +18,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -438,7 +438,12 @@ btr_cur_search_to_nth_level(
ut_ad(dict_index_check_search_tuple(index, tuple));
ut_ad(!dict_index_is_ibuf(index) || ibuf_inside(mtr));
ut_ad(dtuple_check_typed(tuple));
+ ut_ad(index->page != FIL_NULL);
+ UNIV_MEM_INVALID(&cursor->up_match, sizeof cursor->up_match);
+ UNIV_MEM_INVALID(&cursor->up_bytes, sizeof cursor->up_bytes);
+ UNIV_MEM_INVALID(&cursor->low_match, sizeof cursor->low_match);
+ UNIV_MEM_INVALID(&cursor->low_bytes, sizeof cursor->low_bytes);
#ifdef UNIV_DEBUG
cursor->up_match = ULINT_UNDEFINED;
cursor->low_match = ULINT_UNDEFINED;
@@ -810,11 +815,11 @@ retry_page_get:
if (level != 0) {
/* x-latch the page */
- page = btr_page_get(
+ buf_block_t* child_block = btr_block_get(
space, zip_size, page_no, RW_X_LATCH, index, mtr);
- ut_a((ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
+ page = buf_block_get_frame(child_block);
+ btr_assert_not_corrupted(child_block, index);
} else {
cursor->low_match = low_match;
cursor->low_bytes = low_bytes;
@@ -1959,7 +1964,7 @@ btr_cur_update_in_place(
page_zip = buf_block_get_page_zip(block);
/* Check that enough space is available on the compressed page. */
- if (UNIV_LIKELY_NULL(page_zip)
+ if (page_zip
&& !btr_cur_update_alloc_zip(page_zip, block, index,
rec_offs_size(offsets), FALSE, mtr)) {
return(DB_ZIP_OVERFLOW);
@@ -2158,7 +2163,7 @@ any_extern:
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
- if (UNIV_LIKELY_NULL(page_zip)
+ if (page_zip
&& !btr_cur_update_alloc_zip(page_zip, block, index,
new_rec_size, TRUE, mtr)) {
err = DB_ZIP_OVERFLOW;
@@ -2321,7 +2326,9 @@ btr_cur_pessimistic_update(
/*=======================*/
ulint flags, /*!< in: undo logging, locking, and rollback
flags */
- btr_cur_t* cursor, /*!< in: cursor on the record to update */
+ btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
+ cursor may become invalid if *big_rec == NULL
+ || !(flags & BTR_KEEP_POS_FLAG) */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
be stored externally by the caller, or NULL */
@@ -2463,10 +2470,10 @@ btr_cur_pessimistic_update(
record to be inserted: we have to remember which fields were such */
ut_ad(!page_is_comp(page) || !rec_get_node_ptr_flag(rec));
- offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, heap);
+ ut_ad(rec_offs_validate(rec, index, offsets));
n_ext += btr_push_update_extern_fields(new_entry, update, *heap);
- if (UNIV_LIKELY_NULL(page_zip)) {
+ if (page_zip) {
ut_ad(page_is_comp(page));
if (page_zip_rec_needs_ext(
rec_get_converted_size(index, new_entry, n_ext),
@@ -2486,6 +2493,10 @@ make_external:
err = DB_TOO_BIG_RECORD;
goto return_after_reservations;
}
+
+ ut_ad(page_is_leaf(page));
+ ut_ad(dict_index_is_clust(index));
+ ut_ad(flags & BTR_KEEP_POS_FLAG);
}
if (trx->fake_changes) {
@@ -2519,6 +2530,8 @@ make_external:
rec = btr_cur_insert_if_possible(cursor, new_entry, n_ext, mtr);
if (rec) {
+ page_cursor->rec = rec;
+
lock_rec_restore_from_page_infimum(btr_cur_get_block(cursor),
rec, block);
@@ -2532,7 +2545,10 @@ make_external:
rec, index, offsets, mtr);
}
- btr_cur_compress_if_useful(cursor, mtr);
+ btr_cur_compress_if_useful(
+ cursor,
+ big_rec_vec != NULL && (flags & BTR_KEEP_POS_FLAG),
+ mtr);
if (page_zip && !dict_index_is_clust(index)
&& page_is_leaf(page)) {
@@ -2552,6 +2568,21 @@ make_external:
}
}
+ if (big_rec_vec) {
+ ut_ad(page_is_leaf(page));
+ ut_ad(dict_index_is_clust(index));
+ ut_ad(flags & BTR_KEEP_POS_FLAG);
+
+ /* btr_page_split_and_insert() in
+ btr_cur_pessimistic_insert() invokes
+ mtr_memo_release(mtr, index->lock, MTR_MEMO_X_LOCK).
+ We must keep the index->lock when we created a
+ big_rec, so that row_upd_clust_rec() can store the
+ big_rec in the same mini-transaction. */
+
+ mtr_x_lock(dict_index_get_lock(index), mtr);
+ }
+
/* Was the record to be updated positioned as the first user
record on its page? */
was_first = page_cur_is_before_first(page_cursor);
@@ -2567,6 +2598,7 @@ make_external:
ut_a(rec);
ut_a(err == DB_SUCCESS);
ut_a(dummy_big_rec == NULL);
+ page_cursor->rec = rec;
if (dict_index_is_sec_or_ibuf(index)) {
/* Update PAGE_MAX_TRX_ID in the index page header.
@@ -3011,10 +3043,12 @@ UNIV_INTERN
ibool
btr_cur_compress_if_useful(
/*=======================*/
- btr_cur_t* cursor, /*!< in: cursor on the page to compress;
- cursor does not stay valid if compression
- occurs */
- mtr_t* mtr) /*!< in: mtr */
+ btr_cur_t* cursor, /*!< in/out: cursor on the page to compress;
+ cursor does not stay valid if !adjust and
+ compression occurs */
+ ibool adjust, /*!< in: TRUE if should adjust the
+ cursor position even if compression occurs */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
ut_ad(mtr_memo_contains(mtr,
dict_index_get_lock(btr_cur_get_index(cursor)),
@@ -3023,7 +3057,7 @@ btr_cur_compress_if_useful(
MTR_MEMO_PAGE_X_FIX));
return(btr_cur_compress_recommendation(cursor, mtr)
- && btr_compress(cursor, mtr));
+ && btr_compress(cursor, adjust, mtr));
}
/*******************************************************//**
@@ -3270,7 +3304,7 @@ return_after_reservations:
mem_heap_free(heap);
if (ret == FALSE) {
- ret = btr_cur_compress_if_useful(cursor, mtr);
+ ret = btr_cur_compress_if_useful(cursor, FALSE, mtr);
}
if (n_extents > 0) {
@@ -4011,10 +4045,10 @@ btr_cur_set_ownership_of_extern_field(
byte_val = byte_val | BTR_EXTERN_OWNER_FLAG;
}
- if (UNIV_LIKELY_NULL(page_zip)) {
+ if (page_zip) {
mach_write_to_1(data + local_len + BTR_EXTERN_LEN, byte_val);
page_zip_write_blob_ptr(page_zip, rec, index, offsets, i, mtr);
- } else if (UNIV_LIKELY(mtr != NULL)) {
+ } else if (mtr != NULL) {
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN, byte_val,
MLOG_1BYTE, mtr);
@@ -4253,9 +4287,9 @@ The fields are stored on pages allocated from leaf node
file segment of the index tree.
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
UNIV_INTERN
-ulint
-btr_store_big_rec_extern_fields_func(
-/*=================================*/
+enum db_err
+btr_store_big_rec_extern_fields(
+/*============================*/
dict_index_t* index, /*!< in: index of rec; the index tree
MUST be X-latched */
buf_block_t* rec_block, /*!< in/out: block containing rec */
@@ -4264,38 +4298,37 @@ btr_store_big_rec_extern_fields_func(
the "external storage" flags in offsets
will not correspond to rec when
this function returns */
-#ifdef UNIV_DEBUG
- mtr_t* local_mtr, /*!< in: mtr containing the
- latch to rec and to the tree */
-#endif /* UNIV_DEBUG */
-#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
- ibool update_in_place,/*! in: TRUE if the record is updated
- in place (not delete+insert) */
-#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
- const big_rec_t*big_rec_vec) /*!< in: vector containing fields
+ const big_rec_t*big_rec_vec, /*!< in: vector containing fields
to be stored externally */
-
+ mtr_t* btr_mtr, /*!< in: mtr containing the
+ latches to the clustered index */
+ enum blob_op op) /*! in: operation code */
{
- ulint rec_page_no;
- byte* field_ref;
- ulint extern_len;
- ulint store_len;
- ulint page_no;
- ulint space_id;
- ulint zip_size;
- ulint prev_page_no;
- ulint hint_page_no;
- ulint i;
- mtr_t mtr;
- mem_heap_t* heap = NULL;
+ ulint rec_page_no;
+ byte* field_ref;
+ ulint extern_len;
+ ulint store_len;
+ ulint page_no;
+ ulint space_id;
+ ulint zip_size;
+ ulint prev_page_no;
+ ulint hint_page_no;
+ ulint i;
+ mtr_t mtr;
+ mtr_t* alloc_mtr;
+ mem_heap_t* heap = NULL;
page_zip_des_t* page_zip;
- z_stream c_stream;
+ z_stream c_stream;
+ buf_block_t** freed_pages = NULL;
+ ulint n_freed_pages = 0;
+ enum db_err error = DB_SUCCESS;
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(rec_offs_any_extern(offsets));
- ut_ad(mtr_memo_contains(local_mtr, dict_index_get_lock(index),
+ ut_ad(btr_mtr);
+ ut_ad(mtr_memo_contains(btr_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
- ut_ad(mtr_memo_contains(local_mtr, rec_block, MTR_MEMO_PAGE_X_FIX));
+ ut_ad(mtr_memo_contains(btr_mtr, rec_block, MTR_MEMO_PAGE_X_FIX));
ut_ad(buf_block_get_frame(rec_block) == page_align(rec));
ut_a(dict_index_is_clust(index));
@@ -4308,7 +4341,7 @@ btr_store_big_rec_extern_fields_func(
rec_page_no = buf_block_get_page_no(rec_block);
ut_a(fil_page_get_type(page_align(rec)) == FIL_PAGE_INDEX);
- if (UNIV_LIKELY_NULL(page_zip)) {
+ if (page_zip) {
int err;
/* Zlib deflate needs 128 kilobytes for the default
@@ -4324,6 +4357,42 @@ btr_store_big_rec_extern_fields_func(
ut_a(err == Z_OK);
}
+ if (btr_blob_op_is_update(op)) {
+ /* Avoid reusing pages that have been previously freed
+ in btr_mtr. */
+ if (btr_mtr->n_freed_pages) {
+ if (heap == NULL) {
+ heap = mem_heap_create(
+ btr_mtr->n_freed_pages
+ * sizeof *freed_pages);
+ }
+
+ freed_pages = mem_heap_alloc(
+ heap,
+ btr_mtr->n_freed_pages
+ * sizeof *freed_pages);
+ n_freed_pages = 0;
+ }
+
+ /* Because btr_mtr will be committed after mtr, it is
+ possible that the tablespace has been extended when
+ the B-tree record was updated or inserted, or it will
+ be extended while allocating pages for big_rec.
+
+ TODO: In mtr (not btr_mtr), write a redo log record
+ about extending the tablespace to its current size,
+ and remember the current size. Whenever the tablespace
+ grows as pages are allocated, write further redo log
+ records to mtr. (Currently tablespace extension is not
+ covered by the redo log. If it were, the record would
+ only be written to btr_mtr, which is committed after
+ mtr.) */
+ alloc_mtr = btr_mtr;
+ } else {
+ /* Use the local mtr for allocations. */
+ alloc_mtr = &mtr;
+ }
+
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
/* All pointers to externally stored columns in the record
must either be zero or they must be pointers to inherited
@@ -4338,7 +4407,7 @@ btr_store_big_rec_extern_fields_func(
/* Either this must be an update in place,
or the BLOB must be inherited, or the BLOB pointer
must be zero (will be written in this function). */
- ut_a(update_in_place
+ ut_a(op == BTR_STORE_UPDATE
|| (field_ref[BTR_EXTERN_LEN] & BTR_EXTERN_INHERITED_FLAG)
|| !memcmp(field_ref, field_ref_zero,
BTR_EXTERN_FIELD_REF_SIZE));
@@ -4363,7 +4432,7 @@ btr_store_big_rec_extern_fields_func(
prev_page_no = FIL_NULL;
- if (UNIV_LIKELY_NULL(page_zip)) {
+ if (page_zip) {
int err = deflateReset(&c_stream);
ut_a(err == Z_OK);
@@ -4383,18 +4452,24 @@ btr_store_big_rec_extern_fields_func(
hint_page_no = prev_page_no + 1;
}
+alloc_another:
block = btr_page_alloc(index, hint_page_no,
- FSP_NO_DIR, 0, &mtr);
+ FSP_NO_DIR, 0, alloc_mtr, &mtr);
if (UNIV_UNLIKELY(block == NULL)) {
-
mtr_commit(&mtr);
+ error = DB_OUT_OF_FILE_SPACE;
+ goto func_exit;
+ }
- if (UNIV_LIKELY_NULL(page_zip)) {
- deflateEnd(&c_stream);
- mem_heap_free(heap);
- }
-
- return(DB_OUT_OF_FILE_SPACE);
+ if (rw_lock_get_x_lock_count(&block->lock) > 1) {
+ /* This page must have been freed in
+ btr_mtr previously. Put it aside, and
+ allocate another page for the BLOB data. */
+ ut_ad(alloc_mtr == btr_mtr);
+ ut_ad(btr_blob_op_is_update(op));
+ ut_ad(n_freed_pages < btr_mtr->n_freed_pages);
+ freed_pages[n_freed_pages++] = block;
+ goto alloc_another;
}
page_no = buf_block_get_page_no(block);
@@ -4411,7 +4486,7 @@ btr_store_big_rec_extern_fields_func(
SYNC_EXTERN_STORAGE);
prev_page = buf_block_get_frame(prev_block);
- if (UNIV_LIKELY_NULL(page_zip)) {
+ if (page_zip) {
mlog_write_ulint(
prev_page + FIL_PAGE_NEXT,
page_no, MLOG_4BYTES, &mtr);
@@ -4428,7 +4503,7 @@ btr_store_big_rec_extern_fields_func(
}
- if (UNIV_LIKELY_NULL(page_zip)) {
+ if (page_zip) {
int err;
page_zip_des_t* blob_page_zip;
@@ -4511,11 +4586,15 @@ btr_store_big_rec_extern_fields_func(
goto next_zip_page;
}
- rec_block = buf_page_get(space_id, zip_size,
- rec_page_no,
- RW_X_LATCH, &mtr);
- buf_block_dbg_add_level(rec_block,
- SYNC_NO_ORDER_CHECK);
+ if (alloc_mtr == &mtr) {
+ rec_block = buf_page_get(
+ space_id, zip_size,
+ rec_page_no,
+ RW_X_LATCH, &mtr);
+ buf_block_dbg_add_level(
+ rec_block,
+ SYNC_NO_ORDER_CHECK);
+ }
if (err == Z_STREAM_END) {
mach_write_to_4(field_ref
@@ -4549,7 +4628,8 @@ btr_store_big_rec_extern_fields_func(
page_zip_write_blob_ptr(
page_zip, rec, index, offsets,
- big_rec_vec->fields[i].field_no, &mtr);
+ big_rec_vec->fields[i].field_no,
+ alloc_mtr);
next_zip_page:
prev_page_no = page_no;
@@ -4594,19 +4674,23 @@ next_zip_page:
extern_len -= store_len;
- rec_block = buf_page_get(space_id, zip_size,
- rec_page_no,
- RW_X_LATCH, &mtr);
- buf_block_dbg_add_level(rec_block,
- SYNC_NO_ORDER_CHECK);
+ if (alloc_mtr == &mtr) {
+ rec_block = buf_page_get(
+ space_id, zip_size,
+ rec_page_no,
+ RW_X_LATCH, &mtr);
+ buf_block_dbg_add_level(
+ rec_block,
+ SYNC_NO_ORDER_CHECK);
+ }
mlog_write_ulint(field_ref + BTR_EXTERN_LEN, 0,
- MLOG_4BYTES, &mtr);
+ MLOG_4BYTES, alloc_mtr);
mlog_write_ulint(field_ref
+ BTR_EXTERN_LEN + 4,
big_rec_vec->fields[i].len
- extern_len,
- MLOG_4BYTES, &mtr);
+ MLOG_4BYTES, alloc_mtr);
if (prev_page_no == FIL_NULL) {
btr_blob_dbg_add_blob(
@@ -4616,18 +4700,19 @@ next_zip_page:
mlog_write_ulint(field_ref
+ BTR_EXTERN_SPACE_ID,
- space_id,
- MLOG_4BYTES, &mtr);
+ space_id, MLOG_4BYTES,
+ alloc_mtr);
mlog_write_ulint(field_ref
+ BTR_EXTERN_PAGE_NO,
- page_no,
- MLOG_4BYTES, &mtr);
+ page_no, MLOG_4BYTES,
+ alloc_mtr);
mlog_write_ulint(field_ref
+ BTR_EXTERN_OFFSET,
FIL_PAGE_DATA,
- MLOG_4BYTES, &mtr);
+ MLOG_4BYTES,
+ alloc_mtr);
}
prev_page_no = page_no;
@@ -4641,8 +4726,23 @@ next_zip_page:
}
}
- if (UNIV_LIKELY_NULL(page_zip)) {
+func_exit:
+ if (page_zip) {
deflateEnd(&c_stream);
+ }
+
+ if (n_freed_pages) {
+ ulint i;
+
+ ut_ad(alloc_mtr == btr_mtr);
+ ut_ad(btr_blob_op_is_update(op));
+
+ for (i = 0; i < n_freed_pages; i++) {
+ btr_page_free_low(index, freed_pages[i], 0, alloc_mtr);
+ }
+ }
+
+ if (heap != NULL) {
mem_heap_free(heap);
}
@@ -4663,7 +4763,7 @@ next_zip_page:
ut_a(!(field_ref[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG));
}
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
- return(DB_SUCCESS);
+ return(error);
}
/*******************************************************************//**
@@ -4866,7 +4966,7 @@ btr_free_externally_stored_field(
btr_page_free_low(index, ext_block, 0, &mtr);
- if (UNIV_LIKELY(page_zip != NULL)) {
+ if (page_zip) {
mach_write_to_4(field_ref + BTR_EXTERN_PAGE_NO,
next_page_no);
mach_write_to_4(field_ref + BTR_EXTERN_LEN + 4,
diff --git a/storage/xtradb/btr/btr0pcur.c b/storage/xtradb/btr/btr0pcur.c
index e6a9ddcf43e..0de7b63f92d 100644
--- a/storage/xtradb/btr/btr0pcur.c
+++ b/storage/xtradb/btr/btr0pcur.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -52,12 +52,13 @@ btr_pcur_create_for_mysql(void)
}
/**************************************************************//**
-Frees the memory for a persistent cursor object. */
+Resets a persistent cursor object, freeing ::old_rec_buf if it is
+allocated and resetting the other members to their initial values. */
UNIV_INTERN
void
-btr_pcur_free_for_mysql(
-/*====================*/
- btr_pcur_t* cursor) /*!< in, own: persistent cursor */
+btr_pcur_reset(
+/*===========*/
+ btr_pcur_t* cursor) /*!< in, out: persistent cursor */
{
if (cursor->old_rec_buf != NULL) {
@@ -66,6 +67,7 @@ btr_pcur_free_for_mysql(
cursor->old_rec_buf = NULL;
}
+ cursor->btr_cur.index = NULL;
cursor->btr_cur.page_cur.rec = NULL;
cursor->old_rec = NULL;
cursor->old_n_fields = 0;
@@ -73,7 +75,17 @@ btr_pcur_free_for_mysql(
cursor->latch_mode = BTR_NO_LATCHES;
cursor->pos_state = BTR_PCUR_NOT_POSITIONED;
+}
+/**************************************************************//**
+Frees the memory for a persistent cursor object. */
+UNIV_INTERN
+void
+btr_pcur_free_for_mysql(
+/*====================*/
+ btr_pcur_t* cursor) /*!< in, own: persistent cursor */
+{
+ btr_pcur_reset(cursor);
mem_free(cursor);
}
@@ -127,6 +139,8 @@ btr_pcur_store_position(
ut_a(btr_page_get_next(page, mtr) == FIL_NULL);
ut_a(btr_page_get_prev(page, mtr) == FIL_NULL);
+ ut_ad(page_is_leaf(page));
+ ut_ad(page_get_page_no(page) == index->page);
cursor->old_stored = BTR_PCUR_OLD_STORED;
@@ -319,13 +333,19 @@ btr_pcur_restore_position_func(
/* Save the old search mode of the cursor */
old_mode = cursor->search_mode;
- if (UNIV_LIKELY(cursor->rel_pos == BTR_PCUR_ON)) {
+ switch (cursor->rel_pos) {
+ case BTR_PCUR_ON:
mode = PAGE_CUR_LE;
- } else if (cursor->rel_pos == BTR_PCUR_AFTER) {
+ break;
+ case BTR_PCUR_AFTER:
mode = PAGE_CUR_G;
- } else {
- ut_ad(cursor->rel_pos == BTR_PCUR_BEFORE);
+ break;
+ case BTR_PCUR_BEFORE:
mode = PAGE_CUR_L;
+ break;
+ default:
+ ut_error;
+ mode = 0;
}
btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode,
@@ -334,25 +354,44 @@ btr_pcur_restore_position_func(
/* Restore the old search mode */
cursor->search_mode = old_mode;
- if (cursor->rel_pos == BTR_PCUR_ON
- && btr_pcur_is_on_user_rec(cursor)
- && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
- rec_get_offsets(
- btr_pcur_get_rec(cursor), index,
- NULL, ULINT_UNDEFINED, &heap))) {
-
- /* We have to store the NEW value for the modify clock, since
- the cursor can now be on a different page! But we can retain
- the value of old_rec */
+ if (btr_pcur_is_on_user_rec(cursor)) {
+ switch (cursor->rel_pos) {
+ case BTR_PCUR_ON:
+ if (!cmp_dtuple_rec(
+ tuple, btr_pcur_get_rec(cursor),
+ rec_get_offsets(btr_pcur_get_rec(cursor),
+ index, NULL,
+ ULINT_UNDEFINED, &heap))) {
+
+ /* We have to store the NEW value for
+ the modify clock, since the cursor can
+ now be on a different page! But we can
+ retain the value of old_rec */
+
+ cursor->block_when_stored =
+ btr_pcur_get_block(cursor);
+ cursor->modify_clock =
+ buf_block_get_modify_clock(
+ cursor->block_when_stored);
+ cursor->old_stored = BTR_PCUR_OLD_STORED;
- cursor->block_when_stored = btr_pcur_get_block(cursor);
- cursor->modify_clock = buf_block_get_modify_clock(
- cursor->block_when_stored);
- cursor->old_stored = BTR_PCUR_OLD_STORED;
+ mem_heap_free(heap);
- mem_heap_free(heap);
+ return(TRUE);
+ }
- return(TRUE);
+ break;
+ case BTR_PCUR_BEFORE:
+ page_cur_move_to_next(btr_pcur_get_page_cur(cursor));
+ break;
+ case BTR_PCUR_AFTER:
+ page_cur_move_to_prev(btr_pcur_get_page_cur(cursor));
+ break;
+#ifdef UNIV_DEBUG
+ default:
+ ut_error;
+#endif /* UNIV_DEBUG */
+ }
}
mem_heap_free(heap);
diff --git a/storage/xtradb/btr/btr0sea.c b/storage/xtradb/btr/btr0sea.c
index bddbcc79dd6..855ab62c42f 100644
--- a/storage/xtradb/btr/btr0sea.c
+++ b/storage/xtradb/btr/btr0sea.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -1240,7 +1240,7 @@ cleanup:
index->name, (ulong) block->n_pointers);
rw_lock_x_unlock(btr_search_get_latch(index->id));
- btr_search_validate();
+ ut_ad(btr_search_validate());
} else {
rw_lock_x_unlock(btr_search_get_latch(index->id));
}
@@ -2143,7 +2143,9 @@ btr_search_validate(void)
(ulong) block->curr_left_side);
if (n_page_dumps < 20) {
- buf_page_print(page, 0);
+ buf_page_print(
+ page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
n_page_dumps++;
}
}
diff --git a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c
index 11b079dd0ef..fd7b8959473 100644
--- a/storage/xtradb/buf/buf0buf.c
+++ b/storage/xtradb/buf/buf0buf.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -57,7 +57,9 @@ Created 11/5/1995 Heikki Tuuri
/* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx();
-static inline void _increment_page_get_statistics(buf_block_t* block, trx_t* trx)
+static inline
+void
+_increment_page_get_statistics(buf_block_t* block, trx_t* trx)
{
ulint block_hash;
ulint block_hash_byte;
@@ -680,8 +682,12 @@ void
buf_page_print(
/*===========*/
const byte* read_buf, /*!< in: a database page */
- ulint zip_size) /*!< in: compressed page size, or
- 0 for uncompressed pages */
+ ulint zip_size, /*!< in: compressed page size, or
+ 0 for uncompressed pages */
+ ulint flags) /*!< in: 0 or
+ BUF_PAGE_PRINT_NO_CRASH or
+ BUF_PAGE_PRINT_NO_FULL */
+
{
#ifndef UNIV_HOTBACKUP
dict_index_t* index;
@@ -695,11 +701,14 @@ buf_page_print(
size = UNIV_PAGE_SIZE;
}
- ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: Page dump in ascii and hex (%lu bytes):\n",
- (ulong) size);
- ut_print_buf(stderr, read_buf, size);
- fputs("\nInnoDB: End of page dump\n", stderr);
+ if (!(flags & BUF_PAGE_PRINT_NO_FULL)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Page dump in ascii and hex (%lu bytes):\n",
+ (ulong) size);
+ ut_print_buf(stderr, read_buf, size);
+ fputs("\nInnoDB: End of page dump\n", stderr);
+ }
if (zip_size) {
/* Print compressed page. */
@@ -873,6 +882,8 @@ buf_page_print(
stderr);
break;
}
+
+ ut_ad(flags & BUF_PAGE_PRINT_NO_CRASH);
}
#ifndef UNIV_HOTBACKUP
@@ -1078,11 +1089,8 @@ buf_chunk_init(
for (i = chunk->size; i--; ) {
buf_block_init(buf_pool, block, frame);
+ UNIV_MEM_INVALID(block->frame, UNIV_PAGE_SIZE);
-#ifdef HAVE_valgrind
- /* Wipe contents of frame to eliminate a Purify warning */
- memset(block->frame, '\0', UNIV_PAGE_SIZE);
-#endif
/* Add the block to the free list */
mutex_enter(&buf_pool->free_list_mutex);
UT_LIST_ADD_LAST(free, buf_pool->free, (&block->page));
@@ -2768,7 +2776,7 @@ wait_until_unfixed:
block->page.buf_fix_count = 1;
buf_block_set_io_fix(block, BUF_IO_READ);
- rw_lock_x_lock_func(&block->lock, 0, file, line);
+ rw_lock_x_lock_inline(&block->lock, 0, file, line);
UNIV_MEM_INVALID(bpage, sizeof *bpage);
@@ -2931,14 +2939,14 @@ wait_until_unfixed:
break;
case RW_S_LATCH:
- rw_lock_s_lock_func(&(block->lock), 0, file, line);
+ rw_lock_s_lock_inline(&(block->lock), 0, file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
break;
default:
ut_ad(rw_latch == RW_X_LATCH);
- rw_lock_x_lock_func(&(block->lock), 0, file, line);
+ rw_lock_x_lock_inline(&(block->lock), 0, file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
break;
@@ -3023,8 +3031,8 @@ buf_page_optimistic_get(
file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
} else {
- success = rw_lock_x_lock_func_nowait(&(block->lock),
- file, line);
+ success = rw_lock_x_lock_func_nowait_inline(&(block->lock),
+ file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
}
@@ -3165,8 +3173,8 @@ buf_page_get_known_nowait(
file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
} else {
- success = rw_lock_x_lock_func_nowait(&(block->lock),
- file, line);
+ success = rw_lock_x_lock_func_nowait_inline(&(block->lock),
+ file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
}
@@ -3186,7 +3194,7 @@ buf_page_get_known_nowait(
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
- ut_a(block->page.file_page_was_freed == FALSE);
+ ut_a(mode == BUF_KEEP_OLD || !block->page.file_page_was_freed);
#endif
#ifdef UNIV_IBUF_COUNT_DEBUG
@@ -3261,8 +3269,8 @@ buf_page_try_get_func(
S-latch. */
fix_type = MTR_MEMO_PAGE_X_FIX;
- success = rw_lock_x_lock_func_nowait(&block->lock,
- file, line);
+ success = rw_lock_x_lock_func_nowait_inline(&block->lock,
+ file, line);
}
if (!success) {
@@ -3997,7 +4005,8 @@ corrupt:
"InnoDB: You may have to recover"
" from a backup.\n",
(ulong) bpage->offset);
- buf_page_print(frame, buf_page_get_zip_size(bpage));
+ buf_page_print(frame, buf_page_get_zip_size(bpage),
+ BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"InnoDB: Database page corruption on disk"
" or a failed\n"
@@ -5285,34 +5294,32 @@ buf_all_freed(void)
/*********************************************************************//**
Checks that there currently are no pending i/o-operations for the buffer
pool.
-@return TRUE if there is no pending i/o */
+@return number of pending i/o */
UNIV_INTERN
-ibool
-buf_pool_check_no_pending_io(void)
-/*==============================*/
+ulint
+buf_pool_check_num_pending_io(void)
+/*===============================*/
{
ulint i;
- ibool ret = TRUE;
+ ulint pending_io = 0;
buf_pool_mutex_enter_all();
- for (i = 0; i < srv_buf_pool_instances && ret; i++) {
+ for (i = 0; i < srv_buf_pool_instances; i++) {
const buf_pool_t* buf_pool;
buf_pool = buf_pool_from_array(i);
- if (buf_pool->n_pend_reads
- + buf_pool->n_flush[BUF_FLUSH_LRU]
- + buf_pool->n_flush[BUF_FLUSH_LIST]
- + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]) {
+ pending_io += buf_pool->n_pend_reads
+ + buf_pool->n_flush[BUF_FLUSH_LRU]
+ + buf_pool->n_flush[BUF_FLUSH_LIST]
+ + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE];
- ret = FALSE;
- }
}
buf_pool_mutex_exit_all();
- return(ret);
+ return(pending_io);
}
#if 0
diff --git a/storage/xtradb/buf/buf0flu.c b/storage/xtradb/buf/buf0flu.c
index d776a274d14..bb921928653 100644
--- a/storage/xtradb/buf/buf0flu.c
+++ b/storage/xtradb/buf/buf0flu.c
@@ -767,7 +767,8 @@ buf_flush_buffered_writes(void)
if (UNIV_UNLIKELY
(!page_simple_validate_new(block->frame))) {
corrupted_page:
- buf_page_print(block->frame, 0);
+ buf_page_print(block->frame, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -2036,22 +2037,6 @@ buf_flush_list(
buf_pool = buf_pool_from_array(i);
- if (lsn_limit != IB_ULONGLONG_MAX) {
- buf_page_t* bpage;
-
- buf_flush_list_mutex_enter(buf_pool);
- bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
- if (!bpage
- || bpage->oldest_modification >= lsn_limit) {
-
- buf_flush_list_mutex_exit(buf_pool);
- continue;
- } else {
-
- buf_flush_list_mutex_exit(buf_pool);
- }
- }
-
if (!buf_flush_start(buf_pool, BUF_FLUSH_LIST)) {
/* We have two choices here. If lsn_limit was
specified then skipping an instance of buffer
diff --git a/storage/xtradb/buf/buf0lru.c b/storage/xtradb/buf/buf0lru.c
index ecad1cf1e64..f7b5db2d0cc 100644
--- a/storage/xtradb/buf/buf0lru.c
+++ b/storage/xtradb/buf/buf0lru.c
@@ -48,6 +48,7 @@ Created 11/5/1995 Heikki Tuuri
#include "page0zip.h"
#include "log0recv.h"
#include "srv0srv.h"
+#include "srv0start.h"
/** The number of blocks from the LRU_old pointer onward, including
the block pointed to, must be buf_pool->LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
@@ -372,41 +373,277 @@ 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
+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. */
+static
+void
+buf_flush_yield(
+/*============*/
+ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
+ buf_page_t* bpage) /*!< in/out: current page */
+{
+ mutex_t* block_mutex;
+
+ ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(buf_page_in_file(bpage));
+
+ block_mutex = buf_page_get_mutex(bpage);
+
+ mutex_enter(block_mutex);
+ /* "Fix" the block so that the position cannot be
+ changed after we release the buffer pool and
+ block mutexes. */
+ buf_page_set_sticky(bpage);
+
+ /* Now it is safe to release the buf_pool->mutex. */
+ buf_pool_mutex_exit(buf_pool);
+
+ mutex_exit(block_mutex);
+ /* Try and force a context switch. */
+ os_thread_yield();
+
+ buf_pool_mutex_enter(buf_pool);
+
+ mutex_enter(block_mutex);
+ /* "Unfix" the block now that we have both the
+ buffer pool and block mutex again. */
+ buf_page_unset_sticky(bpage);
+ mutex_exit(block_mutex);
+}
+
+/******************************************************************//**
+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.
+@return TRUE if yielded */
+static
+ibool
+buf_flush_try_yield(
+/*================*/
+ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
+ buf_page_t* bpage, /*!< in/out: bpage to remove */
+ ulint processed) /*!< in: number of pages processed */
+{
+ /* Every BUF_LRU_DROP_SEARCH_SIZE iterations in the
+ loop we release buf_pool->mutex to let other threads
+ do their job but only if the block is not IO fixed. This
+ ensures that the block stays in its position in the
+ flush_list. */
+
+ if (bpage != NULL
+ && processed >= BUF_LRU_DROP_SEARCH_SIZE
+ && buf_page_get_io_fix(bpage) == BUF_IO_NONE) {
+
+ buf_flush_list_mutex_exit(buf_pool);
+
+ /* Release the buffer pool and block mutex
+ to give the other threads a go. */
+
+ buf_flush_yield(buf_pool, bpage);
+
+ buf_flush_list_mutex_enter(buf_pool);
+
+ /* Should not have been removed from the flush
+ list during the yield. However, this check is
+ not sufficient to catch a remove -> add. */
+
+ ut_ad(bpage->in_flush_list);
+
+ return(TRUE);
+ }
+
+ return(FALSE);
+}
+
+/******************************************************************//**
+Removes a single page from a given tablespace inside a specific
+buffer pool instance.
+@return TRUE if page was removed. */
+static
+ibool
+buf_flush_or_remove_page(
+/*=====================*/
+ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
+ buf_page_t* bpage) /*!< in/out: bpage to remove */
+{
+ mutex_t* block_mutex;
+ ibool processed = FALSE;
+
+ ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(buf_flush_list_mutex_own(buf_pool));
+
+ block_mutex = buf_page_get_mutex(bpage);
+
+ /* bpage->space and bpage->io_fix are protected by
+ buf_pool->mutex and block_mutex. It is safe to check
+ them while holding buf_pool->mutex only. */
+
+ if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
+
+ /* We cannot remove this page during this scan
+ yet; maybe the system is currently reading it
+ in, or flushing the modifications to the file */
+
+ } else {
+
+ /* We have to release the flush_list_mutex to obey the
+ latching order. We are however guaranteed that the page
+ will stay in the flush_list because buf_flush_remove()
+ needs buf_pool->mutex as well (for the non-flush case). */
+
+ buf_flush_list_mutex_exit(buf_pool);
+
+ mutex_enter(block_mutex);
+
+ ut_ad(bpage->oldest_modification != 0);
+
+ if (bpage->buf_fix_count == 0) {
+
+ buf_flush_remove(bpage);
+
+ processed = TRUE;
+ }
+
+ mutex_exit(block_mutex);
+
+ buf_flush_list_mutex_enter(buf_pool);
+ }
+
+ ut_ad(!mutex_own(block_mutex));
+
+ return(processed);
+}
+
+/******************************************************************//**
Remove all dirty pages belonging to a given tablespace inside a specific
buffer pool instance when we are deleting the data file(s) of that
tablespace. The pages still remain a part of LRU and are evicted from
-the list as they age towards the tail of the LRU. */
+the list as they age towards the tail of the LRU.
+@return TRUE if all freed. */
+static
+ibool
+buf_flush_or_remove_pages(
+/*======================*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ ulint id) /*!< in: target space id for which
+ to remove or flush pages */
+{
+ buf_page_t* prev;
+ buf_page_t* bpage;
+ ulint processed = 0;
+ ibool all_freed = TRUE;
+
+ buf_flush_list_mutex_enter(buf_pool);
+
+ for (bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
+ bpage != NULL;
+ bpage = prev) {
+
+ ut_a(buf_page_in_file(bpage));
+ ut_ad(bpage->in_flush_list);
+
+ /* Save the previous link because once we free the
+ page we can't rely on the links. */
+
+ prev = UT_LIST_GET_PREV(flush_list, bpage);
+
+ if (buf_page_get_space(bpage) != id) {
+
+ /* Skip this block, as it does not belong to
+ the target space. */
+
+ } else if (!buf_flush_or_remove_page(buf_pool, bpage)) {
+
+ /* Remove was unsuccessful, we have to try again
+ by scanning the entire list from the end. */
+
+ all_freed = FALSE;
+ }
+
+ ++processed;
+
+ /* Yield if we have hogged the CPU and mutexes for too long. */
+ if (buf_flush_try_yield(buf_pool, prev, processed)) {
+
+ /* Reset the batch size counter if we had to yield. */
+
+ processed = 0;
+ }
+
+ }
+
+ buf_flush_list_mutex_exit(buf_pool);
+
+ return(all_freed);
+}
+
+/******************************************************************//**
+Remove or flush all the dirty pages that belong to a given tablespace
+inside a specific buffer pool instance. The pages will remain in the LRU
+list and will be evicted from the LRU list as they age and move towards
+the tail of the LRU list. */
+static
+void
+buf_flush_dirty_pages(
+/*==================*/
+ buf_pool_t* buf_pool, /*!< buffer pool instance */
+ ulint id) /*!< in: space id */
+{
+ ibool all_freed;
+
+ do {
+ buf_pool_mutex_enter(buf_pool);
+
+ all_freed = buf_flush_or_remove_pages(buf_pool, id);
+
+ buf_pool_mutex_exit(buf_pool);
+
+ ut_ad(buf_flush_validate(buf_pool));
+
+ if (!all_freed) {
+ os_thread_sleep(20000);
+ }
+
+ } while (!all_freed);
+}
+
+/******************************************************************//**
+Remove all pages that belong to a given tablespace inside a specific
+buffer pool instance when we are DISCARDing the tablespace. */
static
void
-buf_LRU_remove_dirty_pages_for_tablespace(
-/*======================================*/
+buf_LRU_remove_all_pages(
+/*=====================*/
buf_pool_t* buf_pool, /*!< buffer pool instance */
ulint id) /*!< in: space id */
{
buf_page_t* bpage;
ibool all_freed;
- ulint i;
scan_again:
//buf_pool_mutex_enter(buf_pool);
mutex_enter(&buf_pool->LRU_list_mutex);
rw_lock_x_lock(&buf_pool->page_hash_latch);
- buf_flush_list_mutex_enter(buf_pool);
all_freed = TRUE;
- for (bpage = UT_LIST_GET_LAST(buf_pool->flush_list), i = 0;
- bpage != NULL; ++i) {
+ for (bpage = UT_LIST_GET_LAST(buf_pool->LRU);
+ bpage != NULL;
+ /* No op */) {
buf_page_t* prev_bpage;
mutex_t* block_mutex = NULL;
ut_a(buf_page_in_file(bpage));
+ ut_ad(bpage->in_LRU_list);
- prev_bpage = UT_LIST_GET_PREV(flush_list, bpage);
+ prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
/* bpage->space and bpage->io_fix are protected by
- buf_pool->mutex and block_mutex. It is safe to check
+ buf_pool->mutex and the block_mutex. It is safe to check
them while holding buf_pool->mutex only. */
if (buf_page_get_space(bpage) != id) {
@@ -420,97 +657,89 @@ scan_again:
all_freed = FALSE;
goto next_page;
- }
+ } else {
- /* We have to release the flush_list_mutex to obey the
- latching order. We are however guaranteed that the page
- will stay in the flush_list because buf_flush_remove()
- needs buf_pool->mutex as well. */
- buf_flush_list_mutex_exit(buf_pool);
- block_mutex = buf_page_get_mutex_enter(bpage);
+ block_mutex = buf_page_get_mutex(bpage);
+ mutex_enter(block_mutex);
- 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) {
- if (bpage->buf_fix_count > 0) {
- mutex_exit(block_mutex);
- buf_flush_list_mutex_enter(buf_pool);
+ mutex_exit(block_mutex);
- /* We cannot remove this page during
- this scan yet; maybe the system is
- currently reading it in, or flushing
- the modifications to the file */
+ /* We cannot remove this page during
+ this scan yet; maybe the system is
+ currently reading it in, or flushing
+ the modifications to the file */
- all_freed = FALSE;
- goto next_page;
+ all_freed = FALSE;
+
+ goto next_page;
+ }
}
- ut_ad(bpage->oldest_modification != 0);
+ ut_ad(mutex_own(block_mutex));
- buf_flush_remove(bpage);
+#ifdef UNIV_DEBUG
+ if (buf_debug_prints) {
+ fprintf(stderr,
+ "Dropping space %lu page %lu\n",
+ (ulong) buf_page_get_space(bpage),
+ (ulong) buf_page_get_page_no(bpage));
+ }
+#endif
+ if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
+ /* Do nothing, because the adaptive hash index
+ covers uncompressed pages only. */
+ } else if (((buf_block_t*) bpage)->index) {
+ ulint page_no;
+ ulint zip_size;
- mutex_exit(block_mutex);
- buf_flush_list_mutex_enter(buf_pool);
-next_page:
- bpage = prev_bpage;
+ buf_pool_mutex_exit(buf_pool);
- if (!bpage) {
- break;
- }
+ zip_size = buf_page_get_zip_size(bpage);
+ page_no = buf_page_get_page_no(bpage);
- /* Every BUF_LRU_DROP_SEARCH_SIZE iterations in the
- loop we release buf_pool->mutex to let other threads
- do their job. */
- if (i < BUF_LRU_DROP_SEARCH_SIZE) {
- continue;
+ mutex_exit(block_mutex);
+
+ /* Note that the following call will acquire
+ and release block->lock X-latch. */
+
+ btr_search_drop_page_hash_when_freed(
+ id, zip_size, page_no);
+
+ goto scan_again;
}
- /* We IO-fix the block to make sure that the block
- stays in its position in the flush_list. */
- if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
- /* Block is already IO-fixed. We don't
- want to change the value. Lets leave
- this block alone. */
- continue;
+ if (bpage->oldest_modification != 0) {
+ buf_flush_remove(bpage);
}
- buf_flush_list_mutex_exit(buf_pool);
- block_mutex = buf_page_get_mutex(bpage);
- mutex_enter(block_mutex);
- buf_page_set_sticky(bpage);
- mutex_exit(block_mutex);
+ ut_ad(!bpage->in_flush_list);
- /* Now it is safe to release the buf_pool->mutex. */
- //buf_pool_mutex_exit(buf_pool);
- mutex_exit(&buf_pool->LRU_list_mutex);
- rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ /* Remove from the LRU list. */
- os_thread_yield();
- //buf_pool_mutex_enter(buf_pool);
- mutex_enter(&buf_pool->LRU_list_mutex);
- rw_lock_x_lock(&buf_pool->page_hash_latch);
+ if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
+ != BUF_BLOCK_ZIP_FREE) {
+ buf_LRU_block_free_hashed_page((buf_block_t*) bpage, TRUE);
+ mutex_exit(block_mutex);
- mutex_enter(block_mutex);
- buf_page_unset_sticky(bpage);
- mutex_exit(block_mutex);
+ } 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);
+ }
- buf_flush_list_mutex_enter(buf_pool);
- ut_ad(bpage->in_flush_list);
+ ut_ad(!mutex_own(block_mutex));
- i = 0;
+next_page:
+ bpage = prev_bpage;
}
// buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->LRU_list_mutex);
rw_lock_x_unlock(&buf_pool->page_hash_latch);
- buf_flush_list_mutex_exit(buf_pool);
-
- ut_ad(buf_flush_validate(buf_pool));
if (!all_freed) {
os_thread_sleep(20000);
@@ -520,28 +749,46 @@ next_page:
}
/******************************************************************//**
-Invalidates all pages belonging to a given tablespace when we are deleting
-the data file(s) of that tablespace. */
+Removes all pages belonging to a given tablespace. */
UNIV_INTERN
void
-buf_LRU_invalidate_tablespace(
+buf_LRU_flush_or_remove_pages(
/*==========================*/
- ulint id) /*!< in: space id */
+ ulint id, /*!< in: space id */
+ enum buf_remove_t buf_remove)/*!< in: remove or flush
+ strategy */
{
- ulint i;
+ ulint i;
- /* Before we attempt to drop pages one by one we first
- attempt to drop page hash index entries in batches to make
- it more efficient. The batching attempt is a best effort
- attempt and does not guarantee that all pages hash entries
- will be dropped. We get rid of remaining page hash entries
- one by one below. */
for (i = 0; i < srv_buf_pool_instances; i++) {
buf_pool_t* buf_pool;
buf_pool = buf_pool_from_array(i);
- buf_LRU_drop_page_hash_for_tablespace(buf_pool, id);
- buf_LRU_remove_dirty_pages_for_tablespace(buf_pool, id);
+
+ switch (buf_remove) {
+ case BUF_REMOVE_ALL_NO_WRITE:
+ /* A DISCARD tablespace case. Remove AHI entries
+ and evict all pages from LRU. */
+
+ /* Before we attempt to drop pages hash entries
+ one by one we first attempt to drop page hash
+ index entries in batches to make it more
+ efficient. The batching attempt is a best effort
+ attempt and does not guarantee that all pages
+ hash entries will be dropped. We get rid of
+ remaining page hash entries one by one below. */
+ buf_LRU_drop_page_hash_for_tablespace(buf_pool, id);
+ buf_LRU_remove_all_pages(buf_pool, id);
+ break;
+
+ case BUF_REMOVE_FLUSH_NO_WRITE:
+ /* A DROP table case. AHI entries are already
+ removed. No need to evict all pages from LRU
+ list. Just evict pages from flush list without
+ writing. */
+ buf_flush_dirty_pages(buf_pool, id);
+ break;
+ }
}
}
@@ -614,7 +861,7 @@ buf_LRU_insert_zip_clean(
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
//ut_ad(buf_pool_mutex_own(buf_pool));
- ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
+ //ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_ad(mutex_own(&buf_pool->zip_mutex));
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_PAGE);
@@ -2260,6 +2507,7 @@ func_exit:
/********************************************************************//**
Dump the LRU page list to the specific file. */
#define LRU_DUMP_FILE "ib_lru_dump"
+#define LRU_DUMP_TEMP_FILE "ib_lru_dump.tmp"
UNIV_INTERN
ibool
@@ -2294,8 +2542,10 @@ buf_LRU_file_dump(void)
goto end;
}
- dump_file = os_file_create(innodb_file_temp_key, LRU_DUMP_FILE, OS_FILE_OVERWRITE,
- OS_FILE_NORMAL, OS_DATA_FILE, &success);
+ dump_file = os_file_create(innodb_file_temp_key, LRU_DUMP_TEMP_FILE,
+ OS_FILE_OVERWRITE, OS_FILE_NORMAL, OS_DATA_FILE,
+ &success);
+
if (!success) {
os_file_get_last_error(TRUE);
fprintf(stderr,
@@ -2324,6 +2574,13 @@ buf_LRU_file_dump(void)
offset++;
if (offset == UNIV_PAGE_SIZE/4) {
+ if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ success = 0;
+ fprintf(stderr,
+ " InnoDB: stopped dumping lru"
+ " pages because of server"
+ " shutdown.\n");
+ }
success = os_file_write(LRU_DUMP_FILE, dump_file, buffer,
(buffers << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFFUL,
(buffers >> (32 - UNIV_PAGE_SIZE_SHIFT)),
@@ -2363,8 +2620,16 @@ buf_LRU_file_dump(void)
ret = TRUE;
end:
- if (dump_file != (os_file_t) -1)
+ if (dump_file != (os_file_t) -1) {
+ if (success) {
+ success = os_file_flush(dump_file, TRUE);
+ }
os_file_close(dump_file);
+ }
+ if (success) {
+ success = os_file_rename(innodb_file_temp_key,
+ LRU_DUMP_TEMP_FILE, LRU_DUMP_FILE);
+ }
if (buffer_base)
ut_free(buffer_base);
@@ -2410,6 +2675,7 @@ buf_LRU_file_restore(void)
dump_record_t* records = NULL;
ulint size;
ulint size_high;
+ ulint recsize = sizeof(dump_record_t);
ulint length;
dump_file = os_file_create_simple_no_error_handling(innodb_file_temp_key,
@@ -2417,7 +2683,14 @@ buf_LRU_file_restore(void)
if (!success || !os_file_get_size(dump_file, &size, &size_high)) {
os_file_get_last_error(TRUE);
fprintf(stderr,
- " InnoDB: cannot open %s\n", LRU_DUMP_FILE);
+ " InnoDB: cannot open %s, "
+ " buffer pool preload not done.\n", LRU_DUMP_FILE);
+ goto end;
+ }
+
+ if (size == 0 || size_high > 0 || size % recsize) {
+ fprintf(stderr, " InnoDB: broken LRU dump file,"
+ " buffer pool preload not done\n");
goto end;
}
@@ -2501,6 +2774,14 @@ buf_LRU_file_restore(void)
if (offset % 16 == 15) {
os_aio_simulated_wake_handler_threads();
buf_flush_free_margins(FALSE);
+ /* skip loading of the rest of the file if we are
+ terminating anyway */
+ if(srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ fprintf(stderr,
+ " InnoDB: stopped loading lru pages"
+ " because of server shutdown\n");
+ break;
+ }
}
zip_size = fil_space_get_zip_size(space_id);
diff --git a/storage/xtradb/dict/dict0boot.c b/storage/xtradb/dict/dict0boot.c
index fd08fa759ee..4bf69fa4e0b 100644
--- a/storage/xtradb/dict/dict0boot.c
+++ b/storage/xtradb/dict/dict0boot.c
@@ -240,6 +240,166 @@ dict_hdr_create(
}
/*****************************************************************//**
+Verifies the SYS_STATS table by scanning its clustered index. This
+function may only be called at InnoDB startup time.
+
+@return TRUE if SYS_STATS was verified successfully */
+UNIV_INTERN
+ibool
+dict_verify_xtradb_sys_stats(void)
+/*==============================*/
+{
+ dict_index_t* sys_stats_index;
+ ulint saved_srv_pass_corrupt_table = srv_pass_corrupt_table;
+ ibool result;
+
+ sys_stats_index = dict_table_get_first_index(dict_sys->sys_stats);
+
+ /* Since this may be called only during server startup, avoid hitting
+ various asserts by using XtraDB pass_corrupt_table option. */
+ srv_pass_corrupt_table = 1;
+ result = btr_validate_index(sys_stats_index, NULL);
+ srv_pass_corrupt_table = saved_srv_pass_corrupt_table;
+
+ return result;
+}
+
+/*****************************************************************//**
+Creates the B-tree for the SYS_STATS clustered index, adds the XtraDB
+mark and the id of the index to the dictionary header page. Rewrites
+both passed args. */
+static
+void
+dict_create_xtradb_sys_stats(
+/*=========================*/
+ dict_hdr_t** dict_hdr, /*!< in/out: dictionary header */
+ mtr_t* mtr) /*!< in/out: mtr */
+{
+ ulint root_page_no;
+
+ root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
+ DICT_HDR_SPACE, 0, DICT_STATS_ID,
+ dict_ind_redundant, mtr);
+ if (root_page_no == FIL_NULL) {
+ fprintf(stderr, "InnoDB: Warning: failed to create SYS_STATS btr.\n");
+ srv_use_sys_stats_table = FALSE;
+ } else {
+ mlog_write_ulint(*dict_hdr + DICT_HDR_STATS, root_page_no,
+ MLOG_4BYTES, mtr);
+ mlog_write_ull(*dict_hdr + DICT_HDR_XTRADB_MARK,
+ DICT_HDR_XTRADB_FLAG, mtr);
+ }
+ mtr_commit(mtr);
+ /* restart mtr */
+ mtr_start(mtr);
+ *dict_hdr = dict_hdr_get(mtr);
+}
+
+/*****************************************************************//**
+Create the table and index structure of SYS_STATS for the dictionary
+cache and add it there. If called for the first time, also support
+wrong root page id injection for testing purposes. */
+static
+void
+dict_add_to_cache_xtradb_sys_stats(
+/*===============================*/
+ ibool first_time __attribute__((unused)),
+ /*!< in: first invocation flag. If
+ TRUE, optionally inject wrong root page
+ id */
+ mem_heap_t* heap, /*!< in: memory heap for table/index
+ allocation */
+ dict_hdr_t* dict_hdr, /*!< in: dictionary header */
+ mtr_t* mtr) /*!< in: mtr */
+{
+ dict_table_t* table;
+ dict_index_t* index;
+ ulint root_page_id;
+ ulint error;
+
+ table = dict_mem_table_create("SYS_STATS", DICT_HDR_SPACE, 4, 0);
+ table->n_mysql_handles_opened = 1; /* for pin */
+
+ dict_mem_table_add_col(table, heap, "INDEX_ID", DATA_BINARY, 0, 0);
+ dict_mem_table_add_col(table, heap, "KEY_COLS", DATA_INT, 0, 4);
+ dict_mem_table_add_col(table, heap, "DIFF_VALS", DATA_BINARY, 0, 0);
+ dict_mem_table_add_col(table, heap, "NON_NULL_VALS", DATA_BINARY, 0, 0);
+
+ /* The '+ 2' below comes from the fields DB_TRX_ID, DB_ROLL_PTR */
+#if DICT_SYS_STATS_DIFF_VALS_FIELD != 2 + 2
+#error "DICT_SYS_STATS_DIFF_VALS_FIELD != 2 + 2"
+#endif
+#if DICT_SYS_STATS_NON_NULL_VALS_FIELD != 3 + 2
+#error "DICT_SYS_STATS_NON_NULL_VALS_FIELD != 3 + 2"
+#endif
+
+ table->id = DICT_STATS_ID;
+ dict_table_add_to_cache(table, heap);
+ dict_sys->sys_stats = table;
+ mem_heap_empty(heap);
+
+ index = dict_mem_index_create("SYS_STATS", "CLUST_IND",
+ DICT_HDR_SPACE,
+ DICT_UNIQUE | DICT_CLUSTERED, 2);
+
+ dict_mem_index_add_field(index, "INDEX_ID", 0);
+ dict_mem_index_add_field(index, "KEY_COLS", 0);
+
+ index->id = DICT_STATS_ID;
+
+ root_page_id = mtr_read_ulint(dict_hdr + DICT_HDR_STATS, MLOG_4BYTES,
+ mtr);
+#ifdef UNIV_DEBUG
+ if ((srv_sys_stats_root_page != 0) && first_time)
+ root_page_id = srv_sys_stats_root_page;
+#endif
+ error = dict_index_add_to_cache(table, index, root_page_id, FALSE);
+ ut_a(error == DB_SUCCESS);
+
+ mem_heap_empty(heap);
+}
+
+/*****************************************************************//**
+Discard the existing dictionary cache SYS_STATS information, create and
+add it there anew. Does not touch the old SYS_STATS tablespace page
+under the assumption that they are corrupted or overwritten for other
+purposes. */
+UNIV_INTERN
+void
+dict_recreate_xtradb_sys_stats(void)
+/*================================*/
+{
+ mtr_t mtr;
+ dict_hdr_t* dict_hdr;
+ dict_index_t* sys_stats_clust_idx;
+ mem_heap_t* heap;
+
+ heap = mem_heap_create(450);
+
+ mutex_enter(&(dict_sys->mutex));
+
+ sys_stats_clust_idx = dict_table_get_first_index(dict_sys->sys_stats);
+ dict_index_remove_from_cache(dict_sys->sys_stats, sys_stats_clust_idx);
+
+ dict_table_remove_from_cache(dict_sys->sys_stats);
+
+ dict_sys->sys_stats = NULL;
+
+ mtr_start(&mtr);
+
+ dict_hdr = dict_hdr_get(&mtr);
+
+ dict_create_xtradb_sys_stats(&dict_hdr, &mtr);
+ dict_add_to_cache_xtradb_sys_stats(FALSE, heap, dict_hdr, &mtr);
+
+ mem_heap_free(heap);
+
+ mtr_commit(&mtr);
+
+ mutex_exit(&(dict_sys->mutex));
+}
+
+/*****************************************************************//**
Initializes the data dictionary memory structures when the database is
started. This function is also called when the data dictionary is created. */
UNIV_INTERN
@@ -254,13 +414,13 @@ dict_boot(void)
mtr_t mtr;
ulint error;
+ heap = mem_heap_create(450);
+
mtr_start(&mtr);
/* Create the hash tables etc. */
dict_init();
- heap = mem_heap_create(450);
-
mutex_enter(&(dict_sys->mutex));
/* Get the dictionary header */
@@ -268,25 +428,9 @@ dict_boot(void)
if (mach_read_from_8(dict_hdr + DICT_HDR_XTRADB_MARK)
!= DICT_HDR_XTRADB_FLAG) {
+
/* not extended yet by XtraDB, need to be extended */
- ulint root_page_no;
-
- root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
- DICT_HDR_SPACE, 0, DICT_STATS_ID,
- dict_ind_redundant, &mtr);
- if (root_page_no == FIL_NULL) {
- fprintf(stderr, "InnoDB: Warning: failed to create SYS_STATS btr.\n");
- srv_use_sys_stats_table = FALSE;
- } else {
- mlog_write_ulint(dict_hdr + DICT_HDR_STATS, root_page_no,
- MLOG_4BYTES, &mtr);
- mlog_write_ull(dict_hdr + DICT_HDR_XTRADB_MARK,
- DICT_HDR_XTRADB_FLAG, &mtr);
- }
- mtr_commit(&mtr);
- /* restart mtr */
- mtr_start(&mtr);
- dict_hdr = dict_hdr_get(&mtr);
+ dict_create_xtradb_sys_stats(&dict_hdr, &mtr);
}
/* Because we only write new row ids to disk-based data structure
@@ -465,42 +609,7 @@ dict_boot(void)
FALSE);
ut_a(error == DB_SUCCESS);
- /*-------------------------*/
- table = dict_mem_table_create("SYS_STATS", DICT_HDR_SPACE, 4, 0);
- table->n_mysql_handles_opened = 1; /* for pin */
-
- dict_mem_table_add_col(table, heap, "INDEX_ID", DATA_BINARY, 0, 0);
- dict_mem_table_add_col(table, heap, "KEY_COLS", DATA_INT, 0, 4);
- dict_mem_table_add_col(table, heap, "DIFF_VALS", DATA_BINARY, 0, 0);
- dict_mem_table_add_col(table, heap, "NON_NULL_VALS", DATA_BINARY, 0, 0);
-
- /* The '+ 2' below comes from the fields DB_TRX_ID, DB_ROLL_PTR */
-#if DICT_SYS_STATS_DIFF_VALS_FIELD != 2 + 2
-#error "DICT_SYS_STATS_DIFF_VALS_FIELD != 2 + 2"
-#endif
-#if DICT_SYS_STATS_NON_NULL_VALS_FIELD != 3 + 2
-#error "DICT_SYS_STATS_NON_NULL_VALS_FIELD != 3 + 2"
-#endif
-
- table->id = DICT_STATS_ID;
- dict_table_add_to_cache(table, heap);
- dict_sys->sys_stats = table;
- mem_heap_empty(heap);
-
- index = dict_mem_index_create("SYS_STATS", "CLUST_IND",
- DICT_HDR_SPACE,
- DICT_UNIQUE | DICT_CLUSTERED, 2);
-
- dict_mem_index_add_field(index, "INDEX_ID", 0);
- dict_mem_index_add_field(index, "KEY_COLS", 0);
-
- index->id = DICT_STATS_ID;
- error = dict_index_add_to_cache(table, index,
- mtr_read_ulint(dict_hdr
- + DICT_HDR_STATS,
- MLOG_4BYTES, &mtr),
- FALSE);
- ut_a(error == DB_SUCCESS);
+ dict_add_to_cache_xtradb_sys_stats(TRUE, heap, dict_hdr, &mtr);
mem_heap_free(heap);
diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c
index 98cf88455bd..3ee045807ed 100644
--- a/storage/xtradb/dict/dict0dict.c
+++ b/storage/xtradb/dict/dict0dict.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -56,6 +56,8 @@ UNIV_INTERN dict_index_t* dict_ind_compact;
#include "ha_prototypes.h" /* innobase_strcasecmp(), innobase_casedn_str()*/
#include "row0upd.h"
#include "srv0start.h" /* SRV_LOG_SPACE_FIRST_ID */
+#include "m_string.h"
+#include "my_sys.h"
#include <ctype.h>
@@ -2400,6 +2402,8 @@ dict_foreign_free(
/*==============*/
dict_foreign_t* foreign) /*!< in, own: foreign key struct */
{
+ ut_a(foreign->foreign_table->n_foreign_key_checks_running == 0);
+
mem_heap_free(foreign->heap);
}
@@ -4381,25 +4385,32 @@ dict_reload_statistics(
heap = mem_heap_create(1000);
while (index) {
+ mtr_t mtr;
+
if (table->is_corrupt) {
ut_a(srv_pass_corrupt_table);
mem_heap_free(heap);
return(FALSE);
}
- size = btr_get_size(index, BTR_TOTAL_SIZE);
+ mtr_start(&mtr);
+ mtr_s_lock(dict_index_get_lock(index), &mtr);
+
+ size = btr_get_size(index, BTR_TOTAL_SIZE, &mtr);
index->stat_index_size = size;
*sum_of_index_sizes += size;
- size = btr_get_size(index, BTR_N_LEAF_PAGES);
+ size = btr_get_size(index, BTR_N_LEAF_PAGES, &mtr);
if (size == 0) {
/* The root node of the tree is a leaf */
size = 1;
}
+ mtr_commit(&mtr);
+
index->stat_n_leaf_pages = size;
/*===========================================*/
@@ -4731,6 +4742,7 @@ dict_update_statistics(
(srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE
|| (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
&& dict_index_is_clust(index)))) {
+ mtr_t mtr;
ulint size;
if (table->is_corrupt) {
@@ -4739,15 +4751,24 @@ dict_update_statistics(
return;
}
- size = btr_get_size(index, BTR_TOTAL_SIZE);
+ mtr_start(&mtr);
+ mtr_s_lock(dict_index_get_lock(index), &mtr);
- index->stat_index_size = size;
+ size = btr_get_size(index, BTR_TOTAL_SIZE, &mtr);
- sum_of_index_sizes += size;
+ if (size != ULINT_UNDEFINED) {
+ sum_of_index_sizes += size;
+ index->stat_index_size = size;
+ size = btr_get_size(
+ index, BTR_N_LEAF_PAGES, &mtr);
+ }
- size = btr_get_size(index, BTR_N_LEAF_PAGES);
+ mtr_commit(&mtr);
- if (size == 0) {
+ switch (size) {
+ case ULINT_UNDEFINED:
+ goto fake_statistics;
+ case 0:
/* The root node of the tree is a leaf */
size = 1;
}
@@ -4764,6 +4785,7 @@ dict_update_statistics(
various means, also via secondary indexes. */
ulint i;
+fake_statistics:
sum_of_index_sizes++;
index->stat_index_size = index->stat_n_leaf_pages = 1;
diff --git a/storage/xtradb/dict/dict0load.c b/storage/xtradb/dict/dict0load.c
index 5303557548b..44492960bb8 100644
--- a/storage/xtradb/dict/dict0load.c
+++ b/storage/xtradb/dict/dict0load.c
@@ -2137,8 +2137,9 @@ static
void
dict_load_foreign_cols(
/*===================*/
- const char* id, /*!< in: foreign constraint id as a
- null-terminated string */
+ const char* id, /*!< in: foreign constraint id, not
+ necessary '\0'-terminated */
+ ulint id_len, /*!< in: id length */
dict_foreign_t* foreign)/*!< in: foreign constraint object */
{
dict_table_t* sys_foreign_cols;
@@ -2168,7 +2169,7 @@ dict_load_foreign_cols(
tuple = dtuple_create(foreign->heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
- dfield_set_data(dfield, id, ut_strlen(id));
+ dfield_set_data(dfield, id, id_len);
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
@@ -2181,7 +2182,7 @@ dict_load_foreign_cols(
ut_a(!rec_get_deleted_flag(rec, 0));
field = rec_get_nth_field_old(rec, 0, &len);
- ut_a(len == ut_strlen(id));
+ ut_a(len == id_len);
ut_a(ut_memcmp(id, field, len) == 0);
field = rec_get_nth_field_old(rec, 1, &len);
@@ -2210,8 +2211,9 @@ static
ulint
dict_load_foreign(
/*==============*/
- const char* id, /*!< in: foreign constraint id as a
- null-terminated string */
+ const char* id, /*!< in: foreign constraint id, not
+ necessary '\0'-terminated */
+ ulint id_len, /*!< in: id length */
ibool check_charsets,
/*!< in: TRUE=check charset compatibility */
ibool check_recursive)
@@ -2247,7 +2249,7 @@ dict_load_foreign(
tuple = dtuple_create(heap2, 1);
dfield = dtuple_get_nth_field(tuple, 0);
- dfield_set_data(dfield, id, ut_strlen(id));
+ dfield_set_data(dfield, id, id_len);
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
@@ -2259,8 +2261,8 @@ dict_load_foreign(
/* Not found */
fprintf(stderr,
- "InnoDB: Error A: cannot load foreign constraint %s\n",
- id);
+ "InnoDB: Error A: cannot load foreign constraint "
+ "%.*s\n", (int) id_len, id);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -2272,11 +2274,11 @@ dict_load_foreign(
field = rec_get_nth_field_old(rec, 0, &len);
/* Check if the id in record is the searched one */
- if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) {
+ if (len != id_len || ut_memcmp(id, field, len) != 0) {
fprintf(stderr,
- "InnoDB: Error B: cannot load foreign constraint %s\n",
- id);
+ "InnoDB: Error B: cannot load foreign constraint "
+ "%.*s\n", (int) id_len, id);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -2302,7 +2304,7 @@ dict_load_foreign(
foreign->type = (unsigned int) (n_fields_and_type >> 24);
foreign->n_fields = (unsigned int) (n_fields_and_type & 0x3FFUL);
- foreign->id = mem_heap_strdup(foreign->heap, id);
+ foreign->id = mem_heap_strdupl(foreign->heap, id, id_len);
field = rec_get_nth_field_old(rec, 3, &len);
@@ -2318,7 +2320,7 @@ dict_load_foreign(
btr_pcur_close(&pcur);
mtr_commit(&mtr);
- dict_load_foreign_cols(id, foreign);
+ dict_load_foreign_cols(id, id_len, foreign);
ref_table = dict_table_check_if_in_cache_low(
foreign->referenced_table_name_lookup);
@@ -2397,8 +2399,8 @@ dict_load_foreigns(
ibool check_charsets) /*!< in: TRUE=check charset
compatibility */
{
+ char tuple_buf[DTUPLE_EST_ALLOC(1)];
btr_pcur_t pcur;
- mem_heap_t* heap;
dtuple_t* tuple;
dfield_t* dfield;
dict_index_t* sec_index;
@@ -2406,7 +2408,6 @@ dict_load_foreigns(
const rec_t* rec;
const byte* field;
ulint len;
- char* id ;
ulint err;
mtr_t mtr;
@@ -2433,9 +2434,8 @@ dict_load_foreigns(
sec_index = dict_table_get_next_index(
dict_table_get_first_index(sys_foreign));
start_load:
- heap = mem_heap_create(256);
- tuple = dtuple_create(heap, 1);
+ tuple = dtuple_create_from_mem(tuple_buf, sizeof(tuple_buf), 1);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, table_name, ut_strlen(table_name));
@@ -2489,7 +2489,6 @@ loop:
/* Now we get a foreign key constraint id */
field = rec_get_nth_field_old(rec, 1, &len);
- id = mem_heap_strdupl(heap, (char*) field, len);
btr_pcur_store_position(&pcur, &mtr);
@@ -2497,11 +2496,11 @@ loop:
/* Load the foreign constraint definition to the dictionary cache */
- err = dict_load_foreign(id, check_charsets, check_recursive);
+ err = dict_load_foreign((char*) field, len, check_charsets,
+ check_recursive);
if (err != DB_SUCCESS) {
btr_pcur_close(&pcur);
- mem_heap_free(heap);
return(err);
}
@@ -2517,7 +2516,6 @@ next_rec:
load_next_index:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
- mem_heap_free(heap);
sec_index = dict_table_get_next_index(sec_index);
diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c
index 8cabf13e2c4..2b67bdafeb9 100644
--- a/storage/xtradb/fil/fil0fil.c
+++ b/storage/xtradb/fil/fil0fil.c
@@ -193,7 +193,7 @@ struct fil_space_struct {
.ibd file of tablespace and want to
stop temporarily posting of new i/o
requests on the file */
- ibool stop_ibuf_merges;
+ ibool stop_new_ops;
/*!< we set this TRUE when we start
deleting a single-table tablespace */
ibool is_being_deleted;
@@ -218,12 +218,13 @@ struct fil_space_struct {
ulint n_pending_flushes; /*!< this is positive when flushing
the tablespace to disk; dropping of the
tablespace is forbidden if this is positive */
- ulint n_pending_ibuf_merges;/*!< this is positive
- when merging insert buffer entries to
- a page so that we may need to access
- the ibuf bitmap page in the
- tablespade: dropping of the tablespace
- is forbidden if this is positive */
+ ulint n_pending_ops;/*!< this is positive when we
+ have pending operations against this
+ tablespace. The pending operations can
+ be ibuf merges or lock validation code
+ trying to read a block.
+ Dropping of the tablespace is forbidden
+ if this is positive */
hash_node_t hash; /*!< hash chain node */
hash_node_t name_hash;/*!< hash chain the name_hash table */
#ifndef UNIV_HOTBACKUP
@@ -974,11 +975,6 @@ retry:
return;
}
- if (fil_system->n_open < fil_system->max_n_open) {
-
- return;
- }
-
space = fil_space_get_by_id(space_id);
if (space != NULL && space->stop_ios) {
@@ -995,6 +991,25 @@ retry:
mutex_exit(&fil_system->mutex);
+#ifndef UNIV_HOTBACKUP
+
+ /* Wake the i/o-handler threads to make sure pending
+ i/o's are performed */
+ os_aio_simulated_wake_handler_threads();
+
+ /* The sleep here is just to give IO helper threads a
+ bit of time to do some work. It is not required that
+ all IO related to the tablespace being renamed must
+ be flushed here as we do fil_flush() in
+ fil_rename_tablespace() as well. */
+ os_thread_sleep(20000);
+
+#endif /* UNIV_HOTBACKUP */
+
+ /* Flush tablespaces so that we can close modified
+ files in the LRU list */
+ fil_flush_file_spaces(FIL_TABLESPACE);
+
os_thread_sleep(20000);
count2++;
@@ -1002,6 +1017,11 @@ retry:
goto retry;
}
+ if (fil_system->n_open < fil_system->max_n_open) {
+
+ return;
+ }
+
/* If the file is already open, no need to do anything; if the space
does not exist, we handle the situation in the function which called
this function */
@@ -1274,7 +1294,7 @@ try_again:
}
space->stop_ios = FALSE;
- space->stop_ibuf_merges = FALSE;
+ space->stop_new_ops = FALSE;
space->is_being_deleted = FALSE;
space->purpose = purpose;
space->size = 0;
@@ -1283,7 +1303,7 @@ try_again:
space->n_reserved_extents = 0;
space->n_pending_flushes = 0;
- space->n_pending_ibuf_merges = 0;
+ space->n_pending_ops = 0;
UT_LIST_INIT(space->chain);
space->magic_n = FIL_SPACE_MAGIC_N;
@@ -1896,13 +1916,12 @@ fil_read_first_page(
#ifndef UNIV_HOTBACKUP
/*******************************************************************//**
-Increments the count of pending insert buffer page merges, if space is not
-being deleted.
-@return TRUE if being deleted, and ibuf merges should be skipped */
+Increments the count of pending operation, if space is not being deleted.
+@return TRUE if being deleted, and operation should be skipped */
UNIV_INTERN
ibool
-fil_inc_pending_ibuf_merges(
-/*========================*/
+fil_inc_pending_ops(
+/*================*/
ulint id) /*!< in: space id */
{
fil_space_t* space;
@@ -1918,13 +1937,13 @@ fil_inc_pending_ibuf_merges(
(ulong) id);
}
- if (space == NULL || space->stop_ibuf_merges) {
+ if (space == NULL || space->stop_new_ops) {
mutex_exit(&fil_system->mutex);
return(TRUE);
}
- space->n_pending_ibuf_merges++;
+ space->n_pending_ops++;
mutex_exit(&fil_system->mutex);
@@ -1932,11 +1951,11 @@ fil_inc_pending_ibuf_merges(
}
/*******************************************************************//**
-Decrements the count of pending insert buffer page merges. */
+Decrements the count of pending operations. */
UNIV_INTERN
void
-fil_decr_pending_ibuf_merges(
-/*=========================*/
+fil_decr_pending_ops(
+/*=================*/
ulint id) /*!< in: space id */
{
fil_space_t* space;
@@ -1947,13 +1966,13 @@ fil_decr_pending_ibuf_merges(
if (space == NULL) {
fprintf(stderr,
- "InnoDB: Error: decrementing ibuf merge of a"
- " dropped tablespace %lu\n",
+ "InnoDB: Error: decrementing pending operation"
+ " of a dropped tablespace %lu\n",
(ulong) id);
}
if (space != NULL) {
- space->n_pending_ibuf_merges--;
+ space->n_pending_ops--;
}
mutex_exit(&fil_system->mutex);
@@ -2164,7 +2183,7 @@ fil_op_log_parse_or_replay(
switch (type) {
case MLOG_FILE_DELETE:
if (fil_tablespace_exists_in_mem(space_id)) {
- ut_a(fil_delete_tablespace(space_id));
+ ut_a(fil_delete_tablespace(space_id, TRUE));
}
break;
@@ -2234,7 +2253,9 @@ UNIV_INTERN
ibool
fil_delete_tablespace(
/*==================*/
- ulint id) /*!< in: space id */
+ ulint id, /*!< in: space id */
+ ibool evict_all) /*!< in: TRUE if we want all pages
+ evicted from LRU. */
{
ibool success;
fil_space_t* space;
@@ -2243,15 +2264,15 @@ fil_delete_tablespace(
char* path;
ut_a(id != 0);
-stop_ibuf_merges:
+stop_new_ops:
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
if (space != NULL) {
- space->stop_ibuf_merges = TRUE;
+ space->stop_new_ops = TRUE;
- if (space->n_pending_ibuf_merges == 0) {
+ if (space->n_pending_ops == 0) {
mutex_exit(&fil_system->mutex);
count = 0;
@@ -2265,9 +2286,10 @@ stop_ibuf_merges:
ut_print_filename(stderr, space->name);
fprintf(stderr, ",\n"
"InnoDB: but there are %lu pending"
- " ibuf merges on it.\n"
+ " operations (most likely ibuf merges)"
+ " on it.\n"
"InnoDB: Loop %lu.\n",
- (ulong) space->n_pending_ibuf_merges,
+ (ulong) space->n_pending_ops,
(ulong) count);
}
@@ -2276,7 +2298,7 @@ stop_ibuf_merges:
os_thread_sleep(20000);
count++;
- goto stop_ibuf_merges;
+ goto stop_new_ops;
}
}
@@ -2302,7 +2324,7 @@ try_again:
}
ut_a(space);
- ut_a(space->n_pending_ibuf_merges == 0);
+ ut_a(space->n_pending_ops == 0);
space->is_being_deleted = TRUE;
@@ -2358,7 +2380,11 @@ try_again:
if (srv_lazy_drop_table) {
buf_LRU_mark_space_was_deleted(id);
} else {
- buf_LRU_invalidate_tablespace(id);
+ buf_LRU_flush_or_remove_pages(
+ id, evict_all
+ ? BUF_REMOVE_ALL_NO_WRITE
+ : BUF_REMOVE_FLUSH_NO_WRITE);
+
}
#endif
/* printf("Deleting tablespace %s id %lu\n", space->name, id); */
@@ -2447,7 +2473,7 @@ fil_discard_tablespace(
{
ibool success;
- success = fil_delete_tablespace(id);
+ success = fil_delete_tablespace(id, TRUE);
if (!success) {
fprintf(stderr,
@@ -2579,7 +2605,7 @@ fil_rename_tablespace(
retry:
count++;
- if (count > 1000) {
+ if (!(count % 1000)) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: problems renaming ", stderr);
ut_print_filename(stderr, old_name);
@@ -3905,7 +3931,7 @@ convert_err_exit:
level = btr_page_get_level(page, &mtr);
- new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, &mtr);
+ new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, &mtr, &mtr);
new_page = buf_block_get_frame(new_block);
new_page_zip = buf_block_get_page_zip(new_block);
btr_page_create(new_block, new_page_zip, index, level, &mtr);
@@ -3953,7 +3979,7 @@ convert_err_exit:
split_rec = page_get_middle_rec(page);
new_block = btr_page_alloc(index, page_no + 1, FSP_UP,
- btr_page_get_level(page, &mtr), &mtr);
+ btr_page_get_level(page, &mtr), &mtr, &mtr);
new_page = buf_block_get_frame(new_block);
new_page_zip = buf_block_get_page_zip(new_block);
btr_page_create(new_block, new_page_zip, index,
diff --git a/storage/xtradb/fsp/fsp0fsp.c b/storage/xtradb/fsp/fsp0fsp.c
index 0c96aab0356..d4a2745b90b 100644
--- a/storage/xtradb/fsp/fsp0fsp.c
+++ b/storage/xtradb/fsp/fsp0fsp.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 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
@@ -248,28 +248,38 @@ fsp_fill_free_list(
descriptor page and ibuf bitmap page;
then we do not allocate more extents */
ulint space, /*!< in: space */
- fsp_header_t* header, /*!< in: space header */
- mtr_t* mtr); /*!< in: mtr */
+ fsp_header_t* header, /*!< in/out: space header */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ __attribute__((nonnull));
/**********************************************************************//**
Allocates a single free page from a segment. This function implements
the intelligent allocation strategy which tries to minimize file space
fragmentation.
-@return the allocated page number, FIL_NULL if no page could be allocated */
+@retval NULL if no page could be allocated
+@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
+(init_mtr == mtr, or the page was not previously freed in mtr)
+@retval block (not allocated or initialized) otherwise */
static
-ulint
+buf_block_t*
fseg_alloc_free_page_low(
/*=====================*/
ulint space, /*!< in: space */
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
- fseg_inode_t* seg_inode, /*!< in: segment inode */
- ulint hint, /*!< in: hint of which page would be desirable */
+ fseg_inode_t* seg_inode, /*!< in/out: segment inode */
+ ulint hint, /*!< in: hint of which page would be
+ desirable */
byte direction, /*!< in: if the new page is needed because
of an index page split, and records are
inserted there in order, into which
direction they go alphabetically: FSP_DOWN,
FSP_UP, FSP_NO_DIR */
- mtr_t* mtr); /*!< in: mtr handle */
+ mtr_t* mtr, /*!< in/out: mini-transaction */
+ mtr_t* init_mtr)/*!< in/out: mtr or another mini-transaction
+ in which the page should be initialized.
+ If init_mtr!=mtr, but the page is already
+ latched in mtr, do not initialize the page. */
+ __attribute__((warn_unused_result, nonnull));
#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
@@ -639,23 +649,22 @@ xdes_calc_descriptor_index(
/********************************************************************//**
Gets pointer to a the extent descriptor of a page. The page where the extent
-descriptor resides is x-locked. If the page offset is equal to the free limit
-of the space, adds new extents from above the free limit to the space free
-list, if not free limit == space size. This adding is necessary to make the
-descriptor defined, as they are uninitialized above the free limit.
+descriptor resides is x-locked. This function no longer extends the data
+file.
@return pointer to the extent descriptor, NULL if the page does not
-exist in the space or if the offset exceeds the free limit */
-UNIV_INLINE
+exist in the space or if the offset is >= the free limit */
+UNIV_INLINE __attribute__((nonnull, warn_unused_result))
xdes_t*
xdes_get_descriptor_with_space_hdr(
/*===============================*/
- fsp_header_t* sp_header,/*!< in/out: space header, x-latched */
- ulint space, /*!< in: space id */
- ulint offset, /*!< in: page offset;
- if equal to the free limit,
- we try to add new extents to
- the space free list */
- mtr_t* mtr) /*!< in: mtr handle */
+ fsp_header_t* sp_header, /*!< in/out: space header, x-latched
+ in mtr */
+ ulint space, /*!< in: space id */
+ ulint offset, /*!< in: page offset; if equal
+ to the free limit, we try to
+ add new extents to the space
+ free list */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint limit;
ulint size;
@@ -663,11 +672,9 @@ xdes_get_descriptor_with_space_hdr(
ulint descr_page_no;
page_t* descr_page;
- ut_ad(mtr);
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
MTR_MEMO_X_LOCK));
- ut_ad(mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_S_FIX)
- || mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_X_FIX));
+ ut_ad(mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_X_FIX));
ut_ad(page_offset(sp_header) == FSP_HEADER_OFFSET);
/* Read free limit and space size */
limit = mach_read_from_4(sp_header + FSP_FREE_LIMIT);
@@ -704,8 +711,8 @@ Gets pointer to a the extent descriptor of a page. The page where the extent
descriptor resides is x-locked. This function no longer extends the data
file.
@return pointer to the extent descriptor, NULL if the page does not
-exist in the space or if the offset is >= the free limit */
-static
+exist in the space or if the offset exceeds the free limit */
+static __attribute__((nonnull, warn_unused_result))
xdes_t*
xdes_get_descriptor(
/*================*/
@@ -714,7 +721,7 @@ xdes_get_descriptor(
or 0 for uncompressed pages */
ulint offset, /*!< in: page offset; if equal to the free limit,
we try to add new extents to the space free list */
- mtr_t* mtr) /*!< in: mtr handle */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
buf_block_t* block;
fsp_header_t* sp_header;
@@ -1098,14 +1105,14 @@ fsp_header_get_tablespace_size(void)
Tries to extend a single-table tablespace so that a page would fit in the
data file.
@return TRUE if success */
-static
+static __attribute__((nonnull, warn_unused_result))
ibool
fsp_try_extend_data_file_with_pages(
/*================================*/
ulint space, /*!< in: space */
ulint page_no, /*!< in: page number */
- fsp_header_t* header, /*!< in: space header */
- mtr_t* mtr) /*!< in: mtr */
+ fsp_header_t* header, /*!< in/out: space header */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
ibool success;
ulint actual_size;
@@ -1130,7 +1137,7 @@ fsp_try_extend_data_file_with_pages(
/***********************************************************************//**
Tries to extend the last data file of a tablespace if it is auto-extending.
@return FALSE if not auto-extending */
-static
+static __attribute__((nonnull))
ibool
fsp_try_extend_data_file(
/*=====================*/
@@ -1140,8 +1147,8 @@ fsp_try_extend_data_file(
the actual file size rounded down to
megabyte */
ulint space, /*!< in: space */
- fsp_header_t* header, /*!< in: space header */
- mtr_t* mtr) /*!< in: mtr */
+ fsp_header_t* header, /*!< in/out: space header */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint size;
ulint zip_size;
@@ -1277,7 +1284,7 @@ fsp_fill_free_list(
then we do not allocate more extents */
ulint space, /*!< in: space */
fsp_header_t* header, /*!< in/out: space header */
- mtr_t* mtr) /*!< in: mtr */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint limit;
ulint size;
@@ -1476,29 +1483,120 @@ fsp_alloc_free_extent(
}
/**********************************************************************//**
-Allocates a single free page from a space. The page is marked as used.
-@return the page offset, FIL_NULL if no page could be allocated */
+Allocates a single free page from a space. */
+static __attribute__((nonnull))
+void
+fsp_alloc_from_free_frag(
+/*=====================*/
+ fsp_header_t* header, /*!< in/out: tablespace header */
+ xdes_t* descr, /*!< in/out: extent descriptor */
+ ulint bit, /*!< in: slot to allocate in the extent */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+{
+ ulint frag_n_used;
+
+ ut_ad(xdes_get_state(descr, mtr) == XDES_FREE_FRAG);
+ ut_a(xdes_get_bit(descr, XDES_FREE_BIT, bit, mtr));
+ xdes_set_bit(descr, XDES_FREE_BIT, bit, FALSE, mtr);
+
+ /* Update the FRAG_N_USED field */
+ frag_n_used = mtr_read_ulint(header + FSP_FRAG_N_USED, MLOG_4BYTES,
+ mtr);
+ frag_n_used++;
+ mlog_write_ulint(header + FSP_FRAG_N_USED, frag_n_used, MLOG_4BYTES,
+ mtr);
+ if (xdes_is_full(descr, mtr)) {
+ /* The fragment is full: move it to another list */
+ flst_remove(header + FSP_FREE_FRAG, descr + XDES_FLST_NODE,
+ mtr);
+ xdes_set_state(descr, XDES_FULL_FRAG, mtr);
+
+ flst_add_last(header + FSP_FULL_FRAG, descr + XDES_FLST_NODE,
+ mtr);
+ mlog_write_ulint(header + FSP_FRAG_N_USED,
+ frag_n_used - FSP_EXTENT_SIZE, MLOG_4BYTES,
+ mtr);
+ }
+}
+
+/**********************************************************************//**
+Gets a buffer block for an allocated page.
+
+NOTE: If init_mtr != mtr, the block will only be initialized if it was
+not previously x-latched. It is assumed that the block has been
+x-latched only by mtr, and freed in mtr in that case.
+
+@return block, initialized if init_mtr==mtr
+or rw_lock_x_lock_count(&block->lock) == 1 */
static
-ulint
+buf_block_t*
+fsp_page_create(
+/*============*/
+ ulint space, /*!< in: space id of the allocated page */
+ ulint zip_size, /*!< in: compressed page size in bytes
+ or 0 for uncompressed pages */
+ ulint page_no, /*!< in: page number of the allocated page */
+ mtr_t* mtr, /*!< in: mini-transaction of the allocation */
+ mtr_t* init_mtr) /*!< in: mini-transaction for initializing
+ the page */
+{
+ buf_block_t* block
+ = buf_page_create(space, page_no, zip_size, init_mtr);
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)
+ == rw_lock_own(&block->lock, RW_LOCK_EX));
+#endif /* UNIV_SYNC_DEBUG */
+
+ /* Mimic buf_page_get(), but avoid the buf_pool->page_hash lookup. */
+ rw_lock_x_lock(&block->lock);
+ mutex_enter(&block->mutex);
+ buf_block_buf_fix_inc(block, __FILE__, __LINE__);
+ mutex_exit(&block->mutex);
+ mtr_memo_push(init_mtr, block, MTR_MEMO_PAGE_X_FIX);
+
+ if (init_mtr == mtr
+ || rw_lock_get_x_lock_count(&block->lock) == 1) {
+
+ /* Initialize the page, unless it was already
+ X-latched in mtr. (In this case, we would want to
+ allocate another page that has not been freed in mtr.) */
+ ut_ad(init_mtr == mtr
+ || !mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
+
+ fsp_init_file_page(block, init_mtr);
+ }
+
+ return(block);
+}
+
+/**********************************************************************//**
+Allocates a single free page from a space. The page is marked as used.
+@retval NULL if no page could be allocated
+@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
+(init_mtr == mtr, or the page was not previously freed in mtr)
+@retval block (not allocated or initialized) otherwise */
+static __attribute__((nonnull, warn_unused_result))
+buf_block_t*
fsp_alloc_free_page(
/*================*/
ulint space, /*!< in: space id */
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint hint, /*!< in: hint of which page would be desirable */
- mtr_t* mtr) /*!< in: mtr handle */
+ mtr_t* mtr, /*!< in/out: mini-transaction */
+ mtr_t* init_mtr)/*!< in/out: mini-transaction in which the
+ page should be initialized
+ (may be the same as mtr) */
{
fsp_header_t* header;
fil_addr_t first;
xdes_t* descr;
- buf_block_t* block;
ulint free;
- ulint frag_n_used;
ulint page_no;
ulint space_size;
- ibool success;
ut_ad(mtr);
+ ut_ad(init_mtr);
header = fsp_get_space_header(space, zip_size, mtr);
@@ -1525,7 +1623,7 @@ fsp_alloc_free_page(
if (descr == NULL) {
/* No free space left */
- return(FIL_NULL);
+ return(NULL);
}
xdes_set_state(descr, XDES_FREE_FRAG, mtr);
@@ -1570,50 +1668,18 @@ fsp_alloc_free_page(
" space size %lu. Page no %lu.\n",
(ulong) space, (ulong) space_size,
(ulong) page_no);
- return(FIL_NULL);
+ return(NULL);
}
- success = fsp_try_extend_data_file_with_pages(space, page_no,
- header, mtr);
- if (!success) {
+ if (!fsp_try_extend_data_file_with_pages(space, page_no,
+ header, mtr)) {
/* No disk space left */
- return(FIL_NULL);
+ return(NULL);
}
}
- xdes_set_bit(descr, XDES_FREE_BIT, free, FALSE, mtr);
+ fsp_alloc_from_free_frag(header, descr, free, mtr);
- /* Update the FRAG_N_USED field */
- frag_n_used = mtr_read_ulint(header + FSP_FRAG_N_USED, MLOG_4BYTES,
- mtr);
- frag_n_used++;
- mlog_write_ulint(header + FSP_FRAG_N_USED, frag_n_used, MLOG_4BYTES,
- mtr);
- if (xdes_is_full(descr, mtr)) {
- /* The fragment is full: move it to another list */
- flst_remove(header + FSP_FREE_FRAG, descr + XDES_FLST_NODE,
- mtr);
- xdes_set_state(descr, XDES_FULL_FRAG, mtr);
-
- flst_add_last(header + FSP_FULL_FRAG, descr + XDES_FLST_NODE,
- mtr);
- mlog_write_ulint(header + FSP_FRAG_N_USED,
- frag_n_used - FSP_EXTENT_SIZE, MLOG_4BYTES,
- mtr);
- }
-
- /* Initialize the allocated page to the buffer pool, so that it can
- be obtained immediately with buf_page_get without need for a disk
- read. */
-
- buf_page_create(space, page_no, zip_size, mtr);
-
- block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr);
- buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
-
- /* Prior contents of the page should be ignored */
- fsp_init_file_page(block, mtr);
-
- return(page_no);
+ return(fsp_page_create(space, zip_size, page_no, mtr, init_mtr));
}
/**********************************************************************//**
@@ -1652,6 +1718,9 @@ fsp_free_page(
fputs("InnoDB: Dump of descriptor: ", stderr);
ut_print_buf(stderr, ((byte*)descr) - 50, 200);
putc('\n', stderr);
+ /* Crash in debug version, so that we get a core dump
+ of this corruption. */
+ ut_ad(0);
if (state == XDES_FREE) {
/* We put here some fault tolerance: if the page
@@ -1670,6 +1739,9 @@ fsp_free_page(
"InnoDB: Dump of descriptor: ", (ulong) page);
ut_print_buf(stderr, ((byte*)descr) - 50, 200);
putc('\n', stderr);
+ /* Crash in debug version, so that we get a core dump
+ of this corruption. */
+ ut_ad(0);
/* We put here some fault tolerance: if the page
is already free, return without doing anything! */
@@ -1704,6 +1776,8 @@ fsp_free_page(
mtr);
fsp_free_extent(space, zip_size, page, mtr);
}
+
+ mtr->n_freed_pages++;
}
/**********************************************************************//**
@@ -1841,7 +1915,6 @@ fsp_alloc_seg_inode_page(
fseg_inode_t* inode;
buf_block_t* block;
page_t* page;
- ulint page_no;
ulint space;
ulint zip_size;
ulint i;
@@ -1852,15 +1925,15 @@ fsp_alloc_seg_inode_page(
zip_size = dict_table_flags_to_zip_size(
mach_read_from_4(FSP_SPACE_FLAGS + space_header));
- page_no = fsp_alloc_free_page(space, zip_size, 0, mtr);
+ block = fsp_alloc_free_page(space, zip_size, 0, mtr, mtr);
- if (page_no == FIL_NULL) {
+ if (block == NULL) {
return(FALSE);
}
- block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
+ ut_ad(rw_lock_get_x_lock_count(&block->lock) == 1);
block->check_index_page_at_flush = FALSE;
@@ -2273,19 +2346,20 @@ fseg_create_general(
}
if (page == 0) {
- page = fseg_alloc_free_page_low(space, zip_size,
- inode, 0, FSP_UP, mtr);
+ block = fseg_alloc_free_page_low(space, zip_size,
+ inode, 0, FSP_UP, mtr, mtr);
- if (page == FIL_NULL) {
+ if (block == NULL) {
fsp_free_seg_inode(space, zip_size, inode, mtr);
goto funct_exit;
}
- block = buf_page_get(space, zip_size, page, RW_X_LATCH, mtr);
+ ut_ad(rw_lock_get_x_lock_count(&block->lock) == 1);
+
header = byte_offset + buf_block_get_frame(block);
- mlog_write_ulint(header - byte_offset + FIL_PAGE_TYPE,
+ mlog_write_ulint(buf_block_get_frame(block) + FIL_PAGE_TYPE,
FIL_PAGE_TYPE_SYS, MLOG_2BYTES, mtr);
}
@@ -2462,8 +2536,10 @@ fseg_fill_free_list(
Allocates a free extent for the segment: looks first in the free list of the
segment, then tries to allocate from the space free list. NOTE that the extent
returned still resides in the segment free list, it is not yet taken off it!
-@return allocated extent, still placed in the segment free list, NULL
-if could not be allocated */
+@retval NULL if no page could be allocated
+@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
+(init_mtr == mtr, or the page was not previously freed in mtr)
+@retval block (not allocated or initialized) otherwise */
static
xdes_t*
fseg_alloc_free_extent(
@@ -2515,22 +2591,30 @@ fseg_alloc_free_extent(
Allocates a single free page from a segment. This function implements
the intelligent allocation strategy which tries to minimize file space
fragmentation.
-@return the allocated page number, FIL_NULL if no page could be allocated */
+@retval NULL if no page could be allocated
+@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
+(init_mtr == mtr, or the page was not previously freed in mtr)
+@retval block (not allocated or initialized) otherwise */
static
-ulint
+buf_block_t*
fseg_alloc_free_page_low(
/*=====================*/
ulint space, /*!< in: space */
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
- fseg_inode_t* seg_inode, /*!< in: segment inode */
- ulint hint, /*!< in: hint of which page would be desirable */
+ fseg_inode_t* seg_inode, /*!< in/out: segment inode */
+ ulint hint, /*!< in: hint of which page would be
+ desirable */
byte direction, /*!< in: if the new page is needed because
of an index page split, and records are
inserted there in order, into which
direction they go alphabetically: FSP_DOWN,
FSP_UP, FSP_NO_DIR */
- mtr_t* mtr) /*!< in: mtr handle */
+ mtr_t* mtr, /*!< in/out: mini-transaction */
+ mtr_t* init_mtr)/*!< in/out: mtr or another mini-transaction
+ in which the page should be initialized.
+ If init_mtr!=mtr, but the page is already
+ latched in mtr, do not initialize the page. */
{
fsp_header_t* space_header;
ulint space_size;
@@ -2541,7 +2625,6 @@ fseg_alloc_free_page_low(
ulint ret_page; /*!< the allocated page offset, FIL_NULL
if could not be allocated */
xdes_t* ret_descr; /*!< the extent of the allocated page */
- ibool frag_page_allocated = FALSE;
ibool success;
ulint n;
@@ -2563,6 +2646,7 @@ fseg_alloc_free_page_low(
if (descr == NULL) {
/* Hint outside space or too high above free limit: reset
hint */
+ /* The file space header page is always allocated. */
hint = 0;
descr = xdes_get_descriptor(space, zip_size, hint, mtr);
}
@@ -2573,15 +2657,19 @@ fseg_alloc_free_page_low(
&& mach_read_from_8(descr + XDES_ID) == seg_id
&& (xdes_get_bit(descr, XDES_FREE_BIT,
hint % FSP_EXTENT_SIZE, mtr) == TRUE)) {
-
+take_hinted_page:
/* 1. We can take the hinted page
=================================*/
ret_descr = descr;
ret_page = hint;
+ /* Skip the check for extending the tablespace. If the
+ page hint were not within the size of the tablespace,
+ we would have got (descr == NULL) above and reset the hint. */
+ goto got_hinted_page;
/*-----------------------------------------------------------*/
- } else if ((xdes_get_state(descr, mtr) == XDES_FREE)
- && ((reserved - used) < reserved / FSEG_FILLFACTOR)
- && (used >= FSEG_FRAG_LIMIT)) {
+ } else if (xdes_get_state(descr, mtr) == XDES_FREE
+ && reserved - used < reserved / FSEG_FILLFACTOR
+ && used >= FSEG_FRAG_LIMIT) {
/* 2. We allocate the free extent from space and can take
=========================================================
@@ -2599,7 +2687,7 @@ fseg_alloc_free_page_low(
/* Try to fill the segment free list */
fseg_fill_free_list(seg_inode, space, zip_size,
hint + FSP_EXTENT_SIZE, mtr);
- ret_page = hint;
+ goto take_hinted_page;
/*-----------------------------------------------------------*/
} else if ((direction != FSP_NO_DIR)
&& ((reserved - used) < reserved / FSEG_FILLFACTOR)
@@ -2647,7 +2735,7 @@ fseg_alloc_free_page_low(
first = flst_get_first(seg_inode + FSEG_FREE, mtr);
} else {
ut_error;
- return(FIL_NULL);
+ return(NULL);
}
ret_descr = xdes_lst_get_descriptor(space, zip_size,
@@ -2659,20 +2747,23 @@ fseg_alloc_free_page_low(
} else if (used < FSEG_FRAG_LIMIT) {
/* 6. We allocate an individual page from the space
===================================================*/
- ret_page = fsp_alloc_free_page(space, zip_size, hint, mtr);
- ret_descr = NULL;
+ buf_block_t* block = fsp_alloc_free_page(
+ space, zip_size, hint, mtr, init_mtr);
- frag_page_allocated = TRUE;
-
- if (ret_page != FIL_NULL) {
+ if (block != NULL) {
/* Put the page in the fragment page array of the
segment */
n = fseg_find_free_frag_page_slot(seg_inode, mtr);
- ut_a(n != FIL_NULL);
+ ut_a(n != ULINT_UNDEFINED);
- fseg_set_nth_frag_page_no(seg_inode, n, ret_page,
- mtr);
+ fseg_set_nth_frag_page_no(
+ seg_inode, n, buf_block_get_page_no(block),
+ mtr);
}
+
+ /* fsp_alloc_free_page() invoked fsp_init_file_page()
+ already. */
+ return(block);
/*-----------------------------------------------------------*/
} else {
/* 7. We allocate a new extent and take its first page
@@ -2690,7 +2781,7 @@ fseg_alloc_free_page_low(
if (ret_page == FIL_NULL) {
/* Page could not be allocated */
- return(FIL_NULL);
+ return(NULL);
}
if (space != 0) {
@@ -2708,38 +2799,22 @@ fseg_alloc_free_page_low(
" the space size %lu. Page no %lu.\n",
(ulong) space, (ulong) space_size,
(ulong) ret_page);
- return(FIL_NULL);
+ return(NULL);
}
success = fsp_try_extend_data_file_with_pages(
space, ret_page, space_header, mtr);
if (!success) {
/* No disk space left */
- return(FIL_NULL);
+ return(NULL);
}
}
}
- if (!frag_page_allocated) {
- /* Initialize the allocated page to buffer pool, so that it
- can be obtained immediately with buf_page_get without need
- for a disk read */
- buf_block_t* block;
- ulint zip_size = dict_table_flags_to_zip_size(
- mach_read_from_4(FSP_SPACE_FLAGS + space_header));
-
- block = buf_page_create(space, ret_page, zip_size, mtr);
- buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
-
- if (UNIV_UNLIKELY(block != buf_page_get(space, zip_size,
- ret_page, RW_X_LATCH,
- mtr))) {
- ut_error;
- }
-
- /* The prior contents of the page should be ignored */
- fsp_init_file_page(block, mtr);
-
+got_hinted_page:
+ /* ret_descr == NULL if the block was allocated from free_frag
+ (XDES_FREE_FRAG) */
+ if (ret_descr != NULL) {
/* At this point we know the extent and the page offset.
The extent is still in the appropriate list (FSEG_NOT_FULL
or FSEG_FREE), and the page is not yet marked as used. */
@@ -2752,22 +2827,28 @@ fseg_alloc_free_page_low(
fseg_mark_page_used(seg_inode, ret_page, ret_descr, mtr);
}
- buf_reset_check_index_page_at_flush(space, ret_page);
-
- return(ret_page);
+ return(fsp_page_create(
+ space, dict_table_flags_to_zip_size(
+ mach_read_from_4(FSP_SPACE_FLAGS
+ + space_header)),
+ ret_page, mtr, init_mtr));
}
/**********************************************************************//**
Allocates a single free page from a segment. This function implements
the intelligent allocation strategy which tries to minimize file space
fragmentation.
-@return allocated page offset, FIL_NULL if no page could be allocated */
+@retval NULL if no page could be allocated
+@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
+(init_mtr == mtr, or the page was not previously freed in mtr)
+@retval block (not allocated or initialized) otherwise */
UNIV_INTERN
-ulint
+buf_block_t*
fseg_alloc_free_page_general(
/*=========================*/
- fseg_header_t* seg_header,/*!< in: segment header */
- ulint hint, /*!< in: hint of which page would be desirable */
+ fseg_header_t* seg_header,/*!< in/out: segment header */
+ ulint hint, /*!< in: hint of which page would be
+ desirable */
byte direction,/*!< in: if the new page is needed because
of an index page split, and records are
inserted there in order, into which
@@ -2778,15 +2859,18 @@ fseg_alloc_free_page_general(
with fsp_reserve_free_extents, then there
is no need to do the check for this individual
page */
- mtr_t* mtr) /*!< in: mtr handle */
+ mtr_t* mtr, /*!< in/out: mini-transaction handle */
+ mtr_t* init_mtr)/*!< in/out: mtr or another mini-transaction
+ in which the page should be initialized.
+ If init_mtr!=mtr, but the page is already
+ latched in mtr, do not initialize the page. */
{
fseg_inode_t* inode;
ulint space;
ulint flags;
ulint zip_size;
rw_lock_t* latch;
- ibool success;
- ulint page_no;
+ buf_block_t* block;
ulint n_reserved;
space = page_get_space_id(page_align(seg_header));
@@ -2811,43 +2895,20 @@ fseg_alloc_free_page_general(
inode = fseg_inode_get(seg_header, space, zip_size, mtr);
- if (!has_done_reservation) {
- success = fsp_reserve_free_extents(&n_reserved, space, 2,
- FSP_NORMAL, mtr);
- if (!success) {
- return(FIL_NULL);
- }
+ if (!has_done_reservation
+ && !fsp_reserve_free_extents(&n_reserved, space, 2,
+ FSP_NORMAL, mtr)) {
+ return(NULL);
}
- page_no = fseg_alloc_free_page_low(space, zip_size,
- inode, hint, direction, mtr);
+ block = fseg_alloc_free_page_low(space, zip_size,
+ inode, hint, direction,
+ mtr, init_mtr);
if (!has_done_reservation) {
fil_space_release_free_extents(space, n_reserved);
}
- return(page_no);
-}
-
-/**********************************************************************//**
-Allocates a single free page from a segment. This function implements
-the intelligent allocation strategy which tries to minimize file space
-fragmentation.
-@return allocated page offset, FIL_NULL if no page could be allocated */
-UNIV_INTERN
-ulint
-fseg_alloc_free_page(
-/*=================*/
- fseg_header_t* seg_header,/*!< in: segment header */
- ulint hint, /*!< in: hint of which page would be desirable */
- byte direction,/*!< in: if the new page is needed because
- of an index page split, and records are
- inserted there in order, into which
- direction they go alphabetically: FSP_DOWN,
- FSP_UP, FSP_NO_DIR */
- mtr_t* mtr) /*!< in: mtr handle */
-{
- return(fseg_alloc_free_page_general(seg_header, hint, direction,
- FALSE, mtr));
+ return(block);
}
/**********************************************************************//**
@@ -3358,6 +3419,8 @@ crash:
descr + XDES_FLST_NODE, mtr);
fsp_free_extent(space, zip_size, page, mtr);
}
+
+ mtr->n_freed_pages++;
}
/**********************************************************************//**
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 61b14c2358a..12a9abd443e 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
@@ -26,8 +26,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -226,6 +226,9 @@ static my_bool innobase_create_status_file = FALSE;
static my_bool innobase_stats_on_metadata = TRUE;
static my_bool innobase_large_prefix = FALSE;
static my_bool innobase_use_sys_stats_table = FALSE;
+#ifdef UNIV_DEBUG
+static ulong innobase_sys_stats_root_page = 0;
+#endif
static my_bool innobase_buffer_pool_shm_checksum = TRUE;
static uint innobase_buffer_pool_shm_key = 0;
@@ -1217,6 +1220,9 @@ convert_error_code_to_mysql(
case DB_OUT_OF_FILE_SPACE:
return(HA_ERR_RECORD_FILE_FULL);
+ case DB_TABLE_IN_FK_CHECK:
+ return(HA_ERR_TABLE_IN_FK_CHECK);
+
case DB_TABLE_IS_BEING_USED:
return(HA_ERR_WRONG_COMMAND);
@@ -2774,6 +2780,10 @@ mem_free_and_error:
srv_use_sys_stats_table = (ibool) innobase_use_sys_stats_table;
+#ifdef UNIV_DEBUG
+ srv_sys_stats_root_page = innobase_sys_stats_root_page;
+#endif
+
/* -------------- Log files ---------------------------*/
/* The default dir for log files is the datadir of MySQL */
@@ -3896,52 +3906,140 @@ ha_innobase::primary_key_is_clustered()
return(true);
}
+/** Always normalize table name to lower case on Windows */
+#ifdef __WIN__
+#define normalize_table_name(norm_name, name) \
+ normalize_table_name_low(norm_name, name, TRUE)
+#else
+#define normalize_table_name(norm_name, name) \
+ normalize_table_name_low(norm_name, name, FALSE)
+#endif /* __WIN__ */
+
/*****************************************************************//**
Normalizes a table name string. A normalized name consists of the
database name catenated to '/' and table name. An example:
test/mytable. On Windows normalization puts both the database name and the
-table name always to lower case. */
+table name always to lower case if "set_lower_case" is set to TRUE. */
static
void
-normalize_table_name(
-/*=================*/
+normalize_table_name_low(
+/*=====================*/
char* norm_name, /*!< out: normalized name as a
null-terminated string */
- const char* name) /*!< in: table name string */
+ const char* name, /*!< in: table name string */
+ ibool set_lower_case) /*!< in: TRUE if we want to set
+ name to lower case */
{
char* name_ptr;
char* db_ptr;
+ ulint db_len;
char* ptr;
/* Scan name from the end */
- ptr = strend(name)-1;
+ ptr = strend(name) - 1;
+ /* seek to the last path separator */
while (ptr >= name && *ptr != '\\' && *ptr != '/') {
ptr--;
}
name_ptr = ptr + 1;
- DBUG_ASSERT(ptr > name);
+ /* skip any number of path separators */
+ while (ptr >= name && (*ptr == '\\' || *ptr == '/')) {
+ ptr--;
+ }
- ptr--;
+ DBUG_ASSERT(ptr >= name);
+ /* seek to the last but one path separator or one char before
+ the beginning of name */
+ db_len = 0;
while (ptr >= name && *ptr != '\\' && *ptr != '/') {
ptr--;
+ db_len++;
}
db_ptr = ptr + 1;
- memcpy(norm_name, db_ptr, strlen(name) + 1 - (db_ptr - name));
+ memcpy(norm_name, db_ptr, db_len);
- norm_name[name_ptr - db_ptr - 1] = '/';
+ norm_name[db_len] = '/';
-#ifdef __WIN__
- innobase_casedn_str(norm_name);
-#endif
+ memcpy(norm_name + db_len + 1, name_ptr, strlen(name_ptr) + 1);
+
+ if (set_lower_case) {
+ innobase_casedn_str(norm_name);
+ }
}
+#if !defined(DBUG_OFF)
+/*********************************************************************
+Test normalize_table_name_low(). */
+static
+void
+test_normalize_table_name_low()
+/*===========================*/
+{
+ char norm_name[128];
+ const char* test_data[][2] = {
+ /* input, expected result */
+ {"./mysqltest/t1", "mysqltest/t1"},
+ {"./test/#sql-842b_2", "test/#sql-842b_2"},
+ {"./test/#sql-85a3_10", "test/#sql-85a3_10"},
+ {"./test/#sql2-842b-2", "test/#sql2-842b-2"},
+ {"./test/bug29807", "test/bug29807"},
+ {"./test/foo", "test/foo"},
+ {"./test/innodb_bug52663", "test/innodb_bug52663"},
+ {"./test/t", "test/t"},
+ {"./test/t1", "test/t1"},
+ {"./test/t10", "test/t10"},
+ {"/a/b/db/table", "db/table"},
+ {"/a/b/db///////table", "db/table"},
+ {"/a/b////db///////table", "db/table"},
+ {"/var/tmp/mysqld.1/#sql842b_2_10", "mysqld.1/#sql842b_2_10"},
+ {"db/table", "db/table"},
+ {"ddd/t", "ddd/t"},
+ {"d/ttt", "d/ttt"},
+ {"d/t", "d/t"},
+ {".\\mysqltest\\t1", "mysqltest/t1"},
+ {".\\test\\#sql-842b_2", "test/#sql-842b_2"},
+ {".\\test\\#sql-85a3_10", "test/#sql-85a3_10"},
+ {".\\test\\#sql2-842b-2", "test/#sql2-842b-2"},
+ {".\\test\\bug29807", "test/bug29807"},
+ {".\\test\\foo", "test/foo"},
+ {".\\test\\innodb_bug52663", "test/innodb_bug52663"},
+ {".\\test\\t", "test/t"},
+ {".\\test\\t1", "test/t1"},
+ {".\\test\\t10", "test/t10"},
+ {"C:\\a\\b\\db\\table", "db/table"},
+ {"C:\\a\\b\\db\\\\\\\\\\\\\\table", "db/table"},
+ {"C:\\a\\b\\\\\\\\db\\\\\\\\\\\\\\table", "db/table"},
+ {"C:\\var\\tmp\\mysqld.1\\#sql842b_2_10", "mysqld.1/#sql842b_2_10"},
+ {"db\\table", "db/table"},
+ {"ddd\\t", "ddd/t"},
+ {"d\\ttt", "d/ttt"},
+ {"d\\t", "d/t"},
+ };
+
+ for (size_t i = 0; i < UT_ARR_SIZE(test_data); i++) {
+ printf("test_normalize_table_name_low(): "
+ "testing \"%s\", expected \"%s\"... ",
+ test_data[i][0], test_data[i][1]);
+
+ normalize_table_name_low(norm_name, test_data[i][0], FALSE);
+
+ if (strcmp(norm_name, test_data[i][1]) == 0) {
+ printf("ok\n");
+ } else {
+ printf("got \"%s\"\n", norm_name);
+ ut_error;
+ }
+ }
+}
+#endif /* !DBUG_OFF */
+
/********************************************************************//**
Get the upper limit of the MySQL integral and floating-point type.
@return maximum allowed value for the field */
@@ -4343,6 +4441,8 @@ ha_innobase::open(
THD* thd;
ulint retries = 0;
char* is_part = NULL;
+ ibool par_case_name_set = FALSE;
+ char par_case_name[MAX_FULL_NAME_LEN + 1];
DBUG_ENTER("ha_innobase::open");
@@ -4373,51 +4473,107 @@ ha_innobase::open(
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
}
- /* Create buffers for packing the fields of a record. Why
- table->stored_rec_length did not work here? Obviously, because char
- fields when packed actually became 1 byte longer, when we also
- stored the string length as the first byte. */
-
- upd_and_key_val_buff_len =
- table->s->stored_rec_length + table->s->max_key_length
- + MAX_REF_PARTS * 3;
- if (!(uchar*) my_multi_malloc(MYF(MY_WME),
- &upd_buff, upd_and_key_val_buff_len,
- &key_val_buff, upd_and_key_val_buff_len,
- NullS)) {
- free_share(share);
-
- DBUG_RETURN(1);
- }
+ /* Will be allocated if it is needed in ::update_row() */
+ upd_buf = NULL;
+ upd_buf_size = 0;
/* We look for pattern #P# to see if the table is partitioned
MySQL table. The retry logic for partitioned tables is a
workaround for http://bugs.mysql.com/bug.php?id=33349. Look
at support issue https://support.mysql.com/view.php?id=21080
for more details. */
+#ifdef __WIN__
+ is_part = strstr(norm_name, "#p#");
+#else
is_part = strstr(norm_name, "#P#");
+#endif /* __WIN__ */
+
retry:
/* Get pointer to a table object in InnoDB dictionary cache */
ib_table = dict_table_get(norm_name, TRUE);
-
+
if (srv_pass_corrupt_table <= 1 && ib_table && ib_table->is_corrupt) {
free_share(share);
- my_free(upd_buff);
+ my_free(upd_buf);
+ upd_buf = NULL;
+ upd_buf_size = 0;
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
}
share->ib_table = ib_table;
-
-
-
-
if (NULL == ib_table) {
if (is_part && retries < 10) {
- ++retries;
- os_thread_sleep(100000);
- goto retry;
+ /* MySQL partition engine hard codes the file name
+ separator as "#P#". The text case is fixed even if
+ lower_case_table_names is set to 1 or 2. This is true
+ for sub-partition names as well. InnoDB always
+ normalises file names to lower case on Windows, this
+ can potentially cause problems when copying/moving
+ tables between platforms.
+
+ 1) If boot against an installation from Windows
+ platform, then its partition table name could
+ be all be in lower case in system tables. So we
+ will need to check lower case name when load table.
+
+ 2) If we boot an installation from other case
+ sensitive platform in Windows, we might need to
+ check the existence of table name without lowering
+ case them in the system table. */
+ if (innobase_get_lower_case_table_names() == 1) {
+
+ if (!par_case_name_set) {
+#ifndef __WIN__
+ /* Check for the table using lower
+ case name, including the partition
+ separator "P" */
+ memcpy(par_case_name, norm_name,
+ strlen(norm_name));
+ par_case_name[strlen(norm_name)] = 0;
+ innobase_casedn_str(par_case_name);
+#else
+ /* On Windows platfrom, check
+ whether there exists table name in
+ system table whose name is
+ not being normalized to lower case */
+ normalize_table_name_low(
+ par_case_name, name, FALSE);
+#endif
+ par_case_name_set = TRUE;
+ }
+
+ ib_table = dict_table_get(
+ par_case_name, FALSE);
+ }
+ if (!ib_table) {
+ ++retries;
+ os_thread_sleep(100000);
+ goto retry;
+ } else {
+#ifndef __WIN__
+ sql_print_warning("Partition table %s opened "
+ "after converting to lower "
+ "case. The table may have "
+ "been moved from a case "
+ "in-sensitive file system. "
+ "Please recreate table in "
+ "the current file system\n",
+ norm_name);
+#else
+ sql_print_warning("Partition table %s opened "
+ "after skipping the step to "
+ "lower case the table name. "
+ "The table may have been "
+ "moved from a case sensitive "
+ "file system. Please "
+ "recreate table in the "
+ "current file system\n",
+ norm_name);
+#endif
+ goto table_opened;
+ }
}
if (is_part) {
@@ -4442,12 +4598,13 @@ retry:
"how you can resolve the problem.\n",
norm_name);
free_share(share);
- my_free(upd_buff);
my_errno = ENOENT;
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
}
+table_opened:
+
if (ib_table->ibd_file_missing && !thd_tablespace_op(thd)) {
sql_print_error("MySQL is trying to open a table handle but "
"the .ibd file for\ntable %s does not exist.\n"
@@ -4458,16 +4615,14 @@ retry:
"how you can resolve the problem.\n",
norm_name);
free_share(share);
- my_free(upd_buff);
my_errno = ENOENT;
dict_table_decrement_handle_count(ib_table, FALSE);
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
}
- prebuilt = row_create_prebuilt(ib_table);
+ prebuilt = row_create_prebuilt(ib_table, table->s->stored_rec_length);
- prebuilt->mysql_row_len = table->s->stored_rec_length;;
prebuilt->default_rec = table->s->default_values;
ut_ad(prebuilt->default_rec);
@@ -4656,7 +4811,13 @@ ha_innobase::close(void)
row_prebuilt_free(prebuilt, FALSE);
- my_free(upd_buff);
+ if (upd_buf != NULL) {
+ ut_ad(upd_buf_size != 0);
+ my_free(upd_buf);
+ upd_buf = NULL;
+ upd_buf_size = 0;
+ }
+
free_share(share);
/* Tell InnoDB server that there might be work for
@@ -6576,6 +6737,23 @@ ha_innobase::update_row(
ut_a(prebuilt->trx == trx);
+ if (upd_buf == NULL) {
+ ut_ad(upd_buf_size == 0);
+
+ /* Create a buffer for packing the fields of a record. Why
+ table->stored_rec_length did not work here? Obviously, because char
+ fields when packed actually became 1 byte longer, when we also
+ stored the string length as the first byte. */
+
+ upd_buf_size = table->s->stored_rec_length + table->s->max_key_length
+ + MAX_REF_PARTS * 3;
+ upd_buf = (uchar*) my_malloc(upd_buf_size, MYF(MY_WME));
+ if (upd_buf == NULL) {
+ upd_buf_size = 0;
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ }
+
ha_statistic_increment(&SSV::ha_update_count);
if (share->ib_table->is_corrupt) {
@@ -6592,11 +6770,10 @@ ha_innobase::update_row(
}
/* Build an update vector from the modified fields in the rows
- (uses upd_buff of the handle) */
+ (uses upd_buf of the handle) */
calc_row_difference(uvect, (uchar*) old_row, new_row, table,
- upd_buff, (ulint)upd_and_key_val_buff_len,
- prebuilt, user_thd);
+ upd_buf, upd_buf_size, prebuilt, user_thd);
/* This is not a delete */
prebuilt->upd_node->is_delete = FALSE;
@@ -6993,6 +7170,7 @@ ha_innobase::index_read(
DBUG_ENTER("index_read");
ut_a(prebuilt->trx == thd_to_trx(user_thd));
+ ut_ad(key_len != 0 || find_flag != HA_READ_KEY_EXACT);
ha_statistic_increment(&SSV::ha_read_key_count);
@@ -7025,8 +7203,7 @@ ha_innobase::index_read(
row_sel_convert_mysql_key_to_innobase(
prebuilt->search_tuple,
- (byte*) key_val_buff,
- (ulint)upd_and_key_val_buff_len,
+ srch_key_val1, sizeof(srch_key_val1),
index,
(byte*) key_ptr,
(ulint) key_len,
@@ -7580,13 +7757,15 @@ wsrep_append_foreign_key(
/*===========================*/
trx_t* trx, /*!< in: trx */
dict_foreign_t* foreign, /*!< in: foreign key constraint */
- const rec_t* clust_rec, /*!<in: clustered index record */
- dict_index_t* clust_index, /*!<in: clustered index */
+ const rec_t* rec, /*!<in: clustered index record */
+ dict_index_t* index, /*!<in: clustered index */
+ ibool referenced, /*!<in: is check for referenced table */
ibool shared) /*!<in: is shared access */
{
THD* thd = (THD*)trx->mysql_thd;
ulint rcode = DB_SUCCESS;
char cache_key[512] = {'\0'};
+ int cache_key_len;
if (!wsrep_on(trx->mysql_thd) ||
wsrep_thd_exec_mode(thd) != LOCAL_STATE)
@@ -7595,39 +7774,55 @@ wsrep_append_foreign_key(
byte key[WSREP_MAX_SUPPORTED_KEY_LENGTH+1];
ulint len = WSREP_MAX_SUPPORTED_KEY_LENGTH;
- key[0] = '\0';
+ dict_index_t *idx_target = (referenced) ?
+ foreign->referenced_index : foreign->foreign_index;
+ dict_index_t *idx = (referenced) ?
+ UT_LIST_GET_FIRST(foreign->referenced_table->indexes) :
+ UT_LIST_GET_FIRST(foreign->foreign_table->indexes);
+ int i = 0;
+ while (idx != NULL && idx != idx_target) {
+ idx = UT_LIST_GET_NEXT(indexes, idx);
+ i++;
+ }
+ ut_a(idx);
+ key[0] = (char)i;
+
rcode = wsrep_rec_get_primary_key(
- &key[1], &len, clust_rec, clust_index,
+ &key[1], &len, rec, index,
wsrep_protocol_version > 1);
if (rcode != DB_SUCCESS) {
WSREP_ERROR("FK key set failed: %lu", rcode);
return rcode;
}
+ strncpy(cache_key,
+ (wsrep_protocol_version > 1) ?
+ ((referenced) ?
+ foreign->referenced_table->name :
+ foreign->foreign_table->name) :
+ foreign->foreign_table->name, 512);
+ cache_key_len = strlen(cache_key);
#ifdef WSREP_DEBUG_PRINT
- ulint i;
- fprintf(stderr, "FK parent key, table: %s shared: %d len: %lu ",
- foreign->referenced_table_name, (int)shared, len+1);
- for (i=0; i<len+1; i++) {
- fprintf(stderr, " %hhX, ", key[i]);
+ ulint j;
+ fprintf(stderr, "FK parent key, table: %s %s len: %lu ",
+ cache_key, (shared) ? "shared" : "exclusive", len+1);
+ for (j=0; j<len+1; j++) {
+ fprintf(stderr, " %hhX, ", key[j]);
}
fprintf(stderr, "\n");
#endif
- strncpy(cache_key, (wsrep_protocol_version > 1) ?
- foreign->referenced_table->name :
- foreign->foreign_table->name, 512);
char *p = strchr(cache_key, '/');
if (p) {
*p = '\0';
} else {
- WSREP_WARN("unexpected foreign key table %s",
- foreign->foreign_table->name);
+ WSREP_WARN("unexpected foreign key table %s %s",
+ foreign->referenced_table->name, foreign->foreign_table->name);
}
wsrep_key_part_t wkey_part[3];
wsrep_key_t wkey = {wkey_part, 3};
if (!wsrep_prepare_key_for_innodb(
(const uchar*)cache_key,
- strlen(foreign->foreign_table->name) + 1,
+ cache_key_len + 1,
(const uchar*)key, len+1,
wkey_part,
&wkey.key_parts_len)) {
@@ -7706,6 +7901,23 @@ wsrep_append_key(
}
DBUG_RETURN(0);
}
+
+ibool
+wsrep_is_cascding_foreign_key_parent(
+ dict_table_t* table, /*!< in: InnoDB table */
+ dict_index_t* index /*!< in: InnoDB index */
+) {
+ // return referenced_by_foreign_key();
+ dict_foreign_t* fk = dict_table_get_referenced_constraint(table, index);
+ if (fk &&
+ (fk->type & DICT_FOREIGN_ON_UPDATE_CASCADE ||
+ fk->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)
+ ) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
int
ha_innobase::wsrep_append_keys(
/*==================*/
@@ -7774,7 +7986,9 @@ ha_innobase::wsrep_append_keys(
keyval0[0] = (char)i;
keyval1[0] = (char)i;
- if (key_info->flags & HA_NOSAME) {
+ if (key_info->flags & HA_NOSAME ||
+ referenced_by_foreign_key()) {
+
len = wsrep_store_key_val_for_row(
table, i, key0, key_info->key_length,
record0, &is_null);
@@ -8429,6 +8643,8 @@ ha_innobase::create(
DBUG_RETURN(HA_ERR_TO_BIG_ROW);
}
+ ut_a(strlen(name) < sizeof(name2));
+
strcpy(name2, name);
normalize_table_name(norm_name, name2);
@@ -8872,6 +9088,11 @@ ha_innobase::delete_table(
DBUG_ENTER("ha_innobase::delete_table");
+ DBUG_EXECUTE_IF(
+ "test_normalize_table_name_low",
+ test_normalize_table_name_low();
+ );
+
/* Strangely, MySQL passes the table name without the '.frm'
extension, in contrast to ::create */
normalize_table_name(norm_name, name);
@@ -9033,6 +9254,8 @@ innobase_rename_table(
normalize_table_name(norm_to, to);
normalize_table_name(norm_from, from);
+ DEBUG_SYNC_C("innodb_rename_table_ready");
+
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */
@@ -9151,12 +9374,6 @@ ha_innobase::records_in_range(
{
KEY* key;
dict_index_t* index;
- uchar* key_val_buff2 = (uchar*) my_malloc(
- table->s->stored_rec_length
- + table->s->max_key_length + 100,
- MYF(MY_FAE));
- ulint buff2_len = table->s->stored_rec_length
- + table->s->max_key_length + 100;
dtuple_t* range_start;
dtuple_t* range_end;
ib_int64_t n_rows;
@@ -9213,8 +9430,8 @@ ha_innobase::records_in_range(
dict_index_copy_types(range_end, index, key_parts);
row_sel_convert_mysql_key_to_innobase(
- range_start, (byte*) key_val_buff,
- (ulint)upd_and_key_val_buff_len,
+ range_start,
+ srch_key_val1, sizeof(srch_key_val1),
index,
(byte*) (min_key ? min_key->key :
(const uchar*) 0),
@@ -9225,8 +9442,9 @@ ha_innobase::records_in_range(
: range_start->n_fields == 0);
row_sel_convert_mysql_key_to_innobase(
- range_end, (byte*) key_val_buff2,
- buff2_len, index,
+ range_end,
+ srch_key_val2, sizeof(srch_key_val2),
+ index,
(byte*) (max_key ? max_key->key :
(const uchar*) 0),
(ulint) (max_key ? max_key->length : 0),
@@ -9253,7 +9471,6 @@ ha_innobase::records_in_range(
mem_heap_free(heap);
func_exit:
- my_free(key_val_buff2);
prebuilt->trx->op_info = (char*)"";
@@ -13373,6 +13590,13 @@ static MYSQL_SYSVAR_BOOL(use_sys_stats_table, innobase_use_sys_stats_table,
"So you should use ANALYZE TABLE command intentionally.",
NULL, NULL, FALSE);
+#ifdef UNIV_DEBUG_never
+static MYSQL_SYSVAR_ULONG(sys_stats_root_page, innobase_sys_stats_root_page,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Override the SYS_STATS root page id, 0 = no override (for testing only)",
+ NULL, NULL, 0, 0, ULONG_MAX, 0);
+#endif
+
static MYSQL_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
PLUGIN_VAR_OPCMDARG,
"Enable InnoDB adaptive hash index (enabled by default). "
@@ -13623,6 +13847,13 @@ static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
"trigger a readahead.",
NULL, NULL, 56, 0, 64, 0);
+#ifdef UNIV_DEBUG_never
+static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug,
+ PLUGIN_VAR_RQCMDARG,
+ "Debug flags for InnoDB to limit TRX_RSEG_N_SLOTS for trx_rsegf_undo_find_free()",
+ NULL, NULL, 0, 0, 1024, 0);
+#endif /* UNIV_DEBUG */
+
static MYSQL_SYSVAR_LONGLONG(ibuf_max_size, srv_ibuf_max_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"The maximum size of the insert buffer. (in bytes)",
@@ -13744,14 +13975,6 @@ static MYSQL_SYSVAR_ENUM(adaptive_flushing_method, srv_adaptive_flushing_method,
"Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
-#ifdef UNIV_DEBUG
-static MYSQL_SYSVAR_ULONG(flush_checkpoint_debug, srv_flush_checkpoint_debug,
- PLUGIN_VAR_RQCMDARG,
- "Debug flags for InnoDB flushing and checkpointing (0=none,"
- "1=stop preflush and checkpointing)",
- NULL, NULL, 0, 0, 1, 0);
-#endif
-
static MYSQL_SYSVAR_ULONG(import_table_from_xtrabackup, srv_expand_import,
PLUGIN_VAR_RQCMDARG,
"Enable/Disable converting automatically *.ibd files when import tablespace.",
@@ -13857,6 +14080,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(stats_auto_update),
MYSQL_SYSVAR(stats_update_need_lock),
MYSQL_SYSVAR(use_sys_stats_table),
+#ifdef UNIV_DEBUG_never /* disable this flag. --innodb-sys-stats becomes ambiguous */
+ MYSQL_SYSVAR(sys_stats_root_page),
+#endif
MYSQL_SYSVAR(stats_sample_pages),
MYSQL_SYSVAR(adaptive_hash_index),
MYSQL_SYSVAR(adaptive_hash_index_partitions),
@@ -13901,9 +14127,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(purge_threads),
MYSQL_SYSVAR(purge_batch_size),
MYSQL_SYSVAR(rollback_segments),
-#ifdef UNIV_DEBUG
- MYSQL_SYSVAR(flush_checkpoint_debug),
-#endif
+#ifdef UNIV_DEBUG_never /* disable this flag. --innodb-trx becomes ambiguous */
+ MYSQL_SYSVAR(trx_rseg_n_slots_debug),
+#endif /* UNIV_DEBUG */
MYSQL_SYSVAR(corrupt_table_action),
MYSQL_SYSVAR(lazy_drop_table),
MYSQL_SYSVAR(fake_changes),
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index 5d0b4f75a3f..397faa725c0 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -79,13 +79,14 @@ class ha_innobase: public handler
INNOBASE_SHARE* share; /*!< information for MySQL
table locking */
- uchar* upd_buff; /*!< buffer used in updates */
- uchar* key_val_buff; /*!< buffer used in converting
+ uchar* upd_buf; /*!< buffer used in updates */
+ ulint upd_buf_size; /*!< the size of upd_buf in bytes */
+ uchar srch_key_val1[REC_VERSION_56_MAX_INDEX_COL_LEN + 2];
+ uchar srch_key_val2[REC_VERSION_56_MAX_INDEX_COL_LEN + 2];
+ /*!< buffers used in converting
search key values from MySQL format
- to Innodb format */
- ulong upd_and_key_val_buff_len;
- /* the length of each of the previous
- two buffers */
+ to InnoDB format. "+ 2" for the two
+ bytes where the length is stored */
Table_flags int_table_flags;
uint primary_key;
ulong start_of_scan; /*!< this is set to 1 when we are
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index e20e4797dd5..b2aaf31df03 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 2005, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -882,6 +882,8 @@ ha_innobase::add_index(
prebuilt->table, indexed_table,
index, num_of_idx, table);
+ DBUG_EXECUTE_IF("crash_innodb_add_index_after", DBUG_SUICIDE(););
+
error_handling:
/* After an error, remove all those index definitions from the
dictionary which were defined. */
@@ -1024,7 +1026,12 @@ ha_innobase::final_add_index(
row_prebuilt_free(prebuilt, TRUE);
error = row_merge_drop_table(trx, old_table);
add->indexed_table->n_mysql_handles_opened++;
- prebuilt = row_create_prebuilt(add->indexed_table);
+ prebuilt = row_create_prebuilt(add->indexed_table,
+ 0 /* XXX Do we know the mysql_row_len here?
+ Before the addition of this parameter to
+ row_create_prebuilt() the mysql_row_len
+ member was left 0 (from zalloc) in the
+ prebuilt object. */);
}
err = convert_error_code_to_mysql(
@@ -1158,7 +1165,9 @@ ha_innobase::prepare_drop_index(
goto func_exit;
}
+ rw_lock_x_lock(dict_index_get_lock(index));
index->to_be_dropped = TRUE;
+ rw_lock_x_unlock(dict_index_get_lock(index));
}
/* If FOREIGN_KEY_CHECKS = 1 you may not drop an index defined
@@ -1277,7 +1286,9 @@ func_exit:
= dict_table_get_first_index(prebuilt->table);
do {
+ rw_lock_x_lock(dict_index_get_lock(index));
index->to_be_dropped = FALSE;
+ rw_lock_x_unlock(dict_index_get_lock(index));
index = dict_table_get_next_index(index);
} while (index);
}
@@ -1343,7 +1354,9 @@ ha_innobase::final_drop_index(
for (index = dict_table_get_first_index(prebuilt->table);
index; index = dict_table_get_next_index(index)) {
+ rw_lock_x_lock(dict_index_get_lock(index));
index->to_be_dropped = FALSE;
+ rw_lock_x_unlock(dict_index_get_lock(index));
}
goto func_exit;
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.c b/storage/xtradb/ibuf/ibuf0ibuf.c
index 00b7ea7347d..562f207268a 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.c
+++ b/storage/xtradb/ibuf/ibuf0ibuf.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -1523,7 +1523,7 @@ ibuf_add_ops(
for (i = 0; i < IBUF_OP_COUNT; i++) {
#ifdef HAVE_ATOMIC_BUILTINS
- os_atomic_increment_ulint(&arr[i], ops[i]);
+ (void) os_atomic_increment_ulint(&arr[i], ops[i]);
#else /* HAVE_ATOMIC_BUILTINS */
arr[i] += ops[i];
#endif /* HAVE_ATOMIC_BUILTINS */
@@ -2222,14 +2222,14 @@ ibool
ibuf_add_free_page(void)
/*====================*/
{
- mtr_t mtr;
- page_t* header_page;
- ulint flags;
- ulint zip_size;
- ulint page_no;
- page_t* page;
- page_t* root;
- page_t* bitmap_page;
+ mtr_t mtr;
+ page_t* header_page;
+ ulint flags;
+ ulint zip_size;
+ buf_block_t* block;
+ page_t* page;
+ page_t* root;
+ page_t* bitmap_page;
mtr_start(&mtr);
@@ -2250,28 +2250,23 @@ ibuf_add_free_page(void)
of a deadlock. This is the reason why we created a special ibuf
header page apart from the ibuf tree. */
- page_no = fseg_alloc_free_page(
+ block = fseg_alloc_free_page(
header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER, 0, FSP_UP,
&mtr);
- if (UNIV_UNLIKELY(page_no == FIL_NULL)) {
+ if (block == NULL) {
mtr_commit(&mtr);
return(FALSE);
- } else {
- buf_block_t* block = buf_page_get(
- IBUF_SPACE_ID, 0, page_no, RW_X_LATCH, &mtr);
-
- ibuf_enter(&mtr);
-
- mutex_enter(&ibuf_mutex);
-
- root = ibuf_tree_root_get(&mtr);
+ }
- buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW);
+ ut_ad(rw_lock_get_x_lock_count(&block->lock) == 1);
+ ibuf_enter(&mtr);
+ mutex_enter(&ibuf_mutex);
+ root = ibuf_tree_root_get(&mtr);
- page = buf_block_get_frame(block);
- }
+ buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW);
+ page = buf_block_get_frame(block);
/* Add the page to the free list and update the ibuf size data */
@@ -2288,12 +2283,13 @@ ibuf_add_free_page(void)
(level 2 page) */
bitmap_page = ibuf_bitmap_get_map_page(
- IBUF_SPACE_ID, page_no, zip_size, &mtr);
+ IBUF_SPACE_ID, buf_block_get_page_no(block), zip_size, &mtr);
mutex_exit(&ibuf_mutex);
ibuf_bitmap_page_set_bits(
- bitmap_page, page_no, zip_size, IBUF_BITMAP_IBUF, TRUE, &mtr);
+ bitmap_page, buf_block_get_page_no(block), zip_size,
+ IBUF_BITMAP_IBUF, TRUE, &mtr);
ibuf_mtr_commit(&mtr);
@@ -2588,7 +2584,15 @@ ibuf_get_merge_page_nos_func(
} else {
rec_page_no = ibuf_rec_get_page_no(mtr, rec);
rec_space_id = ibuf_rec_get_space(mtr, rec);
- ut_ad(rec_page_no > IBUF_TREE_ROOT_PAGE_NO);
+ /* In the system tablespace, the smallest
+ possible secondary index leaf page number is
+ bigger than IBUF_TREE_ROOT_PAGE_NO (4). In
+ other tablespaces, the clustered index tree is
+ created at page 3, which makes page 4 the
+ smallest possible secondary index leaf page
+ (and that only after DROP INDEX). */
+ ut_ad(rec_page_no
+ > IBUF_TREE_ROOT_PAGE_NO - (rec_space_id != 0));
}
#ifdef UNIV_IBUF_DEBUG
@@ -3920,6 +3924,7 @@ ibuf_insert_to_index_page_low(
fputs("InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
+ ut_ad(0);
}
/************************************************************************
@@ -3970,9 +3975,10 @@ ibuf_insert_to_index_page(
"InnoDB: but the number of fields does not match!\n",
stderr);
dump:
- buf_page_print(page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
dtuple_print(stderr, entry);
+ ut_ad(0);
fputs("InnoDB: The table where where"
" this index record belongs\n"
@@ -4113,6 +4119,11 @@ ibuf_set_del_mark(
TRUE, mtr);
}
} else {
+ const page_t* page
+ = page_cur_get_page(&page_cur);
+ const buf_block_t* block
+ = page_cur_get_block(&page_cur);
+
ut_print_timestamp(stderr);
fputs(" InnoDB: unable to find a record to delete-mark\n",
stderr);
@@ -4121,10 +4132,14 @@ ibuf_set_del_mark(
fputs("\n"
"InnoDB: record ", stderr);
rec_print(stderr, page_cur_get_rec(&page_cur), index);
- putc('\n', stderr);
- fputs("\n"
- "InnoDB: Submit a detailed bug report"
- " to http://bugs.mysql.com\n", stderr);
+ fprintf(stderr, "\nspace %u offset %u"
+ " (%u records, index id %llu)\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n",
+ (unsigned) buf_block_get_space(block),
+ (unsigned) buf_block_get_page_no(block),
+ (unsigned) page_get_n_recs(page),
+ (ulonglong) btr_page_get_index_id(page));
ut_ad(0);
}
}
@@ -4168,12 +4183,31 @@ ibuf_delete(
offsets = rec_get_offsets(
rec, index, offsets, ULINT_UNDEFINED, &heap);
- /* Refuse to delete the last record. */
- ut_a(page_get_n_recs(page) > 1);
-
- /* The record should have been marked for deletion. */
- ut_ad(REC_INFO_DELETED_FLAG
- & rec_get_info_bits(rec, page_is_comp(page)));
+ if (page_get_n_recs(page) <= 1
+ || !(REC_INFO_DELETED_FLAG
+ & rec_get_info_bits(rec, page_is_comp(page)))) {
+ /* Refuse to purge the last record or a
+ record that has not been marked for deletion. */
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: unable to purge a record\n",
+ stderr);
+ fputs("InnoDB: tuple ", stderr);
+ dtuple_print(stderr, entry);
+ fputs("\n"
+ "InnoDB: record ", stderr);
+ rec_print_new(stderr, rec, offsets);
+ fprintf(stderr, "\nspace %u offset %u"
+ " (%u records, index id %llu)\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n",
+ (unsigned) buf_block_get_space(block),
+ (unsigned) buf_block_get_page_no(block),
+ (unsigned) page_get_n_recs(page),
+ (ulonglong) btr_page_get_index_id(page));
+
+ ut_ad(0);
+ return;
+ }
lock_update_delete(block, rec);
@@ -4259,6 +4293,7 @@ ibuf_restore_pos(
fprintf(stderr, "InnoDB: ibuf tree ok\n");
fflush(stderr);
+ ut_ad(0);
}
return(FALSE);
@@ -4441,7 +4476,7 @@ ibuf_merge_or_delete_for_page(
function. When the counter is > 0, that prevents tablespace
from being dropped. */
- tablespace_being_deleted = fil_inc_pending_ibuf_merges(space);
+ tablespace_being_deleted = fil_inc_pending_ops(space);
if (UNIV_UNLIKELY(tablespace_being_deleted)) {
/* Do not try to read the bitmap page from space;
@@ -4467,7 +4502,7 @@ ibuf_merge_or_delete_for_page(
/* No inserts buffered for this page */
if (!tablespace_being_deleted) {
- fil_decr_pending_ibuf_merges(space);
+ fil_decr_pending_ops(space);
}
return;
@@ -4516,12 +4551,14 @@ ibuf_merge_or_delete_for_page(
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
zip_size, &mtr);
- buf_page_print(bitmap_page, 0);
+ buf_page_print(bitmap_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
ibuf_mtr_commit(&mtr);
fputs("\nInnoDB: Dump of the page:\n", stderr);
- buf_page_print(block->frame, 0);
+ buf_page_print(block->frame, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"InnoDB: Error: corruption in the tablespace."
@@ -4541,6 +4578,7 @@ ibuf_merge_or_delete_for_page(
(ulong) page_no,
(ulong)
fil_page_get_type(block->frame));
+ ut_ad(0);
}
}
@@ -4747,7 +4785,7 @@ reset_bit:
mem_heap_free(heap);
#ifdef HAVE_ATOMIC_BUILTINS
- os_atomic_increment_ulint(&ibuf->n_merges, 1);
+ (void) os_atomic_increment_ulint(&ibuf->n_merges, 1);
ibuf_add_ops(ibuf->n_merged_ops, mops);
ibuf_add_ops(ibuf->n_discarded_ops, dops);
#else /* HAVE_ATOMIC_BUILTINS */
@@ -4763,7 +4801,7 @@ reset_bit:
if (update_ibuf_bitmap && !tablespace_being_deleted) {
- fil_decr_pending_ibuf_merges(space);
+ fil_decr_pending_ops(space);
}
#ifdef UNIV_IBUF_COUNT_DEBUG
diff --git a/storage/xtradb/include/btr0btr.h b/storage/xtradb/include/btr0btr.h
index 058fcfb64de..520527d0375 100644
--- a/storage/xtradb/include/btr0btr.h
+++ b/storage/xtradb/include/btr0btr.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -92,6 +92,26 @@ 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
+/**************************************************************//**
+Report that an index page is corrupted. */
+UNIV_INTERN
+void
+btr_corruption_report(
+/*==================*/
+ const buf_block_t* block, /*!< in: corrupted block */
+ const dict_index_t* index) /*!< in: index tree */
+ UNIV_COLD __attribute__((nonnull));
+
+/** Assert that a B-tree page is not corrupted.
+@param block buffer block containing a B-tree page
+@param index the B-tree index */
+#define btr_assert_not_corrupted(block, index) \
+ if ((ibool) !!page_is_comp(buf_block_get_frame(block)) \
+ != dict_table_is_comp((index)->table)) { \
+ btr_corruption_report(block, index); \
+ ut_error; \
+ }
+
#ifdef UNIV_BLOB_DEBUG
# include "ut0rbt.h"
/** An index->blobs entry for keeping track of off-page column references */
@@ -569,11 +589,14 @@ UNIV_INTERN
ibool
btr_compress(
/*=========*/
- btr_cur_t* cursor, /*!< in: cursor on the page to merge or lift;
- the page must not be empty: in record delete
- use btr_discard_page if the page would become
- empty */
- mtr_t* mtr); /*!< in: mtr */
+ btr_cur_t* cursor, /*!< in/out: cursor on the page to merge
+ or lift; the page must not be empty:
+ when deleting records, use btr_discard_page()
+ if the page would become empty */
+ ibool adjust, /*!< in: TRUE if should adjust the
+ cursor position even if compression occurs */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ __attribute__((nonnull));
/*************************************************************//**
Discards a page from a B-tree. This is used to remove the last record from
a B-tree page: the whole page must be removed at the same time. This cannot
@@ -614,17 +637,23 @@ btr_parse_page_reorganize(
#ifndef UNIV_HOTBACKUP
/**************************************************************//**
Gets the number of pages in a B-tree.
-@return number of pages */
+@return number of pages, or ULINT_UNDEFINED if the index is unavailable */
UNIV_INTERN
ulint
btr_get_size(
/*=========*/
dict_index_t* index, /*!< in: index */
- ulint flag); /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */
+ ulint flag, /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */
+ mtr_t* mtr) /*!< in/out: mini-transaction where index
+ is s-latched */
+ __attribute__((nonnull, warn_unused_result));
/**************************************************************//**
Allocates a new file page to be used in an index tree. NOTE: we assume
that the caller has made the reservation for free extents!
-@return new allocated block, x-latched; NULL if out of space */
+@retval NULL if no page could be allocated
+@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
+(init_mtr == mtr, or the page was not previously freed in mtr)
+@retval block (not allocated or initialized) otherwise */
UNIV_INTERN
buf_block_t*
btr_page_alloc(
@@ -635,7 +664,12 @@ btr_page_alloc(
page split is made */
ulint level, /*!< in: level where the page is placed
in the tree */
- mtr_t* mtr); /*!< in: mtr */
+ mtr_t* mtr, /*!< in/out: mini-transaction
+ for the allocation */
+ mtr_t* init_mtr) /*!< in/out: mini-transaction
+ for x-latching and initializing
+ the page */
+ __attribute__((nonnull, warn_unused_result));
/**************************************************************//**
Frees a file page used in an index tree. NOTE: cannot free field external
storage pages because the page must contain info on its level. */
diff --git a/storage/xtradb/include/btr0btr.ic b/storage/xtradb/include/btr0btr.ic
index f446ecb69d3..53c8159c448 100644
--- a/storage/xtradb/include/btr0btr.ic
+++ b/storage/xtradb/include/btr0btr.ic
@@ -279,7 +279,7 @@ btr_node_ptr_get_child_page_no(
"InnoDB: a nonsensical page number 0"
" in a node ptr record at offset %lu\n",
(ulong) page_offset(rec));
- buf_page_print(page_align(rec), 0);
+ buf_page_print(page_align(rec), 0, 0);
}
return(page_no);
diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h
index 4f33aacc48e..cbc6103c2ee 100644
--- a/storage/xtradb/include/btr0cur.h
+++ b/storage/xtradb/include/btr0cur.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -36,6 +36,9 @@ Created 10/16/1994 Heikki Tuuri
#define BTR_NO_LOCKING_FLAG 2 /* do no record lock checking */
#define BTR_KEEP_SYS_FLAG 4 /* sys fields will be found from the
update vector or inserted entry */
+#define BTR_KEEP_POS_FLAG 8 /* btr_cur_pessimistic_update()
+ must keep cursor position when
+ moving columns to big_rec */
#ifndef UNIV_HOTBACKUP
#include "que0types.h"
@@ -310,7 +313,9 @@ btr_cur_pessimistic_update(
/*=======================*/
ulint flags, /*!< in: undo logging, locking, and rollback
flags */
- btr_cur_t* cursor, /*!< in: cursor on the record to update */
+ btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
+ cursor may become invalid if *big_rec == NULL
+ || !(flags & BTR_KEEP_POS_FLAG) */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
be stored externally by the caller, or NULL */
@@ -364,10 +369,13 @@ UNIV_INTERN
ibool
btr_cur_compress_if_useful(
/*=======================*/
- btr_cur_t* cursor, /*!< in: cursor on the page to compress;
+ btr_cur_t* cursor, /*!< in/out: cursor on the page to compress;
cursor does not stay valid if compression
occurs */
- mtr_t* mtr); /*!< in: mtr */
+ ibool adjust, /*!< in: TRUE if should adjust the
+ cursor position even if compression occurs */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ __attribute__((nonnull));
/*******************************************************//**
Removes the record on which the tree cursor is positioned. It is assumed
that the mtr has an x-latch on the page where the cursor is positioned,
@@ -492,6 +500,27 @@ btr_cur_disown_inherited_fields(
const upd_t* update, /*!< in: update vector */
mtr_t* mtr) /*!< in/out: mini-transaction */
__attribute__((nonnull(2,3,4,5,6)));
+
+/** Operation code for btr_store_big_rec_extern_fields(). */
+enum blob_op {
+ /** Store off-page columns for a freshly inserted record */
+ BTR_STORE_INSERT = 0,
+ /** Store off-page columns for an insert by update */
+ BTR_STORE_INSERT_UPDATE,
+ /** Store off-page columns for an update */
+ BTR_STORE_UPDATE
+};
+
+/*******************************************************************//**
+Determine if an operation on off-page columns is an update.
+@return TRUE if op != BTR_STORE_INSERT */
+UNIV_INLINE
+ibool
+btr_blob_op_is_update(
+/*==================*/
+ enum blob_op op) /*!< in: operation */
+ __attribute__((warn_unused_result));
+
/*******************************************************************//**
Stores the fields in big_rec_vec to the tablespace and puts pointers to
them in rec. The extern flags in rec will have to be set beforehand.
@@ -499,52 +528,23 @@ The fields are stored on pages allocated from leaf node
file segment of the index tree.
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
UNIV_INTERN
-ulint
-btr_store_big_rec_extern_fields_func(
-/*=================================*/
+enum db_err
+btr_store_big_rec_extern_fields(
+/*============================*/
dict_index_t* index, /*!< in: index of rec; the index tree
MUST be X-latched */
buf_block_t* rec_block, /*!< in/out: block containing rec */
- rec_t* rec, /*!< in: record */
+ rec_t* rec, /*!< in/out: record */
const ulint* offsets, /*!< in: rec_get_offsets(rec, index);
the "external storage" flags in offsets
will not correspond to rec when
this function returns */
-#ifdef UNIV_DEBUG
- mtr_t* local_mtr, /*!< in: mtr containing the
- latch to rec and to the tree */
-#endif /* UNIV_DEBUG */
-#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
- ibool update_in_place,/*! in: TRUE if the record is updated
- in place (not delete+insert) */
-#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
- const big_rec_t*big_rec_vec) /*!< in: vector containing fields
+ const big_rec_t*big_rec_vec, /*!< in: vector containing fields
to be stored externally */
- __attribute__((nonnull));
-
-/** Stores the fields in big_rec_vec to the tablespace and puts pointers to
-them in rec. The extern flags in rec will have to be set beforehand.
-The fields are stored on pages allocated from leaf node
-file segment of the index tree.
-@param index in: clustered index; MUST be X-latched by mtr
-@param b in/out: block containing rec; MUST be X-latched by mtr
-@param rec in/out: clustered index record
-@param offsets in: rec_get_offsets(rec, index);
- the "external storage" flags in offsets will not be adjusted
-@param mtr in: mini-transaction that holds x-latch on index and b
-@param upd in: TRUE if the record is updated in place (not delete+insert)
-@param big in: vector containing fields to be stored externally
-@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
-#ifdef UNIV_DEBUG
-# define btr_store_big_rec_extern_fields(index,b,rec,offsets,mtr,upd,big) \
- btr_store_big_rec_extern_fields_func(index,b,rec,offsets,mtr,upd,big)
-#elif defined UNIV_BLOB_LIGHT_DEBUG
-# define btr_store_big_rec_extern_fields(index,b,rec,offsets,mtr,upd,big) \
- btr_store_big_rec_extern_fields_func(index,b,rec,offsets,upd,big)
-#else
-# define btr_store_big_rec_extern_fields(index,b,rec,offsets,mtr,upd,big) \
- btr_store_big_rec_extern_fields_func(index,b,rec,offsets,big)
-#endif
+ mtr_t* btr_mtr, /*!< in: mtr containing the
+ latches to the clustered index */
+ enum blob_op op) /*! in: operation code */
+ __attribute__((nonnull, warn_unused_result));
/*******************************************************************//**
Frees the space in an externally stored field to the file space
diff --git a/storage/xtradb/include/btr0cur.ic b/storage/xtradb/include/btr0cur.ic
index 280583f6ccf..e31f77c77eb 100644
--- a/storage/xtradb/include/btr0cur.ic
+++ b/storage/xtradb/include/btr0cur.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -139,7 +139,7 @@ btr_cur_compress_recommendation(
btr_cur_t* cursor, /*!< in: btr cursor */
mtr_t* mtr) /*!< in: mtr */
{
- page_t* page;
+ const page_t* page;
ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
MTR_MEMO_PAGE_X_FIX));
@@ -197,4 +197,25 @@ btr_cur_can_delete_without_compress(
return(TRUE);
}
+
+/*******************************************************************//**
+Determine if an operation on off-page columns is an update.
+@return TRUE if op != BTR_STORE_INSERT */
+UNIV_INLINE
+ibool
+btr_blob_op_is_update(
+/*==================*/
+ enum blob_op op) /*!< in: operation */
+{
+ switch (op) {
+ case BTR_STORE_INSERT:
+ return(FALSE);
+ case BTR_STORE_INSERT_UPDATE:
+ case BTR_STORE_UPDATE:
+ return(TRUE);
+ }
+
+ ut_ad(0);
+ return(FALSE);
+}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/btr0pcur.h b/storage/xtradb/include/btr0pcur.h
index 140f94466db..2ebd70a6f23 100644
--- a/storage/xtradb/include/btr0pcur.h
+++ b/storage/xtradb/include/btr0pcur.h
@@ -53,6 +53,16 @@ UNIV_INTERN
btr_pcur_t*
btr_pcur_create_for_mysql(void);
/*============================*/
+
+/**************************************************************//**
+Resets a persistent cursor object, freeing ::old_rec_buf if it is
+allocated and resetting the other members to their initial values. */
+UNIV_INTERN
+void
+btr_pcur_reset(
+/*===========*/
+ btr_pcur_t* cursor);/*!< in, out: persistent cursor */
+
/**************************************************************//**
Frees the memory for a persistent cursor object. */
UNIV_INTERN
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index 0ea74fb9eb2..7502942d681 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -611,6 +611,31 @@ buf_block_get_modify_clock(
#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
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line */
+#endif /* UNIV_SYNC_DEBUG */
+ buf_block_t* block) /*!< in/out: block to bufferfix */
+ __attribute__((nonnull));
+#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 */
+/** 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 */
/********************************************************************//**
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
@@ -700,6 +725,13 @@ buf_print(void);
/*============*/
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
#endif /* !UNIV_HOTBACKUP */
+enum buf_page_print_flags {
+ /** Do not crash at the end of buf_page_print(). */
+ BUF_PAGE_PRINT_NO_CRASH = 1,
+ /** Do not print the full page dump. */
+ BUF_PAGE_PRINT_NO_FULL = 2
+};
+
/********************************************************************//**
Prints a page to stderr. */
UNIV_INTERN
@@ -707,8 +739,12 @@ void
buf_page_print(
/*===========*/
const byte* read_buf, /*!< in: a database page */
- ulint zip_size); /*!< in: compressed page size, or
+ ulint zip_size, /*!< in: compressed page size, or
0 for uncompressed pages */
+ ulint flags) /*!< in: 0 or
+ BUF_PAGE_PRINT_NO_CRASH or
+ BUF_PAGE_PRINT_NO_FULL */
+ __attribute__((nonnull));
/********************************************************************//**
Decompress a block.
@return TRUE if successful */
@@ -773,11 +809,11 @@ buf_all_freed(void);
/*********************************************************************//**
Checks that there currently are no pending i/o-operations for the buffer
pool.
-@return TRUE if there is no pending i/o */
+@return number of pending i/o operations */
UNIV_INTERN
-ibool
-buf_pool_check_no_pending_io(void);
-/*==============================*/
+ulint
+buf_pool_check_num_pending_io(void);
+/*===============================*/
/*********************************************************************//**
Invalidates the file pages in the buffer pool when an archive recovery is
completed. All the file pages buffered must be in a replaceable state when
diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic
index 55d89b66375..66006d366c6 100644
--- a/storage/xtradb/include/buf0buf.ic
+++ b/storage/xtradb/include/buf0buf.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -18,8 +18,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -1026,19 +1026,6 @@ buf_block_buf_fix_inc_func(
block->page.buf_fix_count++;
}
-#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 */
-/** 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 */
/*******************************************************************//**
Decrements the bufferfix count. */
@@ -1295,7 +1282,7 @@ buf_block_dbg_add_level(
where we have acquired latch */
ulint level) /*!< in: latching order level */
{
- sync_thread_add_level(&block->lock, level);
+ sync_thread_add_level(&block->lock, level, FALSE);
}
#endif /* UNIV_SYNC_DEBUG */
/********************************************************************//**
diff --git a/storage/xtradb/include/buf0lru.h b/storage/xtradb/include/buf0lru.h
index 700136ec488..c3672a65ed7 100644
--- a/storage/xtradb/include/buf0lru.h
+++ b/storage/xtradb/include/buf0lru.h
@@ -64,15 +64,14 @@ These are low-level functions
#define BUF_LRU_FREE_SEARCH_LEN(b) (5 + 2 * BUF_READ_AHEAD_AREA(b))
/******************************************************************//**
-Invalidates all pages belonging to a given tablespace when we are deleting
-the data file(s) of that tablespace. A PROBLEM: if readahead is being started,
-what guarantees that it will not try to read in pages after this operation has
-completed? */
+Removes all pages belonging to a given tablespace. */
UNIV_INTERN
void
-buf_LRU_invalidate_tablespace(
+buf_LRU_flush_or_remove_pages(
/*==========================*/
- ulint id); /*!< in: space id */
+ ulint id, /*!< in: space id */
+ enum buf_remove_t buf_remove);/*!< in: remove or flush
+ strategy */
/******************************************************************//**
*/
diff --git a/storage/xtradb/include/buf0types.h b/storage/xtradb/include/buf0types.h
index d140936a886..a6e947dc21a 100644
--- a/storage/xtradb/include/buf0types.h
+++ b/storage/xtradb/include/buf0types.h
@@ -63,6 +63,15 @@ enum buf_io_fix {
the flush_list */
};
+/** Algorithm to remove the pages for a tablespace from the buffer pool.
+@See buf_LRU_flush_or_remove_pages(). */
+enum buf_remove_t {
+ BUF_REMOVE_ALL_NO_WRITE, /*!< Remove all pages from the buffer
+ pool, don't write or sync to disk */
+ BUF_REMOVE_FLUSH_NO_WRITE /*!< Remove only, from the flush list,
+ don't write or sync to disk */
+};
+
/** Parameters of binary buddy system for compressed pages (buf0buddy.h) */
/* @{ */
#define BUF_BUDDY_LOW_SHIFT PAGE_ZIP_MIN_SIZE_SHIFT
diff --git a/storage/xtradb/include/data0data.h b/storage/xtradb/include/data0data.h
index f7bdd29ed90..6d3c2988fdc 100644
--- a/storage/xtradb/include/data0data.h
+++ b/storage/xtradb/include/data0data.h
@@ -231,6 +231,26 @@ dtuple_set_n_fields_cmp(
dtuple_t* tuple, /*!< in: tuple */
ulint n_fields_cmp); /*!< in: number of fields used in
comparisons in rem0cmp.* */
+
+/* Estimate the number of bytes that are going to be allocated when
+creating a new dtuple_t object */
+#define DTUPLE_EST_ALLOC(n_fields) \
+ (sizeof(dtuple_t) + (n_fields) * sizeof(dfield_t))
+
+/**********************************************************//**
+Creates a data tuple from an already allocated chunk of memory.
+The size of the chunk must be at least DTUPLE_EST_ALLOC(n_fields).
+The default value for number of fields used in record comparisons
+for this tuple is n_fields.
+@return created tuple (inside buf) */
+UNIV_INLINE
+dtuple_t*
+dtuple_create_from_mem(
+/*===================*/
+ void* buf, /*!< in, out: buffer to use */
+ ulint buf_size, /*!< in: buffer size */
+ ulint n_fields); /*!< in: number of fields */
+
/**********************************************************//**
Creates a data tuple to a memory heap. The default value for number
of fields used in record comparisons for this tuple is n_fields.
@@ -240,7 +260,8 @@ dtuple_t*
dtuple_create(
/*==========*/
mem_heap_t* heap, /*!< in: memory heap where the tuple
- is created */
+ is created, DTUPLE_EST_ALLOC(n_fields)
+ bytes will be allocated from this heap */
ulint n_fields); /*!< in: number of fields */
/**********************************************************//**
diff --git a/storage/xtradb/include/data0data.ic b/storage/xtradb/include/data0data.ic
index 5c0f8039c80..205fa397987 100644
--- a/storage/xtradb/include/data0data.ic
+++ b/storage/xtradb/include/data0data.ic
@@ -348,23 +348,25 @@ dtuple_get_nth_field(
#endif /* UNIV_DEBUG */
/**********************************************************//**
-Creates a data tuple to a memory heap. The default value for number
-of fields used in record comparisons for this tuple is n_fields.
-@return own: created tuple */
+Creates a data tuple from an already allocated chunk of memory.
+The size of the chunk must be at least DTUPLE_EST_ALLOC(n_fields).
+The default value for number of fields used in record comparisons
+for this tuple is n_fields.
+@return created tuple (inside buf) */
UNIV_INLINE
dtuple_t*
-dtuple_create(
-/*==========*/
- mem_heap_t* heap, /*!< in: memory heap where the tuple
- is created */
- ulint n_fields) /*!< in: number of fields */
+dtuple_create_from_mem(
+/*===================*/
+ void* buf, /*!< in, out: buffer to use */
+ ulint buf_size, /*!< in: buffer size */
+ ulint n_fields) /*!< in: number of fields */
{
dtuple_t* tuple;
- ut_ad(heap);
+ ut_ad(buf != NULL);
+ ut_a(buf_size >= DTUPLE_EST_ALLOC(n_fields));
- tuple = (dtuple_t*) mem_heap_alloc(heap, sizeof(dtuple_t)
- + n_fields * sizeof(dfield_t));
+ tuple = (dtuple_t*) buf;
tuple->info_bits = 0;
tuple->n_fields = n_fields;
tuple->n_fields_cmp = n_fields;
@@ -386,9 +388,38 @@ dtuple_create(
dfield_get_type(field)->mtype = DATA_ERROR;
}
}
+#endif
+ return(tuple);
+}
+
+/**********************************************************//**
+Creates a data tuple to a memory heap. The default value for number
+of fields used in record comparisons for this tuple is n_fields.
+@return own: created tuple */
+UNIV_INLINE
+dtuple_t*
+dtuple_create(
+/*==========*/
+ mem_heap_t* heap, /*!< in: memory heap where the tuple
+ is created, DTUPLE_EST_ALLOC(n_fields)
+ bytes will be allocated from this heap */
+ ulint n_fields) /*!< in: number of fields */
+{
+ void* buf;
+ ulint buf_size;
+ dtuple_t* tuple;
+
+ ut_ad(heap);
+
+ buf_size = DTUPLE_EST_ALLOC(n_fields);
+ buf = mem_heap_alloc(heap, buf_size);
+ tuple = dtuple_create_from_mem(buf, buf_size, n_fields);
+
+#ifdef UNIV_DEBUG
UNIV_MEM_INVALID(tuple->fields, n_fields * sizeof *tuple->fields);
#endif
+
return(tuple);
}
diff --git a/storage/xtradb/include/db0err.h b/storage/xtradb/include/db0err.h
index 7048341b31e..3a4c8a54016 100644
--- a/storage/xtradb/include/db0err.h
+++ b/storage/xtradb/include/db0err.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -112,6 +112,8 @@ enum db_err {
limit */
DB_INDEX_CORRUPT, /* we have corrupted index */
DB_UNDO_RECORD_TOO_BIG, /* the undo log record is too big */
+ DB_TABLE_IN_FK_CHECK, /* table is being used in foreign
+ key check */
/* The following are partial failure codes */
DB_FAIL = 1000,
diff --git a/storage/xtradb/include/dict0boot.h b/storage/xtradb/include/dict0boot.h
index a817775c93c..9905217ccf7 100644
--- a/storage/xtradb/include/dict0boot.h
+++ b/storage/xtradb/include/dict0boot.h
@@ -94,6 +94,26 @@ void
dict_create(void);
/*=============*/
+/*****************************************************************//**
+Verifies the SYS_STATS table by scanning its clustered index. This
+function may only be called at InnoDB startup time.
+
+@return TRUE if SYS_STATS was verified successfully */
+UNIV_INTERN
+ibool
+dict_verify_xtradb_sys_stats(void);
+/*==============================*/
+
+/*****************************************************************//**
+Discard the existing dictionary cache SYS_STATS information, create and
+add it there anew. Does not touch the old SYS_STATS tablespace page
+under the assumption that they are corrupted or overwritten for other
+purposes. */
+UNIV_INTERN
+void
+dict_recreate_xtradb_sys_stats(void);
+/*================================*/
+
/* Space id and page no where the dictionary header resides */
#define DICT_HDR_SPACE 0 /* the SYSTEM tablespace */
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index 8af806c3572..6974e480144 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -1099,14 +1099,6 @@ dict_index_get_page(
/*================*/
const dict_index_t* tree); /*!< in: index */
/*********************************************************************//**
-Sets the page number of the root of index tree. */
-UNIV_INLINE
-void
-dict_index_set_page(
-/*================*/
- dict_index_t* index, /*!< in/out: index */
- ulint page); /*!< in: page number */
-/*********************************************************************//**
Gets the read-write lock of the index tree.
@return read-write lock */
UNIV_INLINE
diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic
index b10deddd28f..5ed9b182d6c 100644
--- a/storage/xtradb/include/dict0dict.ic
+++ b/storage/xtradb/include/dict0dict.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -776,21 +776,6 @@ dict_index_get_page(
}
/*********************************************************************//**
-Sets the page number of the root of index tree. */
-UNIV_INLINE
-void
-dict_index_set_page(
-/*================*/
- dict_index_t* index, /*!< in/out: index */
- ulint page) /*!< in: page number */
-{
- ut_ad(index);
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
-
- index->page = page;
-}
-
-/*********************************************************************//**
Gets the read-write lock of the index tree.
@return read-write lock */
UNIV_INLINE
diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h
index 7f7904f6a25..50c6e1ee142 100644
--- a/storage/xtradb/include/dict0mem.h
+++ b/storage/xtradb/include/dict0mem.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -399,7 +399,9 @@ struct dict_index_struct{
unsigned to_be_dropped:1;
/*!< TRUE if this index is marked to be
dropped in ha_innobase::prepare_drop_index(),
- otherwise FALSE */
+ otherwise FALSE. Protected by
+ dict_sys->mutex, dict_operation_lock and
+ index->lock.*/
dict_field_t* fields; /*!< array of field descriptions */
#ifndef UNIV_HOTBACKUP
UT_LIST_NODE_T(dict_index_t)
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index 92fdca0db1b..19bf5960ae4 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -348,20 +348,19 @@ fil_read_first_page(
ib_uint64_t* max_flushed_lsn); /*!< out: max of flushed
lsn values in data files */
/*******************************************************************//**
-Increments the count of pending insert buffer page merges, if space is not
-being deleted.
-@return TRUE if being deleted, and ibuf merges should be skipped */
+Increments the count of pending operation, if space is not being deleted.
+@return TRUE if being deleted, and operation should be skipped */
UNIV_INTERN
ibool
-fil_inc_pending_ibuf_merges(
-/*========================*/
+fil_inc_pending_ops(
+/*================*/
ulint id); /*!< in: space id */
/*******************************************************************//**
-Decrements the count of pending insert buffer page merges. */
+Decrements the count of pending operations. */
UNIV_INTERN
void
-fil_decr_pending_ibuf_merges(
-/*=========================*/
+fil_decr_pending_ops(
+/*=================*/
ulint id); /*!< in: space id */
#endif /* !UNIV_HOTBACKUP */
/*******************************************************************//**
@@ -400,7 +399,9 @@ UNIV_INTERN
ibool
fil_delete_tablespace(
/*==================*/
- ulint id); /*!< in: space id */
+ ulint id, /*!< in: space id */
+ ibool evict_all); /*!< in: TRUE if we want all pages
+ evicted from LRU. */
#ifndef UNIV_HOTBACKUP
/*******************************************************************//**
Discards a single-table tablespace. The tablespace must be cached in the
diff --git a/storage/xtradb/include/fsp0fsp.h b/storage/xtradb/include/fsp0fsp.h
index d5e235aa870..f07e3decc66 100644
--- a/storage/xtradb/include/fsp0fsp.h
+++ b/storage/xtradb/include/fsp0fsp.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 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
@@ -260,30 +260,33 @@ fseg_n_reserved_pages(
Allocates a single free page from a segment. This function implements
the intelligent allocation strategy which tries to minimize
file space fragmentation.
-@return the allocated page offset FIL_NULL if no page could be allocated */
-UNIV_INTERN
-ulint
-fseg_alloc_free_page(
-/*=================*/
- fseg_header_t* seg_header, /*!< in: segment header */
- ulint hint, /*!< in: hint of which page would be desirable */
- byte direction, /*!< in: if the new page is needed because
+@param[in/out] seg_header segment header
+@param[in] hint hint of which page would be desirable
+@param[in] direction if the new page is needed because
of an index page split, and records are
inserted there in order, into which
direction they go alphabetically: FSP_DOWN,
- FSP_UP, FSP_NO_DIR */
- mtr_t* mtr); /*!< in: mtr handle */
+ FSP_UP, FSP_NO_DIR
+@param[in/out] mtr mini-transaction
+@return X-latched block, or NULL if no page could be allocated */
+#define fseg_alloc_free_page(seg_header, hint, direction, mtr) \
+ fseg_alloc_free_page_general(seg_header, hint, direction, \
+ FALSE, mtr, mtr)
/**********************************************************************//**
Allocates a single free page from a segment. This function implements
the intelligent allocation strategy which tries to minimize file space
fragmentation.
-@return allocated page offset, FIL_NULL if no page could be allocated */
+@retval NULL if no page could be allocated
+@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
+(init_mtr == mtr, or the page was not previously freed in mtr)
+@retval block (not allocated or initialized) otherwise */
UNIV_INTERN
-ulint
+buf_block_t*
fseg_alloc_free_page_general(
/*=========================*/
- fseg_header_t* seg_header,/*!< in: segment header */
- ulint hint, /*!< in: hint of which page would be desirable */
+ fseg_header_t* seg_header,/*!< in/out: segment header */
+ ulint hint, /*!< in: hint of which page would be
+ desirable */
byte direction,/*!< in: if the new page is needed because
of an index page split, and records are
inserted there in order, into which
@@ -294,7 +297,12 @@ fseg_alloc_free_page_general(
with fsp_reserve_free_extents, then there
is no need to do the check for this individual
page */
- mtr_t* mtr); /*!< in: mtr handle */
+ mtr_t* mtr, /*!< in/out: mini-transaction */
+ mtr_t* init_mtr)/*!< in/out: mtr or another mini-transaction
+ in which the page should be initialized.
+ If init_mtr!=mtr, but the page is already
+ latched in mtr, do not initialize the page. */
+ __attribute__((warn_unused_result, nonnull));
/**********************************************************************//**
Reserves free pages from a tablespace. All mini-transactions which may
use several pages from the tablespace should call this function beforehand
diff --git a/storage/xtradb/include/log0log.h b/storage/xtradb/include/log0log.h
index 281dd61a105..6b1c2859cf7 100644
--- a/storage/xtradb/include/log0log.h
+++ b/storage/xtradb/include/log0log.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -18,8 +18,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
diff --git a/storage/xtradb/include/mem0mem.ic b/storage/xtradb/include/mem0mem.ic
index d214c3fe6c9..c70615e1ca9 100644
--- a/storage/xtradb/include/mem0mem.ic
+++ b/storage/xtradb/include/mem0mem.ic
@@ -209,10 +209,6 @@ mem_heap_alloc(
buf = (byte*)buf + MEM_FIELD_HEADER_SIZE;
#endif
-#ifdef UNIV_SET_MEM_TO_ZERO
- UNIV_MEM_ALLOC(buf, n);
- memset(buf, '\0', n);
-#endif
UNIV_MEM_ALLOC(buf, n);
return(buf);
}
diff --git a/storage/xtradb/include/mtr0log.ic b/storage/xtradb/include/mtr0log.ic
index fa9ac014f4e..3ed1183f5c0 100644
--- a/storage/xtradb/include/mtr0log.ic
+++ b/storage/xtradb/include/mtr0log.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 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
@@ -217,6 +217,7 @@ mlog_write_initial_log_record_fast(
"Please post a bug report to "
"bugs.mysql.com.\n",
type, offset, space);
+ ut_ad(0);
}
}
diff --git a/storage/xtradb/include/mtr0mtr.h b/storage/xtradb/include/mtr0mtr.h
index 7f608546cc2..46f1ff9310c 100644
--- a/storage/xtradb/include/mtr0mtr.h
+++ b/storage/xtradb/include/mtr0mtr.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -50,7 +50,9 @@ first 3 values must be RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
#define MTR_MEMO_PAGE_S_FIX RW_S_LATCH
#define MTR_MEMO_PAGE_X_FIX RW_X_LATCH
#define MTR_MEMO_BUF_FIX RW_NO_LATCH
-#define MTR_MEMO_MODIFY 54
+#ifdef UNIV_DEBUG
+# define MTR_MEMO_MODIFY 54
+#endif /* UNIV_DEBUG */
#define MTR_MEMO_S_LOCK 55
#define MTR_MEMO_X_LOCK 56
@@ -376,6 +378,9 @@ struct mtr_struct{
ulint n_log_recs;
/* count of how many page initial log records
have been written to the mtr log */
+ ulint n_freed_pages;
+ /* number of pages that have been freed in
+ this mini-transaction */
ulint log_mode; /* specifies which operations should be
logged; default value MTR_LOG_ALL */
ib_uint64_t start_lsn;/* start lsn of the possible log entry for
diff --git a/storage/xtradb/include/mtr0mtr.ic b/storage/xtradb/include/mtr0mtr.ic
index 1db4a4bd735..a03a0271535 100644
--- a/storage/xtradb/include/mtr0mtr.ic
+++ b/storage/xtradb/include/mtr0mtr.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -46,6 +46,7 @@ mtr_start(
mtr->modifications = FALSE;
mtr->inside_ibuf = FALSE;
mtr->n_log_recs = 0;
+ mtr->n_freed_pages = 0;
ut_d(mtr->state = MTR_ACTIVE);
ut_d(mtr->magic_n = MTR_MAGIC_N);
@@ -248,7 +249,7 @@ mtr_s_lock_func(
ut_ad(mtr);
ut_ad(lock);
- rw_lock_s_lock_func(lock, 0, file, line);
+ rw_lock_s_lock_inline(lock, 0, file, line);
mtr_memo_push(mtr, lock, MTR_MEMO_S_LOCK);
}
@@ -267,7 +268,7 @@ mtr_x_lock_func(
ut_ad(mtr);
ut_ad(lock);
- rw_lock_x_lock_func(lock, 0, file, line);
+ rw_lock_x_lock_inline(lock, 0, file, line);
mtr_memo_push(mtr, lock, MTR_MEMO_X_LOCK);
}
diff --git a/storage/xtradb/include/page0page.h b/storage/xtradb/include/page0page.h
index 1b9f9c84225..ba1ee7a7d11 100644
--- a/storage/xtradb/include/page0page.h
+++ b/storage/xtradb/include/page0page.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -281,16 +281,42 @@ page_get_supremum_offset(
const page_t* page); /*!< in: page which must have record(s) */
#define page_get_infimum_rec(page) ((page) + page_get_infimum_offset(page))
#define page_get_supremum_rec(page) ((page) + page_get_supremum_offset(page))
+
/************************************************************//**
-Returns the middle record of record list. If there are an even number
-of records in the list, returns the first record of upper half-list.
-@return middle record */
+Returns the nth record of the record list.
+This is the inverse function of page_rec_get_n_recs_before().
+@return nth record */
UNIV_INTERN
+const rec_t*
+page_rec_get_nth_const(
+/*===================*/
+ const page_t* page, /*!< in: page */
+ ulint nth) /*!< in: nth record */
+ __attribute__((nonnull, warn_unused_result));
+/************************************************************//**
+Returns the nth record of the record list.
+This is the inverse function of page_rec_get_n_recs_before().
+@return nth record */
+UNIV_INLINE
+rec_t*
+page_rec_get_nth(
+/*=============*/
+ page_t* page, /*< in: page */
+ ulint nth) /*!< in: nth record */
+ __attribute__((nonnull, warn_unused_result));
+
+#ifndef UNIV_HOTBACKUP
+/************************************************************//**
+Returns the middle record of the records on the page. If there is an
+even number of records in the list, returns the first record of the
+upper half-list.
+@return middle record */
+UNIV_INLINE
rec_t*
page_get_middle_rec(
/*================*/
- page_t* page); /*!< in: page */
-#ifndef UNIV_HOTBACKUP
+ page_t* page) /*!< in: page */
+ __attribute__((nonnull, warn_unused_result));
/*************************************************************//**
Compares a data tuple to a physical record. Differs from the function
cmp_dtuple_rec_with_match in the way that the record must reside on an
@@ -345,6 +371,7 @@ page_get_n_recs(
/***************************************************************//**
Returns the number of records before the given record in chain.
The number includes infimum and supremum records.
+This is the inverse function of page_rec_get_nth().
@return number of records */
UNIV_INTERN
ulint
diff --git a/storage/xtradb/include/page0page.ic b/storage/xtradb/include/page0page.ic
index d8570108115..4fe93345ce5 100644
--- a/storage/xtradb/include/page0page.ic
+++ b/storage/xtradb/include/page0page.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -422,7 +422,37 @@ page_rec_is_infimum(
return(page_rec_is_infimum_low(page_offset(rec)));
}
+/************************************************************//**
+Returns the nth record of the record list.
+This is the inverse function of page_rec_get_n_recs_before().
+@return nth record */
+UNIV_INLINE
+rec_t*
+page_rec_get_nth(
+/*=============*/
+ page_t* page, /*!< in: page */
+ ulint nth) /*!< in: nth record */
+{
+ return((rec_t*) page_rec_get_nth_const(page, nth));
+}
+
#ifndef UNIV_HOTBACKUP
+/************************************************************//**
+Returns the middle record of the records on the page. If there is an
+even number of records in the list, returns the first record of the
+upper half-list.
+@return middle record */
+UNIV_INLINE
+rec_t*
+page_get_middle_rec(
+/*================*/
+ page_t* page) /*!< in: page */
+{
+ ulint middle = (page_get_n_recs(page) + PAGE_HEAP_NO_USER_LOW) / 2;
+
+ return(page_rec_get_nth(page, middle));
+}
+
/*************************************************************//**
Compares a data tuple to a physical record. Differs from the function
cmp_dtuple_rec_with_match in the way that the record must reside on an
@@ -713,7 +743,7 @@ page_rec_get_next_low(
(void*) rec,
(ulong) page_get_space_id(page),
(ulong) page_get_page_no(page));
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
ut_error;
}
diff --git a/storage/xtradb/include/row0mysql.h b/storage/xtradb/include/row0mysql.h
index 69e59ae120f..464024ebe03 100644
--- a/storage/xtradb/include/row0mysql.h
+++ b/storage/xtradb/include/row0mysql.h
@@ -168,7 +168,9 @@ UNIV_INTERN
row_prebuilt_t*
row_create_prebuilt(
/*================*/
- dict_table_t* table); /*!< in: Innobase table handle */
+ dict_table_t* table, /*!< in: Innobase table handle */
+ ulint mysql_row_len); /*!< in: length in bytes of a row in
+ the MySQL format */
/********************************************************************//**
Free a prebuilt struct for a MySQL table handle. */
UNIV_INTERN
@@ -693,9 +695,9 @@ struct row_prebuilt_struct {
in inserts */
que_fork_t* upd_graph; /*!< Innobase SQL query graph used
in updates or deletes */
- btr_pcur_t* pcur; /*!< persistent cursor used in selects
+ btr_pcur_t pcur; /*!< persistent cursor used in selects
and updates */
- btr_pcur_t* clust_pcur; /*!< persistent cursor used in
+ btr_pcur_t clust_pcur; /*!< persistent cursor used in
some selects and updates */
que_fork_t* sel_graph; /*!< dummy query graph used in
selects */
diff --git a/storage/xtradb/include/row0sel.h b/storage/xtradb/include/row0sel.h
index 8544b9d08ba..1c4ea6f7244 100644
--- a/storage/xtradb/include/row0sel.h
+++ b/storage/xtradb/include/row0sel.h
@@ -128,7 +128,12 @@ row_sel_convert_mysql_key_to_innobase(
in the tuple is already according
to index! */
byte* buf, /*!< in: buffer to use in field
- conversions */
+ conversions; NOTE that dtuple->data
+ may end up pointing inside buf so
+ do not discard that buffer while
+ the tuple is being used. See
+ row_mysql_store_col_in_innobase_format()
+ in the case of DATA_INT */
ulint buf_len, /*!< in: buffer length */
dict_index_t* index, /*!< in: index of the key value */
const byte* key_ptr, /*!< in: MySQL key value */
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index eeb5806de40..756a22f4242 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -233,6 +233,9 @@ extern unsigned long long srv_stats_sample_pages;
extern ulint srv_stats_auto_update;
extern ulint srv_stats_update_need_lock;
extern ibool srv_use_sys_stats_table;
+#ifdef UNIV_DEBUG
+extern ulong srv_sys_stats_root_page;
+#endif
extern ibool srv_use_doublewrite_buf;
extern ibool srv_use_checksums;
@@ -292,9 +295,6 @@ extern ibool srv_print_lock_waits;
extern ibool srv_print_buf_io;
extern ibool srv_print_log_io;
extern ibool srv_print_latch_waits;
-
-extern ulong srv_flush_checkpoint_debug;
-
#else /* UNIV_DEBUG */
# define srv_print_thread_releases FALSE
# define srv_print_lock_waits FALSE
@@ -741,12 +741,14 @@ srv_que_task_enqueue_low(
que_thr_t* thr); /*!< in: query thread */
/**********************************************************************//**
-Check whether any background thread is active.
-@return FALSE if all are are suspended or have exited. */
+Check whether any background thread is active. If so, return the thread
+type.
+@return ULINT_UNDEFINED if all are are suspended or have exited, thread
+type if any are still active. */
UNIV_INTERN
-ibool
-srv_is_any_background_thread_active(void);
-/*======================================*/
+ulint
+srv_get_active_thread_type(void);
+/*============================*/
/** Status variables to be passed to MySQL */
struct export_var_struct{
diff --git a/storage/xtradb/include/sync0rw.h b/storage/xtradb/include/sync0rw.h
index 971099c91f5..6159d8d0c81 100644
--- a/storage/xtradb/include/sync0rw.h
+++ b/storage/xtradb/include/sync0rw.h
@@ -155,6 +155,9 @@ unlocking, not the corresponding function. */
# define rw_lock_s_lock(M) \
rw_lock_s_lock_func((M), 0, __FILE__, __LINE__)
+# define rw_lock_s_lock_inline(M, P, F, L) \
+ rw_lock_s_lock_func((M), (P), (F), (L))
+
# define rw_lock_s_lock_gen(M, P) \
rw_lock_s_lock_func((M), (P), __FILE__, __LINE__)
@@ -171,12 +174,18 @@ unlocking, not the corresponding function. */
# define rw_lock_x_lock(M) \
rw_lock_x_lock_func((M), 0, __FILE__, __LINE__)
+# define rw_lock_x_lock_inline(M, P, F, L) \
+ rw_lock_x_lock_func((M), (P), (F), (L))
+
# define rw_lock_x_lock_gen(M, P) \
rw_lock_x_lock_func((M), (P), __FILE__, __LINE__)
# define rw_lock_x_lock_nowait(M) \
rw_lock_x_lock_func_nowait((M), __FILE__, __LINE__)
+# define rw_lock_x_lock_func_nowait_inline(M, F, L) \
+ rw_lock_x_lock_func_nowait((M), (F), (L))
+
# ifdef UNIV_SYNC_DEBUG
# define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(P, L)
# else
@@ -208,6 +217,9 @@ unlocking, not the corresponding function. */
# define rw_lock_s_lock(M) \
pfs_rw_lock_s_lock_func((M), 0, __FILE__, __LINE__)
+# define rw_lock_s_lock_inline(M, P, F, L) \
+ pfs_rw_lock_s_lock_func((M), (P), (F), (L))
+
# define rw_lock_s_lock_gen(M, P) \
pfs_rw_lock_s_lock_func((M), (P), __FILE__, __LINE__)
@@ -223,12 +235,18 @@ unlocking, not the corresponding function. */
# define rw_lock_x_lock(M) \
pfs_rw_lock_x_lock_func((M), 0, __FILE__, __LINE__)
+# define rw_lock_x_lock_inline(M, P, F, L) \
+ pfs_rw_lock_x_lock_func((M), (P), (F), (L))
+
# define rw_lock_x_lock_gen(M, P) \
pfs_rw_lock_x_lock_func((M), (P), __FILE__, __LINE__)
# define rw_lock_x_lock_nowait(M) \
pfs_rw_lock_x_lock_func_nowait((M), __FILE__, __LINE__)
+# define rw_lock_x_lock_func_nowait_inline(M, F, L) \
+ pfs_rw_lock_x_lock_func_nowait((M), (F), (L))
+
# ifdef UNIV_SYNC_DEBUG
# define rw_lock_x_unlock_gen(L, P) pfs_rw_lock_x_unlock_func(P, L)
# else
diff --git a/storage/xtradb/include/sync0rw.ic b/storage/xtradb/include/sync0rw.ic
index 3eaa6172631..73e1f880aad 100644
--- a/storage/xtradb/include/sync0rw.ic
+++ b/storage/xtradb/include/sync0rw.ic
@@ -90,7 +90,7 @@ rw_lock_set_waiter_flag(
rw_lock_t* lock) /*!< in/out: rw-lock */
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
- os_compare_and_swap_ulint(&lock->waiters, 0, 1);
+ (void) os_compare_and_swap_ulint(&lock->waiters, 0, 1);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->waiters = 1;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
@@ -107,7 +107,7 @@ rw_lock_reset_waiter_flag(
rw_lock_t* lock) /*!< in/out: rw-lock */
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
- os_compare_and_swap_ulint(&lock->waiters, 1, 0);
+ (void) os_compare_and_swap_ulint(&lock->waiters, 1, 0);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->waiters = 0;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
@@ -564,8 +564,6 @@ rw_lock_x_unlock_func(
if (lock->lock_word == 0) {
/* Last caller in a possible recursive chain. */
lock->recursive = FALSE;
- UNIV_MEM_INVALID(&lock->writer_thread,
- sizeof lock->writer_thread);
}
#ifdef UNIV_SYNC_DEBUG
@@ -610,8 +608,6 @@ rw_lock_x_unlock_direct(
if (lock->lock_word == 0) {
lock->recursive = FALSE;
- UNIV_MEM_INVALID(&lock->writer_thread,
- sizeof lock->writer_thread);
}
lock->lock_word += X_LOCK_DECR;
diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h
index f9434ed54be..4a2f55d90ff 100644
--- a/storage/xtradb/include/sync0sync.h
+++ b/storage/xtradb/include/sync0sync.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -18,8 +18,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -404,8 +404,10 @@ void
sync_thread_add_level(
/*==================*/
void* latch, /*!< in: pointer to a mutex or an rw-lock */
- ulint level); /*!< in: level in the latching order; if
+ ulint level, /*!< in: level in the latching order; if
SYNC_LEVEL_VARYING, nothing is done */
+ ibool relock) /*!< in: TRUE if re-entering an x-lock */
+ __attribute__((nonnull));
/******************************************************************//**
Removes a latch from the thread level array if it is found there.
@return TRUE if found in the array; it is no error if the latch is
diff --git a/storage/xtradb/include/trx0purge.h b/storage/xtradb/include/trx0purge.h
index 0b83a76cab7..2bd9e64476b 100644
--- a/storage/xtradb/include/trx0purge.h
+++ b/storage/xtradb/include/trx0purge.h
@@ -143,9 +143,9 @@ struct trx_purge_struct{
obtaining an s-latch here. */
read_view_t* view; /*!< The purge will not remove undo logs
which are >= this view (purge view) */
- ulint n_pages_handled;/*!< Approximate number of undo log
+ ulonglong n_pages_handled;/*!< Approximate number of undo log
pages processed in purge */
- ulint handle_limit; /*!< Target of how many pages to get
+ ulonglong handle_limit; /*!< Target of how many pages to get
processed in the current purge */
/*------------------------------*/
/* The following two fields form the 'purge pointer' which advances
diff --git a/storage/xtradb/include/trx0rec.ic b/storage/xtradb/include/trx0rec.ic
index f0b3276ed44..4fc5a7147f9 100644
--- a/storage/xtradb/include/trx0rec.ic
+++ b/storage/xtradb/include/trx0rec.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -107,6 +107,7 @@ trx_undo_rec_copy(
len = mach_read_from_2(undo_rec)
- ut_align_offset(undo_rec, UNIV_PAGE_SIZE);
+ ut_ad(len < UNIV_PAGE_SIZE);
return(mem_heap_dup(heap, undo_rec, len));
}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/trx0rseg.ic b/storage/xtradb/include/trx0rseg.ic
index daffa92fc7d..5e8d2b41120 100644
--- a/storage/xtradb/include/trx0rseg.ic
+++ b/storage/xtradb/include/trx0rseg.ic
@@ -25,6 +25,7 @@ Created 3/26/1996 Heikki Tuuri
#include "srv0srv.h"
#include "mtr0log.h"
+#include "trx0sys.h"
/******************************************************************//**
Gets a rollback segment header.
@@ -131,7 +132,13 @@ trx_rsegf_undo_find_free(
ulint i;
ulint page_no;
- for (i = 0; i < TRX_RSEG_N_SLOTS; i++) {
+ for (i = 0;
+#ifndef UNIV_DEBUG
+ i < TRX_RSEG_N_SLOTS;
+#else
+ i < (trx_rseg_n_slots_debug ? trx_rseg_n_slots_debug : TRX_RSEG_N_SLOTS);
+#endif
+ i++) {
page_no = trx_rsegf_get_nth_undo(rsegf, i, mtr);
diff --git a/storage/xtradb/include/trx0sys.h b/storage/xtradb/include/trx0sys.h
index 0f12fc496b7..c17b0c11767 100644
--- a/storage/xtradb/include/trx0sys.h
+++ b/storage/xtradb/include/trx0sys.h
@@ -252,6 +252,12 @@ 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. */
+extern uint trx_rseg_n_slots_debug;
+#endif
+
/*****************************************************************//**
Writes a trx id to 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/xtradb/include/trx0undo.h b/storage/xtradb/include/trx0undo.h
index 50aa6d0ac09..4a1e40af505 100644
--- a/storage/xtradb/include/trx0undo.h
+++ b/storage/xtradb/include/trx0undo.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -194,16 +194,17 @@ trx_undo_get_first_rec(
mtr_t* mtr); /*!< in: mtr */
/********************************************************************//**
Tries to add a page to the undo log segment where the undo log is placed.
-@return page number if success, else FIL_NULL */
+@return X-latched block if success, else NULL */
UNIV_INTERN
-ulint
+buf_block_t*
trx_undo_add_page(
/*==============*/
trx_t* trx, /*!< in: transaction */
trx_undo_t* undo, /*!< in: undo log memory object */
- mtr_t* mtr); /*!< in: mtr which does not have a latch to any
+ mtr_t* mtr) /*!< in: mtr which does not have a latch to any
undo log page; the caller must have reserved
the rollback segment mutex */
+ __attribute__((nonnull, warn_unused_result));
/********************************************************************//**
Frees the last undo log page.
The caller must hold the rollback segment mutex. */
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 1a48d68d0d7..f4b06ccefa4 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -54,7 +54,10 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_BUGFIX 8
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 24.1
+/* 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
#endif
/* The following is the InnoDB version as shown in
@@ -159,14 +162,6 @@ resolved */
/* DEBUG VERSION CONTROL
===================== */
-/* The following flag will make InnoDB to initialize
-all memory it allocates to zero. It hides Purify
-warnings about reading unallocated memory unless
-memory is read outside the allocated blocks. */
-/*
-#define UNIV_INIT_MEM_TO_ZERO
-*/
-
/* When this macro is defined then additional test functions will be
compiled. These functions live at the end of each relevant source file
and have "test_" prefix. These functions are not called from anywhere in
@@ -236,15 +231,6 @@ operations (very slow); also UNIV_DEBUG must be defined */
#define UNIV_BTR_DEBUG /* check B-tree links */
#define UNIV_LIGHT_MEM_DEBUG /* light memory debugging */
-#ifdef HAVE_valgrind
-/* The following sets all new allocated memory to zero before use:
-this can be used to eliminate unnecessary Purify warnings, but note that
-it also masks many bugs Purify could detect. For detailed Purify analysis it
-is best to remove the define below and look through the warnings one
-by one. */
-#define UNIV_SET_MEM_TO_ZERO
-#endif
-
/*
#define UNIV_SQL_DEBUG
#define UNIV_LOG_DEBUG
@@ -329,11 +315,17 @@ management to ensure correct alignment for doubles etc. */
/* Maximum number of parallel threads in a parallelized operation */
#define UNIV_MAX_PARALLELISM 32
-/* The maximum length of a table name. This is the MySQL limit and is
-defined in mysql_com.h like NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN, the
-number does not include a terminating '\0'. InnoDB probably can handle
-longer names internally */
-#define MAX_TABLE_NAME_LEN 192
+/** This is the "mbmaxlen" for my_charset_filename (defined in
+strings/ctype-utf8.c), which is used to encode File and Database names. */
+#define FILENAME_CHARSET_MAXNAMLEN 5
+
+/** The maximum length of an encode table name in bytes. The max
+table and database names are NAME_CHAR_LEN (64) characters. After the
+encoding, the max length would be NAME_CHAR_LEN (64) *
+FILENAME_CHARSET_MAXNAMLEN (5) = 320 bytes. The number does not include a
+terminating '\0'. InnoDB can handle longer names internally */
+#define MAX_TABLE_NAME_LEN 320
+
/* The maximum length of a database name. Like MAX_TABLE_NAME_LEN this is
the MySQL's NAME_LEN, see check_and_convert_db_name(). */
diff --git a/storage/xtradb/include/ut0mem.h b/storage/xtradb/include/ut0mem.h
index faf6f242883..39f5f20dc6d 100644
--- a/storage/xtradb/include/ut0mem.h
+++ b/storage/xtradb/include/ut0mem.h
@@ -78,40 +78,19 @@ ut_mem_init(void);
/*=============*/
/**********************************************************************//**
-Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
-defined and set_to_zero is TRUE.
+Allocates memory.
@return own: allocated memory */
UNIV_INTERN
void*
ut_malloc_low(
/*==========*/
ulint n, /*!< in: number of bytes to allocate */
- ibool set_to_zero, /*!< in: TRUE if allocated memory
- should be set to zero if
- UNIV_SET_MEM_TO_ZERO is defined */
- ibool assert_on_error); /*!< in: if TRUE, we crash mysqld if
+ ibool assert_on_error) /*!< in: if TRUE, we crash mysqld if
the memory cannot be allocated */
+ __attribute__((malloc));
/**********************************************************************//**
-Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
-defined.
-@return own: allocated memory */
-UNIV_INTERN
-void*
-ut_malloc(
-/*======*/
- ulint n); /*!< in: number of bytes to allocate */
-#ifndef UNIV_HOTBACKUP
-/**********************************************************************//**
-Tests if malloc of n bytes would succeed. ut_malloc() asserts if memory runs
-out. It cannot be used if we want to return an error message. Prints to
-stderr a message if fails.
-@return TRUE if succeeded */
-UNIV_INTERN
-ibool
-ut_test_malloc(
-/*===========*/
- ulint n); /*!< in: try to allocate this many bytes */
-#endif /* !UNIV_HOTBACKUP */
+Allocates memory. */
+#define ut_malloc(n) ut_malloc_low(n, TRUE)
/**********************************************************************//**
Frees a memory block allocated with ut_malloc. Freeing a NULL pointer is
a nop. */
diff --git a/storage/xtradb/include/ut0rnd.ic b/storage/xtradb/include/ut0rnd.ic
index 2c8c959d804..60e213dd19f 100644
--- a/storage/xtradb/include/ut0rnd.ic
+++ b/storage/xtradb/include/ut0rnd.ic
@@ -114,7 +114,7 @@ ut_rnd_interval(
rnd = ut_rnd_gen_ulint();
- return(low + (rnd % (high - low + 1)));
+ return(low + (rnd % (high - low)));
}
/*********************************************************//**
diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c
index ff711195785..eadd52f462a 100644
--- a/storage/xtradb/lock/lock0lock.c
+++ b/storage/xtradb/lock/lock0lock.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -38,6 +38,7 @@ Created 5/7/1996 Heikki Tuuri
#include "trx0purge.h"
#include "dict0mem.h"
#include "trx0sys.h"
+#include "btr0btr.h"
#ifdef WITH_WSREP
extern my_bool wsrep_debug;
@@ -1655,7 +1656,7 @@ lock_sec_rec_some_has_impl_off_kernel(
if (!lock_check_trx_id_sanity(page_get_max_trx_id(page),
rec, index, offsets, TRUE)) {
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
/* The page is corrupt: try to avoid a crash by returning
NULL */
@@ -1734,7 +1735,7 @@ lock_rec_create(
page_no = buf_block_get_page_no(block);
page = block->frame;
- ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
+ btr_assert_not_corrupted(block, index);
/* If rec is the supremum record, then we reset the gap and
LOCK_REC_NOT_GAP bits, as all locks on the supremum are
@@ -1898,6 +1899,7 @@ lock_rec_enqueue_waiting(
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n",
stderr);
+ ut_ad(0);
}
/* Enqueue the lock request that will wait to be granted */
@@ -2112,8 +2114,9 @@ lock_rec_lock_fast(
ut_ad(mode - (LOCK_MODE_MASK & mode) == LOCK_GAP
|| mode - (LOCK_MODE_MASK & mode) == 0
#ifdef WITH_WSREP
- || mode - (LOCK_MODE_MASK & mode) == WSREP_BF
- || mode - (LOCK_MODE_MASK & mode) - LOCK_REC_NOT_GAP == WSREP_BF
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == 0
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_GAP
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_REC_NOT_GAP
#endif /* WITH_WSREP */
|| mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP);
@@ -2197,8 +2200,9 @@ lock_rec_lock_slow(
ut_ad(mode - (LOCK_MODE_MASK & mode) == LOCK_GAP
|| mode - (LOCK_MODE_MASK & mode) == 0
#ifdef WITH_WSREP
- || mode - (LOCK_MODE_MASK & mode) == WSREP_BF
- || mode - (LOCK_MODE_MASK & mode) - LOCK_REC_NOT_GAP == WSREP_BF
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == 0
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_GAP
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_REC_NOT_GAP
#endif /* WITH_WSREP */
|| mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP);
@@ -2272,8 +2276,9 @@ lock_rec_lock(
ut_ad(mode - (LOCK_MODE_MASK & mode) == LOCK_GAP
|| mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP
#ifdef WITH_WSREP
- || mode - (LOCK_MODE_MASK & mode) == WSREP_BF
- || mode - (LOCK_MODE_MASK & mode) - LOCK_REC_NOT_GAP == WSREP_BF
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == 0
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_GAP
+ || mode - (LOCK_MODE_MASK & mode) - WSREP_BF == LOCK_REC_NOT_GAP
#endif /* WITH_WSREP */
|| mode - (LOCK_MODE_MASK & mode) == 0);
#ifdef WITH_WSREP
@@ -4029,6 +4034,7 @@ lock_table_enqueue_waiting(
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n",
stderr);
+ ut_ad(0);
}
/* Enqueue the lock request that will wait to be granted */
@@ -5256,6 +5262,79 @@ function_exit:
}
/*********************************************************************//**
+Validate record locks up to a limit.
+@return lock at limit or NULL if no more locks in the hash bucket */
+static __attribute__((nonnull, warn_unused_result))
+const lock_t*
+lock_rec_validate(
+/*==============*/
+ ulint start, /*!< in: lock_sys->rec_hash
+ bucket */
+ ib_uint64_t* limit) /*!< in/out: upper limit of
+ (space, page_no) */
+{
+ lock_t* lock;
+ ut_ad(mutex_own(&kernel_mutex));
+
+ for (lock = HASH_GET_FIRST(lock_sys->rec_hash, start);
+ lock != NULL;
+ lock = HASH_GET_NEXT(hash, lock)) {
+
+ ib_uint64_t current;
+
+ ut_a(trx_in_trx_list(lock->trx));
+ ut_a(lock_get_type(lock) == LOCK_REC);
+
+ current = ut_ull_create(
+ lock->un_member.rec_lock.space,
+ lock->un_member.rec_lock.page_no);
+
+ if (current > *limit) {
+ *limit = current + 1;
+ return(lock);
+ }
+ }
+
+ return(NULL);
+}
+
+/*********************************************************************//**
+Validate a record lock's block */
+static
+void
+lock_rec_block_validate(
+/*====================*/
+ ulint space,
+ ulint page_no)
+{
+ /* The lock and the block that it is referring to may be freed at
+ this point. We pass BUF_GET_POSSIBLY_FREED to skip a debug check.
+ If the lock exists in lock_rec_validate_page() we assert
+ !block->page.file_page_was_freed. */
+
+ mtr_t mtr;
+ buf_block_t* block;
+
+ /* Make sure that the tablespace is not deleted while we are
+ trying to access the page. */
+ if (!fil_inc_pending_ops(space)) {
+ mtr_start(&mtr);
+ block = buf_page_get_gen(
+ space, fil_space_get_zip_size(space),
+ page_no, RW_X_LATCH, NULL,
+ BUF_GET_POSSIBLY_FREED,
+ __FILE__, __LINE__, &mtr);
+
+ buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
+
+ ut_ad(lock_rec_validate_page(block));
+ mtr_commit(&mtr);
+
+ fil_decr_pending_ops(space);
+ }
+}
+
+/*********************************************************************//**
Validates the lock system.
@return TRUE if ok */
static
@@ -5287,60 +5366,21 @@ lock_validate(void)
trx = UT_LIST_GET_NEXT(trx_list, trx);
}
- for (i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) {
-
- ulint space;
- ulint page_no;
- ib_uint64_t limit = 0;
-
- for (;;) {
- mtr_t mtr;
- buf_block_t* block;
-
- lock = HASH_GET_FIRST(lock_sys->rec_hash, i);
-
- while (lock) {
- ib_uint64_t space_page;
- ut_a(trx_in_trx_list(lock->trx));
-
- space = lock->un_member.rec_lock.space;
- page_no = lock->un_member.rec_lock.page_no;
-
- space_page = ut_ull_create(space, page_no);
+ /* Iterate over all the record locks and validate the locks. We
+ don't want to hog the lock_sys_t::mutex and the trx_sys_t::mutex.
+ Release both mutexes during the validation check. */
- if (space_page >= limit) {
- break;
- }
-
- lock = HASH_GET_NEXT(hash, lock);
- }
+ for (i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) {
+ const lock_t* lock;
+ ib_uint64_t limit = 0;
- if (!lock) {
+ while ((lock = lock_rec_validate(i, &limit)) != NULL) {
- break;
- }
+ ulint space = lock->un_member.rec_lock.space;
+ ulint page_no = lock->un_member.rec_lock.page_no;
lock_mutex_exit_kernel();
-
- /* The lock and the block that it is referring
- to may be freed at this point. We pass
- BUF_GET_POSSIBLY_FREED to skip a debug check.
- If the lock exists in lock_rec_validate_page()
- we assert !block->page.file_page_was_freed. */
-
- mtr_start(&mtr);
- block = buf_page_get_gen(
- space, fil_space_get_zip_size(space),
- page_no, RW_X_LATCH, NULL,
- BUF_GET_POSSIBLY_FREED,
- __FILE__, __LINE__, &mtr);
- buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
-
- ut_ad(lock_rec_validate_page(block));
- mtr_commit(&mtr);
-
- limit++;
-
+ lock_rec_block_validate(space, page_no);
lock_mutex_enter_kernel();
}
}
diff --git a/storage/xtradb/log/log0log.c b/storage/xtradb/log/log0log.c
index af0c801a4ec..dcaf951a0ed 100644
--- a/storage/xtradb/log/log0log.c
+++ b/storage/xtradb/log/log0log.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -18,8 +18,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -1693,13 +1693,10 @@ log_preflush_pool_modified_pages(
recv_apply_hashed_log_recs(TRUE);
}
- retry:
n_pages = buf_flush_list(ULINT_MAX, new_oldest);
- if (sync && n_pages != 0) {
- //buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
- os_thread_sleep(100000);
- goto retry;
+ if (sync) {
+ buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
}
if (n_pages == ULINT_UNDEFINED) {
@@ -2023,13 +2020,6 @@ log_checkpoint(
{
ib_uint64_t oldest_lsn;
-#ifdef UNIV_DEBUG
- if (srv_flush_checkpoint_debug == 1) {
-
- return TRUE;
- }
-#endif
-
if (recv_recovery_is_on()) {
recv_apply_hashed_log_recs(TRUE);
}
@@ -2134,11 +2124,7 @@ log_make_checkpoint_at(
physical write will always be made to
log files */
{
-#ifdef UNIV_DEBUG
- if (srv_flush_checkpoint_debug == 1)
- return;
-#endif
-/* Preflush pages synchronously */
+ /* Preflush pages synchronously */
while (!log_preflush_pool_modified_pages(lsn, TRUE));
@@ -2230,13 +2216,7 @@ log_checkpoint_margin(void)
ibool checkpoint_sync;
ibool do_checkpoint;
ibool success;
-
-#ifdef UNIV_DEBUG
- if (srv_flush_checkpoint_debug == 1)
- return;
-#endif
-
- loop:
+loop:
sync = FALSE;
checkpoint_sync = FALSE;
do_checkpoint = FALSE;
@@ -2259,15 +2239,13 @@ log_checkpoint_margin(void)
/* A flush is urgent: we have to do a synchronous preflush */
sync = TRUE;
- advance = age - log->max_modified_age_sync;
+ advance = 2 * (age - log->max_modified_age_sync);
} else if (age > log_max_modified_age_async()) {
/* A flush is not urgent: we do an asynchronous preflush */
advance = age - log_max_modified_age_async();
- log->check_flush_or_checkpoint = FALSE;
} else {
advance = 0;
- log->check_flush_or_checkpoint = FALSE;
}
checkpoint_age = log->lsn - log->last_checkpoint_lsn;
@@ -2284,9 +2262,9 @@ log_checkpoint_margin(void)
do_checkpoint = TRUE;
- //log->check_flush_or_checkpoint = FALSE;
+ log->check_flush_or_checkpoint = FALSE;
} else {
- //log->check_flush_or_checkpoint = FALSE;
+ log->check_flush_or_checkpoint = FALSE;
}
mutex_exit(&(log->mutex));
@@ -2294,7 +2272,6 @@ log_checkpoint_margin(void)
if (advance) {
ib_uint64_t new_oldest = oldest_lsn + advance;
-retry:
success = log_preflush_pool_modified_pages(new_oldest, sync);
/* If the flush succeeded, this thread has done its part
@@ -2309,7 +2286,7 @@ retry:
log->check_flush_or_checkpoint = TRUE;
mutex_exit(&(log->mutex));
- goto retry;
+ goto loop;
}
}
@@ -3187,11 +3164,7 @@ void
log_check_margins(void)
/*===================*/
{
-#ifdef UNIV_DEBUG
- if (srv_flush_checkpoint_debug == 1)
- return;
-#endif
- loop:
+loop:
log_flush_margin();
log_checkpoint_margin();
@@ -3223,9 +3196,12 @@ void
logs_empty_and_mark_files_at_shutdown(void)
/*=======================================*/
{
- ib_uint64_t lsn;
- ulint arch_log_no;
- ibool server_busy;
+ ib_uint64_t lsn;
+ ulint arch_log_no;
+ ibool server_busy;
+ ulint count = 0;
+ ulint pending_io;
+ ulint active_thd;
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
@@ -3244,6 +3220,8 @@ logs_empty_and_mark_files_at_shutdown(void)
loop:
os_thread_sleep(100000);
+ count++;
+
mutex_enter(&kernel_mutex);
/* We need the monitor threads to stop before we proceed with
@@ -3252,6 +3230,21 @@ loop:
if (srv_error_monitor_active
|| srv_lock_timeout_active
|| srv_monitor_active) {
+ const char* thread_active = NULL;
+
+ /* Print a message every 60 seconds if we are waiting
+ for the monitor thread to exit. Master and worker threads
+ check will be done later. */
+ if (srv_print_verbose_log && count > 600) {
+
+ if (srv_error_monitor_active) {
+ thread_active = "srv_error_monitor_thread";
+ } else if (srv_lock_timeout_active) {
+ thread_active = "srv_lock_timeout thread";
+ } else if (srv_monitor_active) {
+ thread_active = "srv_monitor_thread";
+ }
+ }
mutex_exit(&kernel_mutex);
@@ -3259,6 +3252,13 @@ loop:
os_event_set(srv_monitor_event);
os_event_set(srv_timeout_event);
+ if (thread_active) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Waiting for %s to exit\n",
+ thread_active);
+ count = 0;
+ }
+
goto loop;
}
@@ -3269,9 +3269,54 @@ loop:
server_busy = trx_n_mysql_transactions > 0
|| UT_LIST_GET_LEN(trx_sys->trx_list) > trx_n_prepared;
+
+ if (server_busy) {
+ ulint total_trx = UT_LIST_GET_LEN(trx_sys->trx_list)
+ + trx_n_mysql_transactions;
+
+ mutex_exit(&kernel_mutex);
+
+ if (srv_print_verbose_log && count > 600) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Waiting for %lu "
+ "active transactions to finish\n",
+ (ulong) total_trx);
+ count = 0;
+ }
+
+ goto loop;
+ }
+
mutex_exit(&kernel_mutex);
- if (server_busy || srv_is_any_background_thread_active()) {
+ /* Check that the background threads are suspended */
+ active_thd = srv_get_active_thread_type();
+
+ if (active_thd != ULINT_UNDEFINED) {
+
+ /* The srv_lock_timeout_thread, srv_error_monitor_thread
+ and srv_monitor_thread should already exit by now. The
+ only threads to be suspended are the master threads
+ and worker threads (purge threads). Print the thread
+ type if any of such threads not in suspended mode */
+ if (srv_print_verbose_log && count > 600) {
+ const char* thread_type = "<null>";
+
+ switch (active_thd) {
+ case SRV_WORKER:
+ thread_type = "worker threads";
+ break;
+ case SRV_MASTER:
+ thread_type = "master thread";
+ break;
+ }
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Waiting for %s "
+ "to be suspended\n", thread_type);
+ count = 0;
+ }
+
goto loop;
}
@@ -3283,10 +3328,35 @@ loop:
|| log_sys->n_pending_writes;
mutex_exit(&log_sys->mutex);
- if (server_busy || !buf_pool_check_no_pending_io()) {
+ if (server_busy) {
+ if (srv_print_verbose_log && count > 600) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Pending checkpoint_writes: %lu\n"
+ " InnoDB: Pending log flush writes: %lu\n",
+ (ulong) log_sys->n_pending_checkpoint_writes,
+ (ulong) log_sys->n_pending_writes);
+ count = 0;
+ }
+
goto loop;
}
+ pending_io = buf_pool_check_num_pending_io();
+
+ if (pending_io) {
+ if (srv_print_verbose_log && count > 600) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Waiting for %lu buffer page "
+ "I/Os to complete\n",
+ (ulong) pending_io);
+ count = 0;
+ }
+
+ goto loop;
+ }
+
+
#ifdef UNIV_LOG_ARCHIVE
log_archive_all();
#endif /* UNIV_LOG_ARCHIVE */
@@ -3310,7 +3380,7 @@ loop:
log_buffer_flush_to_disk();
/* Check that the background threads stay suspended */
- if (srv_is_any_background_thread_active()) {
+ if (srv_get_active_thread_type() != ULINT_UNDEFINED) {
fprintf(stderr,
"InnoDB: Warning: some background thread"
" woke up during shutdown\n");
@@ -3319,7 +3389,7 @@ loop:
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
fil_close_all_files();
- ut_a(!srv_is_any_background_thread_active());
+ ut_a(srv_get_active_thread_type() == ULINT_UNDEFINED);
return;
}
@@ -3357,7 +3427,7 @@ loop:
mutex_exit(&log_sys->mutex);
/* Check that the background threads stay suspended */
- if (srv_is_any_background_thread_active()) {
+ if (srv_get_active_thread_type() != ULINT_UNDEFINED) {
fprintf(stderr,
"InnoDB: Warning: some background thread woke up"
" during shutdown\n");
@@ -3375,13 +3445,20 @@ loop:
if (!buf_all_freed()) {
+ if (srv_print_verbose_log && count > 600) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Waiting for dirty buffer "
+ "pages to be flushed\n");
+ count = 0;
+ }
+
goto loop;
}
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
/* Make some checks that the server really is quiet */
- ut_a(!srv_is_any_background_thread_active());
+ ut_a(srv_get_active_thread_type() == ULINT_UNDEFINED);
ut_a(buf_all_freed());
ut_a(lsn == log_sys->lsn);
@@ -3403,7 +3480,7 @@ loop:
fil_close_all_files();
/* Make some checks that the server really is quiet */
- ut_a(!srv_is_any_background_thread_active());
+ ut_a(srv_get_active_thread_type() == ULINT_UNDEFINED);
ut_a(buf_all_freed());
ut_a(lsn == log_sys->lsn);
diff --git a/storage/xtradb/mem/mem0pool.c b/storage/xtradb/mem/mem0pool.c
index dc68cf8eb24..50dbe526d64 100644
--- a/storage/xtradb/mem/mem0pool.c
+++ b/storage/xtradb/mem/mem0pool.c
@@ -228,11 +228,7 @@ mem_pool_create(
pool = ut_malloc(sizeof(mem_pool_t));
- /* We do not set the memory to zero (FALSE) in the pool,
- but only when allocated at a higher level in mem0mem.c.
- This is to avoid masking useful Purify warnings. */
-
- pool->buf = ut_malloc_low(size, FALSE, TRUE);
+ pool->buf = ut_malloc_low(size, TRUE);
pool->size = size;
mutex_create(mem_pool_mutex_key, &pool->mutex, SYNC_MEM_POOL);
diff --git a/storage/xtradb/mtr/mtr0mtr.c b/storage/xtradb/mtr/mtr0mtr.c
index 529af43d2e0..092bd702115 100644
--- a/storage/xtradb/mtr/mtr0mtr.c
+++ b/storage/xtradb/mtr/mtr0mtr.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c
index 875aea7878d..075a2ac4a12 100644
--- a/storage/xtradb/os/os0file.c
+++ b/storage/xtradb/os/os0file.c
@@ -3339,7 +3339,91 @@ retry:
fprintf(stderr,
"InnoDB: You can disable Linux Native AIO by"
- " setting innodb_native_aio = off in my.cnf\n");
+ " setting innodb_use_native_aio = 0 in my.cnf\n");
+ return(FALSE);
+}
+
+/******************************************************************//**
+Checks if the system supports native linux aio. On some kernel
+versions where native aio is supported it won't work on tmpfs. In such
+cases we can't use native aio as it is not possible to mix simulated
+and native aio.
+@return: TRUE if supported, FALSE otherwise. */
+static
+ibool
+os_aio_native_aio_supported(void)
+/*=============================*/
+{
+ int fd;
+ byte* buf;
+ byte* ptr;
+ struct io_event io_event;
+ io_context_t io_ctx;
+ struct iocb iocb;
+ struct iocb* p_iocb;
+ int err;
+
+ if (!os_aio_linux_create_io_ctx(1, &io_ctx)) {
+ /* The platform does not support native aio. */
+ return(FALSE);
+ }
+
+ /* Now check if tmpdir supports native aio ops. */
+ fd = innobase_mysql_tmpfile();
+
+ if (fd < 0) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Error: unable to create "
+ "temp file to check native AIO support.\n");
+
+ return(FALSE);
+ }
+
+ memset(&io_event, 0x0, sizeof(io_event));
+
+ buf = (byte*) ut_malloc(UNIV_PAGE_SIZE * 2);
+ ptr = (byte*) ut_align(buf, UNIV_PAGE_SIZE);
+
+ /* Suppress valgrind warning. */
+ memset(buf, 0x00, UNIV_PAGE_SIZE * 2);
+
+ memset(&iocb, 0x0, sizeof(iocb));
+ p_iocb = &iocb;
+ io_prep_pwrite(p_iocb, fd, ptr, UNIV_PAGE_SIZE, 0);
+
+ err = io_submit(io_ctx, 1, &p_iocb);
+ if (err >= 1) {
+ /* Now collect the submitted IO request. */
+ err = io_getevents(io_ctx, 1, 1, &io_event, NULL);
+ }
+
+ ut_free(buf);
+ close(fd);
+
+ switch (err) {
+ case 1:
+ return(TRUE);
+
+ case -EINVAL:
+ case -ENOSYS:
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: Linux Native AIO is not"
+ " supported on tmpdir.\n"
+ "InnoDB: You can either move tmpdir to a"
+ " file system that supports native AIO\n"
+ "InnoDB: or you can set"
+ " innodb_use_native_aio to FALSE to avoid"
+ " this message.\n");
+
+ /* fall through. */
+ default:
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: Linux Native AIO check"
+ " on tmpdir returned error[%d]\n", -err);
+ }
+
return(FALSE);
}
#endif /* LINUX_NATIVE_AIO */
@@ -3400,12 +3484,23 @@ os_aio_array_create(
if (!os_aio_linux_create_io_ctx(n/n_segments,
&array->aio_ctx[i])) {
/* If something bad happened during aio setup
- we should call it a day and return right away.
- We don't care about any leaks because a failure
- to initialize the io subsystem means that the
- server (or atleast the innodb storage engine)
- is not going to startup. */
- return(NULL);
+ we disable linux native aio.
+ The disadvantage will be a small memory leak
+ at shutdown but that's ok compared to a crash
+ or a not working server.
+ This frequently happens when running the test suite
+ with many threads on a system with low fs.aio-max-nr!
+ */
+
+ fprintf(stderr,
+ " InnoDB: Warning: Linux Native AIO disabled "
+ "because os_aio_linux_create_io_ctx() "
+ "failed. To get rid of this warning you can "
+ "try increasing system "
+ "fs.aio-max-nr to 1048576 or larger or "
+ "setting innodb_use_native_aio = 0 in my.cnf\n");
+ srv_use_native_aio = FALSE;
+ goto skip_native_aio;
}
}
@@ -3479,6 +3574,19 @@ os_aio_init(
os_io_init_simple();
+#if defined(LINUX_NATIVE_AIO)
+ /* Check if native aio is supported on this system and tmpfs */
+ if (srv_use_native_aio
+ && !os_aio_native_aio_supported()) {
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Warning: Linux Native AIO"
+ " disabled.\n");
+ srv_use_native_aio = FALSE;
+ }
+#endif /* LINUX_NATIVE_AIO */
+
for (i = 0; i < n_segments; i++) {
srv_set_io_thread_op_info(i, "not started yet");
}
diff --git a/storage/xtradb/os/os0proc.c b/storage/xtradb/os/os0proc.c
index 0f56a608f38..68321e1aaf9 100644
--- a/storage/xtradb/os/os0proc.c
+++ b/storage/xtradb/os/os0proc.c
@@ -111,9 +111,6 @@ os_mem_alloc_large(
os_fast_mutex_lock(&ut_list_mutex);
ut_total_allocated_memory += size;
os_fast_mutex_unlock(&ut_list_mutex);
-# ifdef UNIV_SET_MEM_TO_ZERO
- memset(ptr, '\0', size);
-# endif
UNIV_MEM_ALLOC(ptr, size);
return(ptr);
}
diff --git a/storage/xtradb/os/os0thread.c b/storage/xtradb/os/os0thread.c
index 12b6805d98e..b19b5378fcd 100644
--- a/storage/xtradb/os/os0thread.c
+++ b/storage/xtradb/os/os0thread.c
@@ -136,8 +136,10 @@ os_thread_create(
if (thread_id) {
*thread_id = win_thread_id;
}
-
- return(thread);
+ if (thread) {
+ CloseHandle(thread);
+ }
+ return((os_thread_t)win_thread_id);
#else
int ret;
os_thread_t pthread;
diff --git a/storage/xtradb/page/page0cur.c b/storage/xtradb/page/page0cur.c
index 936762b986a..d49b121afab 100644
--- a/storage/xtradb/page/page0cur.c
+++ b/storage/xtradb/page/page0cur.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -900,7 +900,7 @@ page_cur_parse_insert_rec(
ut_print_buf(stderr, ptr2, 300);
putc('\n', stderr);
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
ut_error;
}
@@ -1180,14 +1180,15 @@ page_cur_insert_rec_zip_reorg(
/* Before trying to reorganize the page,
store the number of preceding records on the page. */
pos = page_rec_get_n_recs_before(rec);
+ ut_ad(pos > 0);
if (page_zip_reorganize(block, index, mtr)) {
/* The page was reorganized: Find rec by seeking to pos,
and update *current_rec. */
- rec = page + PAGE_NEW_INFIMUM;
-
- while (--pos) {
- rec = page + rec_get_next_offs(rec, TRUE);
+ if (pos > 1) {
+ rec = page_rec_get_nth(page, pos - 1);
+ } else {
+ rec = page + PAGE_NEW_INFIMUM;
}
*current_rec = rec;
@@ -1283,6 +1284,12 @@ page_cur_insert_rec_zip(
insert_rec = page_cur_insert_rec_zip_reorg(
current_rec, block, index, insert_rec,
page, page_zip, mtr);
+#ifdef UNIV_DEBUG
+ if (insert_rec) {
+ rec_offs_make_valid(
+ insert_rec, index, offsets);
+ }
+#endif /* UNIV_DEBUG */
}
return(insert_rec);
diff --git a/storage/xtradb/page/page0page.c b/storage/xtradb/page/page0page.c
index 4858929082a..4a389bbe5b8 100644
--- a/storage/xtradb/page/page0page.c
+++ b/storage/xtradb/page/page0page.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -148,7 +148,7 @@ page_dir_find_owner_slot(
fputs("\n"
"InnoDB: on that page!\n", stderr);
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
ut_error;
}
@@ -549,8 +549,7 @@ page_copy_rec_list_end_no_locks(
page_cur_move_to_next(&cur1);
}
- ut_a((ibool)!!page_is_comp(new_page)
- == dict_table_is_comp(index->table));
+ btr_assert_not_corrupted(new_block, index);
ut_a(page_is_comp(new_page) == page_rec_is_comp(rec));
ut_a(mach_read_from_2(new_page + UNIV_PAGE_SIZE - 10) == (ulint)
(page_is_comp(new_page) ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
@@ -570,8 +569,10 @@ page_copy_rec_list_end_no_locks(
/* Track an assertion failure reported on the mailing
list on June 18th, 2003 */
- buf_page_print(new_page, 0);
- buf_page_print(page_align(rec), 0);
+ buf_page_print(new_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(page_align(rec), 0,
+ BUF_PAGE_PRINT_NO_CRASH);
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -1453,55 +1454,54 @@ page_dir_balance_slot(
}
}
-#ifndef UNIV_HOTBACKUP
/************************************************************//**
-Returns the middle record of the record list. If there are an even number
-of records in the list, returns the first record of the upper half-list.
-@return middle record */
+Returns the nth record of the record list.
+This is the inverse function of page_rec_get_n_recs_before().
+@return nth record */
UNIV_INTERN
-rec_t*
-page_get_middle_rec(
-/*================*/
- page_t* page) /*!< in: page */
+const rec_t*
+page_rec_get_nth_const(
+/*===================*/
+ const page_t* page, /*!< in: page */
+ ulint nth) /*!< in: nth record */
{
- page_dir_slot_t* slot;
- ulint middle;
+ const page_dir_slot_t* slot;
ulint i;
ulint n_owned;
- ulint count;
- rec_t* rec;
-
- /* This many records we must leave behind */
- middle = (page_get_n_recs(page) + PAGE_HEAP_NO_USER_LOW) / 2;
+ const rec_t* rec;
- count = 0;
+ ut_ad(nth < UNIV_PAGE_SIZE / (REC_N_NEW_EXTRA_BYTES + 1));
for (i = 0;; i++) {
slot = page_dir_get_nth_slot(page, i);
n_owned = page_dir_slot_get_n_owned(slot);
- if (count + n_owned > middle) {
+ if (n_owned > nth) {
break;
} else {
- count += n_owned;
+ nth -= n_owned;
}
}
ut_ad(i > 0);
slot = page_dir_get_nth_slot(page, i - 1);
- rec = (rec_t*) page_dir_slot_get_rec(slot);
- rec = page_rec_get_next(rec);
-
- /* There are now count records behind rec */
+ rec = page_dir_slot_get_rec(slot);
- for (i = 0; i < middle - count; i++) {
- rec = page_rec_get_next(rec);
+ if (page_is_comp(page)) {
+ do {
+ rec = page_rec_get_next_low(rec, TRUE);
+ ut_ad(rec);
+ } while (nth--);
+ } else {
+ do {
+ rec = page_rec_get_next_low(rec, FALSE);
+ ut_ad(rec);
+ } while (nth--);
}
return(rec);
}
-#endif /* !UNIV_HOTBACKUP */
/***************************************************************//**
Returns the number of records before the given record in chain.
@@ -1563,6 +1563,7 @@ page_rec_get_n_recs_before(
n--;
ut_ad(n >= 0);
+ ut_ad((ulint)n < UNIV_PAGE_SIZE / (REC_N_NEW_EXTRA_BYTES + 1));
return((ulint) n);
}
@@ -1835,7 +1836,7 @@ page_check_dir(
fprintf(stderr,
"InnoDB: Page directory corruption:"
" infimum not pointed to\n");
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
}
if (UNIV_UNLIKELY(!page_rec_is_supremum_low(supremum_offs))) {
@@ -1843,7 +1844,7 @@ page_check_dir(
fprintf(stderr,
"InnoDB: Page directory corruption:"
" supremum not pointed to\n");
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
}
}
#endif /* !UNIV_HOTBACKUP */
@@ -2547,7 +2548,7 @@ func_exit2:
(ulong) page_get_space_id(page),
(ulong) page_get_page_no(page),
index->name);
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
}
return(ret);
diff --git a/storage/xtradb/pars/pars0pars.c b/storage/xtradb/pars/pars0pars.c
index ef107f2896f..86f54195682 100644
--- a/storage/xtradb/pars/pars0pars.c
+++ b/storage/xtradb/pars/pars0pars.c
@@ -1857,7 +1857,7 @@ pars_sql(
ut_ad(str);
- heap = mem_heap_create(256);
+ heap = mem_heap_create(16000);
/* Currently, the parser is not reentrant: */
ut_ad(mutex_own(&(dict_sys->mutex)));
diff --git a/storage/xtradb/rem/rem0rec.c b/storage/xtradb/rem/rem0rec.c
index 15618a3fa02..0cee1ffb3c8 100644
--- a/storage/xtradb/rem/rem0rec.c
+++ b/storage/xtradb/rem/rem0rec.c
@@ -1803,7 +1803,10 @@ wsrep_rec_get_primary_key(
ut_ad(rec);
key_parts = dict_index_get_n_unique_in_tree(index);
- for (i = 0; i < key_parts; i++) {
+ for (i = 0;
+ i < key_parts && (index->type & DICT_CLUSTERED || i < key_parts - 1);
+ i++) {
+
dict_field_t* field = dict_index_get_nth_field(index, i);
const dict_col_t* col = dict_field_get_col(field);
diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c
index bc722d56203..9fbb5122a82 100644
--- a/storage/xtradb/row/row0ins.c
+++ b/storage/xtradb/row/row0ins.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -23,6 +23,8 @@ Insert into a table
Created 4/20/1996 Heikki Tuuri
*******************************************************/
+#include "m_string.h" /* for my_sys.h */
+#include "my_sys.h" /* DEBUG_SYNC_C */
#include "row0ins.h"
#ifdef UNIV_NONINL
@@ -47,6 +49,8 @@ Created 4/20/1996 Heikki Tuuri
#include "data0data.h"
#include "usr0sess.h"
#include "buf0lru.h"
+#include "m_string.h"
+#include "my_sys.h"
#define ROW_INS_PREV 1
#define ROW_INS_NEXT 2
@@ -348,9 +352,9 @@ row_ins_clust_index_entry_by_modify(
return(DB_LOCK_TABLE_FULL);
}
- err = btr_cur_pessimistic_update(0, cursor,
- heap, big_rec, update,
- 0, thr, mtr);
+ err = btr_cur_pessimistic_update(
+ BTR_KEEP_POS_FLAG, cursor, heap, big_rec, update,
+ 0, thr, mtr);
}
return(err);
@@ -757,7 +761,8 @@ ulint wsrep_append_foreign_key(trx_t *trx,
dict_foreign_t* foreign,
const rec_t* clust_rec,
dict_index_t* clust_index,
- ibool shared);
+ ibool referenced,
+ ibool shared);
#endif /* WITH_WSREP */
/*********************************************************************//**
@@ -957,7 +962,7 @@ row_ins_foreign_check_on_constraint(
fputs("\n"
"InnoDB: Submit a detailed bug report to"
" http://bugs.mysql.com\n", stderr);
-
+ ut_ad(0);
err = DB_SUCCESS;
goto nonstandard_exit_func;
@@ -1082,7 +1087,7 @@ row_ins_foreign_check_on_constraint(
foreign,
clust_rec,
clust_index,
- FALSE);
+ FALSE, FALSE);
}
#endif /* WITH_WSREP */
if (foreign->foreign_table->n_foreign_key_checks_running == 0) {
@@ -1100,6 +1105,9 @@ row_ins_foreign_check_on_constraint(
release the latch. */
row_mysql_unfreeze_data_dictionary(thr_get_trx(thr));
+
+ DEBUG_SYNC_C("innodb_dml_cascade_dict_unfreeze");
+
row_mysql_freeze_data_dictionary(thr_get_trx(thr));
mtr_start(mtr);
@@ -1421,12 +1429,22 @@ run_again:
if (check_ref) {
err = DB_SUCCESS;
#ifdef WITH_WSREP
- err = wsrep_append_foreign_key(
- thr_get_trx(thr),
- foreign,
- rec,
- check_index,
- TRUE);
+ if (thr->fk_cascade_depth == 0) {
+ err = wsrep_append_foreign_key(
+ thr_get_trx(thr),
+ foreign,
+ rec,
+ check_index,
+ check_ref, TRUE);
+ } else {
+ fprintf(stderr, "WSREP: skipping FK key append\n");
+ err = wsrep_append_foreign_key(
+ thr_get_trx(thr),
+ foreign,
+ rec,
+ check_index,
+ TRUE, TRUE);
+ }
#endif /* WITH_WSREP */
goto end_scan;
} else if (foreign->type != 0) {
@@ -1457,6 +1475,14 @@ run_again:
goto end_scan;
}
+#ifdef WITH_WSREP_REMOVED
+ err = wsrep_append_foreign_key(
+ thr_get_trx(thr),
+ foreign,
+ rec,
+ check_index,
+ FALSE);
+#endif /* WITH_WSREP */
/* row_ins_foreign_check_on_constraint
may have repositioned pcur on a
different block */
@@ -2036,6 +2062,7 @@ row_ins_index_entry_low(
ulint modify = 0; /* remove warning */
rec_t* insert_rec;
rec_t* rec;
+ ulint* offsets;
ulint err;
ulint n_unique;
big_rec_t* big_rec = NULL;
@@ -2145,6 +2172,64 @@ row_ins_index_entry_low(
err = row_ins_clust_index_entry_by_modify(
mode, &cursor, &heap, &big_rec, entry,
thr, &mtr);
+
+ if (big_rec) {
+ ut_a(err == DB_SUCCESS);
+ /* Write out the externally stored
+ columns while still x-latching
+ index->lock and block->lock. Allocate
+ pages for big_rec in the mtr that
+ modified the B-tree, but be sure to skip
+ any pages that were freed in mtr. We will
+ write out the big_rec pages before
+ committing the B-tree mini-transaction. If
+ the system crashes so that crash recovery
+ will not replay the mtr_commit(&mtr), the
+ big_rec pages will be left orphaned until
+ the pages are allocated for something else.
+
+ TODO: If the allocation extends the
+ tablespace, it will not be redo
+ logged, in either mini-transaction.
+ Tablespace extension should be
+ redo-logged in the big_rec
+ mini-transaction, so that recovery
+ will not fail when the big_rec was
+ written to the extended portion of the
+ file, in case the file was somehow
+ truncated in the crash. */
+
+ rec = btr_cur_get_rec(&cursor);
+ offsets = rec_get_offsets(
+ rec, index, NULL,
+ ULINT_UNDEFINED, &heap);
+
+ DEBUG_SYNC_C("before_row_ins_upd_extern");
+ err = btr_store_big_rec_extern_fields(
+ index, btr_cur_get_block(&cursor),
+ rec, offsets, big_rec, &mtr,
+ BTR_STORE_INSERT_UPDATE);
+ DEBUG_SYNC_C("after_row_ins_upd_extern");
+ /* If writing big_rec fails (for
+ example, because of DB_OUT_OF_FILE_SPACE),
+ the record will be corrupted. Even if
+ we did not update any externally
+ stored columns, our update could cause
+ the record to grow so that a
+ non-updated column was selected for
+ external storage. This non-update
+ would not have been written to the
+ undo log, and thus the record cannot
+ be rolled back.
+
+ However, because we have not executed
+ mtr_commit(mtr) yet, the update will
+ not be replayed in crash recovery, and
+ the following assertion failure will
+ effectively "roll back" the operation. */
+ ut_a(err == DB_SUCCESS);
+ goto stored_big_rec;
+ }
} else {
ut_ad(!n_ext);
err = row_ins_sec_index_entry_by_modify(
@@ -2191,8 +2276,13 @@ function_exit:
return(err);
}
+ DBUG_EXECUTE_IF(
+ "row_ins_extern_checkpoint",
+ log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE););
+
mtr_start(&mtr);
+ DEBUG_SYNC_C("before_row_ins_extern_latch");
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
BTR_MODIFY_TREE, &cursor, 0,
__FILE__, __LINE__, &mtr);
@@ -2200,10 +2290,13 @@ function_exit:
offsets = rec_get_offsets(rec, index, NULL,
ULINT_UNDEFINED, &heap);
+ DEBUG_SYNC_C("before_row_ins_extern");
err = btr_store_big_rec_extern_fields(
index, btr_cur_get_block(&cursor),
- rec, offsets, &mtr, FALSE, big_rec);
+ rec, offsets, big_rec, &mtr, BTR_STORE_INSERT);
+ DEBUG_SYNC_C("after_row_ins_extern");
+stored_big_rec:
if (modify) {
dtuple_big_rec_free(big_rec);
} else {
diff --git a/storage/xtradb/row/row0merge.c b/storage/xtradb/row/row0merge.c
index 9390946ad88..f00706da0d3 100644
--- a/storage/xtradb/row/row0merge.c
+++ b/storage/xtradb/row/row0merge.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 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
@@ -1607,22 +1607,28 @@ row_merge(
const dict_index_t* index, /*!< in: index being created */
merge_file_t* file, /*!< in/out: file containing
index entries */
- ulint* half, /*!< in/out: half the file */
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* num_run,/*!< in/out: Number of runs remain
+ to be merged */
+ ulint* run_offset) /*!< in/out: Array contains the
+ first offset number for each merge
+ run */
{
ulint foffs0; /*!< first input offset */
ulint foffs1; /*!< second input offset */
ulint error; /*!< error code */
merge_file_t of; /*!< output file */
- const ulint ihalf = *half;
+ const ulint ihalf = run_offset[*num_run / 2];
/*!< half the input file */
- ulint ohalf; /*!< half the output file */
+ ulint n_run = 0;
+ /*!< num of runs generated from this merge */
UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]);
+
ut_ad(ihalf < file->offset);
of.fd = *tmpfd;
@@ -1638,17 +1644,20 @@ row_merge(
#endif /* POSIX_FADV_SEQUENTIAL */
/* Merge blocks to the output file. */
- ohalf = 0;
foffs0 = 0;
foffs1 = ihalf;
+ UNIV_MEM_INVALID(run_offset, *num_run * sizeof *run_offset);
+
for (; foffs0 < ihalf && foffs1 < file->offset; foffs0++, foffs1++) {
- ulint ahalf; /*!< arithmetic half the input file */
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
return(DB_INTERRUPTED);
}
+ /* Remember the offset number for this run */
+ run_offset[n_run++] = of.offset;
+
error = row_merge_blocks(index, file, block,
&foffs0, &foffs1, &of, table);
@@ -1656,21 +1665,6 @@ row_merge(
return(error);
}
- /* Record the offset of the output file when
- approximately half the output has been generated. In
- this way, the next invocation of row_merge() will
- spend most of the time in this loop. The initial
- estimate is ohalf==0. */
- ahalf = file->offset / 2;
- ut_ad(ohalf <= of.offset);
-
- /* Improve the estimate until reaching half the input
- file size, or we can not get any closer to it. All
- comparands should be non-negative when !(ohalf < ahalf)
- because ohalf <= of.offset. */
- if (ohalf < ahalf || of.offset - ahalf < ohalf - ahalf) {
- ohalf = of.offset;
- }
}
/* Copy the last blocks, if there are any. */
@@ -1680,6 +1674,9 @@ row_merge(
return(DB_INTERRUPTED);
}
+ /* Remember the offset number for this run */
+ run_offset[n_run++] = of.offset;
+
if (!row_merge_blocks_copy(index, file, block, &foffs0, &of)) {
return(DB_CORRUPTION);
}
@@ -1692,6 +1689,9 @@ row_merge(
return(DB_INTERRUPTED);
}
+ /* Remember the offset number for this run */
+ run_offset[n_run++] = of.offset;
+
if (!row_merge_blocks_copy(index, file, block, &foffs1, &of)) {
return(DB_CORRUPTION);
}
@@ -1703,10 +1703,23 @@ row_merge(
return(DB_CORRUPTION);
}
+ ut_ad(n_run <= *num_run);
+
+ *num_run = n_run;
+
+ /* Each run can contain one or more offsets. As merge goes on,
+ the number of runs (to merge) will reduce until we have one
+ single run. So the number of runs will always be smaller than
+ the number of offsets in file */
+ ut_ad((*num_run) <= file->offset);
+
+ /* The number of offsets in output file is always equal or
+ smaller than input file */
+ ut_ad(of.offset <= file->offset);
+
/* Swap file descriptors for the next pass. */
*tmpfd = file->fd;
*file = of;
- *half = ohalf;
UNIV_MEM_INVALID(block[0], 3 * sizeof block[0]);
@@ -1731,27 +1744,44 @@ row_merge_sort(
if applicable */
{
ulint half = file->offset / 2;
+ ulint num_runs;
+ ulint* run_offset;
+ ulint error = DB_SUCCESS;
+
+ /* Record the number of merge runs we need to perform */
+ num_runs = file->offset;
+
+ /* If num_runs are less than 1, nothing to merge */
+ if (num_runs <= 1) {
+ return(error);
+ }
+
+ /* "run_offset" records each run's first offset number */
+ run_offset = (ulint*) mem_alloc(file->offset * sizeof(ulint));
+
+ /* This tells row_merge() where to start for the first round
+ of merge. */
+ run_offset[half] = half;
/* The file should always contain at least one byte (the end
of file marker). Thus, it must be at least one block. */
ut_ad(file->offset > 0);
+ /* Merge the runs until we have one big run */
do {
- ulint error;
+ error = row_merge(trx, index, file, block, tmpfd,
+ table, &num_runs, run_offset);
- error = row_merge(trx, index, file, &half,
- block, tmpfd, table);
+ UNIV_MEM_ASSERT_RW(run_offset, num_runs * sizeof *run_offset);
if (error != DB_SUCCESS) {
- return(error);
+ break;
}
+ } while (num_runs > 1);
- /* half > 0 should hold except when the file consists
- of one block. No need to merge further then. */
- ut_ad(half > 0 || file->offset == 1);
- } while (half < file->offset && half > 0);
+ mem_free(run_offset);
- return(DB_SUCCESS);
+ return(error);
}
/*************************************************************//**
@@ -2018,7 +2048,7 @@ row_merge_drop_index(
tables in Innobase. Deleting a row from SYS_INDEXES table also
frees the file segments of the B-tree associated with the index. */
- static const char str1[] =
+ static const char sql[] =
"PROCEDURE DROP_INDEX_PROC () IS\n"
"BEGIN\n"
/* Rename the index, so that it will be dropped by
@@ -2044,9 +2074,19 @@ row_merge_drop_index(
ut_a(trx->dict_operation_lock_mode == RW_X_LATCH);
- err = que_eval_sql(info, str1, FALSE, trx);
+ err = que_eval_sql(info, sql, FALSE, trx);
+
- ut_a(err == DB_SUCCESS);
+ if (err != DB_SUCCESS) {
+ /* Even though we ensure that DDL transactions are WAIT
+ and DEADLOCK free, we could encounter other errors e.g.,
+ DB_TOO_MANY_TRANSACTIONS. */
+ trx->error_state = DB_SUCCESS;
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Error: row_merge_drop_index failed "
+ "with error code: %lu.\n", (ulint) err);
+ }
/* Replace this index with another equivalent index for all
foreign key constraints on this table where this index is used */
@@ -2346,7 +2386,7 @@ row_merge_rename_indexes(
/* We use the private SQL parser of Innobase to generate the
query graphs needed in renaming indexes. */
- static const char rename_indexes[] =
+ static const char sql[] =
"PROCEDURE RENAME_INDEXES_PROC () IS\n"
"BEGIN\n"
"UPDATE SYS_INDEXES SET NAME=SUBSTR(NAME,1,LENGTH(NAME)-1)\n"
@@ -2362,7 +2402,7 @@ row_merge_rename_indexes(
pars_info_add_ull_literal(info, "tableid", table->id);
- err = que_eval_sql(info, rename_indexes, FALSE, trx);
+ err = que_eval_sql(info, sql, FALSE, trx);
if (err == DB_SUCCESS) {
dict_index_t* index = dict_table_get_first_index(table);
@@ -2372,6 +2412,15 @@ row_merge_rename_indexes(
}
index = dict_table_get_next_index(index);
} while (index);
+ } else {
+ /* Even though we ensure that DDL transactions are WAIT
+ and DEADLOCK free, we could encounter other errors e.g.,
+ DB_TOO_MANY_TRANSACTIONS. */
+ trx->error_state = DB_SUCCESS;
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Error: row_merge_rename_indexes "
+ "failed with error code: %lu.\n", (ulint) err);
}
trx->op_info = "";
@@ -2409,7 +2458,7 @@ row_merge_rename_tables(
memcpy(old_name, old_table->name, strlen(old_table->name) + 1);
} else {
ut_print_timestamp(stderr);
- fprintf(stderr, "InnoDB: too long table name: '%s', "
+ fprintf(stderr, " InnoDB: too long table name: '%s', "
"max length is %d\n", old_table->name,
MAX_FULL_NAME_LEN);
ut_error;
diff --git a/storage/xtradb/row/row0mysql.c b/storage/xtradb/row/row0mysql.c
index 63252ed01b3..575160501c3 100644
--- a/storage/xtradb/row/row0mysql.c
+++ b/storage/xtradb/row/row0mysql.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -53,6 +53,8 @@ Created 9/17/2000 Heikki Tuuri
#include "fil0fil.h"
#include "ibuf0ibuf.h"
#include "ha_prototypes.h"
+#include "m_string.h"
+#include "my_sys.h"
/** Provide optional 4.x backwards compatibility for 5.0 and above */
UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
@@ -669,17 +671,60 @@ UNIV_INTERN
row_prebuilt_t*
row_create_prebuilt(
/*================*/
- dict_table_t* table) /*!< in: Innobase table handle */
+ dict_table_t* table, /*!< in: Innobase table handle */
+ ulint mysql_row_len) /*!< in: length in bytes of a row in
+ the MySQL format */
{
row_prebuilt_t* prebuilt;
mem_heap_t* heap;
dict_index_t* clust_index;
dtuple_t* ref;
ulint ref_len;
+ ulint search_tuple_n_fields;
+
+ search_tuple_n_fields = 2 * dict_table_get_n_cols(table);
- heap = mem_heap_create(sizeof *prebuilt + 128);
+ clust_index = dict_table_get_first_index(table);
- prebuilt = mem_heap_zalloc(heap, sizeof *prebuilt);
+ /* Make sure that search_tuple is long enough for clustered index */
+ ut_a(2 * dict_table_get_n_cols(table) >= clust_index->n_fields);
+
+ ref_len = dict_index_get_n_unique(clust_index);
+
+#define PREBUILT_HEAP_INITIAL_SIZE \
+ ( \
+ sizeof(*prebuilt) \
+ /* allocd in this function */ \
+ + DTUPLE_EST_ALLOC(search_tuple_n_fields) \
+ + DTUPLE_EST_ALLOC(ref_len) \
+ /* allocd in row_prebuild_sel_graph() */ \
+ + sizeof(sel_node_t) \
+ + sizeof(que_fork_t) \
+ + sizeof(que_thr_t) \
+ /* allocd in row_get_prebuilt_update_vector() */ \
+ + sizeof(upd_node_t) \
+ + sizeof(upd_t) \
+ + sizeof(upd_field_t) \
+ * dict_table_get_n_cols(table) \
+ + sizeof(que_fork_t) \
+ + sizeof(que_thr_t) \
+ /* allocd in row_get_prebuilt_insert_row() */ \
+ + sizeof(ins_node_t) \
+ /* mysql_row_len could be huge and we are not \
+ sure if this prebuilt instance is going to be \
+ used in inserts */ \
+ + (mysql_row_len < 256 ? mysql_row_len : 0) \
+ + DTUPLE_EST_ALLOC(dict_table_get_n_cols(table)) \
+ + sizeof(que_fork_t) \
+ + sizeof(que_thr_t) \
+ )
+
+ /* We allocate enough space for the objects that are likely to
+ be created later in order to minimize the number of malloc()
+ calls */
+ heap = mem_heap_create(PREBUILT_HEAP_INITIAL_SIZE);
+
+ prebuilt = mem_heap_zalloc(heap, sizeof(*prebuilt));
prebuilt->magic_n = ROW_PREBUILT_ALLOCATED;
prebuilt->magic_n2 = ROW_PREBUILT_ALLOCATED;
@@ -689,23 +734,15 @@ row_create_prebuilt(
prebuilt->sql_stat_start = TRUE;
prebuilt->heap = heap;
- prebuilt->pcur = btr_pcur_create_for_mysql();
- prebuilt->clust_pcur = btr_pcur_create_for_mysql();
+ btr_pcur_reset(&prebuilt->pcur);
+ btr_pcur_reset(&prebuilt->clust_pcur);
prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = 99999999;
UNIV_MEM_INVALID(&prebuilt->stored_select_lock_type,
sizeof prebuilt->stored_select_lock_type);
- prebuilt->search_tuple = dtuple_create(
- heap, 2 * dict_table_get_n_cols(table));
-
- clust_index = dict_table_get_first_index(table);
-
- /* Make sure that search_tuple is long enough for clustered index */
- ut_a(2 * dict_table_get_n_cols(table) >= clust_index->n_fields);
-
- ref_len = dict_index_get_n_unique(clust_index);
+ prebuilt->search_tuple = dtuple_create(heap, search_tuple_n_fields);
ref = dtuple_create(heap, ref_len);
@@ -722,6 +759,8 @@ row_create_prebuilt(
prebuilt->autoinc_last_value = 0;
+ prebuilt->mysql_row_len = mysql_row_len;
+
return(prebuilt);
}
@@ -757,8 +796,8 @@ row_prebuilt_free(
prebuilt->magic_n = ROW_PREBUILT_FREED;
prebuilt->magic_n2 = ROW_PREBUILT_FREED;
- btr_pcur_free_for_mysql(prebuilt->pcur);
- btr_pcur_free_for_mysql(prebuilt->clust_pcur);
+ btr_pcur_reset(&prebuilt->pcur);
+ btr_pcur_reset(&prebuilt->clust_pcur);
if (prebuilt->mysql_template) {
mem_free(prebuilt->mysql_template);
@@ -1419,6 +1458,8 @@ row_update_for_mysql(
return(DB_ERROR);
}
+ DEBUG_SYNC_C("innodb_row_update_for_mysql_begin");
+
trx->op_info = "updating or deleting";
row_mysql_delay_if_needed();
@@ -1429,11 +1470,11 @@ row_update_for_mysql(
clust_index = dict_table_get_first_index(table);
- if (prebuilt->pcur->btr_cur.index == clust_index) {
- btr_pcur_copy_stored_position(node->pcur, prebuilt->pcur);
+ if (prebuilt->pcur.btr_cur.index == clust_index) {
+ btr_pcur_copy_stored_position(node->pcur, &prebuilt->pcur);
} else {
btr_pcur_copy_stored_position(node->pcur,
- prebuilt->clust_pcur);
+ &prebuilt->clust_pcur);
}
ut_a(node->pcur->rel_pos == BTR_PCUR_ON);
@@ -1538,8 +1579,8 @@ row_unlock_for_mysql(
clust_pcur, and we do not need
to reposition the cursors. */
{
- btr_pcur_t* pcur = prebuilt->pcur;
- btr_pcur_t* clust_pcur = prebuilt->clust_pcur;
+ btr_pcur_t* pcur = &prebuilt->pcur;
+ btr_pcur_t* clust_pcur = &prebuilt->clust_pcur;
trx_t* trx = prebuilt->trx;
ut_ad(prebuilt && trx);
@@ -1761,7 +1802,7 @@ row_mysql_freeze_data_dictionary_func(
{
ut_a(trx->dict_operation_lock_mode == 0);
- rw_lock_s_lock_func(&dict_operation_lock, 0, file, line);
+ rw_lock_s_lock_inline(&dict_operation_lock, 0, file, line);
trx->dict_operation_lock_mode = RW_S_LATCH;
}
@@ -1798,7 +1839,7 @@ row_mysql_lock_data_dictionary_func(
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks or lock waits can occur then in these operations */
- rw_lock_x_lock_func(&dict_operation_lock, 0, file, line);
+ rw_lock_x_lock_inline(&dict_operation_lock, 0, file, line);
trx->dict_operation_lock_mode = RW_X_LATCH;
mutex_enter(&(dict_sys->mutex));
@@ -1969,6 +2010,21 @@ err_exit:
}
break;
+ case DB_TOO_MANY_CONCURRENT_TRXS:
+ /* We already have .ibd file here. it should be deleted. */
+
+ if (table->space && !fil_delete_tablespace(table->space,
+ FALSE)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: not able to"
+ " delete tablespace %lu of table ",
+ (ulong) table->space);
+ ut_print_name(stderr, trx, TRUE, table->name);
+ fputs("!\n", stderr);
+ }
+ /* fall through */
+
case DB_DUPLICATE_KEY:
default:
/* We may also get err == DB_ERROR if the .ibd file for the
@@ -3146,6 +3202,7 @@ row_drop_table_for_mysql(
{
dict_foreign_t* foreign;
dict_table_t* table;
+ dict_index_t* index;
ulint space_id;
ulint err;
const char* table_name;
@@ -3353,6 +3410,18 @@ check_next_foreign:
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
trx->table_id = table->id;
+ /* Mark all indexes unavailable in the data dictionary cache
+ before starting to drop the table. */
+
+ for (index = dict_table_get_first_index(table);
+ index != NULL;
+ index = dict_table_get_next_index(index)) {
+ rw_lock_x_lock(dict_index_get_lock(index));
+ ut_ad(!index->to_be_dropped);
+ index->to_be_dropped = TRUE;
+ rw_lock_x_unlock(dict_index_get_lock(index));
+ }
+
/* We use the private SQL parser of Innobase to generate the
query graphs needed in deleting the dictionary data from system
tables in Innobase. Deleting a row from SYS_INDEXES table also
@@ -3493,7 +3562,7 @@ check_next_foreign:
"InnoDB: of table ");
ut_print_name(stderr, trx, TRUE, name);
fprintf(stderr, ".\n");
- } else if (!fil_delete_tablespace(space_id)) {
+ } else if (!fil_delete_tablespace(space_id, FALSE)) {
fprintf(stderr,
"InnoDB: We removed now the InnoDB"
" internal data dictionary entry\n"
@@ -3520,6 +3589,17 @@ check_next_foreign:
the undo log. We can directly exit here
and return the DB_TOO_MANY_CONCURRENT_TRXS
error. */
+
+ /* Mark all indexes available in the data dictionary
+ cache again. */
+
+ for (index = dict_table_get_first_index(table);
+ index != NULL;
+ index = dict_table_get_next_index(index)) {
+ rw_lock_x_lock(dict_index_get_lock(index));
+ index->to_be_dropped = FALSE;
+ rw_lock_x_unlock(dict_index_get_lock(index));
+ }
break;
case DB_OUT_OF_FILE_SPACE:
@@ -3614,7 +3694,7 @@ row_mysql_drop_temp_tables(void)
btr_pcur_store_position(&pcur, &mtr);
btr_pcur_commit_specify_mtr(&pcur, &mtr);
- table = dict_load_table(table_name, TRUE, DICT_ERR_IGNORE_NONE);
+ table = dict_table_get_low(table_name);
if (table) {
row_drop_table_for_mysql(table_name, trx, FALSE);
@@ -3876,6 +3956,7 @@ row_rename_table_for_mysql(
ulint n_constraints_to_drop = 0;
ibool old_is_tmp, new_is_tmp;
pars_info_t* info = NULL;
+ int retry;
ut_a(old_name != NULL);
ut_a(new_name != NULL);
@@ -3958,6 +4039,25 @@ row_rename_table_for_mysql(
}
}
+ /* Is a foreign key check running on this table? */
+ for (retry = 0; retry < 100
+ && table->n_foreign_key_checks_running > 0; ++retry) {
+ row_mysql_unlock_data_dictionary(trx);
+ os_thread_yield();
+ row_mysql_lock_data_dictionary(trx);
+ }
+
+ if (table->n_foreign_key_checks_running > 0) {
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: Error: in ALTER TABLE ", stderr);
+ ut_print_name(stderr, trx, TRUE, old_name);
+ fprintf(stderr, "\n"
+ "InnoDB: a FOREIGN KEY check is running.\n"
+ "InnoDB: Cannot rename table.\n");
+ err = DB_TABLE_IN_FK_CHECK;
+ goto funct_exit;
+ }
+
/* We use the private SQL parser of Innobase to generate the query
graphs needed in updating the dictionary data from system tables. */
diff --git a/storage/xtradb/row/row0row.c b/storage/xtradb/row/row0row.c
index 0462f280858..2c33bdc4b15 100644
--- a/storage/xtradb/row/row0row.c
+++ b/storage/xtradb/row/row0row.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -241,13 +241,18 @@ row_build(
ut_ad(rec_offs_validate(rec, index, offsets));
}
-#if 0 && defined UNIV_BLOB_NULL_DEBUG
- /* This one can fail in trx_rollback_active() if
- the server crashed during an insert before the
- btr_store_big_rec_extern_fields() did mtr_commit()
- all BLOB pointers to the clustered index record. */
- ut_a(!rec_offs_any_null_extern(rec, offsets));
-#endif /* 0 && UNIV_BLOB_NULL_DEBUG */
+#ifdef UNIV_BLOB_NULL_DEBUG
+ if (rec_offs_any_null_extern(rec, offsets)) {
+ /* This condition can occur during crash recovery
+ before trx_rollback_active() has completed execution,
+ or when a concurrently executing
+ row_ins_index_entry_low() has committed the B-tree
+ mini-transaction but has not yet managed to restore
+ the cursor position for writing the big_rec. */
+ ut_a(trx_undo_roll_ptr_is_insert(
+ row_get_rec_roll_ptr(rec, index, offsets)));
+ }
+#endif /* UNIV_BLOB_NULL_DEBUG */
if (type != ROW_COPY_POINTERS) {
/* Take a copy of rec to heap */
diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c
index be2f5d0fcd0..ec3603f2550 100644
--- a/storage/xtradb/row/row0sel.c
+++ b/storage/xtradb/row/row0sel.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -2303,7 +2303,12 @@ row_sel_convert_mysql_key_to_innobase(
in the tuple is already according
to index! */
byte* buf, /*!< in: buffer to use in field
- conversions */
+ conversions; NOTE that dtuple->data
+ may end up pointing inside buf so
+ do not discard that buffer while
+ the tuple is being used. See
+ row_mysql_store_col_in_innobase_format()
+ in the case of DATA_INT */
ulint buf_len, /*!< in: buffer length */
dict_index_t* index, /*!< in: index of the key value */
const byte* key_ptr, /*!< in: MySQL key value */
@@ -2435,6 +2440,7 @@ row_sel_convert_mysql_key_to_innobase(
/* Storing may use at most data_len bytes of buf */
if (UNIV_LIKELY(!is_null)) {
+ ut_a(buf + data_len <= original_buf + buf_len);
row_mysql_store_col_in_innobase_format(
dfield, buf,
FALSE, /* MySQL key value format col */
@@ -2949,17 +2955,17 @@ row_sel_get_clust_rec_for_mysql(
btr_pcur_open_with_no_init(clust_index, prebuilt->clust_ref,
PAGE_CUR_LE, BTR_SEARCH_LEAF,
- prebuilt->clust_pcur, 0, mtr);
+ &prebuilt->clust_pcur, 0, mtr);
- clust_rec = btr_pcur_get_rec(prebuilt->clust_pcur);
+ clust_rec = btr_pcur_get_rec(&prebuilt->clust_pcur);
- prebuilt->clust_pcur->trx_if_known = trx;
+ prebuilt->clust_pcur.trx_if_known = trx;
/* Note: only if the search ends up on a non-infimum record is the
low_match value the real match to the search tuple */
if (!page_rec_is_user_rec(clust_rec)
- || btr_pcur_get_low_match(prebuilt->clust_pcur)
+ || btr_pcur_get_low_match(&prebuilt->clust_pcur)
< dict_index_get_n_unique(clust_index)) {
/* In a rare case it is possible that no clust rec is found
@@ -2991,6 +2997,7 @@ row_sel_get_clust_rec_for_mysql(
fputs("\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
+ ut_ad(0);
}
clust_rec = NULL;
@@ -3008,7 +3015,7 @@ row_sel_get_clust_rec_for_mysql(
we set a LOCK_REC_NOT_GAP type lock */
err = lock_clust_rec_read_check_and_lock(
- 0, btr_pcur_get_block(prebuilt->clust_pcur),
+ 0, btr_pcur_get_block(&prebuilt->clust_pcur),
clust_rec, clust_index, *offsets,
prebuilt->select_lock_type, LOCK_REC_NOT_GAP, thr);
switch (err) {
@@ -3086,7 +3093,7 @@ func_exit:
/* We may use the cursor in update or in unlock_row():
store its position */
- btr_pcur_store_position(prebuilt->clust_pcur, mtr);
+ btr_pcur_store_position(&prebuilt->clust_pcur, mtr);
}
err_exit:
@@ -3341,7 +3348,7 @@ row_sel_try_search_shortcut_for_mysql(
{
dict_index_t* index = prebuilt->index;
const dtuple_t* search_tuple = prebuilt->search_tuple;
- btr_pcur_t* pcur = prebuilt->pcur;
+ btr_pcur_t* pcur = &prebuilt->pcur;
trx_t* trx = prebuilt->trx;
const rec_t* rec;
@@ -3507,7 +3514,7 @@ row_search_for_mysql(
dict_index_t* index = prebuilt->index;
ibool comp = dict_table_is_comp(index->table);
const dtuple_t* search_tuple = prebuilt->search_tuple;
- btr_pcur_t* pcur = prebuilt->pcur;
+ btr_pcur_t* pcur = &prebuilt->pcur;
trx_t* trx = prebuilt->trx;
dict_index_t* clust_index;
que_thr_t* thr;
@@ -4213,7 +4220,8 @@ wrong_offs:
if ((srv_force_recovery == 0 || moves_up == FALSE)
&& srv_pass_corrupt_table <= 1) {
ut_print_timestamp(stderr);
- buf_page_print(page_align(rec), 0);
+ buf_page_print(page_align(rec), 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"\nInnoDB: rec address %p,"
" buf block fix count %lu\n",
@@ -4232,7 +4240,7 @@ wrong_offs:
"InnoDB: restore from a backup, or"
" dump + drop + reimport the table.\n",
stderr);
-
+ ut_ad(0);
err = DB_CORRUPTION;
goto lock_wait_or_error;
diff --git a/storage/xtradb/row/row0umod.c b/storage/xtradb/row/row0umod.c
index b86ce9eeabd..9597c476125 100644
--- a/storage/xtradb/row/row0umod.c
+++ b/storage/xtradb/row/row0umod.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 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
@@ -509,6 +509,7 @@ row_undo_mod_del_unmark_sec_and_undo_update(
fputs("\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
+ ut_ad(0);
break;
case ROW_FOUND:
btr_cur = btr_pcur_get_btr_cur(&pcur);
diff --git a/storage/xtradb/row/row0upd.c b/storage/xtradb/row/row0upd.c
index 5e8099691c5..6453277c8d6 100644
--- a/storage/xtradb/row/row0upd.c
+++ b/storage/xtradb/row/row0upd.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -23,6 +23,8 @@ Update of a row
Created 12/27/1996 Heikki Tuuri
*******************************************************/
+#include "m_string.h" /* for my_sys.h */
+#include "my_sys.h" /* DEBUG_SYNC_C */
#include "row0upd.h"
#ifdef UNIV_NONINL
@@ -168,6 +170,46 @@ func_exit:
return(is_referenced);
}
+#ifdef WITH_WSREP
+ulint wsrep_append_foreign_key(trx_t *trx,
+ dict_foreign_t* foreign,
+ const rec_t* clust_rec,
+ dict_index_t* clust_index,
+ ibool referenced,
+ ibool shared);
+
+static
+void
+wsrep_append_fk_reference(
+/*=================================*/
+ upd_node_t* node, /*!< in: row update node */
+ dict_table_t* table, /*!< in: table in question */
+ dict_index_t* index, /*!< in: index of the cursor */
+ que_thr_t* thr, /*!< in: query thread */
+ const rec_t* rec
+) {
+ dict_foreign_t *foreign = UT_LIST_GET_FIRST(table->foreign_list);
+
+ while (foreign) {
+ if (foreign->foreign_index == index
+ && node->is_delete)
+ {
+ if (DB_SUCCESS != wsrep_append_foreign_key(
+ thr_get_trx(thr),
+ foreign,
+ rec,
+ index,
+ TRUE, TRUE)
+ ) {
+ fprintf(stderr,
+ "WSREP: FK key append failed\n");
+ }
+ }
+ foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
+ }
+}
+#endif /* WITH_WSREP */
+
/*********************************************************************//**
Checks if possible foreign key constraints hold after a delete of the record
under pcur.
@@ -281,7 +323,6 @@ row_upd_check_references_constraints(
}
err = DB_SUCCESS;
-
func_exit:
if (got_s_lock) {
row_mysql_unfreeze_data_dictionary(trx);
@@ -1636,6 +1677,7 @@ row_upd_sec_index_entry(
fputs("\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
+ ut_ad(0);
break;
case ROW_FOUND:
/* Delete mark the old index record; it can already be
@@ -1662,6 +1704,12 @@ row_upd_sec_index_entry(
node, &pcur, index->table,
index, offsets, thr, &mtr);
}
+#ifdef WITH_WSREP
+ if (err == DB_SUCCESS && !referenced) {
+ wsrep_append_fk_reference(node, index->table,
+ index, thr, rec);
+ }
+#endif /* WITH_WSREP */
}
break;
}
@@ -1905,6 +1953,12 @@ err_exit:
goto err_exit;
}
}
+#ifdef WITH_WSREP
+ if (!referenced) {
+ wsrep_append_fk_reference(node, index->table,
+ index, thr, rec);
+ }
+#endif /* WITH_WSREP */
}
mtr_commit(mtr);
@@ -2021,29 +2075,65 @@ row_upd_clust_rec(
ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
dict_table_is_comp(index->table)));
- err = btr_cur_pessimistic_update(BTR_NO_LOCKING_FLAG, btr_cur,
- &heap, &big_rec, node->update,
- node->cmpl_info, thr, mtr);
- mtr_commit(mtr);
+ err = btr_cur_pessimistic_update(
+ BTR_NO_LOCKING_FLAG | BTR_KEEP_POS_FLAG, btr_cur,
+ &heap, &big_rec, node->update,
+ node->cmpl_info, thr, mtr);
/* skip store extern for fake_changes */
if (err == DB_SUCCESS && big_rec && !(thr_get_trx(thr)->fake_changes)) {
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- rec_t* rec;
+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_t* rec;
rec_offs_init(offsets_);
- mtr_start(mtr);
+ ut_a(err == DB_SUCCESS);
+ /* Write out the externally stored
+ columns while still x-latching
+ index->lock and block->lock. Allocate
+ pages for big_rec in the mtr that
+ modified the B-tree, but be sure to skip
+ any pages that were freed in mtr. We will
+ write out the big_rec pages before
+ committing the B-tree mini-transaction. If
+ the system crashes so that crash recovery
+ will not replay the mtr_commit(&mtr), the
+ big_rec pages will be left orphaned until
+ the pages are allocated for something else.
+
+ TODO: If the allocation extends the tablespace, it
+ will not be redo logged, in either mini-transaction.
+ Tablespace extension should be redo-logged in the
+ big_rec mini-transaction, so that recovery will not
+ fail when the big_rec was written to the extended
+ portion of the file, in case the file was somehow
+ truncated in the crash. */
- ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
rec = btr_cur_get_rec(btr_cur);
+ DEBUG_SYNC_C("before_row_upd_extern");
err = btr_store_big_rec_extern_fields(
index, btr_cur_get_block(btr_cur), rec,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),
- mtr, TRUE, big_rec);
- mtr_commit(mtr);
+ big_rec, mtr, BTR_STORE_UPDATE);
+ DEBUG_SYNC_C("after_row_upd_extern");
+ /* If writing big_rec fails (for example, because of
+ DB_OUT_OF_FILE_SPACE), the record will be corrupted.
+ Even if we did not update any externally stored
+ columns, our update could cause the record to grow so
+ that a non-updated column was selected for external
+ storage. This non-update would not have been written
+ to the undo log, and thus the record cannot be rolled
+ back.
+
+ However, because we have not executed mtr_commit(mtr)
+ yet, the update will not be replayed in crash
+ recovery, and the following assertion failure will
+ effectively "roll back" the operation. */
+ ut_a(err == DB_SUCCESS);
}
+ mtr_commit(mtr);
+
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -2075,6 +2165,9 @@ row_upd_del_mark_clust_rec(
btr_pcur_t* pcur;
btr_cur_t* btr_cur;
ulint err;
+#ifdef WITH_WSREP
+ rec_t* rec;
+#endif /* WITH_WSREP */
ut_ad(node);
ut_ad(dict_index_is_clust(index));
@@ -2091,15 +2184,29 @@ row_upd_del_mark_clust_rec(
/* Mark the clustered index record deleted; we do not have to check
locks, because we assume that we have an x-lock on the record */
+#ifdef WITH_WSREP
+ rec = btr_cur_get_rec(btr_cur);
+#endif /* WITH_WSREP */
+
err = btr_cur_del_mark_set_clust_rec(
BTR_NO_LOCKING_FLAG, btr_cur_get_block(btr_cur),
+#ifdef WITH_WSREP
+ rec, index, offsets, TRUE, thr, mtr);
+#else
btr_cur_get_rec(btr_cur), index, offsets, TRUE, thr, mtr);
+#endif /* WITH_WSREP */
if (err == DB_SUCCESS && referenced) {
/* NOTE that the following call loses the position of pcur ! */
err = row_upd_check_references_constraints(
node, pcur, index->table, index, offsets, thr, mtr);
}
+#ifdef WITH_WSREP
+ if (err == DB_SUCCESS && !referenced) {
+ wsrep_append_fk_reference(node, index->table,
+ index, thr, rec);
+ }
+#endif /* WITH_WSREP */
mtr_commit(mtr);
diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c
index c8eefb56fef..598e0505506 100644
--- a/storage/xtradb/srv/srv0srv.c
+++ b/storage/xtradb/srv/srv0srv.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
@@ -444,6 +444,9 @@ UNIV_INTERN unsigned long long srv_stats_sample_pages = 8;
UNIV_INTERN ulint srv_stats_auto_update = 1;
UNIV_INTERN ulint srv_stats_update_need_lock = 1;
UNIV_INTERN ibool srv_use_sys_stats_table = FALSE;
+#ifdef UNIV_DEBUG
+UNIV_INTERN ulong srv_sys_stats_root_page = 0;
+#endif
UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
UNIV_INTERN ibool srv_use_checksums = TRUE;
@@ -482,9 +485,6 @@ UNIV_INTERN ibool srv_print_lock_waits = FALSE;
UNIV_INTERN ibool srv_print_buf_io = FALSE;
UNIV_INTERN ibool srv_print_log_io = FALSE;
UNIV_INTERN ibool srv_print_latch_waits = FALSE;
-
-UNIV_INTERN ulong srv_flush_checkpoint_debug = 0;
-
#endif /* UNIV_DEBUG */
UNIV_INTERN ulint srv_n_rows_inserted = 0;
@@ -2902,6 +2902,7 @@ loop:
"InnoDB: Please submit a bug report"
" to http://bugs.mysql.com\n",
old_lsn, new_lsn);
+ ut_ad(0);
}
old_lsn = new_lsn;
@@ -3066,21 +3067,23 @@ exit_func:
}
/**********************************************************************//**
-Check whether any background thread is active.
-@return FALSE if all are are suspended or have exited. */
+Check whether any background thread is active. If so return the thread
+type
+@return ULINT_UNDEFINED if all are suspended or have exited, thread
+type if any are still active. */
UNIV_INTERN
-ibool
-srv_is_any_background_thread_active(void)
-/*=====================================*/
+ulint
+srv_get_active_thread_type(void)
+/*============================*/
{
ulint i;
- ibool ret = FALSE;
+ ibool ret = ULINT_UNDEFINED;
mutex_enter(&kernel_mutex);
for (i = 0; i <= SRV_MASTER; ++i) {
if (srv_n_threads_active[i] != 0) {
- ret = TRUE;
+ ret = i;
break;
}
}
@@ -3090,6 +3093,57 @@ srv_is_any_background_thread_active(void)
return(ret);
}
+/*********************************************************************//**
+This function prints progress message every 60 seconds during server
+shutdown, for any activities that master thread is pending on. */
+static
+void
+srv_shutdown_print_master_pending(
+/*==============================*/
+ ib_time_t* last_print_time, /*!< last time the function
+ print the message */
+ ulint n_tables_to_drop, /*!< number of tables to
+ be dropped */
+ ulint n_bytes_merged, /*!< number of change buffer
+ just merged */
+ ulint n_pages_flushed) /*!< number of pages flushed */
+{
+ ib_time_t current_time;
+ double time_elapsed;
+
+ current_time = ut_time();
+ time_elapsed = ut_difftime(current_time, *last_print_time);
+
+ if (time_elapsed > 60) {
+ *last_print_time = ut_time();
+
+ if (n_tables_to_drop) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Waiting for "
+ "%lu table(s) to be dropped\n",
+ (ulong) n_tables_to_drop);
+ }
+
+ /* Check change buffer merge, we only wait for change buffer
+ merge if it is a slow shutdown */
+ if (!srv_fast_shutdown && n_bytes_merged) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Waiting for change "
+ "buffer merge to complete\n"
+ " InnoDB: number of bytes of change buffer "
+ "just merged: %lu\n",
+ n_bytes_merged);
+ }
+
+ if (n_pages_flushed) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Waiting for "
+ "%lu pages to be flushed\n",
+ (ulong) n_pages_flushed);
+ }
+ }
+}
+
/*******************************************************************//**
Tells the InnoDB server that there has been activity in the database
and wakes up the master thread if it is suspended (not sleeping). Used
@@ -3259,6 +3313,7 @@ srv_master_thread(
ib_uint64_t lsn_old;
ib_uint64_t oldest_lsn;
+ ib_time_t last_print_time;
#ifdef UNIV_DEBUG_THREAD_CREATION
fprintf(stderr, "Master thread starts, id %lu\n",
@@ -3284,6 +3339,9 @@ srv_master_thread(
mutex_enter(&(log_sys->mutex));
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
+
+ last_print_time = ut_time();
+
loop:
/*****************************************************************/
/* ---- When there is database activity by users, we cycle in this
@@ -3738,18 +3796,11 @@ retry_flush_batch:
PCT_IO(10), IB_ULONGLONG_MAX);
}
-#ifdef UNIV_DEBUG
- if (srv_flush_checkpoint_debug != 1) {
-#endif
-
- srv_main_thread_op_info = "making checkpoint";
+ srv_main_thread_op_info = "making checkpoint";
- /* Make a new checkpoint about once in 10 seconds */
+ /* Make a new checkpoint about once in 10 seconds */
- log_checkpoint(TRUE, FALSE, TRUE);
-#ifdef UNIV_DEBUG
- }
-#endif
+ log_checkpoint(TRUE, FALSE, TRUE);
srv_main_thread_op_info = "reserving kernel mutex";
@@ -3828,10 +3879,6 @@ background_loop:
}
mutex_exit(&kernel_mutex);
-#ifdef UNIV_DEBUG
- if (srv_flush_checkpoint_debug == 1)
- goto skip_flush;
-#endif
flush_loop:
srv_main_thread_op_info = "flushing buffer pool pages";
srv_main_flush_loops++;
@@ -3872,9 +3919,6 @@ flush_loop:
goto flush_loop;
}
-#ifdef UNIV_DEBUG
-skip_flush:
-#endif
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
@@ -3890,6 +3934,14 @@ skip_flush:
*/
n_bytes_archived = 0;
+ /* Print progress message every 60 seconds during shutdown */
+ if (srv_shutdown_state > 0 && srv_print_verbose_log) {
+ srv_shutdown_print_master_pending(&last_print_time,
+ n_tables_to_drop,
+ n_bytes_merged,
+ n_pages_flushed);
+ }
+
/* Keep looping in the background loop if still work to do */
if (srv_fast_shutdown && srv_shutdown_state > 0) {
@@ -3908,6 +3960,7 @@ skip_flush:
} else if (n_tables_to_drop
+ n_pages_purged + n_bytes_merged + n_pages_flushed
+ n_bytes_archived != 0) {
+
/* In a 'slow' shutdown we run purge and the insert buffer
merge to completion */
diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c
index 99916610c21..75e8097ee0b 100644
--- a/storage/xtradb/srv/srv0start.c
+++ b/storage/xtradb/srv/srv0start.c
@@ -925,8 +925,9 @@ skip_size_check:
#endif /* UNIV_LOG_ARCHIVE */
min_flushed_lsn, max_flushed_lsn);
- if (UNIV_PAGE_SIZE
- != fsp_flags_get_page_size(flags)) {
+ if (!one_opened
+ && UNIV_PAGE_SIZE
+ != fsp_flags_get_page_size(flags)) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -1508,10 +1509,20 @@ innobase_start_or_create_for_mysql(void)
}
# endif /* __WIN__ */
- os_aio_init(io_limit,
- srv_n_read_io_threads,
- srv_n_write_io_threads,
- SRV_MAX_N_PENDING_SYNC_IOS);
+ if (!os_aio_init(io_limit,
+ srv_n_read_io_threads,
+ srv_n_write_io_threads,
+ SRV_MAX_N_PENDING_SYNC_IOS))
+ {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Fatal error: cannot initialize AIO"
+ " sub-system\n");
+#if defined(LINUX_NATIVE_AIO)
+ fprintf(stderr, "You can try increasing system fs.aio-max-nr to 1048576 or larger or setting innodb_use_native_aio = 0 in my.cnf\n");
+#endif
+ return(DB_ERROR);
+ }
fil_init(srv_file_per_table ? 50000 : 5000,
srv_max_n_open_files);
@@ -1938,6 +1949,12 @@ innobase_start_or_create_for_mysql(void)
trx_sys_dummy_create(TRX_DOUBLEWRITE_SPACE);
}
+
+ if (UNIV_UNLIKELY(!dict_verify_xtradb_sys_stats())) {
+ fprintf(stderr, "InnoDB: Warning: "
+ "SYS_STATS table corrupted, recreating\n");
+ dict_recreate_xtradb_sys_stats();
+ }
}
if (!create_new_db && sum_of_new_sizes > 0) {
diff --git a/storage/xtradb/sync/sync0rw.c b/storage/xtradb/sync/sync0rw.c
index 8884812d84d..5068d1679c0 100644
--- a/storage/xtradb/sync/sync0rw.c
+++ b/storage/xtradb/sync/sync0rw.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -18,8 +18,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -780,7 +780,9 @@ rw_lock_add_debug_info(
rw_lock_debug_mutex_exit();
if ((pass == 0) && (lock_type != RW_LOCK_WAIT_EX)) {
- sync_thread_add_level(lock, lock->level);
+ sync_thread_add_level(lock, lock->level,
+ lock_type == RW_LOCK_EX
+ && lock->lock_word < 0);
}
}
diff --git a/storage/xtradb/sync/sync0sync.c b/storage/xtradb/sync/sync0sync.c
index d2c4617d65c..7654fade6e8 100644
--- a/storage/xtradb/sync/sync0sync.c
+++ b/storage/xtradb/sync/sync0sync.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -18,8 +18,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -700,7 +700,7 @@ mutex_set_debug_info(
ut_ad(mutex);
ut_ad(file_name);
- sync_thread_add_level(mutex, mutex->level);
+ sync_thread_add_level(mutex, mutex->level, FALSE);
mutex->file_name = file_name;
mutex->line = line;
@@ -1142,8 +1142,9 @@ void
sync_thread_add_level(
/*==================*/
void* latch, /*!< in: pointer to a mutex or an rw-lock */
- ulint level) /*!< in: level in the latching order; if
+ ulint level, /*!< in: level in the latching order; if
SYNC_LEVEL_VARYING, nothing is done */
+ ibool relock) /*!< in: TRUE if re-entering an x-lock */
{
ulint i;
sync_level_t* slot;
@@ -1194,6 +1195,10 @@ sync_thread_add_level(
array = thread_slot->levels;
+ if (relock) {
+ goto levels_ok;
+ }
+
/* NOTE that there is a problem with _NODE and _LEAF levels: if the
B-tree height changes, then a leaf can change to an internal node
or the other way around. We do not know at present if this can cause
@@ -1376,6 +1381,7 @@ sync_thread_add_level(
ut_error;
}
+levels_ok:
if (array->next_free == ULINT_UNDEFINED) {
ut_a(array->n_elems < array->max_elems);
diff --git a/storage/xtradb/trx/trx0purge.c b/storage/xtradb/trx/trx0purge.c
index eb4fa80fa40..122aab119ba 100644
--- a/storage/xtradb/trx/trx0purge.c
+++ b/storage/xtradb/trx/trx0purge.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -730,6 +730,7 @@ trx_purge_rseg_get_next_history_log(
"InnoDB: report, and submit it"
" to http://bugs.mysql.com\n",
(ulong) trx_sys->rseg_history_len);
+ ut_ad(0);
}
mutex_exit(&kernel_mutex);
@@ -1200,7 +1201,7 @@ trx_purge(
(ulong) purge_sys->n_pages_handled);
}
- return(purge_sys->n_pages_handled - old_pages_handled);
+ return((ulint) (purge_sys->n_pages_handled - old_pages_handled));
}
/******************************************************************//**
diff --git a/storage/xtradb/trx/trx0rec.c b/storage/xtradb/trx/trx0rec.c
index 104b80f5d96..db4897c368d 100644
--- a/storage/xtradb/trx/trx0rec.c
+++ b/storage/xtradb/trx/trx0rec.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -1016,6 +1016,7 @@ trx_undo_update_rec_get_update(
fprintf(stderr, "\n"
"InnoDB: n_fields = %lu, i = %lu, ptr %p\n",
(ulong) n_fields, (ulong) i, ptr);
+ ut_ad(0);
*upd = NULL;
return(NULL);
}
@@ -1210,6 +1211,7 @@ trx_undo_report_row_operation(
trx_t* trx;
trx_undo_t* undo;
ulint page_no;
+ buf_block_t* undo_block;
trx_rseg_t* rseg;
mtr_t mtr;
ulint err = DB_SUCCESS;
@@ -1252,10 +1254,13 @@ trx_undo_report_row_operation(
if (UNIV_UNLIKELY(!undo)) {
/* Did not succeed */
+ ut_ad(err != DB_SUCCESS);
mutex_exit(&(trx->undo_mutex));
return(err);
}
+
+ ut_ad(err == DB_SUCCESS);
} else {
ut_ad(op_type == TRX_UNDO_MODIFY_OP);
@@ -1269,30 +1274,30 @@ trx_undo_report_row_operation(
if (UNIV_UNLIKELY(!undo)) {
/* Did not succeed */
+ ut_ad(err != DB_SUCCESS);
mutex_exit(&(trx->undo_mutex));
return(err);
}
+ ut_ad(err == DB_SUCCESS);
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
}
- page_no = undo->last_page_no;
-
mtr_start(&mtr);
+ page_no = undo->last_page_no;
+ undo_block = buf_page_get_gen(
+ undo->space, undo->zip_size, page_no, RW_X_LATCH,
+ undo->guess_block, BUF_GET, __FILE__, __LINE__, &mtr);
+ buf_block_dbg_add_level(undo_block, SYNC_TRX_UNDO_PAGE);
+
do {
- buf_block_t* undo_block;
page_t* undo_page;
ulint offset;
- undo_block = buf_page_get_gen(undo->space, undo->zip_size,
- page_no, RW_X_LATCH,
- undo->guess_block, BUF_GET,
- __FILE__, __LINE__, &mtr);
- buf_block_dbg_add_level(undo_block, SYNC_TRX_UNDO_PAGE);
-
undo_page = buf_block_get_frame(undo_block);
+ ut_ad(page_no == buf_block_get_page_no(undo_block));
if (op_type == TRX_UNDO_INSERT_OP) {
offset = trx_undo_page_report_insert(
@@ -1369,12 +1374,11 @@ trx_undo_report_row_operation(
a pessimistic insert in a B-tree, and we must reserve the
counterpart of the tree latch, which is the rseg mutex. */
- mutex_enter(&(rseg->mutex));
-
- page_no = trx_undo_add_page(trx, undo, &mtr);
-
- mutex_exit(&(rseg->mutex));
- } while (UNIV_LIKELY(page_no != FIL_NULL));
+ mutex_enter(&rseg->mutex);
+ undo_block = trx_undo_add_page(trx, undo, &mtr);
+ mutex_exit(&rseg->mutex);
+ page_no = undo->last_page_no;
+ } while (undo_block != NULL);
/* Did not succeed: out of space */
err = DB_OUT_OF_FILE_SPACE;
@@ -1526,6 +1530,7 @@ trx_undo_prev_version_build(
"InnoDB: record version ", stderr);
rec_print_new(stderr, rec, offsets);
putc('\n', stderr);
+ ut_ad(0);
return(DB_ERROR);
}
@@ -1631,6 +1636,7 @@ trx_undo_prev_version_build(
(ullint) old_roll_ptr, (ullint) roll_ptr);
trx_purge_sys_print();
+ ut_ad(0);
return(DB_ERROR);
}
diff --git a/storage/xtradb/trx/trx0sys.c b/storage/xtradb/trx/trx0sys.c
index 56d0723d777..89db43fb776 100644
--- a/storage/xtradb/trx/trx0sys.c
+++ b/storage/xtradb/trx/trx0sys.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -141,6 +141,11 @@ 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 */
+#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
@@ -257,9 +262,7 @@ trx_sys_create_doublewrite_buf(void)
{
buf_block_t* block;
buf_block_t* block2;
-#ifdef UNIV_SYNC_DEBUG
buf_block_t* new_block;
-#endif /* UNIV_SYNC_DEBUG */
byte* doublewrite;
byte* fseg_header;
ulint page_no;
@@ -338,10 +341,9 @@ start_again:
for (i = 0; i < 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ FSP_EXTENT_SIZE / 2; i++) {
- page_no = fseg_alloc_free_page(fseg_header,
- prev_page_no + 1,
- FSP_UP, &mtr);
- if (page_no == FIL_NULL) {
+ new_block = fseg_alloc_free_page(
+ fseg_header, prev_page_no + 1, FSP_UP, &mtr);
+ if (new_block == NULL) {
fprintf(stderr,
"InnoDB: Cannot create doublewrite"
" buffer: you must\n"
@@ -362,13 +364,8 @@ start_again:
the page position in the tablespace, then the page
has not been written to in doublewrite. */
-#ifdef UNIV_SYNC_DEBUG
- new_block =
-#endif /* UNIV_SYNC_DEBUG */
- buf_page_get(TRX_SYS_SPACE, 0, page_no,
- RW_X_LATCH, &mtr);
- buf_block_dbg_add_level(new_block,
- SYNC_NO_ORDER_CHECK);
+ ut_ad(rw_lock_get_x_lock_count(&new_block->lock) == 1);
+ page_no = buf_block_get_page_no(new_block);
if (i == FSP_EXTENT_SIZE / 2) {
ut_a(page_no == FSP_EXTENT_SIZE);
@@ -438,7 +435,10 @@ start_again:
/* The doublewrite buffer has already been created:
just read in some numbers */
+ trx_doublewrite_init(doublewrite);
+
mtr_commit(&mtr);
+ trx_doublewrite_buf_is_being_created = FALSE;
} else {
fprintf(stderr,
"InnoDB: Doublewrite buffer not found in the doublewrite file:"
@@ -485,13 +485,12 @@ start_again:
for (i = 0; i < 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ FSP_EXTENT_SIZE / 2; i++) {
- page_no = fseg_alloc_free_page(fseg_header,
- prev_page_no + 1,
- FSP_UP, &mtr);
- if (page_no == FIL_NULL) {
+ new_block = fseg_alloc_free_page(
+ fseg_header, prev_page_no + 1, FSP_UP, &mtr);
+ if (new_block == NULL) {
fprintf(stderr,
- "InnoDB: Cannot create the doublewrite"
- " buffer: You must\n"
+ "InnoDB: Cannot create doublewrite"
+ " buffer: you must\n"
"InnoDB: increase your"
" tablespace size.\n"
"InnoDB: Cannot continue operation.\n"
@@ -509,13 +508,8 @@ start_again:
the page position in the tablespace, then the page
has not been written to in doublewrite. */
-#ifdef UNIV_SYNC_DEBUG
- new_block =
-#endif /* UNIV_SYNC_DEBUG */
- buf_page_get(TRX_DOUBLEWRITE_SPACE, 0, page_no,
- RW_X_LATCH, &mtr);
- buf_block_dbg_add_level(new_block,
- SYNC_NO_ORDER_CHECK);
+ ut_ad(rw_lock_get_x_lock_count(&new_block->lock) == 1);
+ page_no = buf_block_get_page_no(new_block);
if (i == FSP_EXTENT_SIZE / 2) {
ut_a(page_no == FSP_EXTENT_SIZE);
@@ -750,12 +744,16 @@ trx_sys_doublewrite_init_or_restore_pages(
if (buf_page_is_corrupted(page, zip_size)) {
fprintf(stderr,
"InnoDB: Dump of the page:\n");
- buf_page_print(read_buf, zip_size);
+ buf_page_print(
+ read_buf, zip_size,
+ BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"InnoDB: Dump of"
" corresponding page"
" in doublewrite buffer:\n");
- buf_page_print(page, zip_size);
+ buf_page_print(
+ page, zip_size,
+ BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"InnoDB: Also the page in the"
@@ -769,7 +767,7 @@ trx_sys_doublewrite_init_or_restore_pages(
"InnoDB: option:\n"
"InnoDB:"
" innodb_force_recovery=6\n");
- exit(1);
+ ut_error;
}
/* Write the good page from the
diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c
index 96e0716e5c0..a6b5fab8589 100644
--- a/storage/xtradb/trx/trx0trx.c
+++ b/storage/xtradb/trx/trx0trx.c
@@ -1158,6 +1158,8 @@ trx_commit_off_kernel(
}
#endif
UT_LIST_REMOVE(trx_list, trx_sys->trx_list, trx);
+
+ trx->error_state = DB_SUCCESS;
}
/****************************************************************//**
diff --git a/storage/xtradb/trx/trx0undo.c b/storage/xtradb/trx/trx0undo.c
index dae0637f72c..3d794c69c8b 100644
--- a/storage/xtradb/trx/trx0undo.c
+++ b/storage/xtradb/trx/trx0undo.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -876,9 +876,9 @@ trx_undo_discard_latest_update_undo(
#ifndef UNIV_HOTBACKUP
/********************************************************************//**
Tries to add a page to the undo log segment where the undo log is placed.
-@return page number if success, else FIL_NULL */
+@return X-latched block if success, else NULL */
UNIV_INTERN
-ulint
+buf_block_t*
trx_undo_add_page(
/*==============*/
trx_t* trx, /*!< in: transaction */
@@ -888,11 +888,10 @@ trx_undo_add_page(
the rollback segment mutex */
{
page_t* header_page;
+ buf_block_t* new_block;
page_t* new_page;
trx_rseg_t* rseg;
- ulint page_no;
ulint n_reserved;
- ibool success;
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(!mutex_own(&kernel_mutex));
@@ -902,37 +901,37 @@ trx_undo_add_page(
if (rseg->curr_size == rseg->max_size) {
- return(FIL_NULL);
+ return(NULL);
}
header_page = trx_undo_page_get(undo->space, undo->zip_size,
undo->hdr_page_no, mtr);
- success = fsp_reserve_free_extents(&n_reserved, undo->space, 1,
- FSP_UNDO, mtr);
- if (!success) {
+ if (!fsp_reserve_free_extents(&n_reserved, undo->space, 1,
+ FSP_UNDO, mtr)) {
- return(FIL_NULL);
+ return(NULL);
}
- page_no = fseg_alloc_free_page_general(header_page + TRX_UNDO_SEG_HDR
- + TRX_UNDO_FSEG_HEADER,
- undo->top_page_no + 1, FSP_UP,
- TRUE, mtr);
+ new_block = fseg_alloc_free_page_general(
+ TRX_UNDO_SEG_HDR + TRX_UNDO_FSEG_HEADER
+ + header_page,
+ undo->top_page_no + 1, FSP_UP, TRUE, mtr, mtr);
fil_space_release_free_extents(undo->space, n_reserved);
- if (page_no == FIL_NULL) {
+ if (new_block == NULL) {
/* No space left */
- return(FIL_NULL);
+ return(NULL);
}
- undo->last_page_no = page_no;
+ ut_ad(rw_lock_get_x_lock_count(&new_block->lock) == 1);
+ buf_block_dbg_add_level(new_block, SYNC_TRX_UNDO_PAGE);
+ undo->last_page_no = buf_block_get_page_no(new_block);
- new_page = trx_undo_page_get(undo->space, undo->zip_size,
- page_no, mtr);
+ new_page = buf_block_get_frame(new_block);
trx_undo_page_init(new_page, undo->type, mtr);
@@ -941,7 +940,7 @@ trx_undo_add_page(
undo->size++;
rseg->curr_size++;
- return(page_no);
+ return(new_block);
}
/********************************************************************//**
diff --git a/storage/xtradb/ut/ut0mem.c b/storage/xtradb/ut/ut0mem.c
index 303fdd6dd44..cb6b050beca 100644
--- a/storage/xtradb/ut/ut0mem.c
+++ b/storage/xtradb/ut/ut0mem.c
@@ -84,17 +84,13 @@ ut_mem_init(void)
#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
-Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
-defined and set_to_zero is TRUE.
+Allocates memory.
@return own: allocated memory */
UNIV_INTERN
void*
ut_malloc_low(
/*==========*/
ulint n, /*!< in: number of bytes to allocate */
- ibool set_to_zero, /*!< in: TRUE if allocated memory should be
- set to zero if UNIV_SET_MEM_TO_ZERO is
- defined */
ibool assert_on_error)/*!< in: if TRUE, we crash mysqld if the
memory cannot be allocated */
{
@@ -106,12 +102,6 @@ ut_malloc_low(
ret = malloc(n);
ut_a(ret || !assert_on_error);
-#ifdef UNIV_SET_MEM_TO_ZERO
- if (set_to_zero) {
- memset(ret, '\0', n);
- UNIV_MEM_ALLOC(ret, n);
- }
-#endif
return(ret);
}
@@ -193,12 +183,6 @@ retry:
}
}
- if (set_to_zero) {
-#ifdef UNIV_SET_MEM_TO_ZERO
- memset(ret, '\0', n + sizeof(ut_mem_block_t));
-#endif
- }
-
UNIV_MEM_ALLOC(ret, n + sizeof(ut_mem_block_t));
((ut_mem_block_t*)ret)->size = n + sizeof(ut_mem_block_t);
@@ -215,75 +199,11 @@ retry:
void* ret = malloc(n);
ut_a(ret || !assert_on_error);
-# ifdef UNIV_SET_MEM_TO_ZERO
- if (set_to_zero) {
- memset(ret, '\0', n);
- }
-# endif
return(ret);
#endif /* !UNIV_HOTBACKUP */
}
/**********************************************************************//**
-Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
-defined.
-@return own: allocated memory */
-UNIV_INTERN
-void*
-ut_malloc(
-/*======*/
- ulint n) /*!< in: number of bytes to allocate */
-{
-#ifndef UNIV_HOTBACKUP
- return(ut_malloc_low(n, TRUE, TRUE));
-#else /* !UNIV_HOTBACKUP */
- return(malloc(n));
-#endif /* !UNIV_HOTBACKUP */
-}
-
-#ifndef UNIV_HOTBACKUP
-/**********************************************************************//**
-Tests if malloc of n bytes would succeed. ut_malloc() asserts if memory runs
-out. It cannot be used if we want to return an error message. Prints to
-stderr a message if fails.
-@return TRUE if succeeded */
-UNIV_INTERN
-ibool
-ut_test_malloc(
-/*===========*/
- ulint n) /*!< in: try to allocate this many bytes */
-{
- void* ret;
-
- ret = malloc(n);
-
- if (ret == NULL) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Error: cannot allocate"
- " %lu bytes of memory for\n"
- "InnoDB: a BLOB with malloc! Total allocated memory\n"
- "InnoDB: by InnoDB %lu bytes."
- " Operating system errno: %d\n"
- "InnoDB: Check if you should increase"
- " the swap file or\n"
- "InnoDB: ulimits of your operating system.\n"
- "InnoDB: On FreeBSD check you have"
- " compiled the OS with\n"
- "InnoDB: a big enough maximum process size.\n",
- (ulong) n,
- (ulong) ut_total_allocated_memory,
- (int) errno);
- return(FALSE);
- }
-
- free(ret);
-
- return(TRUE);
-}
-#endif /* !UNIV_HOTBACKUP */
-
-/**********************************************************************//**
Frees a memory block allocated with ut_malloc. Freeing a NULL pointer is
a nop. */
UNIV_INTERN
diff --git a/storage/xtradb/ut/ut0ut.c b/storage/xtradb/ut/ut0ut.c
index 4fab362b5f5..60def59193a 100644
--- a/storage/xtradb/ut/ut0ut.c
+++ b/storage/xtradb/ut/ut0ut.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2011, Oracle Corpn. All Rights Reserved.
+Copyright (c) 2011, 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
@@ -11,8 +11,8 @@ 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 program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -720,6 +720,8 @@ ut_strerr(
return("End of index");
case DB_SEARCH_ABORTED_BY_USER:
return("Operation was interrupted by end user");
+ case DB_TABLE_IN_FK_CHECK:
+ return("Table is being used in foreign key check");
/* do not add default: in order to produce a warning if new code
is added to the enum but not added here */
}
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 1b6cc1cdb04..93222c1d3ac 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -30,7 +30,7 @@
%define mysqld_group mysql
%define mysqldatadir /var/lib/mysql
-%define release 1
+%define release 2
#
# Macros we use which are not available in all supported versions of RPM
diff --git a/support-files/rpm/server.cnf b/support-files/rpm/server.cnf
index 8cf2c74dbe4..2025a8b811a 100644
--- a/support-files/rpm/server.cnf
+++ b/support-files/rpm/server.cnf
@@ -1,14 +1,17 @@
#
-# These groups are read by MariaDB server
+# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
-[mysqld]
-
+# this is read by the standalone daemon and embedded servers
[server]
+# this is only for the mysqld standalone daemon
+[mysqld]
+
+# this is only for embedded server
[embedded]
# This group is only read by MariaDB-5.5 servers.
diff --git a/support-files/wsrep.cnf.sh b/support-files/wsrep.cnf.sh
index e8483910c0b..c04e5ddaf43 100644
--- a/support-files/wsrep.cnf.sh
+++ b/support-files/wsrep.cnf.sh
@@ -121,5 +121,8 @@ wsrep_sst_auth=root:
# Desired SST donor name.
#wsrep_sst_donor=
+# Reject client queries when donating SST (false)
+#wsrep_sst_donor_rejects_queries=0
+
# Protocol version to use
# wsrep_protocol_version=
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/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/viosocket.c b/vio/viosocket.c
index 8e28e7661a9..baefa1c6d06 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2001, 2011, Oracle and/or its affiliates
+ Copyright (c) 2001, 2012, Oracle and/or its affiliates
Copyright (c) 2012, Monty Program Ab
This program is free software; you can redistribute it and/or